I faced a similar error with OPTIONAL MATCH:
CALL apoc.periodic.iterate(
"MATCH ((c1:citation) -[p1:probability]-> (t:lda_topic) <-[p2:probability]- (c2:citation))
WHERE id(c1) < id(c2) AND (toFloat(p1.prob) + toFloat(p2.prob) > 1)
WITH c1, c2, toFloat(p1.prob) as w1, toFloat(p2.prob) as w2, t, 2 as precision
WITH c1, c2, w1, w2, t, 10^precision as factor
WITH c1, c2, t, round(factor* (1/(2+w1+w2))) / factor as weight
OPTIONAL MATCH (a:alias) -[:authored]-> (c1)
OPTIONAL MATCH (b:alias) -[:authored]-> (c2)
RETURN a, b, weight, t, c1.citation as citation1, c2.citation as citation2",
"CREATE (a)-[e:through_topic]->(b)
SET e.weight= weight,
e.topic = t.entity_type,
e.citation1 = citation1,
e.citation2 = citation2", {batchSize:5000, iterateList:true, parallel:true})
YIELD batches, total, errorMessages
and the error was
"Failed to create relationship `e`, node `b` is missing. If you prefer to simply ignore rows where a relationship node is missing, set 'cypher.lenient_create_relationship = true' in neo4j.conf": 235,
"Failed to create relationship `e`, node `a` is missing. If you prefer to simply ignore rows where a relationship node is missing, set 'cypher.lenient_create_relationship = true' in neo4j.conf": 9660
When I tried to add 'cypher.lenient_create_relationship = true' in my conf, I ran into this error: Setting cypher.lenient_create_relationship doesn`t work · Issue #12059 · neo4j/neo4j · GitHub but with Neo4j instance 3.5.
Currently, I made sure that my OPTIONAL MATCH does not throw any exception and am running the query with
CALL apoc.periodic.iterate(
"MATCH ((c1:citation) -[p1:probability]-> (t:lda_topic) <-[p2:probability]- (c2:citation))
WHERE id(c1) < id(c2) AND (toFloat(p1.prob) + toFloat(p2.prob) > 1)
WITH c1, c2, toFloat(p1.prob) as w1, toFloat(p2.prob) as w2, t, 2 as precision
WITH c1, c2, w1, w2, t, 10^precision as factor
WITH c1, c2, t, round(factor* (1/(2+w1+w2))) / factor as weight
MATCH (a:alias) -[:authored]-> (c1)
MATCH (b:alias) -[:authored]-> (c2)
RETURN a, b, weight, t, c1.citation as citation1, c2.citation as citation2",
"CREATE (a)-[e:through_topic]->(b)
SET e.weight= weight,
e.topic = t.entity_type,
e.citation1 = citation1,
e.citation2 = citation2", {batchSize:5000, iterateList:true, parallel:true})
YIELD batches, total, errorMessages
The query seems to be running fine - just taking time.
I want to know the following:
-
Is issue Setting cypher.lenient_create_relationship doesn`t work · Issue #12059 · neo4j/neo4j · GitHub resolved because "OPTIONAL MATCH" was changed so it will not raise a null?
-
Is "cypher.lenient_create_relationship" error above is being thrown because of OPTIONAL MATCH throwing a null
-
Do I need a WITH statement between the two MATCH statements
MATCH (a:alias) -[:authored]-> (c1)
MATCH (b:alias) -[:authored]-> (c2)
I tested this for small toy examples - but I am not sure what is happening for bigger instances.
@andrew_bowman requesting you to take a look at this.
Thanks,
Lavanya