1

Is it possible to construct a query in parts and run in gremlin python. some thing like this -

q="hasLabel('foo')"
m="has('type','goo')"
g.V().q.m.values('ABC').toList()  

instead of directly running

g.V().hasLabel('foo').has('type','goo').values('ABC').toList()

I tried this and i am getting - [] whereas it is producing results for

g.V().hasLabel('foo').has('type','goo').values('ABC').toList()

Is there any way to construct such a query?

1 Answer 1

2

You can do:

t = g.V()
t = t.hasLabel('foo')
t = t.has('type','goo')
t.values('ABC').toList()

which would allow you to pass around t (i.e. the Traversalobject) to different functions that would each add to it. I suppose that child traversals could be constructed somewhat in the manner you're describing:

child = __.outE().count()
g.V().group().by(child).toList()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.