[
https://issues.apache.org/jira/browse/TINKERPOP-1565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15702865#comment-15702865
]
Marko A. Rodriguez edited comment on TINKERPOP-1565 at 11/28/16 7:30 PM:
-------------------------------------------------------------------------
Here is what I think the graph objects should look like:
*NOTE*: I did not include typing for the numbers to keep things clear.
{code}
{
"@type":"g:Vertex",
"@value": {
"label" : "person",
"id" : "1",
"properties" : {
"name" : [ {
"id" : 0,
"value" : "marko",
} ],
"location" : [ {
"id" : 6,
"value" : "san diego",
"properties" : {
"startTime": 1997,
"endTime" : 2001
}
} ],
}
}
}
/////////////////////////////////
{
"@type" : "g:Edge",
"@value" : {
"id" : 9,
"label" : "created",
"inVLabel" : "software",
"outVLabel" : "person",
"inV" : 3,
"outV" : 0,
"properties" : {
"weight" : 0.4
}
}
}
/////////////////////////////////
{
"@type" : "g:VertexProperty",
"@value" : {
"id" : 0,
"value" : "marko",
"label" : "name",
"vertex" : 1
}
}
////////////////////////////////
{
"@type" : "g:Property",
"@value" : {
"key" : "weight",
"value" : 0.4,
"edge" : 9,
"vertex" : 0
}
}
{
"@type" : "g:Property",
"@value" : {
"key" : "startTime",
"value" : 1997,
"vertexProperty" : 6,
"vertex" : 0
}
}
{code}
The benefits of the above:
1. With {{getOrDefault()}} style selection from JSON, this supports both
{{DetachXXX}} and {{ReferenceXXX}}.
2. Properties are consistent. They are just key/value map. No more needed.
3. All the information is there for attaching both {{DetachXXX}} and
{{ReferenceXXX}}.
4. This is a very concise representation.
was (Author: okram):
Here is what I think the graph objects should look like:
*NOTE*: I did not include typing for the numbers to keep things clear.
{code}
{
"@type":"g:Vertex",
"@value": {
"label" : "person",
"id" : "1",
"properties" : {
"name" : [ {
"id" : 0,
"value" : "marko",
} ],
"location" : [ {
"id" : 6,
"value" : "san diego",
"properties" : {
"startTime": 1997,
"endTime" : 2001
}
} ],
}
}
}
{code}
The benefits of the above:
1. With {{getOrDefault()}} style selection from JSON, this supports both
{{DetachXXX}} and {{ReferenceXXX}}.
2. Properties are consistent. They are just key/value map. No more needed.
3. All the information is there for attaching both {{DetachXXX}} and
{{ReferenceXXX}}.
4. This is a very concise representation.
> 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)