I want to get the list of all the labels available in the graph, but I am unaware of the schema. Is there any way to find out the list of all the labels?
I have tried the following:
g.V().Label().values()
g.V().hasLabel().values()
but they are not working.
In Gremlin you would do:
g.V().label().dedup()
but that would require a scan of all vertices in the graph which would be expensive. JanusGraph has schema you can query with the JanusGraphManagement class.
JanusGraphManagement mgmt = graph.openManagement();
Iterable<VertexLabel> labels = mgmt.getVertexLabels();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With