How to get all vertices of one type?

20 views
Skip to first unread message

rjurney

unread,
Dec 9, 2017, 9:16:55 AM12/9/17
to Gremlin-users
It is frustrating to have to ask such a simple question, but I can't find this in the docs...

I've created vertices of two types via:

v = graph.addVertex('user')
...
v = graph.addVertex('repo')

Now I need to select vertices of one of these types. You would think g.V('user') would work, but it does not. 

How do I select all vertices of one type?

Thanks,
Russ

Robert Dale

unread,
Dec 9, 2017, 9:21:47 AM12/9/17
to gremli...@googlegroups.com
That parameter to addVertex (or addV) is a label.  Thus, use the label step to get all vertexes of a label.  g.V().hasLabel('user')



Robert Dale

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/86739390-f7cd-4afa-a87b-78910523e1cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kelvin Lawrence

unread,
Dec 10, 2017, 11:20:31 AM12/10/17
to Gremlin-users
Hi Russ,
Please feel free to take a look at [1] and let me know if it is useful and also if there are things I could add to help folks like your looking for answers.

[1] https://github.com/krlawrence/graph

Cheers
Kelvin
Reply all
Reply to author
Forward
0 new messages