问题描述
我正在做一个与 GraphDB 相关的项目,我正在使用 arangoDB 创建图形并尝试使用它进行一些查询。我在下面有 2 个 Json 文件,我已经将它们导入 arangoDB 并创建了图 ( airports : document collection,flights : edge collection)
。
我有 2 个图的 AQL 查询示例,但我正在努力将它们转换为 Gremlin 查询。
ex1 ( flights that leave JFK airport):
FOR v,e,p IN 1..1 OUTBOUND
'airport/JFK'
GRAPH 'flights'
RETURN p
ex2 ( flights from SF to KOA international airport and have VIP lounges):
FOR airport IN airports
FILTER airport.city == "San Francisco"
FILTER airport.VIP == true
FOR v,p IN 1..1 OUTBOUND
airport flights
FILTER v._id == 'airports/KOA'
RETURN p
你能帮我解决这个问题吗?谢谢
解决方法
您可以在此处找到感兴趣的示例 [1],因为它们特定于 Gremlin 和航线用例。如果没有您的数据模型或一些示例数据,就不可能为您的查询提供 100% 准确的翻译。但是,小精灵看起来像这样:
// FLights that leave JFK airport
g.V().has('airport','code','JFK').
out().
path()
// Flights from SFO to KOA that have a VIP lounge
g.V().has('airport','city','San Francisco).
has('VIP','true').
out().
has('code','KOA').
path()
[1] http://www.kelvinlawrence.net/book/PracticalGremlin.html