Result set of vertices with an empty collection of edges, vertices

30 views
Skip to first unread message

Athanassios Hatzis

unread,
Jan 22, 2016, 8:47:54 AM1/22/16
to OrientDB

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 ?

Luigi Dell'Aquila

unread,
Jan 22, 2016, 9:00:30 AM1/22/16
to orient-...@googlegroups.com
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, [<connectedVertex1>, <connectedVertex2>...]

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, <connectedVertex1>
person1, <connectedVertex2>
...

I hope it helps

Thanks

Luigi

--

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

Athanassios Hatzis

unread,
Jan 22, 2016, 9:15:33 AM1/22/16
to orient-...@googlegroups.com
Yes it does help, thank you
Reply all
Reply to author
Forward
0 new messages