我在DB中有以下结构:
class(V): @city (Name, X, Y)
class(V): @route(Name)
class(V): @Alternative_Route(Name) extends from @route
class(E): @has_route_to
class(E): @has_subroute
边缘连接到顶点,如下所示:
city -> has_route_to -> route -> has_route_to -> city
route -> has_subroute -> city
作为输入,我有两点:City1和City2
对于intance,我需要看看City1和City2之间有哪些子路由。
我正在编写以下查询:
traverse outE('has_route_to'), has_route_to.in
from
(select * from City where Name = 'City1')
但是如果我执行它我会看到来自City1的所有路线,不仅是从City1到City2。
可以对OrientDB说:只显示City1和City2之间的所有点?
答案 0 :(得分:0)
试试这个:
select from route where (Name in (select both('has_route_to').Name from City where Name = "City1")) and (Name in (select both('has_route_to').Name from City where Name = "City2"))
希望有所帮助
此致