Directional relationships with a different name for each direction

In GraphDB platforms (Neo4j, OrientDB, FlockDB, HyperGraphDB ...), relationships between nodes can be defined.

I need to define the relationship of the direction, so the relation has different names depending on its direction.

For instance:

Parent(A,B) := Sibling(B,A).

Then I want to go through or request a schedule using both terms and directions.

Of course, I do not want to define two relations, but only one.

Sometimes I even want to use an undirected name, for example:

Call(A,B) := Answer(B,A);
TalkWith(A,B) := Call(A,B) || Call(B,A)

And use directional or indirect crawls / queries

For example, I can ask:

Get any X that TalkWith(A,X))

or

Get any X that Call(A,X))

or

Get any X that Answer(A,X))

What existing GraphDB platforms support it?

+5
source share
3 answers

Gremlin (http://gremlin.tinkerpop.com) // . , .

https://github.com/tinkerpop/gremlin/wiki/User-Defined-Steps

TinkerGraph, Neo4j, OrientDB, DEX RDF.

, , .

+5

UI, . .

Neo4j RelationshipType:

public enum MyRelationshipType implements RelationshipType
{
    CHILD("Parent Of", "Child Of");

    public MyRelationshipType(final String forwardString, final String backwardString)
    {
        this.forwardString = forwardString;
        this.backwardString = backwardString;
    }

    private final String backwardString;

    private final String forwardString;

    public String getDisplayString(final boolean forward)
    {
        if (forward)
        {
            return this.forwardString;
        }
        else
        {
            return this.backwardString;
        }
    }
}
+2

InfoGrid . , "HasMet": A B, B A, A B .

Note that unidirectionality goes beyond naming; it is a basic semantic concept that may or may not be understood by a database or modeling language.

In addition, in InfoGrid you can define several TraversalSpecifications and point them to whatever you want, including basic workarounds (switching to neighbors associated with a certain type of relationship) or multi-stage workarounds (for example, switching to uncles on your mother side).

+1
source

All Articles