关系数据

  1. select "MainIDNO",IDNO2,
  2. case when count("MainIDNO") > 1 then '多次同住' else '一次同住' end as label
  3. from POC.TB_XDRY_ZFJL group by "MainIDNO",IDNO2

image.png

  1. select IDNO,"IDNOContacted",
  2. CASE WHEN count(IDNO) > 1 THEN '频繁通信' else '一次通信' end as label
  3. from POC.TB_XDRY_THJL group by IDNO,"IDNOContacted"

image.png

CSV

  1. :START_ID,:END_ID,:TYPE
  2. 630000193810280042,630000195807280067,多次同住
  3. 630000193810280042,630000196210090062,一次同住
  4. 630000193810280042,63000019730125002X,一次同住
  5. 630000193810280042,630000197403050037,一次同住
  6. 630000193810280042,630000198911240050,一次同住
  7. 630000193810280042,630000201307110043,一次同住
  8. 630000194606200089,630000193210260048,多次同住
  9. 630000194606200089,630000196210090062,多次同住
  10. 630000194606200089,630000196705060041,一次同住
  11. 630000194606200089,63000019730125002X,一次同住
  12. 630000194606200089,630000201911070017,一次同住
  13. 630000197705020087,630000193310010054,多次同住
  14. 630000193310010054,630000196210090062,频繁通信
  15. 63000019690520007X,630000194606200089,一次通信
  16. 630000199711240050,630000193810280042,一次通信
  17. 630000199711240050,630000194606200089,频繁通信
  18. 630000199711240050,630000195807280067,一次通信
  19. 630000199711240050,630000197705020087,频繁通信
  20. 630000199711240050,630000198004120047,一次通信

节点数据

  1. 给涉毒、吸毒人员打标签
    1. select GMSFHM,XM,AGE,IS_XD,IS_SD from QH.LABEL lb
    2. inner join
    3. (select GMSFHM,XM from QH.TB_XDRY_JBXX
    4. union all
    5. select ZJHM,XM from QH.TB_DPAJ_SDRYJBXX
    6. ) ry ON lb.ID = ry.GMSFHM
    image.png

CSV1-吸毒涉毒节点

  1. GMSFHM:ID,name:String,AGE:String,IS_XD,IS_SD
  2. 630000193103170071,濮岚,80-,,1
  3. 630000193310010054,胡振,80-,,1
  4. 630000193807020055,蒙琼,80-,,1
  5. 630000193810280042,缪亚,80-,,1
  6. 630000196210090062,贲宁,41-60,,1
  7. 630000196905200071,wx,19-40,1,
  8. 63000019690520007X,于琛,41-60,1,
  9. 63000019730125002X,包纯,41-60,,1
  10. 630000199211280021,皮梦,19-40,,1
  11. 630000199711240050,闽薇,19-40,1,
  12. 630000199806090083,舒娜,19-40,,1
  13. 630000201109150036,别珍,6-18,,1
  1. 通信、住宿人员集合
  1. select distinct IDNO1 from (
  2. select "MainIDNO" IDNO1,IDNO2 from POC.TB_XDRY_ZFJL zfjl
  3. union all
  4. select IDNO IDNO1,"IDNOContacted" IDNO2 from POC.TB_XDRY_THJL
  5. )
  6. union all
  7. select distinct IDNO2 from (
  8. select "MainIDNO" IDNO1,IDNO2 from POC.TB_XDRY_ZFJL zfjl
  9. union all
  10. select IDNO IDNO1,"IDNOContacted" IDNO2 from POC.TB_XDRY_THJL
  11. )

image.png

  1. 通信、住宿人员集合(排除吸毒、涉毒人员)

phoenix不支持复杂SQL,所以这一步应该需要编程实现

CSV2-未涉毒节点

  1. GMSFHM:ID,name:String
  2. 630000197403050037,未涉毒
  3. 630000197705020087,未涉毒
  4. 630000198004120047,未涉毒
  5. 630000198911240050,未涉毒
  6. 630000201307110043,未涉毒
  7. 630000201911070017,未涉毒
  8. 630000196705060041,未涉毒
  9. 630000194606200089,未涉毒
  10. 630000195807280067,未涉毒
  11. 630000193210260048,未涉毒

导入语句

官网文档: https://neo4j.com/docs/operations-manual/current/tutorial/import-tool/

注意:导入前必须先停止ne04j

./bin/neo4j-admin import --nodes:Person=import/person.csv --nodes:Person=import/person2.csv --relationships=import/rel.csv --database=graph2.db

以前的旧方法:

  1. ./neo4j-import --into /opt/neo4j/neo4j-community-3.5.9/data/databases/test_100_graph.db
  2. --nodes import/node.csv --relationships import/relationship.csv
  3. --trim-strings true --input-encoding UTF-8 --stacktrace true --bad-tolerance 0 --skip-bad-relationships true --skip-duplicate-nodes false

修改neo4j默认的db文件

vim conf/neo4j.conf :

修改这个属性: dbms.active_database=graph2.db

启动: ./bin/neo4j console 或者 ./bin/neo4j start