You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ke...@apache.org on 2024/10/04 03:40:09 UTC
(tinkerpop) branch v4-graphson-props updated (dd2a1edb12 -> 704e86f568)
This is an automated email from the ASF dual-hosted git repository.
kenhuuu pushed a change to branch v4-graphson-props
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
discard dd2a1edb12 Update GraphSONv4 format for edge's vertex reference.
new 704e86f568 Update GraphSONv4 format for edge's vertex reference.
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (dd2a1edb12)
\
N -- N -- N refs/heads/v4-graphson-props (704e86f568)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../io/graphson/GraphSONSerializersV4.java | 41 ++++++----------------
1 file changed, 11 insertions(+), 30 deletions(-)
(tinkerpop) 01/01: Update GraphSONv4 format for edge's vertex reference.
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kenhuuu pushed a commit to branch v4-graphson-props
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 704e86f568ee19c77d57633917bfecaf1258875b
Author: Ken Hu <10...@users.noreply.github.com>
AuthorDate: Thu Oct 3 17:44:15 2024 -0700
Update GraphSONv4 format for edge's vertex reference.
Moved id, label into the inV and outV as this logically makes more sense
as its the correct representation of a reference/detached vertex.
---
docs/src/dev/io/graphson.asciidoc | 665 ++++++++++++---------
.../io/graphson/GraphSONSerializersV4.java | 34 +-
.../structure/io/graphson/GraphSONMapperTest.java | 2 +-
.../structure/io/graphson/no-prop-edge-v4.json | 16 +-
.../structure/io/graphson/tinker-graph-v4.json | 224 ++++---
.../io/graphson/traversal-edge-v4-no-types.json | 12 +-
.../structure/io/graphson/traversal-edge-v4.json | 16 +-
7 files changed, 575 insertions(+), 394 deletions(-)
diff --git a/docs/src/dev/io/graphson.asciidoc b/docs/src/dev/io/graphson.asciidoc
index 140b648f83..83b8fe7ff2 100644
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@ -425,8 +425,9 @@ JSON String form of UUID.
==== Edge
JSON Object (required keys are: id, label, inVLabel, outVLabel, inV, outV) +
-"id", "inV", "outV" is any GraphSON 4.0 type +
-"label", "inVLabel", "outVLabel" value is a `g:List` of `String` +
+"id" is any GraphSON 4.0 type +
+"inV", "outV" is an Object that contains "id" which is any GraphSON 4.0 type and "label" which is a `g:List` of `String`
+"label" is a `g:List` of `String` +
"properties" is an optional Object containing Arrays of `g:Property`
The untyped version has one additional required key "type" which is always "vertex".
@@ -443,19 +444,23 @@ The untyped version has one additional required key "type" which is always "vert
"label": [
"develops"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 1
+ "id": {
+ "@type": "g:Int32",
+ "@value": 1
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"since": [
@@ -483,14 +488,18 @@ The untyped version has one additional required key "type" which is always "vert
"develops"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 1,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 1,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"since": [
2009
@@ -1012,19 +1021,23 @@ two required keys: "vertices" and "edges" +
"label": [
"develops"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 1
+ "id": {
+ "@type": "g:Int32",
+ "@value": 1
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"since": [
@@ -1052,19 +1065,23 @@ two required keys: "vertices" and "edges" +
"label": [
"develops"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 1
+ "id": {
+ "@type": "g:Int32",
+ "@value": 1
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"since": [
@@ -1092,19 +1109,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 1
+ "id": {
+ "@type": "g:Int32",
+ "@value": 1
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1132,19 +1153,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 1
+ "id": {
+ "@type": "g:Int32",
+ "@value": 1
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1172,19 +1197,23 @@ two required keys: "vertices" and "edges" +
"label": [
"develops"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 7
+ "id": {
+ "@type": "g:Int32",
+ "@value": 7
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"since": [
@@ -1212,19 +1241,23 @@ two required keys: "vertices" and "edges" +
"label": [
"develops"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 7
+ "id": {
+ "@type": "g:Int32",
+ "@value": 7
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"since": [
@@ -1252,19 +1285,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 7
+ "id": {
+ "@type": "g:Int32",
+ "@value": 7
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1292,19 +1329,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 7
+ "id": {
+ "@type": "g:Int32",
+ "@value": 7
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1332,19 +1373,23 @@ two required keys: "vertices" and "edges" +
"label": [
"develops"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 8
+ "id": {
+ "@type": "g:Int32",
+ "@value": 8
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"since": [
@@ -1372,19 +1417,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 8
+ "id": {
+ "@type": "g:Int32",
+ "@value": 8
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1412,19 +1461,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 8
+ "id": {
+ "@type": "g:Int32",
+ "@value": 8
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1452,19 +1505,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 9
+ "id": {
+ "@type": "g:Int32",
+ "@value": 9
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1492,19 +1549,23 @@ two required keys: "vertices" and "edges" +
"label": [
"uses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 9
+ "id": {
+ "@type": "g:Int32",
+ "@value": 9
+ },
+ "label": [
+ "person"
+ ]
},
"properties": {
"skill": [
@@ -1532,19 +1593,23 @@ two required keys: "vertices" and "edges" +
"label": [
"traverses"
],
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "software"
- ],
"inV": {
- "@type": "g:Int32",
- "@value": 11
+ "id": {
+ "@type": "g:Int32",
+ "@value": 11
+ },
+ "label": [
+ "software"
+ ]
},
"outV": {
- "@type": "g:Int32",
- "@value": 10
+ "id": {
+ "@type": "g:Int32",
+ "@value": 10
+ },
+ "label": [
+ "software"
+ ]
}
}
}
@@ -1771,14 +1836,18 @@ two required keys: "vertices" and "edges" +
"develops"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 1,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 1,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"since": [
2009
@@ -1791,14 +1860,18 @@ two required keys: "vertices" and "edges" +
"develops"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 11,
- "outV": 1,
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 1,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"since": [
2010
@@ -1811,14 +1884,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 1,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 1,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
4
@@ -1831,14 +1908,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 11,
- "outV": 1,
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 1,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
5
@@ -1851,14 +1932,18 @@ two required keys: "vertices" and "edges" +
"develops"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 7,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 7,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"since": [
2010
@@ -1871,14 +1956,18 @@ two required keys: "vertices" and "edges" +
"develops"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 11,
- "outV": 7,
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 7,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"since": [
2011
@@ -1891,14 +1980,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 7,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 7,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
5
@@ -1911,14 +2004,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 11,
- "outV": 7,
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 7,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
4
@@ -1931,14 +2028,18 @@ two required keys: "vertices" and "edges" +
"develops"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 8,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 8,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"since": [
2012
@@ -1951,14 +2052,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 8,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 8,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
3
@@ -1971,14 +2076,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 11,
- "outV": 8,
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 8,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
3
@@ -1991,14 +2100,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 10,
- "outV": 9,
+ "inV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 9,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
5
@@ -2011,14 +2124,18 @@ two required keys: "vertices" and "edges" +
"uses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "person"
- ],
- "inV": 11,
- "outV": 9,
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 9,
+ "label": [
+ "person"
+ ]
+ },
"properties": {
"skill": [
3
@@ -2031,14 +2148,18 @@ two required keys: "vertices" and "edges" +
"traverses"
],
"type": "edge",
- "inVLabel": [
- "software"
- ],
- "outVLabel": [
- "software"
- ],
- "inV": 11,
- "outV": 10
+ "inV": {
+ "id": 11,
+ "label": [
+ "software"
+ ]
+ },
+ "outV": {
+ "id": 10,
+ "label": [
+ "software"
+ ]
+ }
}
]
}
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV4.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV4.java
index 14af4fe71a..0c6a06feef 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV4.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV4.java
@@ -161,15 +161,22 @@ class GraphSONSerializersV4 {
jsonGenerator.writeObjectField(GraphSONTokens.ID, edge.id());
writeLabel(jsonGenerator, GraphSONTokens.LABEL, edge.label());
writeTypeForGraphObjectIfUntyped(jsonGenerator, typeInfo, GraphSONTokens.EDGE);
- writeLabel(jsonGenerator, GraphSONTokens.IN_LABEL, edge.inVertex().label());
- writeLabel(jsonGenerator, GraphSONTokens.OUT_LABEL, edge.outVertex().label());
- jsonGenerator.writeObjectField(GraphSONTokens.IN, edge.inVertex().id());
- jsonGenerator.writeObjectField(GraphSONTokens.OUT, edge.outVertex().id());
+ writeVertex(GraphSONTokens.IN, edge.inVertex(), jsonGenerator);
+ writeVertex(GraphSONTokens.OUT, edge.outVertex(), jsonGenerator);
writeProperties(edge, jsonGenerator);
jsonGenerator.writeEndObject();
}
+ private static void writeVertex(final String vertexDirection, final Vertex v, final JsonGenerator jsonGenerator)
+ throws IOException {
+ jsonGenerator.writeFieldName(vertexDirection);
+ jsonGenerator.writeStartObject();
+ jsonGenerator.writeObjectField(GraphSONTokens.ID, v.id());
+ writeLabel(jsonGenerator, GraphSONTokens.LABEL, v.label());
+ jsonGenerator.writeEndObject();
+ }
+
private void writeProperties(final Edge edge, final JsonGenerator jsonGenerator) throws IOException {
final Iterator<Property<Object>> elementProperties = normalize ?
IteratorUtils.list(edge.properties(), Comparators.PROPERTY_COMPARATOR).iterator() : edge.properties();
@@ -501,8 +508,6 @@ class GraphSONSerializersV4 {
@Override
public Edge deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
final DetachedEdge.Builder e = DetachedEdge.build();
- final DetachedVertex.Builder inV = DetachedVertex.build();
- final DetachedVertex.Builder outV = DetachedVertex.build();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
if (jsonParser.getCurrentName().equals(GraphSONTokens.ID)) {
jsonParser.nextToken();
@@ -514,20 +519,10 @@ class GraphSONSerializersV4 {
}
} else if (jsonParser.getCurrentName().equals(GraphSONTokens.OUT)) {
jsonParser.nextToken();
- outV.setId(deserializationContext.readValue(jsonParser, Object.class));
- } else if (jsonParser.getCurrentName().equals(GraphSONTokens.OUT_LABEL)) {
- jsonParser.nextToken();
- while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
- outV.setLabel(jsonParser.getText());
- }
+ e.setOutV((DetachedVertex) deserializationContext.readValue(jsonParser, Vertex.class));
} else if (jsonParser.getCurrentName().equals(GraphSONTokens.IN)) {
jsonParser.nextToken();
- inV.setId(deserializationContext.readValue(jsonParser, Object.class));
- } else if (jsonParser.getCurrentName().equals(GraphSONTokens.IN_LABEL)) {
- jsonParser.nextToken();
- while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
- inV.setLabel(jsonParser.getText());
- }
+ e.setInV((DetachedVertex) deserializationContext.readValue(jsonParser, Vertex.class));
} else if (jsonParser.getCurrentName().equals(GraphSONTokens.PROPERTIES)) {
jsonParser.nextToken();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
@@ -539,9 +534,6 @@ class GraphSONSerializersV4 {
}
}
- e.setInV(inV.create());
- e.setOutV(outV.create());
-
return e.create();
}
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
index 0adccc7580..052e95b15b 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
@@ -113,7 +113,7 @@ public class GraphSONMapperTest {
else if (version.startsWith("v2"))
assertEquals("{\"id\":123,\"label\":\"knows\",\"inVLabel\":\"person\",\"outVLabel\":\"person\",\"inV\":2,\"outV\":1,\"properties\":{\"weight\":{\"key\":\"weight\",\"value\":0.5}}}", json);
else if (version.startsWith("v4"))
- assertEquals("{\"id\":123,\"label\":[\"knows\"],\"type\":\"edge\",\"inVLabel\":[\"person\"],\"outVLabel\":[\"person\"],\"inV\":2,\"outV\":1,\"properties\":{\"weight\":[0.5]}}", json);
+ assertEquals("{\"id\":123,\"label\":[\"knows\"],\"type\":\"edge\",\"inV\":{\"id\":2,\"label\":[\"person\"]},\"outV\":{\"id\":1,\"label\":[\"person\"]},\"properties\":{\"weight\":[0.5]}}", json);
else
throw new IllegalStateException("Version not accounted for in asserts");
}
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/no-prop-edge-v4.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/no-prop-edge-v4.json
index 1c779c8349..b4f16b31d1 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/no-prop-edge-v4.json
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/no-prop-edge-v4.json
@@ -6,15 +6,19 @@
"@value" : 13
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 1
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 1
+ },
+ "label" : [ "person" ]
}
}
}
\ No newline at end of file
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinker-graph-v4.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinker-graph-v4.json
index e322cfa7d7..8d51265d89 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinker-graph-v4.json
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinker-graph-v4.json
@@ -410,15 +410,19 @@
"@value" : 13
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 1
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 1
+ },
+ "label" : [ "person" ]
},
"properties" : {
"since" : [ {
@@ -441,15 +445,19 @@
"@value" : 14
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 1
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 1
+ },
+ "label" : [ "person" ]
},
"properties" : {
"since" : [ {
@@ -472,15 +480,19 @@
"@value" : 15
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 1
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 1
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -503,15 +515,19 @@
"@value" : 16
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 1
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 1
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -534,15 +550,19 @@
"@value" : 17
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 7
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 7
+ },
+ "label" : [ "person" ]
},
"properties" : {
"since" : [ {
@@ -565,15 +585,19 @@
"@value" : 18
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 7
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 7
+ },
+ "label" : [ "person" ]
},
"properties" : {
"since" : [ {
@@ -596,15 +620,19 @@
"@value" : 19
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 7
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 7
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -627,15 +655,19 @@
"@value" : 20
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 7
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 7
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -658,15 +690,19 @@
"@value" : 21
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 8
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 8
+ },
+ "label" : [ "person" ]
},
"properties" : {
"since" : [ {
@@ -689,15 +725,19 @@
"@value" : 22
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 8
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 8
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -720,15 +760,19 @@
"@value" : 23
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 8
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 8
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -751,15 +795,19 @@
"@value" : 24
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 9
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 9
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -782,15 +830,19 @@
"@value" : 25
},
"label" : [ "uses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 9
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 9
+ },
+ "label" : [ "person" ]
},
"properties" : {
"skill" : [ {
@@ -813,15 +865,19 @@
"@value" : 26
},
"label" : [ "traverses" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "software" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 11
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 11
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
}
}
} ]
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4-no-types.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4-no-types.json
index 26c92ee5fd..9cdac5b038 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4-no-types.json
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4-no-types.json
@@ -2,10 +2,14 @@
"id" : 13,
"label" : [ "develops" ],
"type" : "edge",
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
- "inV" : 10,
- "outV" : 1,
+ "inV" : {
+ "id" : 10,
+ "label" : [ "software" ]
+ },
+ "outV" : {
+ "id" : 1,
+ "label" : [ "person" ]
+ },
"properties" : {
"since" : [ 2009 ]
}
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4.json
index cc13e232a8..0510745b67 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4.json
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/traversal-edge-v4.json
@@ -6,15 +6,19 @@
"@value" : 13
},
"label" : [ "develops" ],
- "inVLabel" : [ "software" ],
- "outVLabel" : [ "person" ],
"inV" : {
- "@type" : "g:Int32",
- "@value" : 10
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 10
+ },
+ "label" : [ "software" ]
},
"outV" : {
- "@type" : "g:Int32",
- "@value" : 1
+ "id" : {
+ "@type" : "g:Int32",
+ "@value" : 1
+ },
+ "label" : [ "person" ]
},
"properties" : {
"since" : [ {