如何排除 neo4j 中的标签关系
How to exclude a label in neo4j for relationship
我是 Neo4j 的新手,我想显示除标签之外的所有关系。
我正在做:
match ()-[p:PLAYED]->() where not p:Today return p
但是给我以下错误
Type mismatch: expected Node but was Relationship (line 1, column 37 (offset: 36))
"match ()-[p:PLAYED]->() where not p:Today return p"
它适用于排除节点标签但不适用于关系,我无法解决这个问题。
关系没有标签,只有节点有。
关系只有一个 类型 。
在您的查询中,p
已经是 PLAYED
类型,因此它不能是任何其他类型。
此外,p:Today
是 label 谓词的语法,但 p
绑定到关系,因此出现错误。
如果您有一个约束较少的模式,例如 ()-[p]->()
,那么您可以使用 TYPE(p)
检查类型。但是请注意,您最终将使用此模式遍历整个连接图。
我是 Neo4j 的新手,我想显示除标签之外的所有关系。
我正在做:
match ()-[p:PLAYED]->() where not p:Today return p
但是给我以下错误
Type mismatch: expected Node but was Relationship (line 1, column 37 (offset: 36))
"match ()-[p:PLAYED]->() where not p:Today return p"
它适用于排除节点标签但不适用于关系,我无法解决这个问题。
关系没有标签,只有节点有。
关系只有一个 类型 。
在您的查询中,p
已经是 PLAYED
类型,因此它不能是任何其他类型。
此外,p:Today
是 label 谓词的语法,但 p
绑定到关系,因此出现错误。
如果您有一个约束较少的模式,例如 ()-[p]->()
,那么您可以使用 TYPE(p)
检查类型。但是请注意,您最终将使用此模式遍历整个连接图。