我正在使用车辆历史记录数据库和 OrientDb Studio 2.2.8 ,我想要预览由automobile
制作的Kia
类的所有记录}。
数据库的架构如下所示:
(Automobile) --isModel--> (Model) --isMake--> (Make)
其中Automobile
,Model
和Make
是顶点,isModel
和isMake
是边缘类型。
我想使用遍历语句来返回我从此命令获得的等效结果集:
Select expand(in('isMake').in('isModel')) from Make where name = "Kia"
其结果是......
+----+--------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
|# |@RID |@CLASS |color |convertib|out_isMod|trailerHi|emissions|safety |out_Purch|VIN |
+----+--------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
|0 |#17:1441|Automo...|White |true |[#24:1...|false |2016-0...|2014-0...|[#23:5...|840CDC...|
|1 |#17:1576|Automo...|Maroon |true |[#24:1...|false |2010-0...|2004-0...|[#23:5...|E71761...|
|2 |#17:1503|Automo...|Dark Gray|true |[#24:1...|false |2009-0...|2016-1...|[#23:5...|FAEB6F...|
+----+--------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
我试过这个:
Select
from (traverse in from Make while $depth <= 2)
where name = "Kia"
我刚刚返回一条记录,并且它不像我预期的那样属于汽车类。它来自Make。
+----+-------+------+----+-------------------------------------+----------------------------+
|# |@RID |@CLASS|name|in_isMake |out_Sold |
+----+-------+------+----+-------------------------------------+----------------------------+
|0 |#15:612|Make |Kia |[#25:1767,#25:2036,#25:2067,#25:2131]|[#22:5153,#22:5383,#22:5655]|
+----+-------+------+----+-------------------------------------+----------------------------+
基本上,我想使用从Make
开始的Traverse在数据库中投射三辆起亚汽车。
答案 0 :(得分:3)
你能试试吗?
SELECT FROM (TRAVERSE in()
FROM (SELECT FROM Make where name='Kia'))
WHERE @class='Automobile'