Hi,

>> Does that help you? Can you map that motif over to your problem?
> 
> Thank you, I hope so. Maybe the best way is to get all the properties
> map in each vertex in order to be able to operate with those values in
> the next vertex. Is that possible?

In that case do:

        gremlin> g.V.sideEffect{x = it.map()}.out.sideEffect{println x}   
        [name:marko, age:29]
        ==>v[2]
        [name:marko, age:29]
        ==>v[3]
        [name:marko, age:29]
        ==>v[4]
        [name:peter, age:35]
        ==>v[3]
        [name:josh, age:32]
        ==>v[5]
        [name:josh, age:32]
        ==>v[3]

In short, every vertex out of V is passed into sideEffect{}. The current 
vertex's properties are saved to x as a HashMap. Then the outgoing related 
vertices of that vertex are retrieved. There is a sideEffect again where you 
can access your map in x from previous.

Perhaps I'm misunderstanding your use case... Finally, you might want to 
consider "aggregate" as a way to get all before processing the next step. Check 
this:

        gremlin> x = []                                                         
   
        gremlin> g.V.aggregate(x).out.sideEffect{println x*.map()}
        [[name:lop, lang:java], [name:vadas, age:27], [name:marko, age:29], 
[name:peter, age:35], [name:ripple, lang:java], [name:josh, age:32]]
        ==>v[2]
        [[name:lop, lang:java], [name:vadas, age:27], [name:marko, age:29], 
[name:peter, age:35], [name:ripple, lang:java], [name:josh, age:32]]
        ==>v[3]
        [[name:lop, lang:java], [name:vadas, age:27], [name:marko, age:29], 
[name:peter, age:35], [name:ripple, lang:java], [name:josh, age:32]]
        ==>v[4]
        [[name:lop, lang:java], [name:vadas, age:27], [name:marko, age:29], 
[name:peter, age:35], [name:ripple, lang:java], [name:josh, age:32]]
        ==>v[3]
        [[name:lop, lang:java], [name:vadas, age:27], [name:marko, age:29], 
[name:peter, age:35], [name:ripple, lang:java], [name:josh, age:32]]
        ==>v[5]
        [[name:lop, lang:java], [name:vadas, age:27], [name:marko, age:29], 
[name:peter, age:35], [name:ripple, lang:java], [name:josh, age:32]]
        ==>v[3]

In this way, x has ALL the maps of all the vertices coming out of V. x is an 
ArrayList<HashMap>(). You can then do some sideEffect work on that aggregation 
later in the path expression... Does that help?

> My use case is a little particular. I'm writing a mini language to
> support ITL [1], which can work over Kripke structures [2] stored in a
> graph. So what I'm doing is a lexer and a grammar to translate ITL
> into Gremlin queries.

Ah. You might wish to translate it directly to Pipes perhaps? In one week 
(August 1st -- next round of TinkerPop releases), Pipes++ is coming out which 
will make it very easy for anyone to emulate Gremlin behavior in any language 
of their choosing.
        
http://groups.google.com/group/gremlin-users/browse_thread/thread/a1a7092762d22e37
Just a thought...

See ya,
Marko.

http://markorodriguez.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to