Search code examples
pythonjanusgraphgremlin-server

Janusgraph no labels being created for vertices


I am working with Janusgraph. For batch-loading, I have defined some schema, including :

m   = janusGraph.openManagement()

// vertex labels
contentV = m.makeVertexLabel("Content").make()
...

// edge labels
contentE = m.makeEdgeLabel("content").make
...

// properties
...

m.commit()

I am able to create vertices and edges successfully. But the vertices don't have any labels. Edges do have labels.

I tried this for a demo:

...
>>> g.addV('Content').property('name','123').next()
v[43475160]
>>> n = g.V(43475160).next()
>>> n
v[43475160]
>>> n.id
43475160
>>> n.label
''

Is there something I need to edit in the schema, or is it something else?

I am using gremlin-python package for running gremlin queries from python.


Update

g.V().hasLabel('Content').toList(), do return the nodes, but the nodes have their label as an empty string as shown in the demo.


Found a solution

I get the label when I use g.V(123).valueMap(True).toList()


Solution

  • Found a solution

    I get the label when I use g.V(123).valueMap(True).toList()

    The valueMap(True) part is responsible, without providing True, I don't get the label