How to match repeating sub-paths in Cypher

Showing 1-7 of 7 messages
How to match repeating sub-paths in Cypher Daniel Cox 3/14/12 5:56 AM
Hey All,

You know how you can get paths of different lengths from this?:
match path = (startnode)-[:REL*]->()
 
I'd like to do the same thing, but i need more than just a single relationship to repeat:
match path = (startnode)-{[:FIRST_REL]->()-[:SECOND_REL]->()}*
 
I'm just making up syntax there.^ The essential thing is that i need to repeat the section of the path "-[:CONTAINS]->()-[:RELATES_TO]->()" multiple times.
Is this possible?

Thanks!
-Daniel

PS: The freenode IRC channel isn't too lively as of late.


Re: [Neo4j] How to match repeating sub-paths in Cypher Peter Neubauer 3/14/12 6:03 AM
Daniel,
 you could do

http://docs.neo4j.org/chunked/snapshot/query-where.html#where-filtering-on-relationship-type
which means

match path = (startnode)-[e:*]->() where type(r) =~ /FIRSTREL|SECONDREL/

with regexp, or direct

match path = (startnode)-[e:*]->() where type(r) = "FIRSTREL" OR
type(r)="SECONDREL"

or something along these lines.

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.6 released                 - dzone.com/6S4K
The Neo4j Heroku Challenge   - http://neo4j-challenge.herokuapp.com/

Re: [Neo4j] How to match repeating sub-paths in Cypher Andres Taylor 3/14/12 9:25 AM


On Wed, Mar 14, 2012 at 1:56 PM, Daniel Cox <danie...@gmail.com> wrote:
You know how you can get paths of different lengths from this?:
match path = (startnode)-[:REL*]->()
 
I'd like to do the same thing, but i need more than just a single relationship to repeat:
match path = (startnode)-{[:FIRST_REL]->()-[:SECOND_REL]->()}*
 
I'm just making up syntax there.^ The essential thing is that i need to repeat the section of the path "-[:CONTAINS]->()-[:RELATES_TO]->()" multiple times.
Is this possible?

Sorry, Daniel, but that is not supported. It's a good idea, and it really should be supported.

Andrés 
Re: How to match repeating sub-paths in Cypher James Thornton 3/14/12 9:35 AM


On Wednesday, March 14, 2012 6:56:26 AM UTC-6, Daniel Cox wrote:

PS: The freenode IRC channel isn't too lively as of late.


I didn't realize there is an IRC channel :-\

- James
Re: [Neo4j] Re: How to match repeating sub-paths in Cypher Peter Neubauer 3/14/12 9:37 AM

Yeah,
We haven't been hanging out there lately, mostly because of one more channel being open, that one with bad logging possibility.

Who is interested in having more active conversation there again?

Re: [Neo4j] How to match repeating sub-paths in Cypher Daniel Cox 3/27/12 10:05 AM
OK, thanks for that. I also notice that the syntax for this has been cleaned up a bit in 1.7m2.

As to the irc channel, I'd definitely enjoy an occasional conversation there. :) Perhaps is logging is an issue someone could host a logger bot?
-Daniel

Re: [Neo4j] How to match repeating sub-paths in Cypher Peter Neubauer 3/30/12 7:16 AM
Daniel,
if you wanna hang out, we are having our next community hangout in 2
weeks, see http://www.meetup.com/graphdb-world/

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j                                - Graphs rule.
Program or be programmed - Computer Literacy for kids.
http://foocafe.org/#CoderDojo