Reputation: 123
I am using this code:
n1 = Node("X", name=w1)
graph.create(n1)
n1.add_label(u2)
But it's simply not adding this label u2
, even from the Python prompt.
Upvotes: 2
Views: 1068
Reputation: 328
If you are trying to update node with list of labels then you can try:
nodeLabelList = ["Person", "Admin"]
node.update_labels(nodeLabelList)
This is for py2neo v4.
Upvotes: 1
Reputation: 16365
According the docs you should add labels to a node in this way:
alice = Node("Person", name="Alice")
alice.labels.add("Employee")
In your case, you are using a different method name (add_label) and not passing a string. Try:
n1 = Node("X", name="w1")
graph.create(n1)
n1.labels.add("u2")
Note the "u2"
instead of u2
.
Upvotes: 0