Neo4j 详细输出原因

Neo4j verbose output reason

我想知道为什么 neo4j returns 的输出中有这么多重复。下面以query/graph为例:

MATCH p=()-[r:ACTED_IN]->() RETURN p LIMIT 2

这 return 的两个结果的形式为 (Person, Relationship, Movie):

{
  "start": {
"identity": 1,
"labels": [
      "Person"
    ],
"properties": {
"name": "Keanu Reeves",
"born": 1964
    }
  },
  "end": {
"identity": 87,
"labels": [
      "Movie"
    ],
"properties": {
"tagline": "Pain heals, Chicks dig scars... Glory lasts forever",
"title": "The Replacements",
"released": 2000
    }
  },
  "segments": [
    {
      "start": {
"identity": 1,
"labels": [
          "Person"
        ],
"properties": {
"name": "Keanu Reeves",
"born": 1964
        }
      },
      "relationship": {
"identity": 114,
"start": 1,
"end": 87,
"type": "ACTED_IN",
"properties": {
"roles": [
            "Shane Falco"
          ]
        }
      },
      "end": {
"identity": 87,
"labels": [
          "Movie"
        ],
"properties": {
"tagline": "Pain heals, Chicks dig scars... Glory lasts forever",
"title": "The Replacements",
"released": 2000
        }
      }
    }
  ],
  "length": 1.0
}

但这看起来很冗长,我不明白为什么它不会 return 像这样:

{
    "start": {"identity": 1, "labels": ["Person"], "properties": {"name": "Keanu Reeves", ...}},
    "edge": {"identity": 11, "start": 1, "end": 7, "type": "ACTED_IN",  "properties" {...}},
    "end": {"identity": 7, "labels": ["Movie"], "properties": {"name" "The Replacements", ...}}
}

或者我对需要在结果集中呈现的内容的概念是否遗漏了很多东西?

一条路径可以超过一跳,可以包含两个以上的节点和一个以上的关系。所以你的格式在一般情况下是行不通的。

但是,您建议的格式是 segments 密钥中使用的格式。每个段有startrelationshipend