Best way to run multi-statement cypher query

CSV:

  1. The formatting is fine, I've also tried leaving the apoc conversion out, or not using the properties operator in export - same result
  2. I was able to reproduce both a working (using a boolean property) and non-working example with a single property, as it turns out temporal type does not seem to be supported in import.

Export:
CALL apoc.export.csv.query("MATCH (x:X)-[r:relationship]->(y:Y) RETURN ID(x) as x,r,ID(y) as y", "test.csv", {})

File (note forum converts [ and ] to ):
"x","r","y"
"1919374","{""id"":3919461,""type"":""relationship"",""start"":1919374,""end"":1919375,""properties"":{""myProperty"":{""offset"":{""totalSeconds"":0,""id"":""Z"",""rules"":{""transitions"":,""transitionRules"":,""fixedOffset"":true}},""zone"":{""totalSeconds"":0,""id"":""Z"",""rules"":{""transitions"":,""transitionRules"":,""fixedOffset"":true}},""dayOfYear"":1,""dayOfWeek"":""TUESDAY"",""month"":""JANUARY"",""dayOfMonth"":1,""year"":2019,""monthValue"":1,""hour"":0,""minute"":0,""nano"":0,""second"":0,""chronology"":{""id"":""ISO"",""calendarType"":""iso8601""}}}}","1919375"

Import:
LOAD CSV WITH HEADERS FROM "file:///test.csv" AS row MATCH (x:X) MATCH (y:Y) WHERE ID(x)=toInteger(row.x) AND ID(y)=toInteger(row.y) MERGE (x)-[r:relationship]->(y) SET r=apoc.convert.fromJsonMap(row.r).properties

Result:
Neo.ClientError.Statement.TypeError: Property values can only be of primitive types or arrays thereof

CYPHER:

  1. Thank you for providing this - this is fine if it works (though it would be nice to have an argument for file input). I appreciate this is APOC, but if there is no selective export functionality in standard cypher, then this is the only way we can export.

Testing the described method unfortunately does not seem to add any relationships. Further investigation shows there appears to be an issue with the exported cypher syntax.

If the first row is (forum seems to eat the single quotes around UNIQUE IMPORT LABEL etc):
MATCH (n1:UNIQUE IMPORT LABEL{UNIQUE IMPORT ID:4762}), (n2:UNIQUE IMPORT LABEL{UNIQUE IMPORT ID:1919299}) MERGE (n1)-[r:relationship]->(n2);

Then running this query should return existing nodes:
MATCH (n1:UNIQUE IMPORT LABEL{UNIQUE IMPORT ID:4762}), (n2:UNIQUE IMPORT LABEL{UNIQUE IMPORT ID:1919299}) return n1,n2

However, it does not find the nodes. Is this depricated use of ID? The following does return them:
MATCH (n1), (n2) where ID(n1)=4762 and ID(n2)=1919299 return n1,n2

PS: APOC version 3.5.0.1