English 中文(简体)
Convert Neo4j DB to XML?
原标题:
  • 时间:2010-02-05 01:10:27
  •  标签:
  • neo4j

Can I convert Neo4J Database files to XML?

问题回答

I agree, GraphML is the way to go, if you don t have problems with the verbosity of XML. A simple way to do it is to open the Neo4j graph from Gremlin, where GraphML is the default import/export format, something like

peters: ./gremlin.sh

gremlin> $_g := neo4j:open( /tmp/neo4j )
==>neograph[/tmp/neo4j, vertices:2, edges:1]
gremlin> g:save( graphml-export.xml )

As described here

Does that solve your problem?

With Blueprints, simply do:

Graph graph = new Neo4jGraph("/tmp/mygraph");
GraphMLWriter.outputGraph(graph, new FileOutputStream("mygraph.xml"));

Or, with Gremlin (which does the same thing in the back):

g = new Neo4jGraph( /tmp/mygraph );
g.saveGraphML( mygraph.xml );

Finally, to the constructor for Neo4jGraph, you can also pass in a GraphDatabaseService instance.

I don t believe anything exists out there for this, not as of few months ago when messing with it. From what I saw, there are 2 main roadblocks:

  1. XML is hierarchical, you can t represent graph data readily in this format.
  2. Lack of explicit IDs for nodes. Even though implicit IDs exist it d be like using ROWID in oracle for import/export...not guaranteed to be the same.

Some people have suggested that GraphML would be the proper format for this, I m inclined to agree. If you don t have graphical structures and you would be fine represented in an XML/hierarchical format...well then that s just bad luck. Since the majority of users who would tackle this sort of enhancement task are using data that wouldn t store that way, I don t see an XML solution coming out...more likely to see a format supporting all uses first.

Take a look at NoSqlUnit It has tools for converting GraphML to neo4j and back again.

In particular, there is com.lordofthejars.nosqlunit.graph.parser.GraphMLWriter and com.lordofthejars.nosqlunit.graph.parser.GraphMLReader which read / write XML files to / from a neo4j database.





相关问题
NoSQL or Ehcache caching?

I m 利用春天/Hibernate/Tomcat和我sql数据库建造一个路标网络

How does FlockDB compare with neo4j?

Both FlockDB and neo4j are open source frameworks for keeping large graph dataset. Anyone familiar enough with both products to write a comparison?

Problem Working with Neo

I downloaded Neoclipse Source and downloaded the Neo4J source. However some of the classes that the Neoclipse source file refers to are not found in the Neo4J source. Are they deprecated? Can I get ...

Neo4j Documentation [closed]

I ve been looking into setting up and trying out Neo4j on Amazon EC2 however I seem to have hit a road block with finding documentation that I can use. For example, this page mentions "Clustering, ...

热门标签