You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Horacio Hoyos Rodriguez <ho...@york.ac.uk.INVALID> on 2018/07/12 15:09:28 UTC

Executing GraphTraversal on Provider (via Java)

Hi,

I am implementing a Provider for ArangoDB. I have implemented the structure
package interfaces and after running most of the TestSuite Iam happy with
the result.

Now, if I want an ArangoDBGraph to be modified/queried via the
 GraphTraversal API, e.g.

   g.addVertex(...

do I also have to implement the process package interfaces?

And, from Java, once you have a traversal, how do you actually execute it?
E.g.

g.addVertex("someLabel").property("name", "Marko").<what goes here?>;

I have read that it is either iterate(),next(), toList()?

Thanks,

Re: Executing GraphTraversal on Provider (via Java)

Posted by Stephen Mallette <sp...@gmail.com>.
Glad to hear things are moving along. Also good to see that there's an
ArangoDB option for Gremlin coming along - is that something that will be
open source and generally available for use? Also, if you don't mind my
asking, will this implementation be officially maintained by ArangoDB or is
it something you are working on personally?  As for your questions:

>  Now, if I want an ArangoDBGraph to be modified/queried via the GraphTraversal
API, e.g.

Just to be clear, addVertex() is a method of Graph and hence not part of
the GraphTraversal API. The Traversal API (i.e. Gremlin) would be g.addV().

>  do I also have to implement the process package interfaces?

No - just spawn a GraphTraversalSource from your Graph instance:

Graph graph = YourArangoGraph.open()
GraphTraversalSource g = graph.traversal()
g.addV()......iterate()

Now, while you don't have to do anything special to get Gremlin working, I
suspect that your implementation as it is will be "slow". why? Well, at a
minimum (as an example) because Gremlin doesn't know anything about
ArangoDB. When you do

g.V().has('person', 'name','marko')

Gremlin will be dumb. He will use YourArangoGraph.vertices() method to get
an iterator of all the vertices in the graph and then cycle through all of
them filtering each looking for "marko". Ideally, you will want to optimize
that query to use ArangoDB indices to avoid a full scan of all vertices. To
do that, you write TraversalStrategy implementations:

http://tinkerpop.apache.org/docs/current/reference/#traversalstrategy

TraversalStrategy writing is the "hard" part of TinkerPop-enabled systems.
The smarter the strategies you write the more you can showcase the
capabilities of your underlying graph systems.


On Thu, Jul 12, 2018 at 11:09 AM Horacio Hoyos Rodriguez
<ho...@york.ac.uk.invalid> wrote:

> Hi,
>
> I am implementing a Provider for ArangoDB. I have implemented the structure
> package interfaces and after running most of the TestSuite Iam happy with
> the result.
>
> Now, if I want an ArangoDBGraph to be modified/queried via the
>  GraphTraversal API, e.g.
>
>    g.addVertex(...
>
> do I also have to implement the process package interfaces?
>
> And, from Java, once you have a traversal, how do you actually execute it?
> E.g.
>
> g.addVertex("someLabel").property("name", "Marko").<what goes here?>;
>
> I have read that it is either iterate(),next(), toList()?
>
> Thanks,
>