Relationship/Arrows in Neo4j can not get more than one type/label (see here, and here). I have a data model that edges need to get labels and (probably) properties. If I decide to use Neo4j (instead of OriendDB which supports labeled arrow), I think I would have then two options to model an arrow, say f, between two nodes A and B:
1) encode an arrow f as a span, say A<--f-->B, such that f is also a node and --> and <-- are arrows.
or
2) encode an arrow f as A --> f -->B, such that f is a node again and two --> are arrows.
Though this seems to be adding unnecessary complexity on my data model, it does not seem to be any other option at the moment if I want to use Neo4j. Then, I am trying to see which of the above encoding might fit better in my queries (queries are the core of my system). For doing so, I need to resort to examples. So I have two question:
First Question:
part1) I have nodes labeled as Person and father, and there are arrows between them like
Person<-[:sr]-father-[:tr]->Person
in order to model who is father of who (tr is father of sr). For a given person p1 how can I get all of his ancestors.part2) If I had
Person-[:sr]->father-[:tr]->Person
structure instead, for modeling father relationship, how the above same query would look like.
This is answered here when father is considered as a simple relationship (instead of being encoded as a node)
Second Question:
part1) I have nodes labeled as A nodes with the property p1 for each. I want to query A nodes, get those elements that p1<5, then create the following structure: for each a1 in the query result I create
qa1<-[:sr]-isA-[:tr]->a1
such that isA and qa1 are nodes.part2) What if I wanted to create
qa1-[:sr]->isA-[:tr]->qa1
instead?
This question is answered here when isA is considered as a simple arrow (instead of being modeled as a node).