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.

Create multiple labels (hierarchical label) relationship

leminhvn
Node Clone

Dear Neo4j team,

I have simple graph of (:Agent{agentid, name, type})-[:Trans{tran_datetime, amount}]->(:Agent{agentid, name, type})
However due to large amount of transaction [Trans] (about several millions per day), I want to separate [Trans] into Year, Month.
Therefore I want to create model of

  • (:Agent{agentid, name, type})-[:Trans:2020:01{tran_datetime, amount}]->(:Agent{agentid, name, type})
  • (:Agent{agentid, name, type})-[:Trans:2020:02{tran_datetime, amount}]->(:Agent{agentid, name, type})
  • (:Agent{agentid, name, type})-[:Trans:2020:03{tran_datetime, amount}]->(:Agent{agentid, name, type})
  • ...
    How can I do that in Neo4j?

I read some userguide and it said that Relationship can not have multiple lables so I need to create many relationships e.g. (:Agent{agentid, name, type})-[:Trans_2020_02{tran_datetime, amount}]->(:Agent{agentid, name, type}) instead.
If doing by this way, I can not combine transaction from many months in to a single analytics.

2 REPLIES 2

ameyasoft
Graph Maven

Here is one way.

Hope this will work for you.

leminhvn
Node Clone

Many thanks,

I understand the idea. Problem can be solved from partition Nodes on Day.
From Edge point of view, is there any way to divide Edges into smaller partition? I try to use index in relationship but it is also not workable. Neo4j v3.5 does not support Relationship indexing.

I am thinking about convert Tran to Node e.g.
(:Agent)-[:Make]->(:Tran:Year:Month:Day)-[Toward]->(:Agent)
but is will create many difficulty when applying PagRank, Community algorithms on this schema.

Please advice.