Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4J relationships with time constraints

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?

like image 472
ignazw Avatar asked Mar 12 '13 15:03

ignazw


1 Answers

Have you seen the timeline modeling described here: http://docs.neo4j.org/chunked/milestone/cypher-cookbook-path-tree.html

like image 92
Luanne Avatar answered Oct 10 '22 11:10

Luanne