Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j 如何从浏览器中以前的结果恢复数据?_Neo4j_Cypher - Fatal编程技术网

Neo4j 如何从浏览器中以前的结果恢复数据?

Neo4j 如何从浏览器中以前的结果恢复数据?,neo4j,cypher,Neo4j,Cypher,我在neo4j web浏览器中运行了一个查询: MATCH p=(z)<-[*]-(a)-[:foo]->(b) WHERE b.value = "bar" return p 有没有办法从旧查询的输出中重新创建所有这些数据 你可以用它来做这件事。请注意,此解决方案不会保留内部节点ID。APOC是一个扩展内置Neo4j功能的过程库 给定JSON文件 {"graph": { "nodes": [ { "id": "32496"

我在neo4j web浏览器中运行了一个查询:

MATCH p=(z)<-[*]-(a)-[:foo]->(b) WHERE b.value = "bar" return p
有没有办法从旧查询的输出中重新创建所有这些数据

你可以用它来做这件事。请注意,此解决方案不会保留内部节点ID。APOC是一个扩展内置Neo4j功能的过程库

给定JSON文件

{"graph": {
        "nodes": [
          {
            "id": "32496",
            "labels": [
              "Person"
            ],
            "properties": {
              "born": 1967,
              "name": "Carrie-Anne Moss"
            }
          },
          {
            "id": "32505",
            "labels": [
              "Movie"
            ],
            "properties": {
              "tagline": "Evil has its winning ways",
              "title": "The Devil's Advocate",
              "released": 1997
            }
          },
          {
            "id": "32494",
            "labels": [
              "Movie"
            ],
            "properties": {
              "tagline": "Welcome to the Real World",
              "title": "The Matrix",
              "released": 1999
            }
          },
          {
            "id": "32495",
            "labels": [
              "Person"
            ],
            "properties": {
              "born": 1964,
              "name": "Keanu Reeves"
            }
          }
        ],
        "relationships": [
          {
            "id": "83204",
            "type": "ACTED_IN",
            "startNode": "32495",
            "endNode": "32505",
            "properties": {
              "role": "Kevin Lomax"
            }
          },
          {
            "id": "83183",
            "type": "ACTED_IN",
            "startNode": "32496",
            "endNode": "32494",
            "properties": {
              "role": "Trinity"
            }
          },
          {
            "id": "83182",
            "type": "ACTED_IN",
            "startNode": "32495",
            "endNode": "32494",
            "properties": {
              "role": "Neo"
            }
          }
        ]
      }
    }
  } 
我们可以使用以下查询重新创建图形:

CALL apoc.load.json("https://dl.dropboxusercontent.com/u/67572426/small_movie_graph.json") YIELD value AS row
WITH row, row.graph.nodes AS nodes
UNWIND nodes AS node
CALL apoc.create.node(node.labels, node.properties) YIELD node AS n
SET n.id = node.id
WITH row
UNWIND row.graph.relationships AS rel
MATCH (a) WHERE a.id = rel.startNode
MATCH (b) WHERE b.id = rel.endNode
CALL apoc.create.relationship(a, rel.type, rel.properties, b) YIELD rel AS r
RETURN *
CALL apoc.load.json("https://dl.dropboxusercontent.com/u/67572426/small_movie_graph.json") YIELD value AS row
WITH row, row.graph.nodes AS nodes
UNWIND nodes AS node
CALL apoc.create.node(node.labels, node.properties) YIELD node AS n
SET n.id = node.id
WITH row
UNWIND row.graph.relationships AS rel
MATCH (a) WHERE a.id = rel.startNode
MATCH (b) WHERE b.id = rel.endNode
CALL apoc.create.relationship(a, rel.type, rel.properties, b) YIELD rel AS r
RETURN *