如何在 OrientDB 中进行排除查询
How to do Exclusion Queries in OrientDB
我想知道是否可以在 orient db (v2.0) 中使用子选择作为排除查询。或者如果需要在 Java/PHP/etc.
中导出单独的查询和处理
例如,假设我们有以下霍格沃茨图表。
顶点
人,房子,类
边
is_at(子类 is_student、is_faculty)、was_at(校友)、is_taking、is_teaching、belongs_to
我们如何找到所有不是教职员工的校友?是否可以将其作为单个查询或以某种方式使用 LET?
我们如何找到教授时间旅行等课程的所有教职员工中没有属于格兰芬多学院的学生?
谢谢,
林赛
.size() 运算符应该可以工作:http://orientdb.com/docs/2.0/orientdb.wiki/SQL-Methods.html#size
select from People where out('is_faculty').size() = 0
根据您的图表使用 out('...') 或 in('...')。
How would we find all the faculty you are teaching a course on, say, time travel, that have no students who belong to the house gryffindor?
关于你的图表和 类 我没有太多信息,但这可能是这样的:
select from Classes where ClassName='time travel' and in('is_teaching')[Id=yourId] and in('is_taking').out('belongs_to')[Name='gryffindor'].size() = 0
同样,根据您的图表使用 in() 或 out()。
我想知道是否可以在 orient db (v2.0) 中使用子选择作为排除查询。或者如果需要在 Java/PHP/etc.
中导出单独的查询和处理例如,假设我们有以下霍格沃茨图表。
顶点 人,房子,类
边 is_at(子类 is_student、is_faculty)、was_at(校友)、is_taking、is_teaching、belongs_to
我们如何找到所有不是教职员工的校友?是否可以将其作为单个查询或以某种方式使用 LET?
我们如何找到教授时间旅行等课程的所有教职员工中没有属于格兰芬多学院的学生?
谢谢, 林赛
.size() 运算符应该可以工作:http://orientdb.com/docs/2.0/orientdb.wiki/SQL-Methods.html#size
select from People where out('is_faculty').size() = 0
根据您的图表使用 out('...') 或 in('...')。
How would we find all the faculty you are teaching a course on, say, time travel, that have no students who belong to the house gryffindor?
关于你的图表和 类 我没有太多信息,但这可能是这样的:
select from Classes where ClassName='time travel' and in('is_teaching')[Id=yourId] and in('is_taking').out('belongs_to')[Name='gryffindor'].size() = 0
同样,根据您的图表使用 in() 或 out()。