Neo4J 密码模式语法
Neo4J Cypher Pattern syntax
我正在学习 Neo4J,在阅读 O'Reilly 的书 "Graph Databases" 时,我遇到了一个图形模式,它描述了三个朋友,表示为节点和它们之间的关系方向,表示谁是谁的朋友.
这是图表 -
从图中可以看出 - b knows a, c knows a and c knows b
但我不清楚 Cypher 查询模式 -
(a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:KNOWS]->(c)
在下一节描述语法的地方,他们提到了 -
Using ASCII characters to represent nodes and relationships, we draw
the data we're interested in. We use parantheses to draw nodes, and
pairs of dashes and greater-than and less-than sign to draw
relationships(- -> and <- -). The < and > signs indicate relationship
direction.
如果是这样的话,(a)-[:KNOWS]->(b)-[:KNOWS]->(c)
表示a KNOWS b
,b KNOWS c
,(a)-[:KNOWS]->(c)
表示a KNOWS c
。这不是图中箭头所描绘的相反吗?
这本书似乎有误。所示图表示为
(a)<-[:KNOWS]-(b)<-[:KNOWS]-(c), (c)-[:KNOWS]->(a)
或
(a)<-[:KNOWS]-(b)<-[:KNOWS]-(c)-[:KNOWS]->(a)
我正在学习 Neo4J,在阅读 O'Reilly 的书 "Graph Databases" 时,我遇到了一个图形模式,它描述了三个朋友,表示为节点和它们之间的关系方向,表示谁是谁的朋友.
这是图表 -
从图中可以看出 - b knows a, c knows a and c knows b
但我不清楚 Cypher 查询模式 -
(a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:KNOWS]->(c)
在下一节描述语法的地方,他们提到了 -
Using ASCII characters to represent nodes and relationships, we draw the data we're interested in. We use parantheses to draw nodes, and pairs of dashes and greater-than and less-than sign to draw relationships(- -> and <- -). The < and > signs indicate relationship direction.
如果是这样的话,(a)-[:KNOWS]->(b)-[:KNOWS]->(c)
表示a KNOWS b
,b KNOWS c
,(a)-[:KNOWS]->(c)
表示a KNOWS c
。这不是图中箭头所描绘的相反吗?
这本书似乎有误。所示图表示为
(a)<-[:KNOWS]-(b)<-[:KNOWS]-(c), (c)-[:KNOWS]->(a)
或
(a)<-[:KNOWS]-(b)<-[:KNOWS]-(c)-[:KNOWS]->(a)