Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-17-2020 01:39 AM
Hello,
I've been using neo4j for a while and recently i got stuck with a query that i don't seem to be able to succesfully run.
My goal: I have a type of relationship called HAS_RELATIONSHIP
. this type of rel sometimes have a property called verified
. I want to get a subgraph of those relationships that don't have this property so i can afterwards add the property.
What I have done so far:
Match (a)-[r:HAS_RELATIONSHIP]-(b)
where r.verified=False
set r.verified=True
LIMIT 5
return r, r1, a, b
the part that is not working is where r.verified=False
it should be something like exists(r)=verified
but t doesn't seem to exist this kind of query. I have checked on OPTIONAL MATCH
, but it seems it is neither the solution.
Any ideas?
Solved! Go to Solution.
09-17-2020 02:32 AM
Hello @alvaro.lloret.demull and welcome to the Neo4j community
MATCH (a)-[r:HAS_RELATIONSHIP]-(b)
WHERE NOT EXISTS(r.verified)
SET r.verified = True
LIMIT 5
RETURN r, r1, a, b
OR
MATCH (a)-[r:HAS_RELATIONSHIP]-(b)
WHERE r.verified IS NULL
SET r.verified = True
LIMIT 5
RETURN r, r1, a, b
Regards,
Cobra
09-17-2020 02:32 AM
Hello @alvaro.lloret.demull and welcome to the Neo4j community
MATCH (a)-[r:HAS_RELATIONSHIP]-(b)
WHERE NOT EXISTS(r.verified)
SET r.verified = True
LIMIT 5
RETURN r, r1, a, b
OR
MATCH (a)-[r:HAS_RELATIONSHIP]-(b)
WHERE r.verified IS NULL
SET r.verified = True
LIMIT 5
RETURN r, r1, a, b
Regards,
Cobra
09-17-2020 02:33 AM
Thanks! This was it!
All the sessions of the conference are now available online