John Whelan created TINKERPOP3-660:
--------------------------------------

             Summary: GraphML load has order dependency
                 Key: TINKERPOP3-660
                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-660
             Project: TinkerPop 3
          Issue Type: Bug
          Components: tinkergraph
    Affects Versions: 3.0.0.GA
         Environment: Windows 7
            Reporter: John Whelan


The order of nodes and edges in a loaded GraphML file can cause load to fail, 
despite being allowed by GraphML. ("In GraphML there is no order defined for 
the appearance of node and edge elements." 
--http://graphml.graphdrawing.org/primer/graphml-primer.html#Graph)

I produced this issue using version '3.0.0.M8-incubating'.

The following test file fails to load. However, if the edge is listed last, 
then it loads properly.

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns";>
        <key id="labelE" for="edge" attr.name="labelE" attr.type="string"/>
        <key id="labelV" for="node" attr.name="labelV" attr.type="string"/>
   <gml:graph xmlns:gml="http://graphml.graphdrawing.org/xmlns";
              edgedefault="directed"
                          id="G">
      <gml:node id="id44427" label="id44427">
         <gml:data key="labelV">node</gml:data>
      </gml:node>
      <gml:edge id="1" source="id44427" target="id73895">
             <data key="labelE">created</data>
          </gml:edge>
      <gml:node id="id73895" label="id73895">
         <gml:data key="labelV">node</gml:data>
      </gml:node>
   </gml:graph>
</graphml>

I used the following code to load the graph.

import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
import groovy.transform.TypeChecked;
@TypeChecked
class Loader {
        public static void main( String[] args ) {
                Long startTime = System.currentTimeMillis();
                Graph graph = TinkerGraph.open();
                
graph.io().readGraphML("D:/Secure/sandbox/20150304_Graports/simple.graphml");
                System.out.println("done in " + 
(System.currentTimeMillis()-startTime)/1000 + " seconds.");
        }
}

The problem seems to be that the creation of the edge registers the related 
nodes as existing, and then when it gets to the edge it hits a uniqueness 
problem.


P.S. Please forgive any faux pas I may have made in submitting this issue. I'm 
new to this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to