Hi Gremlin fans!
I've been working with Gremlin for a year now (and I love this language!!).
I'm a bit stuck on a query. This is why I'm posting here.
I'm basically trying to aggregate strings (vertices properties) in a large gremlin-python query to populate newly created vertices with these aggregated strings.
(this field is used later in solr for search purposes)
Here is a basic schema that enable to test the query:
schema.propertyKey("name").Text().single().create()
schema.propertyKey("location").Text().single().create()
schema.vertexLabel("legal_entity").properties("name", "location").create()
schema.config().option("graph.allow_scan").set("true")
g.addV("legal_entity").property("name","renault").property("location","FR")
g.addV("legal_entity").property("name","bmw").property("location","DE")
Here is a working query in gremlin, with a lambda:
g.V().values('location').dedup().fold(""){a,b->a+' '+b} returns the expected " FR DE".
Ideally, I would like to either translate it in pure gremlin to avoid the lambda. Or if it's not possible, I'd like to translate the lambda in gremlin-python.
I tried the latter without success:
g.V().values('location').dedup().fold("",lambda: ("lambda x, y: x+' '+y", "gremlin-python")).toList()
returns an empty list while result = g.V().values('location').dedup().fold().next()
returns the expected ['FR', 'DE']
I tried the other gremlin-python syntaxes in the link below but without success
http://tinkerpop.apache.org/docs/current/reference/#gremlin-variantsDo you have any Ideas?
Thanks for your help!
Pierre-Yves de Brito
ps : I'm working with DSE 5.1.3