[orientdb] Result set of vertices with an empty collection of edges, vertices

2016-01-22 Thread Athanassios Hatzis


Hi,
this might be a simple question but I am confused, please help.

I am using OrientDB 2.1.9 and I am experimenting with VehicleHistoryGraph 
database.
>From Studio, Browse mode, set limit to 9 records only. Now I am entering 
this simple query

select out() from Person

The result set I am getting back is 9 records BUT only two have Bought a 
vehicle. The rest are displayed with empty collections []. This is no good, 
I am confused. I would expect to get back only those two vertices with 
collections of edges !

How do I get back these two persons that bought something ?
I noticed also that there is this unwind operator in select. Is this useful 
in that case, can you make an example ?

-- 

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


Re: [orientdb] Result set of vertices with an empty collection of edges, vertices

2016-01-22 Thread Luigi Dell'Aquila
Hi Athanassios,

This is the expected behavior, but you can obtain what your are looking for
just adding a filter to the query:

select out() from Person where out().size() > 0

Consider that out() is a normal projection, you could have more than one,
eg.

select name as personName, out() from Person where out().size() > 0

In this case you will obtain, for each person, his name and the list of
connected vertices, eg.

person1, [, ...]

The UNWIND operator allows you to "unwind" collections, eg.

select name as personName, out() as connectedVeritces from Person where
out().size() > 0 unwind connectedVeritces

In this case you will obtain, for each row in the result set, a person name
and one of the connected vertices, eg.

person1, 
person1, 
...

I hope it helps

Thanks

Luigi

2016-01-22 14:47 GMT+01:00 Athanassios Hatzis :

> Hi,
> this might be a simple question but I am confused, please help.
>
> I am using OrientDB 2.1.9 and I am experimenting with VehicleHistoryGraph
> database.
> From Studio, Browse mode, set limit to 9 records only. Now I am entering
> this simple query
>
> select out() from Person
>
> The result set I am getting back is 9 records BUT only two have Bought a
> vehicle. The rest are displayed with empty collections []. This is no good,
> I am confused. I would expect to get back only those two vertices with
> collections of edges !
>
> How do I get back these two persons that bought something ?
> I noticed also that there is this unwind operator in select. Is this
> useful in that case, can you make an example ?
>
> --
>
> ---
> 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 orient-database+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

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