Organisation -> Department -> System -> Function -> Port - > Request -> Response -> Parameter
Now i retrieve the Parameter node like -
MATCH p=()-[r:Parameter]->(b:checkoutby) RETURN p;
However, checkoutby is present in two Organisations -Century & IndiaBulls and i want to retrieve the Parameter checkoutby from Organisation Century. What will be my cypher ?
This is definitely not working -
MATCH p=(n: Century)-[r:Parameter]->(b:checkoutby) RETURN p;
Can you elaborate more on your model? So far you've given us a hierarchy of node relationships, but it would help to know the node labels of nodes in that pattern.
The problem you've provided suggests a modeling problem.
Keep in mind that given the longer pattern, if you have the same :checkoutby node connected (at multiple hops) from multiple organizations, you need something to preserve the context of which organization is connected, usually with a direct relationship to the :Organization node in question (provided you have one).
MATCH (n:william) WHERE n is null RETURN n UNION MATCH n=(p)-[:Parameter]->(b) WHERE
b.name ="checkoutBy" RETURN n
But here the effect of william node i.e. the first parent node is nullified and we get the output irrespective of the parent node.
I even tried this query -
MATCH (n) WHERE none(node in nodes(n) WHERE node:william) RETURN n UNION MATCH n=(p)--
()-[:Parameter]->(b) WHERE b.name ="cabinet" RETURN n
but i get error -
Neo.ClientError.Statement.SyntaxError: Type mismatch: expected Path but was Node (line 1, column 36 (offset: 35))
"MATCH (n) WHERE none(node in nodes(n) WHERE node: william ) RETURN n UNION MATCH n=(p)--()-[:Parameter]->(b) WHERE b.name ="cabinet" RETURN n"
I even tried the intersection query but to no avail .
MATCH (n1:william), (n2),(q:cabinet)
WHERE (n1)<-[:Department]-() AND (n2)<-[:Parameter]-(q)
RETURN count(q), collect(q.name)
Warning Error-
This query builds a cartesian product between disconnected patterns.
If a part of a query contains multiple disconnected patterns, this will build a cartesian product between all those parts. This may produce a large amount of data and slow down query processing. While occasionally intended, it may often be possible to reformulate the query that avoids the use of this cross product, perhaps by adding a relationship between the different parts or by using OPTIONAL MATCH (identifier is: (n2))
EXPLAIN MATCH (n1:william), (n2),(ego:cabinet)
^
Even this query doesn't work -
MATCH (n:william) RETURN n UNION MATCH n=(p)-[:Parameter]->(b) WHERE b.name ="checkoutBy"
call apoc.path.expandConfig(n, {labelFilter:'-william'}) yield path
return path
Please help . I want to retrieve the checkoutby / cabinet node only if it is from the topmost parent node - william