12
votes

I have relationships between nodes which are only valid for a specific time. Simple example: Person P lived at Address A from time t1 to time t2. I can put a validFrom and a validUntil property on the relationship, but when using cypher, I have to filer this in the WHERE clause, but I would want it in the MATCH clause.

The reason why I want this in the MATCH clause is that it may potentially traverse a large subgraph, only to find out later that most of it could be ignored. This is especially so with a large set of historic relationships.

I can make seperate validFrom and validUntil relationships to specific date nodes. That way I can use MATCH. This would be OK if I have a limited set of such time nodes, but when I have to store timestamps it is not practical to do this.

How can you optimize Cypher for this type of querying? How to time-slice a graph with nodes and relationships having time-validity indicators?

1
Cypher automatically pulls expressions into match clauses whenever possible, so they are evaluated as soon as they can be. - Michael Hunger
Can you actually show your query? - Michael Hunger
Did you come up with a solution that worked for this please? - John

1 Answers

5
votes