Bit Manipulator
Bit Manipulator

Reputation: 358

How to change label of a node in neo4j?

I read the method here to create the label of node through embedded Java Api. But in my problem the label is dynamic because of correction. So, is there a way to change the label?

Without this facility the alternate solution I have thought is to create nodes of 'labels' and create edge from entity node to that 'label' node. But this may lead to some disadvantages as not able to make use of index over the label.

Upvotes: 1

Views: 501

Answers (1)

Jacob Davis-Hansson
Jacob Davis-Hansson

Reputation: 2663

You can remove labels from nodes using:

node.removeLabel(DynamicLabel.label("MyLabel"));

And you can find all the nodes with the incorrect label using the global operations:

GlobalGraphOperations.at(graphDB).getAllNodesWithLabel( DynamicLabel.label("MyLabel") );

Upvotes: 2

Related Questions