Message from discussion
Cypher questions - return updates count, update 2 things in a single query
Received: by 10.66.86.39 with SMTP id m7mr5123387paz.4.1350504224697;
Wed, 17 Oct 2012 13:03:44 -0700 (PDT)
X-BeenThere: neo4j@googlegroups.com
Received: by 10.68.197.72 with SMTP id is8ls28370849pbc.5.gmail; Wed, 17 Oct
2012 13:03:43 -0700 (PDT)
Received: by 10.66.76.5 with SMTP id g5mr5169946paw.44.1350504223000;
Wed, 17 Oct 2012 13:03:43 -0700 (PDT)
Received: by 10.66.76.5 with SMTP id g5mr5169944paw.44.1350504222980;
Wed, 17 Oct 2012 13:03:42 -0700 (PDT)
Return-Path: <azeeztechni...@gmail.com>
Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47])
by gmr-mx.google.com with ESMTPS id js4si1234856pbb.2.2012.10.17.13.03.42
(version=TLSv1/SSLv3 cipher=OTHER);
Wed, 17 Oct 2012 13:03:42 -0700 (PDT)
Received-SPF: pass (google.com: domain of azeeztechni...@gmail.com designates 209.85.160.47 as permitted sender) client-ip=209.85.160.47;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of azeeztechni...@gmail.com designates 209.85.160.47 as permitted sender) smtp.mail=azeeztechni...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-pb0-f47.google.com with SMTP id ro12so7662146pbb.20
for <neo4j@googlegroups.com>; Wed, 17 Oct 2012 13:03:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-type;
bh=ARq2eS/eSYUuP4aXPKbei5/RmCZckGdeCkW9qXlDSrY=;
b=IbQk+Kd1gwnVoYpkmD3ik77y/3k2jTals2XV4Wbdr+hEvRbF7pYVbJUsTsn1Pe6WEa
4AinxecAXV6rwceuzSMWitAlRSND7XXp8RMt3z9LsnXtFTQR2UdDQ4r6dOlt9/CkjWeY
mn49FqkeWLRrc4Lg7eYRAi1OSPXbgpqJ7+HWsRn/8jPRkFmMk/C+EFV3bdGREY59DZp3
NrZbngdNcAvMcYleprxu1ej7+VwdwRWv9/LxaLke2cYK2TE1e4wtZk6oiBz1bPoc5fvJ
y+szg3xYwD202i/EmzFfRobzBtpfpakJaKEnsCGDiMePuhS21F8PDXb9RWrVQT1y9zqA
7m3g==
Received: by 10.68.211.67 with SMTP id na3mr58961147pbc.21.1350504222627; Wed,
17 Oct 2012 13:03:42 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.68.15.10 with HTTP; Wed, 17 Oct 2012 13:03:02 -0700 (PDT)
In-Reply-To: <86a8f9a6-5ac7-46d5-a705-53eb12debb6c@googlegroups.com>
References: <CAAuGTBi3pZ74PxhAeCsShw4WsehSwog84cPF4wWm4v3Zzta...@mail.gmail.com>
<CAP4mnvY-364N9Z8T8c5Na4_frSxgYTWaUQB-r48A3tmC8O=...@mail.gmail.com> <86a8f9a6-5ac7-46d5-a705-53eb12debb6c@googlegroups.com>
From: Abdul Azeez Shaik <azeeztechni...@gmail.com>
Date: Thu, 18 Oct 2012 01:33:02 +0530
Message-ID: <CAP4mnvYzzuvQJN4JBDqv5XVTF-qVTsqi=26TwgAv2FHrhvL...@mail.gmail.com>
Subject: Re: [Neo4j] Cypher questions - return updates count, update 2 things
in a single query
To: neo4j@googlegroups.com
Content-Type: multipart/alternative; boundary=e89a8ff1c83e7516f004cc46c494
--e89a8ff1c83e7516f004cc46c494
Content-Type: text/plain; charset=ISO-8859-1
AFIK, WHERE predicate can be removed, as anyways r.preferred is false.
But, i don't know what would be the performance effect on that. May be
Peter or Michael can answer this better.
BTW, what is your data size?
Thanks,
Abdul
On Thu, Oct 18, 2012 at 12:31 AM, wujek <wujek.sru...@gmail.com> wrote:
> Hi. This:
>
> start me = node({me}), like=node{{like}} match me-[r:LIKES]->t set
> r.preferred = false where r.preferred = true
> with me, like
> match me-[r:LIKES]->t set r.preferred = true
>
> doesn't work for me in the following scenario: there is no preferred yet
> (all relations have preferred = false), so the first part doesn't update
> anything, and then the second doesn't update anything as well.
> When I first set a preferred to some node, then the query works fine.
> Which means I cannot be used as is in my use case, as there is no preferred
> initially, and this seems to prevent setting one.
>
> Am I doing something wrong?
>
> wujek
>
>
> On Monday, October 15, 2012 12:57:03 PM UTC+2, Abdul Azeez Shaik wrote:
>>
>> Hi Wujek,
>>
>> You can use WITH clause to have two sub-queries in one query.
>> Your query would be,
>> start me = node({me}), like=node{{like}} match me-[r:LIKES]->t set
>> r.preferred = false where r.preferred = true
>> WITH me, like
>> match me-[r:LIKES]->t set r.preferred = true
>>
>>
>> --
>
>
>
--e89a8ff1c83e7516f004cc46c494
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
AFIK, WHERE predicate can be removed, as anyways r.preferred is false.<div>=
But, i don't know what would be the performance effect on that. May be =
Peter or Michael can answer this better.</div><div><br></div><div>BTW, what=
is your data size?</div>
<div><br></div><div>Thanks,</div><div>Abdul<br><div><br><div class=3D"gmail=
_quote">On Thu, Oct 18, 2012 at 12:31 AM, wujek <span dir=3D"ltr"><<a hr=
ef=3D"mailto:wujek.sru...@gmail.com" target=3D"_blank">wujek.sru...@gmail.c=
om</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hi. This:<div><div class=3D"im"><div><br></d=
iv><div>start me =3D node({me}), like=3Dnode{{like}} match me-[r:LIKES]->=
;t set r.preferred =3D false where r.preferred =3D true</div>
</div><div>with me, like</div><div class=3D"im"><div>match me-[r:LIKES]->=
;t set r.preferred =3D true</div></div></div><div><br></div><div>doesn'=
t work for me in the following scenario: there is no preferred yet (all rel=
ations have preferred =3D false), so the first part doesn't update anyt=
hing, and then the second doesn't update anything as well.<div>
When I first set a preferred to some node, then the query works fine. Which=
means I cannot be used as is in my use case, as there is no preferred init=
ially, and this seems to prevent setting one.</div><div><br></div><div>
Am I doing something wrong?</div><span class=3D"HOEnZb"><font color=3D"#888=
888"><div><br></div></font></span><div><span class=3D"HOEnZb"><font color=
=3D"#888888">wujek</font></span><div class=3D"im"><br><br>On Monday, Octobe=
r 15, 2012 12:57:03 PM UTC+2, Abdul Azeez Shaik wrote:<blockquote class=3D"=
gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid=
;padding-left:1ex">
Hi Wujek,<div><br></div><div>You can use WITH clause to have two sub-querie=
s in one query.</div><div>Your query would be,</div><div>start me =3D node(=
{me}), like=3Dnode{{like}} match me-[r:LIKES]->t set r.preferred =3D fal=
se where r.preferred =3D true</div>
<div>WITH me, like</div><div>match me-[r:LIKES]->t set r.preferred =3D t=
rue</div><div><br></div></blockquote><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex=
">
<div><br></div>
</blockquote></div></div></div>
<p></p>
-- <br>
=A0<br>
=A0<br>
</blockquote></div><br></div></div>
--e89a8ff1c83e7516f004cc46c494--