B.3 GML Data Format
The Graph Modeling Language (GML) file format uses ASCII to describe graphs.
Note:
GML Data Format is not supported in Tinkerpop 3, and it has been deprecated in Tinkerpop 2.
The example in this topic shows a GML description of the property graph shown in What Are Property Graphs?.
Example B-5 GML Description of a Simple Property Graph
graph [ comment "Simple property graph" directed 1 IsPlanar 1 node [ id 1 label "1" name "Alice" age 31 ] node [ id 2 label "2" name "Bob" age 27 ] edge [ source 1 target 2 label "knows" type "friends" ] ]
Methods are provided to import and export graphs from and into GML format.
The following fragments of code show how to import and export GML data. Note that these methods are deprecated and their use is discouraged:
// Get graph instance OraclePropertyGraph opg = OraclePropertyGraph.getInstance(args, szGraphName); // Import graph in GML format String fileName = "./mygraph.gml"; PrintStream ps = new PrintStream("./output"); OraclePropertyGraphUtils.importGML(opg,fileName,ps); // Export graph into GML format String fileName = "./mygraph.gml"; PrintStream ps = new PrintStream("./output"); OraclePropertyGraphUtils.exportGML(opg,fileName,ps);
Related Topics
Parent topic: About Property Graph Data Formats