Hello,

I have a question about querying 'hierarchical' data in a graph.

Let's assume I have a Person( name ) class, an EdgeClass 'owns', and a 
Bicycle( color, type ) class.
Let's assume than John owns 2 bicycles: ( 'red', 'mountain bike' ) and ( 
'blue', 'recumbent bicycle' )

I found out about the expand function, so in order to get a person with the 
2 types of bicycles, I could query:

select name, 
       outE()[ @class = 'owns' ].inV().type as bicycletypes
from Person

And if I do
select name, 
       outE()[ @class = 'owns' ].inV().type as bicycletypes
from Person

I get something like:
{
    "result": [
        {
            "@type": "d",
            "@rid": "#-2:1",
            "@version": 0,
            "name": "John",
            "bicycletypes": [ 2 ]
        }
    ],
    "notification": "Query executed in 0.03 sec. Returned 1 record(s)"
}

But I would like to have something like:
{
    "result": [
        {
            "@type": "d",
            "@rid": "#-2:1",
            "@version": 0,
            "name": "John",
*            "bicycletypes": [ "recumbent bicycle", "mountain bike" ]*
        }
    ],
    "notification": "Query executed in 0.03 sec. Returned 1 record(s)"
}

And even better would be:
{
    "result": [
        {
            "@type": "d",
            "@rid": "#-2:1",
            "@version": 0,
            "name": "John",
*            "bicycles": [ { "color": "red", "type": "recumbent bicycle" 
}, *
                          *{ "color": "red", "type": **"mountain bike" } *
*                        ]*
        }
    ],
    "notification": "Query executed in 0.03 sec. Returned 1 record(s)"
}

When I try to get a similar result, for example with the following query:
select *{* "name": name, "bicycles": outE()[ @class = 'owns' ].inV() *}* as 
expandedperson
from Person
I get
{"name":"_NOT_PARSED_","bicycles":"_NOT_PARSED_"}

or something else I tried
select *, expand( outE()[ @class = 'owns' ].inV() ) as bicycles
from Person

doesn't work either.



*So, my question isn (if possible using OrientDB SQL queries)*

   - *can something like this be done in a single query, and if so, how?  *(I 
   guess not currently?)
   - 
*Are there plans to make such a thing possible in  the future? I would 
   really love to be able to do these things. Something similar to the 
   highlighted syntax would rock :) *
   - 
*Are there 'workarounds' that I can use for now (with the least possible 
   amount of queries)? *


Thanks again for all your help getting me started.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" 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