Hello please I have an SQL query that make more then three joins so I wanted to use cypher query and I write my new cypher query like this:
*MATCH (N0:entityclazz4) * * OPTIONAL MATCH (N0:entityclazz4)-[R0:relationshipclazz3]->(N1:entityclazz3)* * OPTIONAL MATCH (N1)-[R1:relationshipclazz2]-()* * OPTIONAL MATCH (N0:entityclazz4)-[R2:relationshipclazz3]-()* * OPTIONAL MATCH ()-[R3:relationshipclazz3]-(N2:entityclazz4)* * OPTIONAL MATCH (N2:entityclazz4)-[R4:relationshipclazz3]-()* * WITH distinct N0, N0.att0 as AN0, count(R1.att1) as AR1, R1.att1 as BR1, count(R4.att0) as AR4, R4.att0 as BR4 order by AR4 desc,BR4,AR1 desc,BR1,ID(N0), AN0 WITH ID(N0) as i, N0.att0 as O1, head(collect(BR1)) as O2, head(collect(BR4)) as O3, N0 RETURN O1, O2, O3, count(i) ORDER BY O1, O2, O3* this query has many optional match and it gives me the right result that I want and it takes few seconds Now my second type of query is that in my query I start from a relationship and an empty entity like this it is a *recursive query I make many comming and going in the same query *: * MATCH ()-[R0:relationshipclazz3]-() * * OPTIONAL MATCH ()-[R0:relationshipclazz3]->(N0:entityclazz3)* * OPTIONAL MATCH (N0)-[R1:relationshipclazz2]-() * * OPTIONAL MATCH()<-[R0:relationshipclazz3]-(N2:entityclazz4) * * OPTIONAL MATCH (N2:entityclazz4)-[R1:relationshipclazz3]-()* * WITH distinct R0, R0.att0 as AR0, count(R1.att0) as AR1, R1.att0 as BR1, count(R1.att2) as AR2, R1.att2 as BR2, count(R1.att1) as AR3, R1.att1 as BR3 order by AR1 desc,BR1,AR2 desc,BR2,AR2 desc,BR3,ID(R0), AR0 WITH ID(R0) as i, R0.att0 as O1, head(collect(BR1)) as O2, head(collect(BR2)) as O3, head(collect(BR3)) as O4,R0 * * RETURN O1, O2, O3, O4, count(i) ORDER BY O1, O2, O3, O4* now here I have a problem that the query take many time to have a response more than 2 and 3 hours I read this post https://maxdemarzi.com/2017/02/06/neo4j-is-faster-than-mysql-in-performing-recursive-query/ how to resolve problem of recursive query but I didn't understand enough how can I resolve the problem when I made many optional match starting from a given relationship and an empty node what is PruningVarExpanderTest.scala and how can I use it please I need your help because I have to use this in my thesis thank you in advance -- 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.
