Data is loss when i use the UNWIND

13 views
Skip to first unread message

akshay....@kanakasoftware.com

unread,
Aug 22, 2017, 6:52:02 AM8/22/17
to Neo4j

MATCH (ORG:ORG)-[ORGHASPROBLEM:HAS]->(PROBLEM:PROBLEM) WITH PROBLEM,

 

extract(NUM IN filter( V IN collect({ PROB1:PROBLEM.PROB_ID, PROB2:PROBLEM.REGION}) where V.PROB2= LONDON) | NUM.PROB1) AS MEASURES1,

 

extract(NUM IN filter( V IN collect({ PROB1:PROBLEM.PROB_ID, PROB2:PROBLEM.REGION}) where V.PROB2= PARIS) | NUM.PROB1) AS MEASURES2,

 

unwind MEASURES1 AS RESULT1

unwind MEASURES2 AS RESULT2

RETURN DISTINCT PROBLEM.SLAB AS DIMENSION,count(RESULT1) AS  MEASURES1,count(RESULT2) AS MEASURES2

 ===================================================================================================

I am Uploading the image of the database and expected output can anybody rewrite the query or tell me where i am going wrong

AS MY Question is that MEASURES1 and MEASURES2 have my required data when i am using the unwind MEASURES1 AS RESULT1 it give the output as required but in case of the 2nd step : unwind MEASURES2 AS RESULT2 it remove the entier data from MEASURES1 and MEASURES2

--> PLEASE SEE THE IMAGE ATTACH WITH THIS QUESTION TO UNDERSTAND THE SCENARIO MORE CLEARLY

Michael Hunger

unread,
Aug 22, 2017, 6:05:56 PM8/22/17
to ne...@googlegroups.com
Not really sure what you want to achieve.

WITH problem, collect(problem) doesn't make sense, as you are aggregating on problem, so you have all 1 element collections.

You don't need unwind for collections, just use size(measures)

--
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 neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages