Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-15-2019 06:46 AM
Dear community,
I got nodes and relationships types from this structure:
class Ages(StructuredRel):
age_score = IntegerProperty()
class Sizes(StructuredRel):
size_score = IntegerProperty()
class Sample(StructuredNode):
name = StringProperty()
similarity_age= Relationship('Sample', "Ages", model=Ages)
similarity_size = Relationship('Sample', "Sizes", model=Sizes)
Now I want to use a cypher query to return all nodes and relationships with the following condition:
I want to get:
together with:
example:
Sample1 ----- age_score = 60 -----> Sample2
Sample1 ----- size_score = 10 -----> Sample2
Sample1 ----- size_score = 70 -----> Sample2
Sample2 ----- age_score = 30 -----> Sample3
Sample2 ----- size_score = 30-----> Sample3
Sample2 ----- size_score = 80 -----> Sample3
Output should be:
Sample1 ----- age_score = 60 -----> Sample2 (conditon 1)
Sample1 ----- size_score = 10 -----> Sample2 (conditon 2)
Which query should I use?
I tried
MATCH (p:Sample)-[r1: Ages | r2: Sizes]->(c:Sample)
WHERE
(r1.age_score >= 50) or
(r2.size_score <= 40 and r1.age_score >= 40)
RETURN p, r1, r2, c
10-23-2019 03:38 AM
Hi!
If you change your query to the following, does it work as expected?
MATCH (p:Sample)-[r1: Ages|Sizes]->(c:Sample)
WHERE
(r1.age_score >= 50) or
(r1.size_score <= 40 and r1.age_score >= 40)
RETURN p, r1, c
All the sessions of the conference are now available online