[ 
https://issues.apache.org/jira/browse/TINKERPOP-2006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16550828#comment-16550828
 ] 

ASF GitHub Bot commented on TINKERPOP-2006:
-------------------------------------------

Github user twilmes commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/891#discussion_r204065865
  
    --- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
 ---
    @@ -218,20 +220,33 @@ private void writeTypes(final Map<String, String> 
identifiedVertexKeyTypes,
                                 final Map<String, String> 
identifiedEdgeKeyTypes,
                                 final XMLStreamWriter writer) throws 
XMLStreamException {
             // <key id="weight" for="edge" attr.name="weight" 
attr.type="float"/>
    -        final Collection<String> vertexKeySet = 
getVertexKeysAndNormalizeIfRequired(identifiedVertexKeyTypes);
    +        Collection<String> vertexKeySet = 
getVertexKeysAndNormalizeIfRequired(identifiedVertexKeyTypes);
    +        Collection<String> edgeKeySet = 
getEdgeKeysAndNormalizeIfRequired(identifiedEdgeKeyTypes);
    +        // in case vertex and edge may have the same attribute name, the 
key id in graphml have to be different
    +        intersection = CollectionUtils.intersection(vertexKeySet, 
edgeKeySet);
    +        // speeding-up later checks
    +        if(intersection.isEmpty()){
    --- End diff --
    
    I can see what you're doing for the `null` check but I'm wondering if it's 
worth it versus just initializing the intersection to an empty set at the start 
to make the code a bit simpler. Did you do some performance comparison and 
identify that the null check approach was a lot faster?


> GraphML serialization invalid if a vertex and edge have similar named property
> ------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2006
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2006
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: io
>    Affects Versions: 3.3.3
>            Reporter: Svante Schubert
>            Priority: Trivial
>
> I have created a graph using the Tinkerpop Graph and required for Gephi 
> visualization a property called color on edges and vertices to be coloured.
> The current gremlin-core serialization creates the following two key elements 
> in GraphML
> <key id="color" for="node" attr.name="color" attr.type="string"></key>
> <key id="color" for="edge" attr.name="color" attr.type="string"></key>
> the id attribute is an internal name, but have to be different.
> I would suggest a patch to check for an intersection of the edge & vertices 
> keys and add for those keys an additional differentiating letter like:
> <key id="colorV" for="node" attr.name="color" attr.type="string"></key>
> <key id="colorE" for="edge" attr.name="color" attr.type="string"></key>
>  
> Going to provide a pullrequest on GitHub.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to