neo4j - How can I restore data from a previous result in the browser? -


i have query ran in neo4j web browser:

match p=(z)<-[*]-(a)-[:foo]->(b) b.value = "bar" return p 

this returned large number of connected nodes. happened seems have deleted of these nodes (in separate incident), still have output of old query. code section of browser has response data listed:

 ...  "graph": {         "nodes": [           {             "id": "1148578",             "labels": [               "text"             ],             "properties": {               "value": "bar",               "timestamp": 1478747946867             }           },    ... 

is there way me recreate of data output of old query?

you use apoc.load.json this. note solution not preserve internal node ids. apoc procedure library extends built-in neo4j functionality.

given json file

{"graph": {         "nodes": [           {             "id": "32496",             "labels": [               "person"             ],             "properties": {               "born": 1967,               "name": "carrie-anne moss"             }           },           {             "id": "32505",             "labels": [               "movie"             ],             "properties": {               "tagline": "evil has winning ways",               "title": "the devil's advocate",               "released": 1997             }           },           {             "id": "32494",             "labels": [               "movie"             ],             "properties": {               "tagline": "welcome 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"             }           }         ]       }     }   }  

we can recreate graph using query:

call apoc.load.json("https://dl.dropboxusercontent.com/u/67572426/small_movie_graph.json") yield value row row, row.graph.nodes nodes unwind nodes node call apoc.create.node(node.labels, node.properties) yield node n set n.id = node.id row unwind row.graph.relationships rel match (a) a.id = rel.startnode match (b) b.id = rel.endnode call apoc.create.relationship(a, rel.type, rel.properties, b) yield rel r return * 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -