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
Message from discussion How to query nodes with multiple relationships?
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
 
fli.rpx  
View profile  
 More options Aug 10 2012, 12:59 pm
From: "fli.rpx" <fudon...@gmail.com>
Date: Fri, 10 Aug 2012 09:59:48 -0700 (PDT)
Local: Fri, Aug 10 2012 12:59 pm
Subject: Re: [Neo4j] How to query nodes with multiple relationships?

Hi Michael,

Thanks for your reply.

There are differences between the two queries. The first query, "start
a=node(1405) match a-[:A*1..3]->m, a-[:B*1..3]->m return distinct m.name",
has AND relationship. Its result set will be the intersection of two
traversals.

The second query, "start a=node(1405) match a-[:A|B*1..3] return distinct
m; ", is OR relationship.

These two queries have performance difference. The first one will take two
traversals then compare. The second one only has one traversal.

I am wondering if I can write the first query in a way of the second query.
Something like this?:

start a=node(1405) match a-[:A&B*1..3] return distinct m;

Thanks,

Fudong

On Thursday, August 9, 2012 2:16:52 PM UTC-7, Michael Hunger wrote:

> I don't really understand your question?

> Does the second query not work for you?

> Michael

> Am 09.08.2012 um 21:48 schrieb fli.rpx:

> > I am trying to write a query to return nodes with two relationships.

> > One way to do it: start a=node(1405) match a-[:A*1..3]->m,
> a-[:B*1..3]->m return distinct m.name;

> > This will work, but takes much a lot more time than a query like this:
> start a=node(1405) match a-[:A|B*1..3] return distinct m;

> > I think maybe neo4j does two traversals in the first query.
> yes it does and their results span up a cross product which is filtered
> down by distinct again.

> > Is it possible to do a query to get nodes with both relationships like
> the second query?


 
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.