简体   繁体   English

在Java中使用cypher的neo4j部分转储

[英]neo4j partial dump with cypher in java

Yesterday i asked a question but it was unclear, so i created a new one with really better explanations to find the answer i need :). 昨天我问了一个问题,但还不清楚,因此我创建了一个新的问题,并给出了更好的解释以找到所需的答案。

So, in my Java Application, i need to do a neo4j copy System, here is an example: 因此,在我的Java应用程序中,我需要执行neo4j复制系统,这是一个示例:

       A      <--- this is a project 
      / \     <--- With relationships
     B   C    <--- and subnodes + Labels
    / \ / \   <--- with a depth unknown
   .........

I need to do a copy of this in my database, with another id, like this: 我需要在数据库中复制此副本,并使用另一个ID,如下所示:

       A                 A1    
      / \               /  \     
     B   C             B1  C1  
    / \ / \           / \  / \  
   .........         ..........   

In neo4j shell, i can simply use dump from A to n to return a cypher statement that i can copy and paste to neo4j web interface to create my copy. 在neo4j shell中,我可以简单地使用从A到n的dump来返回一个密码语句,可以将其复制并粘贴到neo4j Web界面中以创建副本。

But in fact, i'm in an application with java, so i need to find how to do the same thing, but with java (i'm using VAADIN framework + JDK7 + Neo4j 2.1.4). 但是实际上,我在使用Java的应用程序中,所以我需要找到使用Java进行相同操作的方法(我正在使用VAADIN框架+ JDK7 + Neo4j 2.1.4)。

I tried to use Neo4j-shell in java but never found how to get the reply from dump command (the cypher sentence) so i'm stuck now, and asking on stack overflow to get help :). 我试图在Java中使用Neo4j-shell,但从未找到如何从dump命令(密码语句)中获取答复,所以我现在陷入困境,并在堆栈溢出时寻求帮助:)。

Have a nice day 祝你今天愉快

Dump is a shell command, in theory you could instantiate and run it yourself. 转储是一个shell命令,理论上您可以实例化并运行它。

It uses the SubgraphExporter from the Cypher module, Neo4j is OSS you can find it on GitHub 它使用Cypher模块中的SubgraphExporter,Neo4j是OSS,您可以在GitHub上找到它

In general it should be easier for you to run a cypher query against the database yourself and then with the results recreate the data you're interested in. 通常,对于您自己对数据库运行密码查询,然后根据结果重新创建您感兴趣的数据,应该更容易。

Something like this should help you: 这样的事情应该可以帮助您:

https://github.com/neo4j-contrib/developer-resources/blob/gh-pages/examples/java/jdbc/src/main/java/example/jdbc/movies/MovieService.java#L58 https://github.com/neo4j-contrib/developer-resources/blob/gh-pages/examples/java/jdbc/src/main/java/example/jdbc/movies/MovieService.java#L58

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM