Closed TangMonk closed 3 months ago
match p=(v)-[*]->(v3) where id(v)=="a" and all(n in nodes(p) where id(n) <> "c") return nodes(p)
Thanks, I am using
MATCH p=(a)-[e*]->(b)
WHERE id(a) == "a" AND NONE (x in nodes(p) WHERE id(x) == "c")
UNWIND relationships(p) as e2
RETURN DISTINCT src(e2) AS src, dst(e2) AS dst, e2 as e;
it works
Nebula version
3.8.0
operating system
Linux
Describe the Question
I am using Nebula Graph database and trying to write a query that stops the chain when encountering a specific node and ignores any relationships beyond that node. For example, I have the following graph structure:
I want to start the query from node a and follow the chain, but if the query encounters node
c
, it should stop and not fromc->d->e
andc->j->l
, it should be:Here is the setup for the vertices and edges:
I have tried the following query to achieve this, but it still includes the relationship from d to e:
The result includes:
How can I modify the query to ensure that the chain is interrupted at node c and any relationships beyond c are ignored?
Thank you for your help!