cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Versionned nodes

I have some questions about node versionning (storing history of a graph) and effectivity:

Assume one as a set of nodes and relations that evolve over time:
(nodeA00:MyNode {nodeidentifier:"000A" noderev:"00"})-[rel00:MyRelation {RelationRev:00}]-(nodeB00:MyNode {nodeidentifier:"000B" noderev:"00"})

at some point in time
nodeA gets modified with an aditional nodeC
will be
(nodeA01:MyNode {nodeidentifier:"000A" noderev:"01"})-[rel00:MyRelation {RelationRev:00}]-(nodeB00:MyNode {nodeidentifier:"000B" noderev:"00"})

(nodeA01:MyNode {nodeidentifier:"000A" noderev:"01"})-[rel01:MyRelation {RelationRev:00}]-(nodeC00:MyNode {nodeidentifier:"000C" noderev:"00"})

a user might also revise the relation (e.g modify an relation property such as quantity)

now i would like to introduce some kind of validity/effectivity of versions on nodes and relations.
a node version or relation might be valid through multiple date ranges.

my intend is to create an validity relation to each node version like so

(nodeA01:MyNode {nodeidentifier:"000A" noderev:"01"})-[effectivity1:EffectivityRelation]->effiectitynode1:Effectivity{From:"2019/01/01",To:"2019/01/31"})
(nodeA01:MyNode {nodeidentifier:"000A" noderev:"01"})-[effectivity1:EffectivityRelation]->(effiectitynode2:Effectivity{From:"2019/05/01",To:"2019/05/31"})

This way nodeA Rev 01 would be valid in january and may 2019 but not in february,march and april

There are two questions related to this datamodel.
a) how would i query for the subgraph configured with latest effectivity on a specific date?
b) how can i model multiple effectivities for a relation (like for the node). As of now i have a workaround i call a "PseudoRelation" representing "relations" via a node+primary and secondary relations. But if anyone has a better idea, im am happy to evaluate. The "RelationNode" Concept has got also the possibilty to serve as an n:m PseudoRelation.

regards
Thomas

3 REPLIES 3

jasperblues
Graph Buddy

@thomas.stuempfig You may wish to explore the GraphAware audit module, and see if it suits your needs: https://graphaware.com/neo4j/2018/02/28/audit-module.html

As I understand it, this is opensource (https://github.com/graphaware/neo4j-framework/blob/master/gpl.txt), however if you require support or consulting you would need to contact the maintainers.

Hi Jasper,
thank you very much for the hint. I'll investigate. At a first glance the audit module
is enterprise only

regards
Thomas

i put together a small slide to make thing more graphical

the subgraph retrieved by may 30 should be
N1/00-myRel-N2/00

the subgraph retrieved by june 30 should be
N1/01-myRel-N2/00
N1/01-myRel-N3/00

the subgraph retrieved by Feb 20 should be NULL