赞
踩
第一步:如上图,按照岗位->岗位细分方向->岗位技术要求基本思路不重复地创建所有节点。
- CREATE (le:Person {name:"Euler"}),[1]
- (db:Person {name:"Bernoulli"}),
- (le)-[:KNOWS {since:1768}]->(db)[2]
- RETURN le, db[3]
- create (:job {name:"自动化办公"}),(:job {name:"Web开发"}),(:job {name:"爬虫"}),(:job {name:"数据分析"}),(:job {name:"大数据"}),(:job {name:"人工智能"}),
- (:knowledge {name:"网络"}),(:knowledge {name:"HTML"}),(:knowledge {name:"xpath"}),(:knowledge {name:"CSS"}),(:knowledge {name:"linux"}),
- (:knowledge {name:"Windowns办公软件"}),(:knowledge {name:"所属行业的业务知识"}),(:knowledge {name:"Python"}),(:knowledge {name:"统计"}),
- (:knowledge {name:"高数"}),(:knowledge {name:"机器学习"}),(:knowledge {name:"深度学习"}),
- (:position_direction {name:"视觉"}),(:position_direction {name:"语音"}),(:position_direction {name:"NLP"}),(:position_direction {name:"推荐"}),
- (:position_direction {name:"离线计算"}),(:position_direction {name:"实时计算"}),
- (:knowledge {name:"Hive"}),(:knowledge {name:"HBase"}),(:knowledge {name:"Scala"}),(:knowledge {name:"Spark"}),(:knowledge {name:"Hadhoop"}),
- (:knowledge {name:"JAVA"}),(:knowledge {name:"Storm"}),(:knowledge {name:"kafka"}),(:knowledge {name:" Flink"}) ,(:knowledge {name:"flume "}) ,
- (:knowledge {name:"文件处理"}) ,(:knowledge {name:"Flask"}) ,(:knowledge {name:"Django"}) ,
- (:knowledge {name:"Requests"}) ,(:knowledge {name:"Bs4"}) ,(:knowledge {name:"scrapy"}) ,(:knowledge {name:"MYSQL"}) ,(:knowledge {name:"MongoBD"})
第二步:据岗位、岗位细分方向、岗位技术要求之间关系,创建各节点间关系(match(先查到)...create(然后创建节点间关系)...return(返回结果)... )。
- MATCH (director:Person)-[:DIRECTED]->(movie)
- WHERE director.name = "Steven Spielberg"
- RETURN movie.title
- match (a:job {name:"自动化办公"}),(b:knowledge {name:"Python"}) create (a)-[r:TechnicalRequiremention {name:""}]->(b)
- return a,b
2. 创建“Web开发”知识图谱
- match (a:job {name:"Web开发"}),(b:knowledge {name:"Python"}),(c:knowledge {name:"linux"})
- create (a)-[r:TechnicalRequiremention {name:""}]->(b), (a)-[o:TechnicalRequiremention {name:""}]->(c)
- return a,b,c
3. 创建“爬虫”知识图谱
- match (a:job {name:"爬虫"}),(b:knowledge {name:"网络"}),(c:knowledge {name:"HTML"}),(d:knowledge {name:"xpath"}),(e:knowledge {name:"CSS"}) ,(f:knowledge {name:"linux"})
- create (a)-[:TechnicalRequiremention {name:""}]->(b),(a)-[:TechnicalRequiremention {name:""}]->(c),(a)-[:TechnicalRequiremention {name:""}]->(f),
- (c)-[:TechnicalDRequiremention {name:""}]->(d),(c)-[:TechnicalDRequiremention {name:""}]->(e)
- return a,b,c,d,e,f
4. 创建“数据分析”知识图谱
- match (a:job {name:"数据分析"}),(b:knowledge {name:"Python"}),(c:knowledge {name:"linux"}),(d:knowledge {name:"Windowns办公软件"}),
- (e:knowledge {name:"所属行业的业务知识"}) ,(f:knowledge {name:"统计"})
- create (a)-[:TechnicalRequiremention {name:""}]->(b),(a)-[:TechnicalRequiremention {name:""}]->(c),(a)-[:TechnicalRequiremention {name:""}]->(d),
- (a)-[:TechnicalDRequiremention {name:""}]->(e),(a)-[:TechnicalDRequiremention {name:""}]->(f)
- return a,b,c,d,e,f
5. 创建“人工智能”知识图谱
- match (a:job {name:"人工智能"}),(ab:knowledge {name:"Python"}),(b:knowledge {name:"高数"}),(c:knowledge {name:"统计"}),(d:knowledge {name:"机器学习"}),
- (e:knowledge {name:"linux"}),(f:knowledge {name:"深度学习"}),(o:position_direction {name:"视觉"}),(p:position_direction {name:"语音"}),
- (q:position_direction {name:"NLP"}),(i:position_direction {name:"推荐"})
- create (a)-[:TechnicalRequiremention {name:""}]->(ab),(a)-[:TechnicalRequiremention {name:""}]->(b),(b)-[:TechnicalDRequiremention {name:""}]->(c),
- (c)-[:TechnicalDRequiremention {name:""}]->(d),(d)-[:TechnicalDRequiremention {name:""}]->(e) ,(d)-[:TechnicalDRequiremention {name:""}]->(f) ,
- (f)-[:position_direction {name:""}]->(o) ,(f)-[:position_direction {name:""}]->(p),(f)-[:position_direction {name:""}]->(q),(f)-[:position_direction {name:""}]->(i)
- return a,ab,b,c,d,e,f,o,p,q,i
6. 创建“大数据”知识图谱
- match (a:job {name:"大数据"}),(b:position_direction {name:"离线计算"}),(c:position_direction {name:"实时计算"}), (d:knowledge {name:"linux"}),
- (e:knowledge {name:"Hive"}),(f:knowledge {name:"HBase"}),(o:knowledge {name:"Scala"}),(p:knowledge {name:"Spark"}),(q:knowledge {name:"Hadhoop"}),
- (i:knowledge {name:"JAVA"}),(s:knowledge {name:"Storm"}),(t:knowledge {name:"kafka"}),(u:knowledge {name:" Flink"}),(v:knowledge {name:"flume "}) ,
- (w:knowledge {name:"Python"}),(x:knowledge {name:"文件处理"}) ,(y:knowledge {name:"Flask"}) ,(z:knowledge {name:"Django"}) ,
- (aa:knowledge {name:"Requests"}) ,(bb:knowledge {name:"Bs4"}) ,(cc:knowledge {name:"scrapy"}) ,(dd:knowledge {name:"MYSQL"}) ,(ee:knowledge {name:"MongoBD"})
- create (a)-[:position_direction {name:""}]->(b),(a)-[:position_direction {name:""}]->(c),(a)-[:TechnicalRequiremention {name:""}]->(d),
- (b)-[:TechnicalRequiremention {name:""}]->(e) ,(b)-[:TechnicalRequiremention {name:""}]->(f) ,(b)-[:TechnicalRequiremention {name:""}]->(o) ,
- (o)-[:TechnicalDRequiremention {name:""}]->(p),(b)-[:TechnicalRequiremention {name:""}]->(q) ,
- (c)-[:TechnicalRequiremention {name:""}]->(i) ,(i)-[:TechnicalDRequiremention {name:""}]->(q),(i)-[:TechnicalDRequiremention {name:""}]->(s),
- (i)-[:TechnicalDRequiremention {name:""}]->(t),(i)-[:TechnicalDRequiremention {name:""}]->(u),(i)-[:TechnicalDRequiremention {name:""}]->(v),
- (w)-[:TechnicalDRequiremention {name:""}]->(x),(x)-[:TechnicalDRequiremention {name:""}]->(y),(x)-[:TechnicalDRequiremention {name:""}]->(z),
- (y)-[:TechnicalDRequiremention {name:""}]->(dd),(z)-[:TechnicalDRequiremention {name:""}]->(dd),(w)-[:TechnicalDRequiremention {name:""}]->(aa),
- (aa)-[:TechnicalDRequiremention {name:""}]->(bb),(bb)-[:TechnicalDRequiremention {name:""}]->(cc),(cc)-[:TechnicalDRequiremention {name:""}]->(dd),
- (cc)-[:TechnicalDRequiremention {name:""}]->(ee),(w)-[:TechnicalDRequiremention {name:""}]->(dd),(w)-[:TechnicalDRequiremention {name:""}]->(ee),
- (w)-[:TechnicalDRequiremention {name:""}]->(e),(w)-[:TechnicalDRequiremention {name:""}]->(f)
- return a,b,c,d,e,f,o,p,q,i,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee
第三步:结果查询(match (n) return n)。
【1】先删关系,再删节点
【2】当记不得关系名时,type(r)可以查到关系名
【3】彻底删除节点标签名,需要删除前期对该标签名建立的索引
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。