Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Help with this cypher query
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
vmarcinko  
View profile  
 More options Jul 27 2012, 3:05 am
From: vmarcinko <vmarci...@gmail.com>
Date: Fri, 27 Jul 2012 00:05:26 -0700 (PDT)
Local: Fri, Jul 27 2012 3:05 am
Subject: Help with this cypher query

Hello,

I've been struggling to solve this cypher query, if possible at all.

I want to return final nodes (finalNode) from my cypher query. And there
are 2 ways one can find final nodes in db:

startNode <-[:r1]-finalNode
(when finalNode is directly connected to startNode)
...and...
startNode -[:r2*]->middleNode-[:r3]->finalNode
(when finalNode is connected to middleNode, and this one is connected
directly to startNode or to "parent" middleNode)

Both of these queries return finalNodes correctly, but I dunno how to
connect them together for purpose of returning final nodes regardless in
which way they are connected to start node.

I tried connecting tha match portion with comma, but it doesn't work :

start startNode = node(3131) match startNode <-[:r1]-finalNode , startNode
-[:r2*]->middleNode-[:r3]->finalNode return finalNode

Any help?

regards,
Vjeran


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Armbruster  
View profile  
 More options Jul 27 2012, 6:44 am
From: Stefan Armbruster <sarmbruste...@gmail.com>
Date: Fri, 27 Jul 2012 03:44:41 -0700 (PDT)
Local: Fri, Jul 27 2012 6:44 am
Subject: Re: Help with this cypher query

According to
http://docs.neo4j.org/chunked/milestone/query-match.html#match-match-... there
is no OR in MATCH. But you could probably use

start startNode = node(3131) match
finalNode1<-[:r3?]-middleNode<-[:r2*]-startNode<-[:r1?]-finalNode2 return
collect([finalNode1, finalNode2])

Regards,
Stefan

Am Freitag, 27. Juli 2012 09:05:26 UTC+2 schrieb vmarcinko:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vmarcinko  
View profile  
 More options Jul 28 2012, 2:19 am
From: vmarcinko <vmarci...@gmail.com>
Date: Fri, 27 Jul 2012 23:19:28 -0700 (PDT)
Local: Sat, Jul 28 2012 2:19 am
Subject: Re: Help with this cypher query

Hi again,

First of all, thanx.

From Neo4j docs example, my problem is that I want for node (3) (Anders) to
find out all the poeple that he KNOWS, or he BLOCKS.

I'm very close to answer, the problem is that nodes are not distinct, so I
have duplicates:
start a=node(3) match x1-[?:KNOWS]-a-[?:BLOCKS]->x2 return collect([x1,x2])
Here is a link to try it out:
http://console.neo4j.org/r/c7ime2
The result should contain 3 nodes, but it returns duplicate, so I have 4.

I have hoped initially that simplier query would be enough, but it doesn't
return correct nodes (only 1):
start a=node(3) match a-[?:KNOWS]-x<-[?:BLOCKS]-a return x

http://console.neo4j.org/r/3gskd3

Regards,
Vjeran


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Armbruster  
View profile  
 More options Jul 28 2012, 8:27 am
From: Stefan Armbruster <sarmbruste...@gmail.com>
Date: Sat, 28 Jul 2012 05:27:57 -0700 (PDT)
Local: Sat, Jul 28 2012 8:27 am
Subject: Re: Help with this cypher query

Am Samstag, 28. Juli 2012 08:19:28 UTC+2 schrieb vmarcinko:

> Hi again,

> First of all, thanx.

> From Neo4j docs example, my problem is that I want for node (3) (Anders)
> to find out all the poeple that he KNOWS, or he BLOCKS.

> I'm very close to answer, the problem is that nodes are not distinct, so I
> have duplicates:
> start a=node(3) match x1-[?:KNOWS]-a-[?:BLOCKS]->x2 return collect([x1,x2])
> Here is a link to try it out:
> http://console.neo4j.org/r/c7ime2
> The result should contain 3 nodes, but it returns duplicate, so I have 4.

The problem is that collect does not flatten nested collections. If it did,
we could use distinct to filter out duplicates.

> I have hoped initially that simplier query would be enough, but it doesn't
> return correct nodes (only 1):
> start a=node(3) match a-[?:KNOWS]-x<-[?:BLOCKS]-a return x

This only returns results if both ends refer to the very same node.

Cheers,
Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »