Hi Michael :)
So here's the initial full query (with the non-expected output, no "one
shot").
The context is: I want to retrieve the number of participants
corresponding to meetings that the user 123 made (meaning participated
too), associated to a meeting's array properties.
MATCH (meeting:Meeting)<-[:TO]-(part)-[:PARTICIPATES]->(user:User {id: "123"
}) //traverse user123's participations
MATCH (meeting)<-[:TO]-(participation)-[:PARTICIPATES]->(participant)
//traverse
to retrieve all the participants for the meetings matched
RETURN meeting.myArrayProperties AS myArrayProperties, count(participant)
AS total_participants
Didn't display the whole array in one column.
However, if I replace the array properties with a standard field like,
meeting.title, it works.
So, arrays are weird.. IMHO ;)
Here's what I did to fix it:
MATCH (meeting:Meeting)<-[:TO]-(part)-[:PARTICIPATES]->(user:User {id: "123"
})
MATCH (meeting)<-[:TO]-(participation)-[:PARTICIPATES]->(participant)
RETURN extract(property IN meeting.myArrayProperties | property) AS
myArrayProperties, count(participant) AS total_participants
Thanks for your feedback, I appreciate.
Michael
On Friday, August 8, 2014 12:06:28 AM UTC+2, Michael Hunger wrote:
>
> Something is wrong there.
>
> An array property is never converted into individual rows by cypher you
> must have done something differently.
>
> Can you please share the full query?
>
> Just tried it, works perfectly fine.
>
>
>
>
> On Thu, Aug 7, 2014 at 10:15 PM, Michael Azerhad <[email protected]
> <javascript:>> wrote:
>
>> I managed to do the trick with:
>>
>> RETURN extract(d IN user.ranks | d) as ranks, count(game.name)
>>
>> => one shot :)
>>
>> Michael
>>
>>
>> On Thursday, August 7, 2014 9:01:55 PM UTC+2, Michael Azerhad wrote:
>>>
>>> Hi,
>>>
>>> Let's suppose this Cypher query snippet:
>>>
>>> RETURN user.name, count(game.name)
>>>
>>>
>>> => a user can have multiple video games
>>>
>>> No matter the example is, the important thing is that I can count names
>>> of user's video games associated with the user's name.
>>>
>>> Result would be:
>>>
>>> NAME NUMBER_OF_GAMES
>>> Michael 18
>>>
>>>
>>> Now, suppose that the user.name is replaced by an array property: let's
>>> imagine user.ranks
>>>
>>> I expect the output to be:
>>>
>>> RANKS NUMBER_OF_GAMES
>>> [1,2,3] 18
>>>
>>>
>>> However the result is a cartesian product over the array:
>>>
>>> RANKS NUMBER_OF_GAMES
>>> 1 ... //no matter the number of games
>>> is
>>> 2 ...
>>> 3 ...
>>>
>>>
>>> Why isn't it possible to return the array in one shot ?
>>>
>>> Thanks,
>>>
>>> Michael
>>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.