O'Reilly logo

Learning Neo4j 3.x - Second Edition by Rik Van Bruggen, Jérôme Baton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Property to label

To add a label to a node based on a property, there are two steps:

  • Add the label to the node
  • Remove the property

For example, should we want to set a hasRestaurant label to towers with a restaurant, the queries would be as follows:

MATCH (t:Tower) WHERE t.hasRestaurantSET t:HasRestaurantREMOVE t.hasRestaurantRETURN t

This also illustrates the need of naming hygiene: HasRestaurant is a label because it starts with a capital letter while hasRestaurant is a property because it starts with a lowercase letter.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required