Hello,
please I make an algorithm that count instances from Neo4j database so I 
generate cypher queries automatically from neo4j

 I have a Neo4j database which is movie_rating database that contains users 
who likes movies 
so I have two entities label "movie" with genre property and "user" with 
gender and age properties  and the relationship label "rating" which has 
the property likes

 I tried now to excute a cypher querie as follow:

MATCH (N0:movie)
OPTIONAL MATCH (N0:movie)<-[R0:rating]-()
WITH distinct N0, N0.genre as AN0, R0, count(R0.likes) as AR0 
order by ID(N0), AN0, AR0 desc  
WITH   N0.genre as O1,  head(collect(R0.likes)) as O2, N0
RETURN  O1, O2, count(ID(N0)) ORDER BY  O1, O2

the result was not good and I get innacurate counts 
Then I execute the same request but now I just modify the place of R0 
colored in red (in the second query) and I get now good counts 

MATCH (N0:movie) OPTIONAL MATCH (N0:movie)<-[R0:rating]-() WITH distinct 
N0, R0,N0.genre as AN0,  count(R0.likes) as AR0 order by ID(N0), AN0, AR0 
desc  WITH   N0.genre as O1,  head(collect(R0.likes)) as O2, N0 RETURN  O1, 
O2, count(ID(N0)) ORDER BY  O1, O2

The problem that this just an example but in some other queries when I put 
R0 in the beginning I get innacurate results so it works for some request 
and for other request it doesn't work (means that when I let R0 in its 
original place like in the first request colred in blue it works )

So how can I correct this to get just one signature and always have good 
results 
please 


-- 
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.

Reply via email to