我是Neo4j和图形数据库的新手。我正在尝试创建一个简单的图表数据库,但我的MATCH
查询返回null
值。如何避免编码中出现null
或任何错误?
CREATE
(d2:CorNode:course:dscor{Cors_Name:'DataScience_Sem2',Start_Date:'January2018',No_Students:[tointeger(10)]})-[:sem2dsrelation{Name:'Semester2',Cor_Name:'Data Science',A_Y:'AY2017-18',Cor_Node:'CMM534'}]->(Rob:FLNode:course:dscor{Name_F:'Rob Lothian', Role:'Leader',Mod_code:'CMM534'}),
(d2)-[:sem2dsrelation{Name:'Semester2', Cor_Name:'Data Science',A_Y:'AY2017-18',Cor_Node:'CMM534'}]->(Eyad:FLNode:course:dscor{Name_F:'Eyad Elyan',Role:'Leader',Mod_code:'CMM534'}),
(d2)-[:sem2dsrelation{Name:'Semester2', Cor_Name:'Data Science',A_Y:'AY2017-18',Cor_Node:'CMM507'}]->(David:FLNode:course:dscor{Name_F:'David Lonie', Role:'Leader', Mod_code:'CMM507'}),
(d2)-[:sem2dsrelation{Name:'Semester2',Cor_Name:'Data Science', A_Y:'AY2017-18',Cor_Node:'CMM535'}]->(Rob),
(d1:CorNode:course:dscor{Cors_Name:'DataScience_Sem1',Start_Date:'Septemer2017',No_Students:[tointeger(25)]})-[:sem1dsrelation{Name:'Semester1',Cor_Name:'Data Science',A_Y:'AY2017-18',Cor_Node:'CMM524'}]->(Rob),
(d1)-[:sem1dsrelation{Name:'Semester1', Cor_Name:'Data Science',A_Y:'AY2017-18',Cor_Node:'CMM531'}]->(Eyad),
(d1)-[:sem1dsrelation{Name:'Semester1', Cor_Name:'Data Science',A_Y:'AY2017-18',Cor_Node:'CMM510'}]->(Ines:FLNode:course:dscor{Name_F:'Ines Arana',Role:'Leader',Mod_code:'CMM510'})
MATCH (:dscor)-[ds1:sem1dsrelation{Name:'Semester1',Cor_Name:'Data Science'}]-(FLNode:dscor)
RETURN DISTINCT [FLNode.Name_F,ds1.Cor_Node]
答案 0 :(得分:1)
你基本上有一个错字。在(FLNode:dscor)
," FLNode"正在使用变量名而不是标签。
要解决此问题,您需要为节点分配变量名称(例如x
),确保将FLNode
指定为标签(通过放置:
前面的),然后在结果中使用x
。像这样:
MATCH (:dscor)-[ds1:sem1dsrelation{Name:'Semester1',Cor_Name:'Data Science'}`]-(x:FLNode:dscor)
RETURN DISTINCT [x.Name_F,ds1.Cor_Node];