On Wed, Nov 2, 2011 at 11:01 AM, D. Frej <dieter_f...@gmx.net> wrote:

> Hi,
>
> I have a very simply graph:
>
> UserGroup 2 <-[:IS_MEMBER_OF]- UserGroup 1, User 3
> UserGroup 1 <-[:IS_MEMBER_OF]- User 1, User 2
>
> I want to find all nodes that are on the same level or on a level below
> the starting point. Using
>
> START principals=node:nodes(NAME='User 3')
> MATCH (principals)-[?:IS_MEMBER_OF]->()<-[:IS_MEMBER_OF*0..]-(n)"
> RETURN n
>
> I first go one level up and then determine all nodes below this level.
> However, it is not working if I change the start to
>
> START principals=node:nodes(NAME='UserGroup 2')
> (because there is no IS_MEMBER_OF relationship to go up).
>
> Is there a way to ommit this condition if it is not available? To make
> it somehow optional?
>

You could use an optional relationship here. See:

http://docs.neo4j.org/chunked/snapshot/query-match.html#match-optional-relationship

Note that this is the snapshot version of the documentation, you will want
to look at the documentation for the version of neo4j you are using to make
sure that this syntax is supported.


>
> Thanks,
>
> - Didi
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Jacob Hansson
Phone: +46 (0) 763503395
Twitter: @jakewins
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to