Re: similar edges and how to prevent them


Daniel Kuppitz <me@...>
 

I guess the point is, that the edge's direction doesn't matter. Hence it should be more like:

g.V().has(instanceId, "nodeId", nodeA).as("a").
  V().has(instanceId, "nodeId", nodeB).
  coalesce(bothE("link").where(otherV().as("a")),
           addE("link").to("a"))

...or, if performance matters, don't enable path computations (using otherV):

g.V().has(instanceId, "nodeId", nodeA).as("a").
  V().has(instanceId, "nodeId", nodeB).
  coalesce(outE("link").where(inV().as("a")),
           inE("link").where(outV().as("a")),
           addE("link").to("a"))

Cheers,
Daniel


On Mon, Sep 11, 2017 at 3:32 AM, <tpr...@...> wrote:
You can use coalesce step to do a check or insert query.
http://tinkerpop.apache.org/docs/current/reference/#coalesce-step
Something like g.V(idTo).as('to').V(idFrom).coalesce(__.outE('labelE').has('id',idValue),
     __.addE('labelE').property('id',idvalue).to('to'))

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/020a1758-af67-4510-9860-90bc7b470709%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.