我试图了解某些标识符或表达式对应于什么类型的密码"数据结构",具体取决于它们的使用方式和位置.下面我列出了我遇到的例子.请告诉我,如果我做对了(在评论中)或我错过了什么.
MATCH (a:MYTYPE { label:'l_a' })
// a corresponds to a collection of nodes
MATCH (b:MYTYPE { label:'l_b' })
// so does b
MATCH p=(a)-[sp1:CF*]->(b)-[sp12:CF]->(c)
// p corresponds to a collection of paths
// a and b correspond to a collection of nodes
// (or does the previous MATCH of a and b change something?)
// sp1 corresponds to a collection of collections of relationships
// sp12 corresponds to a collection of relationships
// c corresponds to a collection of nodes
WHERE ( p = ... )
// Here, the p corresponds to a path, i.e. there must be a path or (I don't know) on the right side of the =
WHERE ( a = ... )
// a corresponds to a node, i.e. there must be a node on the right side of the =
WHERE ( sp1 = ... )
// sp1 corresponds to a collection of nodes, i.e. there must be a collection of relationships on the right side
//BONUS:
WHERE ( (e)-[sp2:CF*]->(f) ) = ...
// there must be a collection of collections of paths on the right side of the =
Run Code Online (Sandbox Code Playgroud)
Nic*_*ite 10
我认为回答所有这些问题的最简单方法是将标识符传递给函数,这些函数会抛出错误,告诉您它的预期和实际收到的内容.我认为你也应该小心你如何使用单词集合,因为它不正确.
MATCH (n) RETURN n;
n是一个Node.
MATCH ()-[r]-() RETURN r;
r是一个Relationship.
MATCH p = ()-[]-()
p是一个Path.
MATCH (n) WITH COLLECT(n) AS c RETURN c;
c是一个Collection<Node>.
MATCH ()-[r]-() WITH COLLECT(r) AS c RETURN c;
c是一个Collection<Relationship>.
MATCH p = ()-[]-() WITH COLLECT(p) AS c RETURN c;
c是一个Collection<Path>.
MATCH p = ()-[r*..2]-() RETURN p, r;
p是一个Path.
r是一个Collection<Relationship>.
并参考您的具体示例:
MATCH p = (a)-[sp1:CF*]->(b)-[sp12:CF]->(c)
p是一个Path.
a是一个Node.
sp1是一个Collection<Relationship>.
b是一个Node.
sp12是一个Relationship.
c是一个Node.
而且我不确定你对这些WHERE条款的要求.也许你可以通过编辑你的问题来澄清.