Reputation: 28924
I run the following code in gremlin console, I suppose I can get the value of a
, but actually I can't. What is the mechanism of gremlin-console, why I can not just print one variable?
gremlin> a = g.V().next()
==>v[4104]
gremlin> a
No such property: a for class: Script98
Type ':help' or ':h' for help.
Display stack trace? [yN]
Upvotes: 0
Views: 21
Reputation: 1581
Apparently, judging from the "Scipt98" in the error message, your traversalsource g
belongs to a connection to a remote TinkerPop-compatible server. By default, remote queries are run in independent transactions and scripting environments. As a result, the variable a
is not known when it is used remotely in a second query.
If you want to keep remote variables, you would have to use a session. It is also possible to reuse a
in a oneliner, like:
a = g.V().next(); a.id
Upvotes: 0