query vertex property including connected edge property

57 views
Skip to first unread message

Thanawat Keawborisut

unread,
Apr 14, 2015, 10:03:15 AM4/14/15
to orient-...@googlegroups.com
EDITED::

Hi, I have a trouble in query something like this, let me explain example

I have 2 vertex class as user and present, 1 edge class as got

CLASS vertex  user : [name,id,level,gender,job]
CLASS vertex present : [name,cost,rare_level,num]

CLASS edge got : [owner,time,share_to]

so I create structure like this:

create vertex user set name='user1',id='id1',level='1',gender='male',job='mage'  ->>> let we get #10:0
create vertex present set name='staff',cost=100,rare_level=1,num=10 ->>> let we get #11:0
create vertex present set name='cloth',cost=200,rare_level=1,num=10 ->>> let we get #11:1
create vertex present set name='booth',cost=50,rare_level=1,num=10 ->>> let we get #11:2

create edge got from #10:0 to [#11:0,#11:1,#11:2] set owner='user1','2015 04 10',share_to='no'  ->> let we get #12:0,#12:1,#12:2

now I want to query and get result like this

@rid,name,level,job, [{@rid,owner,time,share_to},{@rid,owner,time,share_to},{@rid,owner,time,share_to},... ]

What I try were below

select @rid,name,level,job, out('got').include('@rid','owner','time',share_to') from user

but it return the result to me like : 

#10:0,user1,1,mage,[ #12:0,#12:1,#12:2]  <---- it return the rid of all edge link and I can't use expand to get property which I want

Next, I try 

select @rid,name,level,job, out('got').include('owner','time',share_to') from user

this time I got

#10:0,user1,1,mage,[{owner='user1',time='2015 04 10',share_to='no'}.{owner='user1',time='2015 04 10',share_to='no'},{owner='user1',time='2015 04 10',share_to='no'}]  <---- now I got the property but I also need edge rid too!! ***

another try 

select @rid,name,level,job, out('got').include('rid','name','cost','num') from user        

and the result return rid:null to me

#10:0,user1,1,mage,[{rid:null,owner='user1',time='2015 04 10',share_to='no'}.{rid:null,owner='user1',time='2015 04 10',share_to='no'},{rid:null,owner='user1',time='2015 04 10',share_to='no'}] 


Do all guy have any suggest or any trick to do this for me, thank you for your participate.

thank,

tk haaz

de...@theambitious.com

unread,
Sep 29, 2015, 7:11:09 PM9/29/15
to OrientDB
Same issue here. How can we include the rid along with properties of the edge?

Thanks

user.w...@gmail.com

unread,
Sep 29, 2015, 9:46:03 PM9/29/15
to OrientDB
Hi,

The only solution I found is this:

select @rid,owner,time,share_to,outV('got').append(rid) as id,outV('got').append(name).subString(14,19) as name,outV('got').append(level).subString(14,15) as level,outV('got').append(job).subString(14,18) as job from got

Let me know if it works.

Regards,
Michela

alessand...@gmail.com

unread,
Sep 30, 2015, 5:35:26 AM9/30/15
to OrientDB
Hi,
it might be useful to you the following query
SELECT @rid,name,level,job, outE('Got') as got FROM User FETCHPLAN got:0

Alessandro
Reply all
Reply to author
Forward
0 new messages