Hi all, I have a follow up question. Is it possible to extend this to allow variable length matching over multiple *paths*? By a path I mean something like two KNOWS traversals or three BLOCKS traversals. For example, I'd like to be able to write something like:
MATCH (s)-[r*]->(t) WHERE ALL (x in type(r) WHERE x=KNOWS/KNOWS OR x= BLOCKS/BLOCKS/BLOCKS) RETURN s, t where by "KNOWS/KNOWS" I mean something like (a)-[:KNOWS]->(b)-[:KNOWS]->(c). I hope this makes sense. Thanks, George On Friday, June 1, 2012 at 4:04:22 PM UTC+2, Neo wrote: > > Thank You so much. That's an incredible demo. I didn't think I could > exploit functions so much. And by the way I got features of 1.8.2 of Cypher > to work for a database project on 1.6. I have pointed GraphDatabaseService > to the graph.db in 1.6 folder, but added 1.8 versions of all JAR libraries, > and all of the usability of 1.8 came into 1.6. Please tell me if there are > any hidden dangers in doing so. Thanks again for pointing out the > alternatives! > > On Friday, June 1, 2012 6:44:13 PM UTC+5:30, Andres Taylor wrote: > > Hi there, > > This query should work: > > start n=node(1) > match n-[rels*1..3]->m > where all(r in rels WHERE type(r) = "KNOWS" or type(r) = "LOVES") > return n,m > > http://tinyurl.com/76h7xtc > > > HTH, > > Andrés > > On Fri, Jun 1, 2012 at 2:36 PM, Neo <[email protected] <javascript:>> > wrote: > > Thank you for the quick reply. I tried using JAR file of one version(1.8) > in version(1.6), but it didn't work. > I am really sorry, I didn't ask my question correctly. > Along with above feature, Cypher also has support for variable length > relationship like following. > > [:TYPE*minHops..maxHops]->. > > *Query* > START a=node(3), x=node(2, 4) > MATCH a-[:KNOWS*1..3]->x > RETURN a,x > I was trying to combine these two. (Multiple relationship names, Variable > length) in one query. > Query is > > START a=node(3), x=node(2, 4) > MATCH a-[:KNOWS|BLOCKS*1..3]->x > RETURN a,x > > Above method worked in 1.8, but not in 1.6 (sorry, not 1.7). How can I > reproduce same effect. In this case, assigning relationship > as a variable r results in IterableType error. Please suggest any > alternatives. Or anyway to accomplish this in Java in single query > On Friday, June 1, 2012 5:21:23 PM UTC+5:30, Michael Hunger wrote: > > Both could work, > > neo4j-cypher-1.8*.jar should work with Neo4j 1.7 too, but no guarantees > and graph-matching, scala version should be the same. > > An alternative (but less performant) would be to check the types in where. > > START n=node(3) > MATCH (n)-[r]->(x) > > WHERE type(r)="BLOCKS" OR type(r)="KNOWS" > > RETURN x > > > Cheers > > Michael > > Am 01.06.2012 um 13:40 schrieb Neo: > > In Cypher, we have following to allow multiple relationships > > START n=node(3) > MATCH (n)-[:BLOCKS|KNOWS]->(x) > RETURN x > > But, this works only in Version 1.8 above. My questions are > - Is there any alternative to execute same query in version 1.7 or below? > If not,-- > - If, I am executing Cypher in Java on Neo4j embedded graph service, can I > include different JAR library files to get the above query support in Neo4j > 1.7 itsel > > ... -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
