I am completely new to Gremlin and have some really old code that is using addInE()
and addOutE()
. I understand that it is deprecated as of release 3.1.0
and - according to the javadocs - should be replaced with addE()
.
My problem is that I have very little knowledge of Gremlin in general and found almost no documentation for the addInE()
and addOutE()
steps.
In the reference documentation for version 3.0.0
there is exactly one example where it is used, but not explained.
Here is the example that is given:
gremlin> g.V(1).as('a').out('created').in('created').where(neq('a')).addOutE('co-developer','a','year',2009) //(1)
==>e[12][4-co-developer->1]
==>e[13][6-co-developer->1]
gremlin> g.withSideEffect('a',g.V(3,5).toList()).V(4).addInE('createdBy','a') //(2)
==>e[14][3-createdBy->4]
==>e[15][5-createdBy->4]
gremlin> g.V().as('a').out('created').as('b').select('a','b').addOutE('b','createdBy','a','acl','public') //(3)
==>e[16][3-createdBy->1]
==>e[17][5-createdBy->4]
==>e[18][3-createdBy->4]
==>e[19][3-createdBy->6]
gremlin> g.V(1).as('a').out('knows').addInE('livesNear','a','year',2009).inV().inE('livesNear').values('year') //(4)
==>2009
==>2009
My current interpretation of the first query
g.V(1).as('a').out('created').in('created').where(neq('a'))
selects elements from the graphaddOutE('co-developer','a','year',2009)
will add something to the selectionI would appreciate if someone could first elaborate on what is happening here and then point out how addInE()
and addOutE()
could be represented using addE()
.
This is a trip down memory lane!
Using one of the examples you found
gremlin> g.V(1).as('a').out('created').in('created').where(neq('a')).addOutE('co-developer','a','year',2009)
would, in current day Gremlin be written as
g.V(1).as('a').
out('created').
in('created').
where(neq('a')).
addE('co-developer').to('a').property('year',2009)
The way to read this is
When replacing addInE
still use the addE
step, but replace the to
with a from
. Note that an addE
can also have both from
and to
used with it at the same time.