2015-09-29 257 views
0

如何查詢數據庫並使用所有關聯數據(LeaderAttending和PersonAttending)獲取AttendanceReport?不僅僅是RID,我通常使用select from AttendanceReport請在OrientDB中選擇相關文檔

或者我應該使用links這種數據?

我是OrientDB,圖形和文檔數據庫的新手。

create class Person extends V 
create class Leader extends Person 
create class AttendanceReport extends V 
create class HasLeader extends E 
create class LeaderAttending extends E 
create class PersonAttending extends E 

create property Person.name string 
create property AttendanceReport.meetingDate datetime 

create vertex Person set name='Billy' 
create vertex Person set name='Jane' 
create vertex Leader set name='Boss' 
create vertex AttendanceReport set meetingDate='2015-09-25 11:00:00' 

create edge HasLeader from (select from Person where name='Billy') to (select from Leader where name='Boss') 

create edge HasLeader from (select from Person where name='Jane') to (select from Leader where name='Boss') 

create edge LeaderAttending from (select from AttendanceReport limit 1) to (select from Leader where name='Boss') 

create edge PersonAttending from (select from AttendanceReport limit 1) to (select from Person where name='Jane') 

回答

1

你能做到這一點查詢

select in.name,out.meetingDate from (select expand(outE('LeaderAttending','PersonAttending')) from AttendanceReport )