如何通过两个输入参数限制OrientDB中的查询

问题描述 投票:0回答:1

我在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。 例如,我需要看看City1和City2之间有哪些子路由。 我正在编写以下查询:

traverse outE('has_route_to'), has_route_to.in 
from 
(select * from City where Name = 'City1')

但是如果我执行它,我会看到来自City1的所有路线,不仅仅是从City1到City2。 可以对OrientDB说:只显示City1和City2之间的所有点数?

orientdb traversal orientdb2.2
1个回答
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"))

希望能帮助到你

问候

© www.soinside.com 2019 - 2024. All rights reserved.