I've now written parts of the query, but I can't get a few things working.
It's basically this:
IF(
MATCH
(u:User {name:'U1'})-[r:HAS_PERMISSION]->(o:Object {name:'O1'
})
RETURN r.READ
) ELSE IF (
MATCH
(u:User {name:'U1'}),
(o:Object {name:'O1'}),
u-[r:HAS_PERMISSION]->()-[:PARENT_OF*]->o
RETURN r.READ
) ELSE (
MATCH
(u:User {name:'U1'}),
(o:Object {name:'O1'}),
u-[*]->(v:Role)-[r:HAS_PERMISSION]->o
RETURN r.READ
)
I don't know how to express IF-ELSE with Cypher. I know, I can do CASE
inside the return, but I can't figure out how to combine that with my
query...
The IF-ELSE Blocks:
1. The first IF-Block is working as expected :)
2. The second Block is missing a "shortestPath" statement, but I don't
know how to do the following:
- Return the "r:HAS_PERMISSION" relation of the shortest path
(respectively its "READ" property)
3. The third Block is still missing a lot of code, but that can be
resolved later.
The second block should more looks like:
MATCH
(u:User {name:'U1'}),
(o:Object {name:'O1'}),
s = shortestPath(u-[r:HAS_PERMISSION]->()-[:PARENT_OF*]->o)
RETURN r.READ
But it seems, like it's not possible to use "r:HAS_PERMISSION" within the
shortestPath
I also thought about combining Block 1 and 2, but I was not able to figure
out, how to an optional node with optional relation within the query, i.e.:
MATCH
(u:User {name:'U1'}),
(o:Object {name:'O1'}),
s = shortestPath(
u-[r:HAS_PERMISSION]
*OPTIONAL **->()-[:PARENT_OF]*
->o
)
RETURN r.READ
And again, as stated above: The shortestPath stuff is not working, because
i cannot name new nodes/relations with in this function.
Would be really cool, if someone can give me a hint how to get this working
:)
Thank you!
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.