Re: [Neo4j] Cypher: multiple match clauses, but OR, not AND

2011-08-24 Thread Aseem Kishore
Yes, this allows specifying multiple relationship types -- as long as the
direction is the same. Thanks!

It would still be extremely useful to be able to specify this when the
directions also differ. (Or in some cases, the shapes of the path also
differ.)

Cheers,
Aseem

On Wed, Aug 24, 2011 at 6:04 PM, Andres Taylor <
andres.tay...@neotechnology.com> wrote:

> Forgot to mention it: We've changed ~TYPE to .TYPE. It's in out snapshot
> version. Just a heads up.
>
> Andrés
>
> On Wed, Aug 24, 2011 at 6:02 PM, Andres Taylor <
> andres.tay...@neotechnology.com> wrote:
>
> >
> >
> > On Wed, Aug 24, 2011 at 5:44 PM, Aseem Kishore  >wrote:
> >
> >> Here's my use case: I want to show my friends' "comments" and "likes".
> >>
> >> For comments, I can do e.g. "(friend) -[:WROTE]-> (comment)", and for
> >> likes,
> >> I can do e.g. "(friend) -[:LIKES]-> (object)", but is there a way I can
> >> combine both these matches into one Cypher query? I know I can put
> >> multiple
> >> match clauses, but it's my understanding that that's an AND, not an OR.
> >>
> >> For this particular case, since the length/shape of the path is the same
> >> for
> >> both cases, being able to specify multiple choices for relationship type
> >> would work here, e.g. "(friend) -[:WROTE,:LIKES]-> (object)", where the
> >> returned object could potentially be a comment.
> >>
> >
> > What you can do if you want to OR relationship types is this:
> >
> > MATCH friend -[r]-> object
> > WHERE r~TYPE = "WROTE" or r~TYPE = "LIKES"
> >
> > I've been considering adding something like what you suggest. It's a good
> > idea - it's mostly a matter of picking the most important features first
> > right not.
> >
> > Thanks for your feedback - much appreciated!
> >
> > Andrés
> >
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Cypher: multiple match clauses, but OR, not AND

2011-08-24 Thread Andres Taylor
Forgot to mention it: We've changed ~TYPE to .TYPE. It's in out snapshot
version. Just a heads up.

Andrés

On Wed, Aug 24, 2011 at 6:02 PM, Andres Taylor <
andres.tay...@neotechnology.com> wrote:

>
>
> On Wed, Aug 24, 2011 at 5:44 PM, Aseem Kishore wrote:
>
>> Here's my use case: I want to show my friends' "comments" and "likes".
>>
>> For comments, I can do e.g. "(friend) -[:WROTE]-> (comment)", and for
>> likes,
>> I can do e.g. "(friend) -[:LIKES]-> (object)", but is there a way I can
>> combine both these matches into one Cypher query? I know I can put
>> multiple
>> match clauses, but it's my understanding that that's an AND, not an OR.
>>
>> For this particular case, since the length/shape of the path is the same
>> for
>> both cases, being able to specify multiple choices for relationship type
>> would work here, e.g. "(friend) -[:WROTE,:LIKES]-> (object)", where the
>> returned object could potentially be a comment.
>>
>
> What you can do if you want to OR relationship types is this:
>
> MATCH friend -[r]-> object
> WHERE r~TYPE = "WROTE" or r~TYPE = "LIKES"
>
> I've been considering adding something like what you suggest. It's a good
> idea - it's mostly a matter of picking the most important features first
> right not.
>
> Thanks for your feedback - much appreciated!
>
> Andrés
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Cypher: multiple match clauses, but OR, not AND

2011-08-24 Thread Andres Taylor
On Wed, Aug 24, 2011 at 5:44 PM, Aseem Kishore wrote:

> Here's my use case: I want to show my friends' "comments" and "likes".
>
> For comments, I can do e.g. "(friend) -[:WROTE]-> (comment)", and for
> likes,
> I can do e.g. "(friend) -[:LIKES]-> (object)", but is there a way I can
> combine both these matches into one Cypher query? I know I can put multiple
> match clauses, but it's my understanding that that's an AND, not an OR.
>
> For this particular case, since the length/shape of the path is the same
> for
> both cases, being able to specify multiple choices for relationship type
> would work here, e.g. "(friend) -[:WROTE,:LIKES]-> (object)", where the
> returned object could potentially be a comment.
>

What you can do if you want to OR relationship types is this:

MATCH friend -[r]-> object
WHERE r~TYPE = "WROTE" or r~TYPE = "LIKES"

I've been considering adding something like what you suggest. It's a good
idea - it's mostly a matter of picking the most important features first
right not.

Thanks for your feedback - much appreciated!

Andrés
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Cypher: multiple match clauses, but OR, not AND

2011-08-24 Thread Aseem Kishore
Here's my use case: I want to show my friends' "comments" and "likes".

For comments, I can do e.g. "(friend) -[:WROTE]-> (comment)", and for likes,
I can do e.g. "(friend) -[:LIKES]-> (object)", but is there a way I can
combine both these matches into one Cypher query? I know I can put multiple
match clauses, but it's my understanding that that's an AND, not an OR.

For this particular case, since the length/shape of the path is the same for
both cases, being able to specify multiple choices for relationship type
would work here, e.g. "(friend) -[:WROTE,:LIKES]-> (object)", where the
returned object could potentially be a comment.

But if the relationship direction is different in the two cases (as they
actually are in our app -- we have "(friend) <-[AUTHOR]- (comment)"), we
probably need two different match clauses.

If this isn't possible today, consider it a feature request. Thanks!

Aseem
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user