Domanda

I am using gremlin query to search for vertices from a given vertex.

v.both("edgeLabel").has("propertykey", "27826345");

This query is returning a bunch of vertices. Now I am creating edges from 'v' to all those returned vertices by simple iterator.

Now my question is:
Is there any process/query style available through which I can search for those vertices and create edges in the same query ?

I have already tried this query:

 v.both('edgeLabel').has('propertykey','27826345').gather(){g.addEdge(v,it,'TEST_LABEL')}

But I'm getting error :

No signature of method: groovy.lang.MissingMethodException.addEdge()

I am currently using Gremlin-Groovy ScriptEngine to execute my query from a Java class.

Thank you in Advance.

È stato utile?

Soluzione

In Gremlin 2.3.0, there are three new steps:

 linkIn
 linkOut
 linkBoth

Please see GremlinDocs (http://gremlindocs.com) for more information on how to use them.

http://gremlindocs.com/#transform/linkboth-in-out

Note that these pipes yield a sideEffect (the edge generated) so you can cap the pipe if you need to get the edge.

Altri suggerimenti

You probably need to provide an id to addEdge. Here are the javadocs.

v.both('edgeLabel').has('propertykey','27826345').gather(){g.addEdge(1,v,it,'TEST_LABEL')}

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top