UNWIND multiple unrelated arrays loaded from JSON file UNWIND multiple unrelated arrays loaded from JSON file json json

UNWIND multiple unrelated arrays loaded from JSON file


The actual problem here is just an unnecessary , between the last line of your SET clause and the WITH clause. Get rid of that, and you get rid of the syntax error.

That said, I highly recommend grouping each UNWIND with the clauses which act on the unwinded values, then resetting the cardinality back to a single row before performing the next UNWIND and processing. Something like this:

//LOAD CLASSES AND UNWIND COMMON ITEMS,COMPANIONS,LOCATIONS CALL apoc.load.json("file:///c://pathToFile//classes.json") YIELD value AS classMERGE (c:Class {name: class.name})SET c.strength = class.strength,c.intelligence = class.intelligence,c.dexterity = class.dexterityWITH c, classUNWIND class.items AS itemMERGE (i:Item {name: item})MERGE (i)-[:LIKELY_HAS]->(c)MERGE (c)-[:LIKELY_BELONGS_TO]->(i)WITH distinct c, classUNWIND class.companions AS companionMERGE (comp:Class {name: companion})MERGE (comp)-[:LIKELY_COMPANION_OF]->(c)MERGE (c)-[:LIKELY_ACCOMPANIED_BY]->(comp)WITH distinct c, classUNWIND class.locations AS locationMERGE (l:Location {name: location})MERGE (l)-[:LIKELY_LOCATION_OF]->(c)MERGE (c)-[:LIKELY_LOCATED_IN]->(l)