Pipe is the right analogy, but also imagine that you're pulling data through the pipe as you iterate through the results. Notice that the pipes are the MATCH/WHERE together.
MATCH n WHERE n.visible = true // gives 10 results, let's say OPTIONAL MATCH n-[r]->m WHERE m.visible = true // for each n from the first part, searches for connected m nodes that are visible and the relationship r between them Wes On Wed, Jun 11, 2014 at 3:57 PM, brian <[email protected]> wrote: > I'm having a little trouble understanding how multiple MATCH clauses work. > Let's say I have a graph nodes with a "visible" property that indicates > whether the node is visible. I want to form a query that return all of the > visible nodes any related nodes that are visible and the relationship > between the visible nodes. I've come up with the following query: > > MATCH n WHERE n.visible = true OPTIONAL MATCH n-[r]->m where m.visible = > true return n,r,m > > This seems to work fine, but I'm not sure I understand why. Is this a sort > of "pipe" in which the result of the first MATCH is piped into the second > OPTIONAL MATCH? Or is it more correct to say that forms the intersection of > the results of the two MATCH clauses? Or is there a much better way to > describe this behavior? > > Thanks > > -brian > -- 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.
