关系数据
select "MainIDNO",IDNO2,
case when count("MainIDNO") > 1 then '多次同住' else '一次同住' end as label
from POC.TB_XDRY_ZFJL group by "MainIDNO",IDNO2
select IDNO,"IDNOContacted",
CASE WHEN count(IDNO) > 1 THEN '频繁通信' else '一次通信' end as label
from POC.TB_XDRY_THJL group by IDNO,"IDNOContacted"
CSV
:START_ID,:END_ID,:TYPE
630000193810280042,630000195807280067,多次同住
630000193810280042,630000196210090062,一次同住
630000193810280042,63000019730125002X,一次同住
630000193810280042,630000197403050037,一次同住
630000193810280042,630000198911240050,一次同住
630000193810280042,630000201307110043,一次同住
630000194606200089,630000193210260048,多次同住
630000194606200089,630000196210090062,多次同住
630000194606200089,630000196705060041,一次同住
630000194606200089,63000019730125002X,一次同住
630000194606200089,630000201911070017,一次同住
630000197705020087,630000193310010054,多次同住
630000193310010054,630000196210090062,频繁通信
63000019690520007X,630000194606200089,一次通信
630000199711240050,630000193810280042,一次通信
630000199711240050,630000194606200089,频繁通信
630000199711240050,630000195807280067,一次通信
630000199711240050,630000197705020087,频繁通信
630000199711240050,630000198004120047,一次通信
节点数据
- 给涉毒、吸毒人员打标签
select GMSFHM,XM,AGE,IS_XD,IS_SD from QH.LABEL lb
inner join
(select GMSFHM,XM from QH.TB_XDRY_JBXX
union all
select ZJHM,XM from QH.TB_DPAJ_SDRYJBXX
) ry ON lb.ID = ry.GMSFHM
CSV1-吸毒涉毒节点
GMSFHM:ID,name:String,AGE:String,IS_XD,IS_SD
630000193103170071,濮岚,80-,,1
630000193310010054,胡振,80-,,1
630000193807020055,蒙琼,80-,,1
630000193810280042,缪亚,80-,,1
630000196210090062,贲宁,41-60,,1
630000196905200071,wx,19-40,1,
63000019690520007X,于琛,41-60,1,
63000019730125002X,包纯,41-60,,1
630000199211280021,皮梦,19-40,,1
630000199711240050,闽薇,19-40,1,
630000199806090083,舒娜,19-40,,1
630000201109150036,别珍,6-18,,1
- 通信、住宿人员集合
select distinct IDNO1 from (
select "MainIDNO" IDNO1,IDNO2 from POC.TB_XDRY_ZFJL zfjl
union all
select IDNO IDNO1,"IDNOContacted" IDNO2 from POC.TB_XDRY_THJL
)
union all
select distinct IDNO2 from (
select "MainIDNO" IDNO1,IDNO2 from POC.TB_XDRY_ZFJL zfjl
union all
select IDNO IDNO1,"IDNOContacted" IDNO2 from POC.TB_XDRY_THJL
)
- 通信、住宿人员集合(排除吸毒、涉毒人员)
phoenix不支持复杂SQL,所以这一步应该需要编程实现
CSV2-未涉毒节点
GMSFHM:ID,name:String
630000197403050037,未涉毒
630000197705020087,未涉毒
630000198004120047,未涉毒
630000198911240050,未涉毒
630000201307110043,未涉毒
630000201911070017,未涉毒
630000196705060041,未涉毒
630000194606200089,未涉毒
630000195807280067,未涉毒
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
以前的旧方法:
./neo4j-import --into /opt/neo4j/neo4j-community-3.5.9/data/databases/test_100_graph.db
--nodes import/node.csv --relationships import/relationship.csv
--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