Hi.
I have a problem with a query which consumes a lot of memory.
Let's imagine I have the following data :
I have a Type class with two vertices: Vegetal, Animal
I have a class Species: Tree, Flower, Firefox, Panda, Elephant
A class Color: Brown, Yellow, Orange, White, Black, Green, Gray
those nodes a connected that way:
Vegetal -> Tree and Flower
Animal to Firefox, Panda and Element
Tree to Brown and Green
Flower to Green and Yellow
Firefox to Orange
Panda to Black and White
Elephant to Gray
What i'd like to do is to get all the data of each Type nodes with their Species and the Colors of the Species, with prefixes (i need the prefixes for post operations)
For now what I do is: SELECT t.* as t_, s.* as s_, c.* as c_ from (MATCH {class: Type, as t}-->{class: Species, as: s}-->{class: Color, as: c} return t, s, c)
but the more relations there is, the entries I get (in the example above, i would end up with 8 entries with all the data each time). What i'd like to get is one entry per Node and one entry per match. Something like that:
- Data of Vegetal
- Data of Animal
- Data of Tree
- Data of Flower
- Data of Firefox
- Data of Panda
- Data of Elephant
- ... (same for each colors)
- one entry for t: Vegetal s:Tree c:Brown
- one for t:Vegetal s:Tree c:Green
- t:Vegetal s:Flower c:Green
- ...
I'd end up with more entries but much less data because the entries for relationships would only contain RIDs.
Any idea on how to do that ?