Reputation: 113
What is the best way, given the following Neo4j Cypher query, for the returned collection of paths not to contain any path that contains an Item node whose itemId is equal to “Q5”?
MATCH p=allShortestPaths( (a:Item {itemId:"Q6294"})-[*]-(b:Item {itemId:"Q359442"}) )
RETURN p;
Also, what is the best way, given the above query, for the returned collection of paths not to contain any path that contains a relationship whose propId is equal to “P31”?
Thanks, James Weaver
Upvotes: 2
Views: 1202
Reputation: 66989
The returned collection of paths does not contain any path that contains an Item node whose itemId is equal to “Q5”:
MATCH p=allShortestPaths( (a:Item {itemId:"Q6294"})-[*]-(b:Item {itemId:"Q359442"}) )
WHERE NONE(x IN NODES(p) WHERE x:Item AND x.itemId = "Q5")
RETURN p;
The returned collection of paths does not contain any path that contains a relationship whose propId is equal to “P31”:
MATCH p=allShortestPaths( (a:Item {itemId:"Q6294"})-[*]-(b:Item {itemId:"Q359442"}) )
WHERE NONE(x IN RELATIONSHIPS(p) WHERE x.propId = "P31")
RETURN p;
Upvotes: 7