如何比较ArangoDB中的两个相似图形,结果会产生路径和顶点的差异?

时间:2016-02-03 13:49:09

标签: arangodb arangojs arangodb-php nosql

我有两个图表,我想比较它们之间的区别。作为AQL查询的结果,我只想要它们之间的路径和顶点的差异。 ArangoDb中是否有任何查询。如果可能,请告诉我。提前谢谢。

2 个答案:

答案 0 :(得分:2)

首先,您将在子查询中执行:

$SOMEFILE

将第一个LET queryA = (RETURN {myFirstGraphResult: true, a: true, b: true}) LET queryB = (RETURN {mySecondGraphResult: true, a: true, b: true}) RETURN queryA == queryB 替换为您的实际查询。你需要以相同的顺序制作shure,所以如果你有一个包含多个路径的数组,首先RETURN

如果您想知道两条路径之间的实际差异, Jan has created a nice blogpost howto get the differences of two documnets in AQL

答案 1 :(得分: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