How export to xml file!

555 views
Skip to first unread message

aye nwe thaing

unread,
May 23, 2012, 11:22:46 PM5/23/12
to orient-...@googlegroups.com
Hi Dear all,

I use xml file to import graph to orientdb graph database. It is ok and very useful to me. But I want to know can we export data from orientdb to xml file format. If it can, I want to know the procedure to export xml file format.


Be happy


Thanks to all.
--
x_3c103edc

Pierre De Wilde

unread,
May 24, 2012, 1:14:23 AM5/24/12
to orient-...@googlegroups.com
Hi,

An easy way to export current graph database in GraphML (xml) format is Gremlin saveGraphML().

From OrientDB Console:

> gremlin g.saveGraphML(filename.xml)

HTH,
Pierre

aye nwe thaing

unread,
May 24, 2012, 2:21:44 AM5/24/12
to orient-...@googlegroups.com
Hi Dear all,

I try to code to export graph to XML file.

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import javax.xml.stream.XMLStreamException;

import com.tinkerpop.blueprints.pgm.impls.orientdb.OrientGraph;
import com.tinkerpop.blueprints.pgm.util.graphml.GraphMLReader;
import com.tinkerpop.blueprints.pgm.util.graphml.GraphMLWriter;

public class TestLoadGraph {
    public static void main(String[] args) throws Exception {
    OrientGraph g = new OrientGraph("local:C:/orientdb-graphed-1.0rc8/databases/Test_3");
    GraphMLReader.inputGraph(g, new FileInputStream(
    "C:/orientdb-graphed-1.0rc8/data/Test_3.xml"));
    g.shutdown();

    g = new OrientGraph("local:C:/orientdb-graphed-1.0rc8/databases/Test_3");
    FileOutputStream fo = new FileOutputStream("C:/orientdb-graphed-1.0rc8/data/Test_5.xml");
    GraphMLWriter.outputGraph(g, fo);
    g.shutdown();

    }
    }

But the following error occurs. How can i solve this problem?

Exception in thread "main" java.lang.NoSuchMethodError: com.orientechnologies.orient.core.record.impl.ODocument.fieldNames()Ljava/util/Set;
    at com.tinkerpop.blueprints.pgm.impls.orientdb.OrientElement.getPropertyKeys(OrientElement.java:96)
    at com.tinkerpop.blueprints.pgm.impls.orientdb.OrientVertex.getPropertyKeys(OrientVertex.java:60)
    at com.tinkerpop.blueprints.pgm.util.graphml.GraphMLWriter.outputGraph(GraphMLWriter.java:76)
    at com.tinkerpop.blueprints.pgm.util.graphml.GraphMLWriter.outputGraph(GraphMLWriter.java:250)
    at TestLoadGraph.main(TestLoadGraph.java:20)

Thanks,

--
x_3c103edc

Pierre De Wilde

unread,
May 24, 2012, 2:29:24 AM5/24/12
to orient-...@googlegroups.com
Hi,

Have you tried with the last official release?


HTH,
Pierre

Luke Rodgers

unread,
Feb 10, 2016, 2:56:56 AM2/10/16
to OrientDB
For others trying to get a GraphML export from orientdb, I wrote a quick n dirty nodejs tool that will convert orientdb's JSON export format to GraphML. https://github.com/lukeasrodgers/odb2graphml 

Handy if you aren't familiar with Java.
Reply all
Reply to author
Forward
0 new messages