Not sure I follow completely.

MATCH (main:org) -[r:orders_from]-> (other:org)
WHERE main.id IN ['o1','o2‘] and other.id IN ['ob']
return main, other

this automatically excludes  oa,oc because you only look for 'ob'
you could add a AND NOT other.id IN ['oa','oc'] if the data would come from
elsewhere

On Fri, Jun 19, 2015 at 9:51 PM, Luke Samaha <[email protected]> wrote:

> We're pretty new to cypher, though we've done some training and use neo4j
> pretty regularly. A lot of queries have come very easily!
>
> This week we realized we needed to focus on organizations in our graph
> that were connected to a few specified organizations and no others. This
> helps us suss out dependencies and focus on groups for beta tests as we
> role out product features (but I digress). We couldn't really come up with
> anything we liked and thought we'd post to the forum.
>
> Example pseudo-data:
>
> (o1:org) -[r:orders_from]-> (oa:org)
>
> (o1:org) -[r:orders_from]-> (ob:org)
> (o2:org) -[r:orders_from]-> (ob:org)
>
> (o1:org) -[r:orders_from]-> (oc:org)
> (o2:org) -[r:orders_from]-> (oc:org)
> (o3:org) -[r:orders_from]-> (oc:org)
>
> We want a query that, given:
>
> o1:org
> o2:org
>
> Will include:
>
> (ob:org)
>
> But exclude
>
> (oa:org),(oc:org)
>
> Because each member of the set does not orders_from them, or because
> someone outside the set orders_from them (o3:org).
>
> We were able to solve the problem, but we are sure our query is way to
> ugly to be the best way in cypher. So what do you think cypher community?
>
>
>
>  --
> 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.
>

-- 
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.

Reply via email to