OrientDB SELECT 和子查询 [英] OrientDB SELECT and subqueries

查看:95
本文介绍了OrientDB SELECT 和子查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很困惑这个.为什么这样做:

I'm really puzzled about this. Why does this works:

SELECT out('Posted').out('IsFromCategory') FROM #18:1

这不会:

SELECT out('IsFromCategory') FROM (SELECT out('Posted') FROM #18:1)

这不是我真正的逻辑,而是我在做一些测试时想到的......

That's not me real logic, but is something I came up doing some tests...

推荐答案

正如你所意识到的,你需要在你的子查询中使用 expand,所以它看起来像

As you realised, you need to use expand in your subquery, so it would look like

SELECT out('IsFromCategory') FROM (SELECT expand(out('Posted')) FROM #18:1)

这就像没有 expand 的子查询返回一个 @rid 的列表,所以没有什么可以从那里选择的,而在展开之后,你会得到一个包含整体的列表实体(顶点),您可以从中遍历它们拥有的任何边.

It's like the subquery without the expand returns a list of @rid, so there's nothing to select from there, while after expanding, you get a list with the whole entities (vertices) from which you can traverse any edge they have.

(不确定为什么这与您的第一个查询的行为不同.也许,因为第一个是一个查询并且您明确要求遍历,而第二个是两个查询,当子查询返回时,它不知道您想要检索到整个顶点).

(Not sure why this behaves differently from your first query. Maybe, because the first is one query and you ask explicitly to traverse, whereas the second is two queries and when the subquery returns it doesn't know that you want the whole vertex retrieved).

这篇关于OrientDB SELECT 和子查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆