我有两个图表,我想比较它们之间的差异。作为 AQL 查询的结果,我只想要它们之间的路径和顶点的差异。ArangoDb 中是否有任何查询。如果可能,请告诉我。提前致谢。
问问题
179 次
2 回答
2
首先,您将在子查询中执行两者:
LET queryA = (RETURN {myFirstGraphResult: true, a: true, b: true})
LET queryB = (RETURN {mySecondGraphResult: true, a: true, b: true})
RETURN queryA == queryB
将前两个RETURN
s 替换为您的实际查询。您需要确保它们的顺序相同,因此如果您有一个包含多个路径的数组,请首先使用SORT
它。
如果您想知道这两条路径之间的实际差异, Jan 创建了一篇不错的博文 howto get the Differences of two documnets in AQL
于 2016-02-03T14:26:54.330 回答
0
{
"graph1": [
{
"vertices": [
{
"task": "A",
"_id": "ExampleCollection/A",
"_rev": "184076271151",
"_key": "A"
},
{
"task": "B",
"_id": "ExampleCollection/B",
"_rev": "184078695983",
"_key": "B"
}
],
"edges": [
{
"relation": "A to B",
"_id": "ExampleEdges/184091213359",
"_rev": "184247516719",
"_key": "184091213359",
"_from": "ExampleCollection/A",
"_to": "ExampleCollection/B"
}
]
},
{
"vertices": [
{
"task": "A",
"_id": "ExampleCollection/A",
"_rev": "184076271151",
"_key": "A"
},
{
"task": "C",
"_id": "ExampleCollection/C",
"_rev": "184081120815",
"_key": "C"
}
],
"edges": [
{
"relation": "A to C",
"_id": "ExampleEdges/184250269231",
"_rev": "184251711023",
"_key": "184250269231",
"_from": "ExampleCollection/A",
"_to": "ExampleCollection/C"
}
]
}
],
"graph2": [
{
"vertices": [
{
"task": "A",
"_id": "ExampleCollection/184258199087",
"_rev": "184262917679",
"_key": "184258199087"
},
{
"task": "R",
"_id": "ExampleCollection/R",
"_rev": "184084397615",
"_key": "R"
}
],
"edges": [
{
"relation": "A to R",
"_id": "ExampleEdges/184265145903",
"_rev": "184270781999",
"_key": "184265145903",
"_from": "ExampleCollection/184258199087",
"_to": "ExampleCollection/R"
}
]
},
{
"vertices": [
{
"task": "A",
"_id": "ExampleCollection/184258199087",
"_rev": "184262917679",
"_key": "184258199087"
},
{
"task": "Q",
"_id": "ExampleCollection/Q",
"_rev": "184082365999",
"_key": "Q"
}
],
"edges": [
{
"relation": "A to Q",
"_id": "ExampleEdges/184264883759",
"_rev": "184272420399",
"_key": "184264883759",
"_from": "ExampleCollection/184258199087",
"_to": "ExampleCollection/Q"
}
]
}
]
}
就像在这种情况下,尽管模式相同,但它给了我错误的结果。
@dothebart
于 2016-02-04T08:55:30.557 回答