0
votes

I updated relationships with properties Expirydate. I want to exclude all expired relationship in my traversal path. The query condition is to check Expirydate through all relationships in path. I got the error:

==> SyntaxException: ==> ==> Think we should have better error message here? Help us by sending this query to cypher@neo4j.org.

Here is the query:

START sNode=node(530) 
MATCH sNode-[r:hasRegisteredPlate|inHouseHoldWith*1..2]->eNode 
WHERE eNode.NodeType = "Plate" and (rel in r:(not has(rel.ExpiryDate) or 
    (has(rel.ExpiryDate) and (rel.ExpiryDate<>'' or rel.ExpiryDate >'2013-10-04')))) 
RETURN eNode LIMIT 20

Any help is much appreciated

1

1 Answers

0
votes

You could try using the predicate all.

START sNode=node(530)
MATCH sNode-[r:hasRegisteredPlate|inHouseHoldWith*1..2]->eNode
WHERE eNode.NodeType = "Plate" and all(rel in r
  WHERE (not(has(rel.ExpiryDate)) or (has(rel.ExpiryDate) and (rel.ExpiryDate<>'' or rel.ExpiryDate>'2013-10-04')))
)
RETURN eNode LIMIT 20

You could also try the inverse

WHERE eNode.NodeType = "Plate" and none(rel in r
  WHERE (has(rel.ExpiryDate) and rel.ExpiryDate<'2013-10-04')
)

Note that I haven't tried these, if they don't work perhaps you could setup a sample graph in the neo4j console.