pattern matching, how do you know which vertex 'it' refers to?

27 views
Skip to first unread message

Cyril Auburtin

unread,
Apr 21, 2014, 6:57:47 AM4/21/14
to gremli...@googlegroups.com
http://vimeo.com/26377162 at 23:50, there's an expression ending with table(t){it.id}{it.name}
but te table generated has the ids of one vertex, and the name of successor nodes, so it's confusing how it magically works
thanks

Marko Rodriguez

unread,
Apr 21, 2014, 9:00:45 AM4/21/14
to gremli...@googlegroups.com
Hello,

When you use table, you are referencing particular named steps. For example,

g.V.as('a').outE.as('b')

'a' refers to the vertex in the path
'b' refers to the edge in the path

When you then append table:

g.V.as('a').outE.as('b').table{it.name}{it.weight}

it.name is referring to the vertex named 'a'
it.weight is referring to the edge named 'b'

Next, table closures work in round robin fashion so if you do this:

g.V.as('a').outE('b').table{it.id}

This would produce a table row with the id of the vertex and the edge.

You can learn more about table from the following locations:


Take care,
Marko.
--
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.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages