在OrientDB

时间:2015-09-29 19:30:06

标签: graph-databases orientdb document-database

如何查询数据库并获取带有所有关联数据的AttendanceReport(LeaderAttending和PersonAttending)?不仅仅是我使用常规select from AttendanceReport的RID。

或者我应该使用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 个答案:

答案 0 :(得分:1)

您可以执行此查询

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