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

Marko A. Rodriguez commented on TINKERPOP-1565:
-----------------------------------------------

There are only 4 things to consider -- Vertex, Edge, VertexProperty, and 
Property. Thus, maintainability of the de/serializers isn't that big of a deal. 
Next, because there are only 4 things to consider, the code to treat each type 
individually without cascade is trivial (a morning efforts tweak to what we 
have now).

So regarding JSON size ---

{{g:Property}} will have to have reference to its parents (element+vertex ids) 
to get attached. Thus, "cascading" introduces lots of repeated data. And when 
you start adding {{@type}} to ids and stuff, this gets big. For instance, if we 
use "cascading," then when you serialize a vertex, you have:

{code}
Vertex -> VertexProperties (with ref id back to vertex and label) -> Properties 
(with ref it back to vertex property and back to vertex and key)
{code}

If we treat {{Vertex}} independent of the serialization of {{VertexProperty}} 
and {{Property}} we won't incur repeated data and lots of {{@type}} object 
nesting.

{code}
Vertex -> label:[VertexProperties (just id/value/properties)]  -> 
key:[Properties (just value)]
{code}

Finally with {{getOrCreate()}} optional fields, we don't have to have 
{{VertexProperty.properties()}} field if it doesn't exist. If the vertex is 
just a {{ReferenceVertex}}, all it has is id. etc. etc... 




> GraphSON 2.0 updates -- supporting attachment, maintaining consistency, and 
> reducing verbosity
> ----------------------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1565
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1565
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 3.2.3
>            Reporter: Marko A. Rodriguez
>              Labels: breaking
>             Fix For: 3.2.3
>
>
> GraphSON 2.0 has some issues that should be recified for its "official 
> release" in 3.3.0.
> *Supporting Attachment*
> We need to make sure that every element and property can be attached back to 
> the main graph.
> * For {{Vertex}}, this means that we need to have the ID encoded (CHECK).
> * For {{Edge}}, this means we need to have the out/in vertex ids encoded 
> (CHECK).
> * For {{VertexProperty}}, this means we need to have the vertex ID encoded 
> (ERROR).
> * For {{Property}}, this means we need to have the the element ID (vertex 
> property or edge) encoded and then the subsequent vertex ID (ERROR).
> *Maintaining Consistency*
> Currently, property encoding in {{Edge}} is different than property encoding 
> in {{VertexProperty}}. 
> Edge -->
> {code}
> properties : {
>       key : "aKey",
>       value : { @type: "gProperty", @value : {"key","aKey","value",10}}
> }
> {code}
> VertexProperty-->
> {code}
> properties : {
>       key : "aKey",
>       value : 10
> }
> {code}
> This should be consistent.
> *Reducing Verbosity*
> We have the problem of representing both {{DetachedElements}} and 
> {{ReferenceElements}}. {{DetachedElements}} contain lots of information and 
> is typicaly used to ensure a data rich result set. {{ReferenceElements}} 
> contain only the necessary information for attachment. I think we can support 
> both representations by making certain fields "optional."
> Vertex-->
> {code}
> return new 
> Vertex(json.get("id"),json.getOrDefault("label",Vertex.DEFAULT_LABEL),json.getOrDefault("properties",Collections.emptyMap()))
> {code}
> That is, lots of {{getOrDefault()}} use will make sure that when desesired, 
> we only send/recv information that is needed for the particular 
> computatation. E.g. as dictated by {{HaltedTraverserStrategy}}.



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

Reply via email to