[ 
https://issues.apache.org/jira/browse/TINKERPOP3-660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

stephen mallette closed TINKERPOP3-660.
---------------------------------------
    Resolution: Fixed

Thanks.  This was a really nice bug find.  GraphML should indeed be able to 
read vertex/edges out of order.  The problem was that the reader was not 
properly setting vertex properties for those that had been created by an edge 
(where only the id as known).  

Note that the GraphML spec allows this form and TinkerPop does its best to 
support it, but there is a limitation to consider if your edges do not come 
after all vertices in the GraphML.  TinkerPop does not allow the vertex label 
to be changed.  So, if the vertex is created by an {{<edge>}} entry, the label 
won't be present (only the id) and thus the vertex label will be ignored.  I've 
made that note in the docs.

Fixed as of: 
https://github.com/apache/incubator-tinkerpop/commit/da90fd5b97caa4ddeb6752faae6f5d5425051c20

> GraphML load has order dependency
> ---------------------------------
>
>                 Key: TINKERPOP3-660
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-660
>             Project: TinkerPop 3
>          Issue Type: Bug
>          Components: io
>         Environment: Windows 7
>            Reporter: John Whelan
>            Assignee: stephen mallette
>             Fix For: 3.0.0.GA
>
>
> 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.
> {code}
> <?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.");
>       }
> }
> {code}
> 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