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

    https://github.com/apache/tinkerpop/pull/499#discussion_r89010296
  
    --- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
 ---
    @@ -459,9 +486,33 @@ public PropertyJacksonDeserializer() {
     
             @Override
             public Property createObject(final Map<String, Object> propData) {
    -            return new DetachedProperty(
    -                    (String) propData.get(GraphSONTokens.KEY),
    -                    propData.get(GraphSONTokens.VALUE));
    +            final Object element = propData.get(GraphSONTokens.ELEMENT);
    +            return element instanceof Element ? // graphson-non-embedded 
is treated differently, but since this is a hard coded embedding...
    +                    new DetachedProperty<>((String) 
propData.get(GraphSONTokens.KEY), propData.get(GraphSONTokens.VALUE), (Element) 
element) :
    +                    new DetachedProperty<>((String) 
propData.get(GraphSONTokens.KEY), propData.get(GraphSONTokens.VALUE));
    +        }
    +    }
    +
    +    static class VertexPropertyJacksonDeserializer extends 
AbstractObjectDeserializer<VertexProperty> {
    +
    +        protected VertexPropertyJacksonDeserializer() {
    +            super(VertexProperty.class);
    +        }
    +
    +        @Override
    +        public VertexProperty createObject(final Map<String, Object> 
propData) {
    +            return propData.containsKey(GraphSONTokens.VERTEX) ?
    +                    new DetachedVertexProperty<>(
    +                            propData.get(GraphSONTokens.ID),
    +                            (String) propData.get(GraphSONTokens.LABEL),
    +                            propData.get(GraphSONTokens.VALUE), 
(Map<String, Object>) propData.get(GraphSONTokens.PROPERTIES),
    +                            new 
DetachedVertex(propData.get(GraphSONTokens.VERTEX), Vertex.DEFAULT_LABEL, 
null)) :
    --- End diff --
    
    I don't quite follow what you are saying, but if you have a cool idea with 
"context awareness," by all means, push a patch to this branch.
    
    Here is the thing about being able to attach an element back to the main 
graph.
    
    * `Vertex`: All you need is the vertex ID.
    * `Edge`: Edge ID (but for most dbs, outV id and edge label too)
    * `VertexProperty`: vertex property ID, vertex ID (but for optimization in 
most dbs, label too).
    * `Property`: key/value, element id. Given that properties are ONLY on 
vertex properties and edges, then you need the requisite information about the 
element for attachment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to