Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-31-2022 10:01 AM
I'm defining the relationship between two entities, Variety and Treatment.
match (s1:Variety),(c:Treatment)
where id(s1)=0 and id(c)=4
create (s1) - [rel:UNTREATED]-> (c)
return type(rel)
Result is '(no changes, no records)'.
In this context, an error occurs:
This query builds a cartesian product between disconnected patterns.
01-31-2022 10:15 AM
It worked for me. Are you sure the two nodes exist.
You can refactor the code as follows to eliminate the warning and to ensure the relationship doesn't get recreated every time you run the query:
match (s1:Variety) where id(s1)=0
match (c:Treatment) where id(c)=1
merge (s1) - [rel:UNTREATED]-> (c)
return type(rel)
Note: the id's are from my test data. Change appropriately.
01-31-2022 10:20 AM
Thanks. But the result is the same. The nodes exists.
Previously this was working. Current version Neo4j is 1.4.12.
01-31-2022 11:18 AM
You screenshot shows your label is "Varieties", not "Variety." There is also no label "Treatment." Could this explain it?
02-01-2022 11:25 AM
Hi @iganea9
Here is my environment.
macOS 12.2
Neo4j Desktop 1.4.12
Neo4j 4.4.3
I created the 5 nodes.
CREATE (:Variety); // id()=0
CREATE (:Label1); // id()=1
CREATE (:Label2); // id()=2
CREATE (:Label3); // id()=3
CREATE (:Treatment); // id()=4
Your Cypher works correctly.
I ran it 3 times.
MATCH (s1:Variety),(c:Treatment)
WHERE id(s1)=0 AND id(c)=4
CREATE (s1)-[rel:UNTREATED]->(c)
RETURN type(rel)
You may be able to find the problem with this Cypher.
MATCH (n)
WHERE id(n) IN [0,4]
RETURN n;
All the sessions of the conference are now available online