You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/08/27 00:54:23 UTC
[08/50] [abbrv] tinkerpop git commit: Minor cleanup to documentation
around GraphSON 2.0
Minor cleanup to documentation around GraphSON 2.0
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6a2532f7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6a2532f7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6a2532f7
Branch: refs/heads/master
Commit: 6a2532f7708379a8b14e067d20b3fee900610bf6
Parents: 531dcb5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Aug 24 16:48:55 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Aug 24 16:48:55 2016 -0400
----------------------------------------------------------------------
docs/src/reference/the-graph.asciidoc | 152 +++++++++----------
.../upgrade/release-3.2.x-incubating.asciidoc | 2 +-
2 files changed, 74 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6a2532f7/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graph.asciidoc b/docs/src/reference/the-graph.asciidoc
index 151de3a..b7fbc74 100644
--- a/docs/src/reference/the-graph.asciidoc
+++ b/docs/src/reference/the-graph.asciidoc
@@ -559,9 +559,9 @@ Types embedding
With a minor change to the construction of the `GraphSONWriter` the lossy nature of GraphSON can be avoided.
-[[graphson-1.0-types]]
-Types with GraphSON 1.0.
-++++++++++++++++++++++++
+[[graphson-1-0-types]]
+Types with GraphSON 1.0
++++++++++++++++++++++++
GraphSON 1.0 is the version enabled by default when creating a GraphSON Mapper. Here is how to enable types with GraphSON
1.0:
@@ -663,9 +663,9 @@ from JSON typing. While the output is more verbose, it comes with the security
non-JVM languages won't be able to consume this information automatically, at least there is a hint as to how the
values should be coerced back into the correct types in the target language.
-[[graphson-2.0-types]]
-GraphSON 2.0.
-+++++++++++++
+[[graphson-2-0-types]]
+GraphSON 2.0
+++++++++++++
GraphSON 2.0 has been introduced to improve the format of the typed values from GraphSON 1.0. It provides non-Java
centric types information in a consistent format.
@@ -682,19 +682,18 @@ A namespace gives the possibility for TinkerPop implementors to categorize custo
and avoid collision with existing TinkerPop types. By default, TinkerPop types will have the
namespace `g`.
-GraphSON 2.0 will provide type information for any value that is not String, Boolean, Map or Collection.
-This includes types for Graph objects as well. The current Graph object types provided by
-TinkerPop, and their respective typeIDs are :
+GraphSON 2.0 will provide type information for any value that is not `String`, `Boolean`, `Map` or `Collection`.
+TinkerPop includes types for graph elements:
-* Vertex -> "gremlin:vertex"
-* Edge -> "gremlin:edge"
-* VertexPropery -> "gremlin:vertexproperty"
-* Property -> "gremlin:property"
-* Path -> "gremlin:path"
-* Tree -> "gremlin:tree"
-* Graph -> "gremlin:graph"
-* Metrics -> "gremlin:metrics"
-* TraversalMetrics -> `gremlin:traversalmetrics"
+* Vertex -> "g:Vertex"
+* Edge -> "g:Edge"
+* VertexPropery -> "g:VertexProperty"
+* Property -> "g:Property"
+* Path -> "g:Path"
+* Tree -> "g:Tree"
+* Graph -> "g:Graph"
+* Metrics -> "g:Metrics"
+* TraversalMetrics -> `g:TraversalMetrics"
Here's the same previous example of GraphSON 1.0, but with GraphSON 2.0:
@@ -716,74 +715,69 @@ Here's a sample output:
[source,json]
----
{
- "@type":"gremlin:vertex",
- "@value":{
- "id":{
- "@type":"gremlin:int32",
- "@value":1
- },
- "label":"person",
- "properties":{
- "name":[
- {
- "@type":"gremlin:vertexproperty",
- "@value":{
- "id":{
- "@type":"gremlin:int64",
- "@value":0
- },
- "value":"marko",
- "label":"name"
- }
- }
- ],
- "myUUIDprop":[
- {
- "@type":"gremlin:vertexproperty",
- "@value":{
- "id":{
- "@type":"gremlin:int64",
- "@value":12
- },
- "value":{
- "@type":"gremlin:uuid",
- "@value":"02c1041b-c7ef-46ce-812e-3d7963ad50b3"
- },
- "label":"myUUIDprop"
- }
- }
- ],
- "age":[
- {
- "@type":"gremlin:vertexproperty",
- "@value":{
- "id":{
- "@type":"gremlin:int64",
- "@value":1
- },
- "value":{
- "@type":"gremlin:int32",
- "@value":29
- },
- "label":"age"
- }
- }
- ]
- }
- }
+ "@type": "g:Vertex",
+ "@value": {
+ "id": {
+ "@type": "g:Int32",
+ "@value": 1
+ },
+ "label": "person",
+ "properties": {
+ "name": [{
+ "@type": "g:VertexProperty",
+ "@value": {
+ "id": {
+ "@type": "g:Int64",
+ "@value": 0
+ },
+ "value": "marko",
+ "label": "name"
+ }
+ }],
+ "uuid": [{
+ "@type": "g:VertexProperty",
+ "@value": {
+ "id": {
+ "@type": "g:Int64",
+ "@value": 12
+ },
+ "value": {
+ "@type": "g:UUID",
+ "@value": "829c7ddb-3831-4687-a872-e25201230cd3"
+ },
+ "label": "uuid"
+ }
+ }],
+ "age": [{
+ "@type": "g:VertexProperty",
+ "@value": {
+ "id": {
+ "@type": "g:Int64",
+ "@value": 1
+ },
+ "value": {
+ "@type": "g:Int32",
+ "@value": 29
+ },
+ "label": "age"
+ }
+ }]
+ }
+ }
}
----
-Here's how to disable types when creating a GraphSON 2.0 `Mapper`:
+Types can be disabled when creating a GraphSON 2.0 `Mapper` with:
-[gremlin-groovy]
+[source,groovy]
----
-mapper = graph.io(graphson()).mapper().version(GraphSONVersion.V2_0).typeInfo(GraphSONMapper.TypeInfo.NO_TYPES).create()
+graph.io(graphson()).mapper().
+ version(GraphSONVersion.V2_0).
+ typeInfo(GraphSONMapper.TypeInfo.NO_TYPES).create()
----
-By disabling types, the JSON payload produced will be the same than GraphSON 2.0, without the
-extra information that is written for types. Please note, disabling types can be unsafe with
-regards to the written data.
+By disabling types, the JSON payload produced will lack the extra information that is written for types. Please note,
+disabling types can be unsafe with regards to the written data in that types can be lost.
[[gryo-reader-writer]]
Gryo Reader/Writer
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6a2532f7/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index fb2ec21..a73dabf 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -38,7 +38,7 @@ GraphSON 2.0
GraphSON 2.0 has been introduced to improve and normalize the format of types embedded in GraphSON.
See: link:https://issues.apache.org/jira/browse/TINKERPOP-1274[TINKERPOP-1274],
-link:http://tinkerpop.apache.org/docs/3.2.1-incubating/reference/#graphson-2.0-types[Reference Documentation -
+link:http://tinkerpop.apache.org/docs/3.2.1-incubating/reference/#graphson-2-0-types[Reference Documentation -
GraphSON 2.0].
Log4j Dependencies