Message from discussion
Cypher: filtering nodes if a relation exists
Received: by 10.236.76.4 with SMTP id a4mr37030108yhe.2.1335901235189;
Tue, 01 May 2012 12:40:35 -0700 (PDT)
X-BeenThere: neo4j@googlegroups.com
Received: by 10.236.176.198 with SMTP id b46ls6386618yhm.2.gmail; Tue, 01 May
2012 12:40:34 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.173.74 with SMTP id u50mr221382yhl.1.1335901234242; Tue,
01 May 2012 12:40:34 -0700 (PDT)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
josh.ad...@gmail.com designates internal as permitted sender)
smtp.mail=josh.ad...@gmail.com; dkim=pass
header...@gmail.com
Received: by s7g2000yqm.googlegroups.com with HTTP; Tue, 1 May 2012 12:40:34
-0700 (PDT)
Date: Tue, 1 May 2012 12:40:34 -0700 (PDT)
In-Reply-To: <CAN_At8Jpon6oZtWhbeK5xzuC++DoNG1qYD0Fv3CdW=QX77yhDw@mail.gmail.com>
References: <CAN_At8Jpon6oZtWhbeK5xzuC++DoNG1qYD0Fv3CdW=QX77yhDw@mail.gmail.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like
Gecko) Chrome/19.0.1084.36 Safari/536.5,gzip(gfe)
Message-ID: <3b1b0e4f-b4f7-4cb4-84cb-838ed8fad613@s7g2000yqm.googlegroups.com>
Subject: Re: Cypher: filtering nodes if a relation exists
From: Josh Adell <josh.ad...@gmail.com>
To: Neo4j <neo4j@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Maybe:
start n =3D node(13), interest=3Dnode(17)
match (n)<-[:knows|works_with]-(person)-[:friend]-(friend)-[:knows|
works_with]-(friendProfile)-[h?:has]->(interest)<-[:has]->(n)
where h is null
return friendProfile.name as name
-- Josh
On May 1, 1:11=A0pm, Luanne Coutinho <luanne.couti...@gmail.com> wrote:
> Hi,
>
> How do you filter out nodes from the result of a cypher query based on
> whether a relation exists or not?
> This is an example of what I was trying to do:
>
> start n =3D node(13), interest=3Dnode(17)
> match
> (n)<-[:knows|works_with]-(person)-[:friend]-(friend)-[:knows|works_with]-=
(f riendProfile)
> where not (friendProfile)-[:has]->(interest)<-[:has]->(n))
> return friendProfile.name as name
>
> I was trying to say- do not give me friendProfiles that have the same
> interest as the start node n.
>
> Thanks