Neo4j,当目标匹配'property'是列表时,如何在python中使用匹配函数?

Neo4j, How to use match function in python when the targeted matching 'property' is a list?

我在Neo4j中创建了一个节点,节点名为robot,robots有一个属性,叫做'capabilities'。对于功能,有一个机器人所有功能的列表。例如,下图中的机器人有一个能力列表,[Moving, ForceApplying]。

现在我想在Py2neo中使用matcher.match命令来搜索具有特定能力的机器人节点。如果我正在寻找的能力是移动的。那我怎么写代码呢?下面是我写的代码,但是不起作用,

from py2neo import Graph, Node, Relationship, NodeMatcher

graph = Graph('bolt://localhost:7687', auth=("neo4j", "neo4j"))
matcher = NodeMatcher(graph)     
a = matcher.match('Robot', capabilities = 'Moving').first()

节点匹配器正在 属性 中搜索完全相同的值,而 first() 子句返回结果中的第一条记录。它不是在查看 属性 'capabilities'.

的第一个条目

您可以在此处详细了解它的工作原理(书呆子警报!):

https://py2neo.org/v4/_modules/py2neo/matching.html

我就是这样做的。

 from py2neo import Graph, NodeMatcher
 graph = Graph("bolt://localhost:7687", user="neo4j", password="neo4j")
 matcher = NodeMatcher(graph)
 list(matcher.match("Robot").where("'Moving' in _.capabilities"))

Result:
     [(_489:Robot {capabilities: ['Moving', 'ForceApplying'], name: 'Application_Kuka'})]