我在OrientDb Studio 2.2.8中使用了Vehicle History数据库,并且我想投影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在数据库中投影三辆起亚汽车。 最佳答案
你可以试试这个吗?
SELECT FROM (TRAVERSE in()
FROM (SELECT FROM Make where name='Kia'))
WHERE @class='Automobile'