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

Adding data with specific values

Should you want to specify a value for each node concerned, there are two main cases. Either the value is known or it has to be computed. If the value is known, you can certainly read it from a source, such as a JSON file, an XML file, or a CSV file.

In the first two cases, APOC will help you, or you may use LOAD CSV, as we saw in Chapter 08, Importing Data into Neo4j. The recipe will be as follows:

LOAD CSV  OR  CALL apoc.load.json(url) YIELD valueMATCH the node with its IDSET the new property to the given value

If the value is not known and has to be computed from existing data, it gets a little trickier because there may be conversions to do from one field type to another to do. An example could be getting ...

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