iamtheef
(iNSIDE the mirror)
1
How can I query multiple relationships and pass filter for just one of them?
eg:
match (u:User)-[:PURCHASED|r:RATED {r.value > 3.5}]->(i:Item) return i
I wanna query all the items a user has interacted and only include those which the user rated above a limit.
iamtheef
(iNSIDE the mirror)
2
match (u:User)-[r:PURCHASED|RATED]->(i:Item) where r.value>3.4 return u, i
This kinda works but the other of the edges doesn't hold values. Only RATED edge has a value.
Nope, it only returns RATED nodes by the user.
glilienfield
(Gary Lilienfield)
3
Do you mean you would like to get all the items a user purchased where the user also rated with a rating greater than 3.5? If so, try this.
match (u:User)-[:PURCHASED]->(i:Item)
where exists {
match (u)-[r:RATED]->(i)
where r.value > 3.5
}
return u.name, collect(i.name)
Got it..try this:
match (u:User)-[r]->(i:Item)
where r:PURCHASED or (r:RATED and r.value > 3.5)
return u, i
iamtheef
(iNSIDE the mirror)
5
No. I mean I wanna get all the items a user either purchased OR rated > some value.
iamtheef
(iNSIDE the mirror)
6