2

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.

Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
ugp
  • 119
  • 11

2 Answers2

1

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.

AKJ
  • 328
  • 4
  • 14
0

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.

Fabio Lamanna
  • 20,504
  • 24
  • 90
  • 122
Bruno Peres
  • 15,845
  • 5
  • 53
  • 89