Translate Business Requirements into DSL

We should be able to define simple Data Traversal Constructs to abstract out underlying Gremlin Queries.

Here is an example from – https://academy.datastax.com/courses/ds230-getting-started-gremlin/domain-specific-traversal

Sample Implementation 

Reference: https://issues.apache.org/jira/browse/TINKERPOP-786

public SocailTraversal<S,E> extends DefaultTraversal<S,E> {

  private final GraphTraversal<S,E> rawTraversal = new DefaultGraphTraversal<S,E>();

  public SocialTraversal<S,Vertex> know(final String personName) {

    this.rawTraversal.out("knows").hasLabel("person").has("name",personName);

    return this;

  }

  public SocialTraversal<S,Vertex> olderThan(final String personName) {

    this.rawTraversal.filter(as("xx").V().has("name",personName").values("age").where(lt("xx")));

   return this;

  }

 public SocialTraversal<S,Vertex> people() {

    this.rawTraversal.V().hasLabel("person");

    return this;

 }

 public SocialTraversal<S,String> name() {

   this.rawTraversal.values("name");

   return this;

 }

 public SocialTraversal<S,E> who() {

   return this;

  }

  public SocialTraversal<S,E> thatAre() {

   return this;

  }

  ......

}

They will then need a TraversalSource implementation which we will have a DefaultTraversalSource to make things easy. And finally, in action:

social = graph.traversal(SocialTraversal.class)

social.people().who().know(“stephen”).thatAre().olderThan(“daniel”).name()

Related Jira: https://issues.apache.org/jira/browse/TINKERPOP-971

The above JIRA explains how simple Traversal DSL Query should be formed just like GraphComputer Query

e.g.  g = graph.traversal().withComputer(graph -> graph.compute(SparkGraphComputer.class).workers(10));

g.V().hasLabel('person').pageRank(out('knows')).order().by('page.rank',decr)

Example of Domain Specific Traversal in Healthcare

https://fullmetalhealth.com/dsl/

Titan Benchmarks

Common Questions  

Advertisements