简体   繁体   English

Py2neo-如何通过节点匹配获取节点ID?

[英]Py2neo - How do i get node id by node matching?

i'm using py2neo and try to get node id by these code and there is no entity["id"], i want to know anyhow to get id of each node. 我正在使用py2neo并尝试通过这些代码获取节点ID,并且没有entity [“ id”],我想知道如何获取每个节点的ID。 thank you 谢谢

for rel in matcher.match("SINGLE_NODE"): print("name:", rel["name"]) print("occur:", rel["occur"]) print("pos:", rel["pos"])

Query for the node(s) using their label and, if filtering, a property. 使用节点的标签和属性(如果进行过滤)来查询节点。 Then you return the node ID and anything else desired. 然后,您返回节点ID和其他所需的内容。

match (n:YourLabel{Property:xxx}) return id(n) as NodeID

You can also query by id 您也可以按ID查询

match (n) where id(n)=12 return id(n)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM