cancel
Showing results for 
Search instead for 
Did you mean: 

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

mf093087
Node

I create a node, the node name is robot, the robots has a property, which is called 'capabilities'. For the capabilities, there is a list of all the capabilities for the robot. For example, the robot in the picture below has a capability lists, [Moving,ForceApplying].
3X_2_5_258718823d986e42b1f0f57025d998ea3ab2be5d.png

Now I want to use matcher.match command in Py2neo to search for the robot node with specific capability. If the capability I am searching for is Moving. Then how do I write the code? Below is the code I write, but doesn't work,

a = matcher.match('Robot', capabilities = 'Moving').first()

3X_2_7_27320f1c12d50f1b9dab16b083eb9b9ea3c70e99.png

1 REPLY 1

I think that's not expressible (yet) with py2neo matchers, it seems that list properties are not yet supported for ` WHERE $value in node.capabilities` 

https://py2neo.org/v4/matching.html#node-matching

In your model it might also make more sense to pull out those capabilities as extra nodes and link the robot to them.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.