l = [ [from: 'marko', to: 'josh', properties: [ weight: 9]]];
g.inject(l).unfold().as('edge').addE('knows'). from(V().has('name', select('edge').select('from'))). to(V().has('name', select('edge').select('to'))).as('e').sideEffect(select('edge').select('properties'). unfold().as('kv'). select('e'). property(select('kv').by(keys), select('kv').by(values)))gremlin> l = [ 'josh']
gremlin> g.inject(l).unfold().as('n').V().has('name', select('n')).valueMap()==>{name=[josh], age=[32], country=[usa]}==>{name=[vadas], age=[27], country=[usa]}==>{name=[marko], age=[29], country=[usa]} // why all 3 vertices in result
gremlin> l = ['josh', 'marko']==>josh==>marko
gremlin> g.inject(l).unfold().as('n').V().has('name', select('n')).valueMap()==>{name=[josh], age=[32], country=[usa]}==>{name=[vadas], age=[27], country=[usa]}==>{name=[marko], age=[29], country=[usa]}==>{name=[josh], age=[32], country=[usa]}==>{name=[vadas], age=[27], country=[usa]}==>{name=[marko], age=[29], country=[usa]} // now all vertex repeat for each value in list ???
gremlin> g.inject(l).unfold().map{V().has('name', it.get()).next()}.valueMap()gremlin> //no result
//I can get result if I start traversal from anonymous traversal and then use g.V() inside map()
gremlin> inject(l).unfold().map{g.V().has('name', it.get()).next()}.valueMap()==>{name=[josh], age=[32], country=[usa]}==>{name=[marko], age=[29], country=[usa]}
gremlin> l = ['josh', 'amiya']
gremlin> inject(l).unfold().as('n').map{g.V().has('name', it.get()).fold().......1> coalesce(unfold(), addV('person').property('name', it.get())).next()}.valueMap()
==>{name=[josh], age=[32], country=[usa]}==>{name=[amiya]}
gremlin> l = [[name:'josh',age:29,country:'usa'], [name:'foo',age:24,country:'usa']];==>{name=josh, age=29, country=usa}==>{name=foo, age=24, country=usa}
gremlin> inject(l).unfold().as('properties').map{g.V().has('name', it.get().get('name')).fold().......1> coalesce(unfold(), addV('person')).next()}.as('vertex').......2> sideEffect(select('properties').......3> unfold().as('kv').......4> select('vertex').......5> property(select('kv').by(Column.keys), select('kv').by(Column.values)))==>v[8192]==>v[16384]
gremlin> g.V().valueMap(true)==>{id=8192, label=person, name=[josh], age=[29], country=[usa]}==>{id=12288, label=person, name=[vadas], age=[27], country=[usa]}==>{id=16384, label=person, name=[foo], age=[24], country=[usa]}==>{id=4312, label=person, name=[marko], age=[29], country=[usa]}==>{id=20632, label=person, name=[amiya]}
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/b257d118-4e27-40ef-921f-87308b54da70%40googlegroups.com.
l = [
[name:'josh',age:29,country:'usa'],
[name:'bar',age:24,country:'usa']]; g.inject(l). unfold().as('properties'). select('name').as('pName'). coalesce(V().has('name', where(eq('pName'))), addV('person')).as('vertex'). sideEffect(select('properties'). unfold().as('kv'). select('vertex'). property(select('kv').by(Column.keys), select('kv').by(Column.values)))To unsubscribe from this group and stop receiving emails from it, send an email to gremli...@googlegroups.com.