| //// |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| //// |
| [[graphson]] |
| = GraphSON |
| |
| image:../../../static/images/gremlin-graphson.png[width=350,float=left] GraphSON is a JSON-based format that is designed for human readable |
| output that is easily supported in any programming language through the wide-array of JSON parsing libraries that |
| exist on virtually all platforms. GraphSON versions 1 to 3 were considered to be both a "graph" format and a |
| generalized object serialization format. That characteristic makes it useful as a serialization format for Gremlin |
| Server where arbitrary objects of varying types may be returned as results. However, starting in GraphSON 4, GraphSON |
| is only intended to be a network serialization format that is only able to serialize specific types defined by the |
| format. It is only meant to be used with the TinkerPop HTTP API. |
| |
| When considering GraphSON as a "graph" format, the relevant feature to consider is the `writeGraph` and `readGraph` |
| methods on the `GraphSONWriter` and `GraphSONReader` interfaces, respectively. These methods write the entire `Graph` |
| instance as output or read an entire `Graph` instance input and they do so in a way external to generalized object |
| serialization. In other words, the output of: |
| |
| [source,java] |
| ---- |
| final Graph graph = TinkerFactory.createModern(); |
| final GraphWriter writer = graph.io(IoCore.graphson()).writer(); |
| writer.writeGraph("tinkerpop-modern.json"); |
| ---- |
| |
| will be different of: |
| |
| [source,java] |
| ---- |
| final Graph graph = TinkerFactory.createModern(); |
| final GraphWriter writer = graph.io(IoCore.graphson()).writer(); |
| final OutputStream os = new FileOutputStream("tinkerpop-modern.json"); |
| writer.writeObject(os, graph); |
| ---- |
| |
| Generalized object serialization will be discussed later in this section, so for now the focus will be on the "graph" |
| format. Unlike GraphML, GraphSON does not use an edge list format. It uses an adjacency list. In the adjacency list, |
| each vertex is essentially a line in the file and the vertex line contains a list of all the edges associated with |
| that vertex. The GraphSON 4.0 representation looks like this for the Modern toy graph: |
| |
| [source,json] |
| ---- |
| {"id":{"@type":"g:Int32","@value":1},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":9},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}],"knows":[{"id":{"@type":"g:Int32","@value":7},"inV":{"@type":"g:Int32","@value":2},"properties":{"weight":{"@type":"g:Double","@value":0.5}}},{"id":{"@type":"g:Int32","@value":8},"inV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}],"age":[{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29}}]}} |
| {"id":{"@type":"g:Int32","@value":2},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":7},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":0.5}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":2},"value":"vadas"}],"age":[{"id":{"@type":"g:Int64","@value":3},"value":{"@type":"g:Int32","@value":27}}]}} |
| {"id":{"@type":"g:Int32","@value":3},"label":"software","inE":{"created":[{"id":{"@type":"g:Int32","@value":9},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":0.4}}},{"id":{"@type":"g:Int32","@value":11},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":0.4}}},{"id":{"@type":"g:Int32","@value":12},"outV":{"@type":"g:Int32","@value":6},"properties":{"weight":{"@type":"g:Double","@value":0.2}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":4},"value":"lop"}],"lang":[{"id":{"@type":"g:Int64","@value":5},"value":"java"}]}} |
| {"id":{"@type":"g:Int32","@value":4},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":8},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"outE":{"created":[{"id":{"@type":"g:Int32","@value":10},"inV":{"@type":"g:Int32","@value":5},"properties":{"weight":{"@type":"g:Double","@value":1.0}}},{"id":{"@type":"g:Int32","@value":11},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":6},"value":"josh"}],"age":[{"id":{"@type":"g:Int64","@value":7},"value":{"@type":"g:Int32","@value":32}}]}} |
| {"id":{"@type":"g:Int32","@value":5},"label":"software","inE":{"created":[{"id":{"@type":"g:Int32","@value":10},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":8},"value":"ripple"}],"lang":[{"id":{"@type":"g:Int64","@value":9},"value":"java"}]}} |
| {"id":{"@type":"g:Int32","@value":6},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":12},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.2}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":10},"value":"peter"}],"age":[{"id":{"@type":"g:Int64","@value":11},"value":{"@type":"g:Int32","@value":35}}]}} |
| ---- |
| |
| At a glance, one can see that this is not a valid JSON document (although it is a valid https://jsonlines.org[JSON Lines] document). While that form may seem incorrect, there is a reason. |
| The "graph" format is designed by default to be splittable, such that distributed systems like Spark can easily divide |
| the GraphSON file for processing. If this data were represented as an "array of vertices" with square brackets at the |
| beginning and end of the file, the format would be less conducive to fit that purpose. It is possible to change this |
| behavior by building the `GraphSONWriter` with the `wrapAdjacencyList` setting set to `true`, in which case the output |
| will be a valid JSON document that looks like this: |
| |
| [source,json] |
| ---- |
| { "vertices": [ |
| {"id":{"@type":"g:Int32","@value":1},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":9},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}],"knows":[{"id":{"@type":"g:Int32","@value":7},"inV":{"@type":"g:Int32","@value":2},"properties":{"weight":{"@type":"g:Double","@value":0.5}}},{"id":{"@type":"g:Int32","@value":8},"inV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}],"age":[{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29}}]}}, |
| {"id":{"@type":"g:Int32","@value":2},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":7},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":0.5}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":2},"value":"vadas"}],"age":[{"id":{"@type":"g:Int64","@value":3},"value":{"@type":"g:Int32","@value":27}}]}}, |
| {"id":{"@type":"g:Int32","@value":3},"label":"software","inE":{"created":[{"id":{"@type":"g:Int32","@value":9},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":0.4}}},{"id":{"@type":"g:Int32","@value":11},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":0.4}}},{"id":{"@type":"g:Int32","@value":12},"outV":{"@type":"g:Int32","@value":6},"properties":{"weight":{"@type":"g:Double","@value":0.2}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":4},"value":"lop"}],"lang":[{"id":{"@type":"g:Int64","@value":5},"value":"java"}]}}, |
| {"id":{"@type":"g:Int32","@value":4},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":8},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"outE":{"created":[{"id":{"@type":"g:Int32","@value":10},"inV":{"@type":"g:Int32","@value":5},"properties":{"weight":{"@type":"g:Double","@value":1.0}}},{"id":{"@type":"g:Int32","@value":11},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":6},"value":"josh"}],"age":[{"id":{"@type":"g:Int64","@value":7},"value":{"@type":"g:Int32","@value":32}}]}}, |
| {"id":{"@type":"g:Int32","@value":5},"label":"software","inE":{"created":[{"id":{"@type":"g:Int32","@value":10},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":8},"value":"ripple"}],"lang":[{"id":{"@type":"g:Int64","@value":9},"value":"java"}]}}, |
| {"id":{"@type":"g:Int32","@value":6},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":12},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.2}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":10},"value":"peter"}],"age":[{"id":{"@type":"g:Int64","@value":11},"value":{"@type":"g:Int32","@value":35}}]}} |
| ]} |
| ---- |
| |
| NOTE: The `writeGraph` method essentially calls `writeVertices` with the directionality of `BOTH`. The `writeVertices` |
| method simply calls `writeVertex` which detaches each `Vertex` instance into a directional `StarGraph` which forms |
| the basis for the format. |
| |
| The following sections discuss the GraphSON object serialization format as available in each version of GraphSON. Core |
| to understanding these sections is to understand that GraphSON can be produced with and without types being embedded |
| in the output. Without embedded types, the type system is restricted to standard JSON types of `Object`, `List`, |
| `String`, `Number`, `Boolean` and that will lead to "lossyness" in the format (i.e. a float will be interpreted as |
| double). It is also worth considering that choosing a GraphSON format without embedded types may also restrict the |
| type of results that can be obtained. For example, `g.V().groupCount()` returns a format with a `Map`. That's fine |
| for GraphSON, but the key in that `Map` is a complex object (i.e. a `Vertex`) and as such is not compatible with JSON |
| itself which can only support `String` keys. |
| |
| WARNING: The `application/json` mime type is shared with all versions of GraphSON and their variations and does not |
| reflect a particular one. Servers will return the GraphSON version and variation that this mime type is configured for |
| and it could be different (or change) from server to server. When building applications, it is recommended that the |
| mime type is made explicit on requests to avoid breaking changes or unexpected results. |
| |
| [[graphson-4]] |
| == Version 4.0 |
| |
| Version 4.0 of GraphSON was first introduced on TinkerPop 4.0.0 and is represented by the |
| `application/vnd.gremlin-v4.0+json` mime type. There also exists an untyped version: |
| `application/vnd.gremlin-v4.0+json;types=false`. It is very similar to GraphSON 3.0, with just several key differences: |
| many underused or duplicated types have been removed, labels are now list of strings and request/response formats have |
| changed quite a bit, and custom types have been replaced with Provider Defined Type (PDT). |
| |
| === Boolean |
| |
| Matches the JSON Boolean and doesn't have type information. |
| |
| [source,text] |
| ---- |
| true |
| ---- |
| |
| [source,text] |
| ---- |
| true |
| ---- |
| |
| === Composite PDT |
| |
| JSON Object with two required keys: "type" and "fields" + |
| "type" is a JSON String + |
| "fields" is a `g:Map` |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:CompositePdt", |
| "@value": { |
| "type": "tinkerId", |
| "fields": { |
| "@type": "g:Map", |
| "@value": [ |
| "intId", |
| { |
| "@type": "g:Int32", |
| "@value": -1360894799 |
| }, |
| "strId", |
| "0" |
| ] |
| } |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "type": "tinkerId", |
| "fields": { |
| "intId": -1360894799, |
| "strId": "0" |
| } |
| } |
| ---- |
| |
| === DateTime |
| |
| JSON String representing a datetime in the ISO-8601 format. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:DateTime", |
| "@value" : "2007-12-03T10:15:30+01:00" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "2007-12-03T10:15:30+01:00" |
| ---- |
| |
| === Double |
| |
| A JSON Number with the same range as a IEEE754 double precision floating point or a JSON String with one of the |
| following values: "-Infinity", "Infinity", "NaN" |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Double", |
| "@value" : 100.0 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 100.0 |
| ---- |
| |
| === Float |
| |
| A JSON Number with the same range as a IEEE754 single precision floating point or a JSON String with one of the |
| following values: "-Infinity", "Infinity", "NaN" |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Float", |
| "@value" : 100.0 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 100.0 |
| ---- |
| |
| === Integer |
| |
| A JSON Number with the same range as a 4-byte signed integer. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Int32", |
| "@value" : 100 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 100 |
| ---- |
| |
| === List |
| |
| List is a JSON Array. The type is used to distinguish between different collection types that are also mapped to JSON |
| Array. The untyped version converts complex types to JSON String. |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:List", |
| "@value": [ |
| { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "person", |
| true, |
| null |
| ] |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| [ 1, "person", true, null ] |
| ---- |
| |
| === Long |
| |
| A JSON Number with the same range as a 8-byte signed integer. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Int64", |
| "@value" : 100 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 100 |
| ---- |
| |
| === Map |
| |
| Map is a JSON Array to provide the ability to allow for non-String keys, which is not possible in JSON. The untyped |
| version converts complex types to JSON String. |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:Map", |
| "@value": [ |
| { |
| "@type": "g:List", |
| "@value": [ |
| { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| { |
| "@type": "g:Int32", |
| "@value": 2 |
| }, |
| { |
| "@type": "g:Int32", |
| "@value": 3 |
| } |
| ] |
| }, |
| null, |
| "test", |
| { |
| "@type": "g:Int32", |
| "@value": 123 |
| }, |
| { |
| "@type": "g:DateTime", |
| "@value": "2024-09-02T10:30Z" |
| }, |
| "red" |
| ] |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "[1, 2, 3]": null, |
| "test": 123, |
| "2024-09-02T10:30Z": "red" |
| } |
| ---- |
| |
| === Null |
| |
| Matches the JSON Null and doesn't have type information. |
| |
| [source,text] |
| ---- |
| null |
| ---- |
| |
| [source,text] |
| ---- |
| null |
| ---- |
| |
| === Primitive PDT |
| |
| JSON Object with two required keys: "type" and "value" + |
| "type" is a JSON String + |
| "value" is a JSON String |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:PrimitivePdt", |
| "@value": { |
| "type": "tinkerId", |
| "value": "-1360894799" |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "type": "tinkerId", |
| "value": "-1360894799" |
| } |
| ---- |
| |
| === Set |
| |
| A JSON Array. The untyped version converts complex types to JSON String. |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:Set", |
| "@value": [ |
| null, |
| { |
| "@type": "g:Int32", |
| "@value": 2 |
| }, |
| "person", |
| true |
| ] |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| [ null, 2, "person", true ] |
| ---- |
| |
| === String |
| |
| Matches the JSON String and doesn't have type information. |
| |
| [source,text] |
| ---- |
| "abc" |
| ---- |
| |
| [source,text] |
| ---- |
| "abc" |
| ---- |
| |
| === UUID |
| |
| JSON String form of UUID. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:UUID", |
| "@value" : "41d2e28a-20a4-4ab0-b379-d810dede3786" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "41d2e28a-20a4-4ab0-b379-d810dede3786" |
| ---- |
| |
| === Edge |
| |
| JSON Object (required keys are: id, label, inVLabel, outVLabel, inV, outV) + |
| "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". |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 13 |
| }, |
| "label": [ |
| "develops" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2009 |
| } |
| } |
| } |
| ] |
| } |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "id": 13, |
| "label": [ |
| "develops" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 1, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| 2009 |
| ] |
| } |
| } |
| ---- |
| |
| === Graph |
| |
| `TinkerGraph` has a custom serializer that is registered as part of the `TinkerIoRegistry`. Graph is a JSON Object with |
| two required keys: "vertices" and "edges" + |
| "vertices" is an Array of `g:Vertex` + |
| "edges" is an Array of `g:Edge` |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:graph", |
| "@value": { |
| "vertices": [ |
| { |
| "@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" |
| ] |
| } |
| } |
| ], |
| "location": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 6 |
| }, |
| "value": "san diego", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 1997 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2001 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 7 |
| }, |
| "value": "santa cruz", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2001 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 8 |
| }, |
| "value": "brussels", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 9 |
| }, |
| "value": "santa fe", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 7 |
| }, |
| "label": [ |
| "person" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 1 |
| }, |
| "value": "stephen", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ], |
| "location": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 10 |
| }, |
| "value": "centreville", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 1990 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2000 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 11 |
| }, |
| "value": "dulles", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2000 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2006 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 12 |
| }, |
| "value": "purcellville", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2006 |
| } |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 8 |
| }, |
| "label": [ |
| "person" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 2 |
| }, |
| "value": "matthias", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ], |
| "location": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 13 |
| }, |
| "value": "bremen", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2007 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 14 |
| }, |
| "value": "baltimore", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2007 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2011 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 15 |
| }, |
| "value": "oakland", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2011 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2014 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 16 |
| }, |
| "value": "seattle", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2014 |
| } |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 9 |
| }, |
| "label": [ |
| "person" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 3 |
| }, |
| "value": "daniel", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ], |
| "location": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 17 |
| }, |
| "value": "spremberg", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 1982 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 18 |
| }, |
| "value": "kaiserslautern", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2009 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 19 |
| }, |
| "value": "aachen", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2009 |
| } |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 4 |
| }, |
| "value": "gremlin", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 5 |
| }, |
| "value": "tinkergraph", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ] |
| } |
| } |
| } |
| ], |
| "edges": [ |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 13 |
| }, |
| "label": [ |
| "develops" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2009 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 14 |
| }, |
| "label": [ |
| "develops" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2010 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 15 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 4 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 16 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 5 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 17 |
| }, |
| "label": [ |
| "develops" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 7 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2010 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 18 |
| }, |
| "label": [ |
| "develops" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 7 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2011 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 19 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 7 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 5 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 20 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 7 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 4 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 21 |
| }, |
| "label": [ |
| "develops" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 8 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2012 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 22 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 8 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 3 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 23 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 8 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 3 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 24 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 9 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 5 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 25 |
| }, |
| "label": [ |
| "uses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 9 |
| }, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "skill", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 3 |
| } |
| } |
| } |
| ] |
| } |
| } |
| }, |
| { |
| "@type": "g:Edge", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 26 |
| }, |
| "label": [ |
| "traverses" |
| ], |
| "inV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| } |
| } |
| } |
| ] |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "vertices": [ |
| { |
| "id": 1, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 0, |
| "value": "marko" |
| } |
| ], |
| "location": [ |
| { |
| "id": 6, |
| "value": "san diego", |
| "properties": { |
| "startTime": 1997, |
| "endTime": 2001 |
| } |
| }, |
| { |
| "id": 7, |
| "value": "santa cruz", |
| "properties": { |
| "startTime": 2001, |
| "endTime": 2004 |
| } |
| }, |
| { |
| "id": 8, |
| "value": "brussels", |
| "properties": { |
| "startTime": 2004, |
| "endTime": 2005 |
| } |
| }, |
| { |
| "id": 9, |
| "value": "santa fe", |
| "properties": { |
| "startTime": 2005 |
| } |
| } |
| ] |
| } |
| }, |
| { |
| "id": 7, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 1, |
| "value": "stephen" |
| } |
| ], |
| "location": [ |
| { |
| "id": 10, |
| "value": "centreville", |
| "properties": { |
| "startTime": 1990, |
| "endTime": 2000 |
| } |
| }, |
| { |
| "id": 11, |
| "value": "dulles", |
| "properties": { |
| "startTime": 2000, |
| "endTime": 2006 |
| } |
| }, |
| { |
| "id": 12, |
| "value": "purcellville", |
| "properties": { |
| "startTime": 2006 |
| } |
| } |
| ] |
| } |
| }, |
| { |
| "id": 8, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 2, |
| "value": "matthias" |
| } |
| ], |
| "location": [ |
| { |
| "id": 13, |
| "value": "bremen", |
| "properties": { |
| "startTime": 2004, |
| "endTime": 2007 |
| } |
| }, |
| { |
| "id": 14, |
| "value": "baltimore", |
| "properties": { |
| "startTime": 2007, |
| "endTime": 2011 |
| } |
| }, |
| { |
| "id": 15, |
| "value": "oakland", |
| "properties": { |
| "startTime": 2011, |
| "endTime": 2014 |
| } |
| }, |
| { |
| "id": 16, |
| "value": "seattle", |
| "properties": { |
| "startTime": 2014 |
| } |
| } |
| ] |
| } |
| }, |
| { |
| "id": 9, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 3, |
| "value": "daniel" |
| } |
| ], |
| "location": [ |
| { |
| "id": 17, |
| "value": "spremberg", |
| "properties": { |
| "startTime": 1982, |
| "endTime": 2005 |
| } |
| }, |
| { |
| "id": 18, |
| "value": "kaiserslautern", |
| "properties": { |
| "startTime": 2005, |
| "endTime": 2009 |
| } |
| }, |
| { |
| "id": 19, |
| "value": "aachen", |
| "properties": { |
| "startTime": 2009 |
| } |
| } |
| ] |
| } |
| }, |
| { |
| "id": 10, |
| "label": [ |
| "software" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 4, |
| "value": "gremlin" |
| } |
| ] |
| } |
| }, |
| { |
| "id": 11, |
| "label": [ |
| "software" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 5, |
| "value": "tinkergraph" |
| } |
| ] |
| } |
| } |
| ], |
| "edges": [ |
| { |
| "id": 13, |
| "label": [ |
| "develops" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 1, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| 2009 |
| ] |
| } |
| }, |
| { |
| "id": 14, |
| "label": [ |
| "develops" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 1, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| 2010 |
| ] |
| } |
| }, |
| { |
| "id": 15, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 1, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 4 |
| ] |
| } |
| }, |
| { |
| "id": 16, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 1, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 5 |
| ] |
| } |
| }, |
| { |
| "id": 17, |
| "label": [ |
| "develops" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 7, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| 2010 |
| ] |
| } |
| }, |
| { |
| "id": 18, |
| "label": [ |
| "develops" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 7, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| 2011 |
| ] |
| } |
| }, |
| { |
| "id": 19, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 7, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 5 |
| ] |
| } |
| }, |
| { |
| "id": 20, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 7, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 4 |
| ] |
| } |
| }, |
| { |
| "id": 21, |
| "label": [ |
| "develops" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 8, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "since": [ |
| 2012 |
| ] |
| } |
| }, |
| { |
| "id": 22, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 8, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 3 |
| ] |
| } |
| }, |
| { |
| "id": 23, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 8, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 3 |
| ] |
| } |
| }, |
| { |
| "id": 24, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 9, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 5 |
| ] |
| } |
| }, |
| { |
| "id": 25, |
| "label": [ |
| "uses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 9, |
| "label": [ |
| "person" |
| ] |
| }, |
| "properties": { |
| "skill": [ |
| 3 |
| ] |
| } |
| }, |
| { |
| "id": 26, |
| "label": [ |
| "traverses" |
| ], |
| "type": "edge", |
| "inV": { |
| "id": 11, |
| "label": [ |
| "software" |
| ] |
| }, |
| "outV": { |
| "id": 10, |
| "label": [ |
| "software" |
| ] |
| } |
| } |
| ] |
| } |
| ---- |
| |
| === Path |
| |
| Object with two required keys: "labels" and "objects" + |
| "labels" is a `g:List` of `g:Set` of labels of the steps traversed + |
| "objects" is a `g:List` of objects traversed |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:Path", |
| "@value": { |
| "labels": { |
| "@type": "g:List", |
| "@value": [ |
| { |
| "@type": "g:Set", |
| "@value": [] |
| }, |
| { |
| "@type": "g:Set", |
| "@value": [] |
| }, |
| { |
| "@type": "g:Set", |
| "@value": [] |
| } |
| ] |
| }, |
| "objects": { |
| "@type": "g:List", |
| "@value": [ |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 1 |
| }, |
| "label": [ |
| "person" |
| ] |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ] |
| } |
| }, |
| { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ] |
| } |
| } |
| ] |
| } |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "labels": [ |
| [], |
| [], |
| [] |
| ], |
| "objects": [ |
| { |
| "id": 1, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex" |
| }, |
| { |
| "id": 10, |
| "label": [ |
| "software" |
| ], |
| "type": "vertex" |
| }, |
| { |
| "id": 11, |
| "label": [ |
| "software" |
| ], |
| "type": "vertex" |
| } |
| ] |
| } |
| ---- |
| |
| === Property |
| |
| JSON Object with two required keys: "key" and "value" + |
| "key" is a `String` + |
| "value" is any GraphSON 4.0 type |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:Property", |
| "@value": { |
| "key": "since", |
| "value": { |
| "@type": "g:Int32", |
| "@value": 2009 |
| } |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "key" : "since", |
| "value" : 2009 |
| } |
| ---- |
| |
| === Tree |
| |
| JSON Object with one or more possibly nested "key" "value" pairs |
| "key" is an Element (`g:Vertex`, `g:Edge`, `g:VertexProperty`) |
| "value" is a `g:Tree` making this a recursively defined structure |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:Tree", |
| "@value": [ |
| { |
| "key": { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 10 |
| }, |
| "label": [ |
| "software" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 4 |
| }, |
| "value": "gremlin", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ] |
| } |
| } |
| }, |
| "value": { |
| "@type": "g:Tree", |
| "@value": [ |
| { |
| "key": { |
| "@type": "g:Vertex", |
| "@value": { |
| "id": { |
| "@type": "g:Int32", |
| "@value": 11 |
| }, |
| "label": [ |
| "software" |
| ], |
| "properties": { |
| "name": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 5 |
| }, |
| "value": "tinkergraph", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ] |
| } |
| } |
| }, |
| "value": { |
| "@type": "g:Tree", |
| "@value": [] |
| } |
| } |
| ] |
| } |
| } |
| ] |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| [ |
| { |
| "key": { |
| "id": 10, |
| "label": [ |
| "software" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 4, |
| "value": "gremlin" |
| } |
| ] |
| } |
| }, |
| "value": [ |
| { |
| "key": { |
| "id": 11, |
| "label": [ |
| "software" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 5, |
| "value": "tinkergraph" |
| } |
| ] |
| } |
| }, |
| "value": [] |
| } |
| ] |
| } |
| ] |
| ---- |
| |
| === Vertex |
| |
| JSON Object with required keys: "id", "label", "properties" + |
| "id" is any GraphSON 4.0 type + |
| "label" is a `g:List` of `String` + |
| "properties" is an optional Object containing Arrays of `g:VertexProperty` |
| |
| The untyped version has one additional required key "type" which is always "vertex". |
| |
| [source,json] |
| ---- |
| { |
| "@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" |
| ] |
| } |
| } |
| ], |
| "location": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 6 |
| }, |
| "value": "san diego", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 1997 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2001 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 7 |
| }, |
| "value": "santa cruz", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2001 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 8 |
| }, |
| "value": "brussels", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 9 |
| }, |
| "value": "santa fe", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| } |
| ] |
| } |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "id": 1, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 0, |
| "value": "marko" |
| } |
| ], |
| "location": [ |
| { |
| "id": 6, |
| "value": "san diego", |
| "properties": { |
| "startTime": 1997, |
| "endTime": 2001 |
| } |
| }, |
| { |
| "id": 7, |
| "value": "santa cruz", |
| "properties": { |
| "startTime": 2001, |
| "endTime": 2004 |
| } |
| }, |
| { |
| "id": 8, |
| "value": "brussels", |
| "properties": { |
| "startTime": 2004, |
| "endTime": 2005 |
| } |
| }, |
| { |
| "id": 9, |
| "value": "santa fe", |
| "properties": { |
| "startTime": 2005 |
| } |
| } |
| ] |
| } |
| } |
| ---- |
| |
| === VertexProperty |
| |
| JSON Object with required keys: "id", "value", "label", "properties" + |
| "id" is any type GraphSON 4.0 type + |
| "value" is any type GraphSON 4.0 type + |
| "label" is a `g:List` of `String` + |
| "properties" is an optional Object containing Arrays of "g:Property" (metaproperties) |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 0 |
| }, |
| "value": "marko", |
| "label": [ |
| "name" |
| ] |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "id": 0, |
| "value": "marko", |
| "label": [ |
| "name" |
| ] |
| } |
| ---- |
| |
| === BulkSet |
| |
| JSON Array that contains the expanded entries of the BulkSet. |
| |
| NOTE: BulkSet is serialized to g:List so there is no BulkSet deserializer. |
| |
| [source,json] |
| ---- |
| { |
| "@type": "g:List", |
| "@value": [ |
| "marko", |
| "josh", |
| "josh" |
| ] |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| [ "marko", "josh", "josh" ] |
| ---- |
| |
| === Direction |
| |
| JSON String of the enum value. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Direction", |
| "@value" : "OUT" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "OUT" |
| ---- |
| |
| === T |
| |
| JSON String of the enum value. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:T", |
| "@value" : "label" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "label" |
| ---- |
| |
| === Standard Request |
| |
| The following `RequestMessage` is an example of a simple sessionless request for a script evaluation with parameters. |
| |
| [source,json] |
| ---- |
| { |
| "gremlin": "g.V(x)", |
| "materializeProperties": "tokens", |
| "timeoutMs": { |
| "@type": "g:Int64", |
| "@value": 1000 |
| }, |
| "g": "g", |
| "bindings": { |
| "@type": "g:Map", |
| "@value": [ |
| "x", |
| { |
| "@type": "g:Int32", |
| "@value": 1 |
| } |
| ] |
| }, |
| "language": "gremlin-groovy" |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "gremlin": "g.V(x)", |
| "materializeProperties": "tokens", |
| "timeoutMs": 1000, |
| "g": "g", |
| "bindings": { |
| "x": 1 |
| }, |
| "language": "gremlin-groovy" |
| } |
| ---- |
| |
| === Standard Result |
| |
| The following `ResponseMessage` is a typical example of the typical successful response Gremlin Server will return when returning results from a script. |
| |
| [source,json] |
| ---- |
| { |
| "result": { |
| "data": { |
| "@type": "g:List", |
| "@value": [ |
| { |
| "@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" |
| ] |
| } |
| } |
| ], |
| "location": [ |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 6 |
| }, |
| "value": "san diego", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 1997 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2001 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 7 |
| }, |
| "value": "santa cruz", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2001 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 8 |
| }, |
| "value": "brussels", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2004 |
| }, |
| "endTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| }, |
| { |
| "@type": "g:VertexProperty", |
| "@value": { |
| "id": { |
| "@type": "g:Int64", |
| "@value": 9 |
| }, |
| "value": "santa fe", |
| "label": [ |
| "location" |
| ], |
| "properties": { |
| "startTime": { |
| "@type": "g:Int32", |
| "@value": 2005 |
| } |
| } |
| } |
| } |
| ] |
| } |
| } |
| } |
| ] |
| } |
| }, |
| "status": { |
| "code": 200 |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "result": { |
| "data": [ |
| { |
| "id": 1, |
| "label": [ |
| "person" |
| ], |
| "type": "vertex", |
| "properties": { |
| "name": [ |
| { |
| "id": 0, |
| "value": "marko" |
| } |
| ], |
| "location": [ |
| { |
| "id": 6, |
| "value": "san diego", |
| "properties": { |
| "startTime": 1997, |
| "endTime": 2001 |
| } |
| }, |
| { |
| "id": 7, |
| "value": "santa cruz", |
| "properties": { |
| "startTime": 2001, |
| "endTime": 2004 |
| } |
| }, |
| { |
| "id": 8, |
| "value": "brussels", |
| "properties": { |
| "startTime": 2004, |
| "endTime": 2005 |
| } |
| }, |
| { |
| "id": 9, |
| "value": "santa fe", |
| "properties": { |
| "startTime": 2005 |
| } |
| } |
| ] |
| } |
| } |
| ] |
| }, |
| "status": { |
| "code": 200 |
| } |
| } |
| ---- |
| |
| === Error Result |
| |
| The following `ResponseMessage` is a typical example of the typical successful response Gremlin Server will return when returning results from a script. |
| |
| [source,json] |
| ---- |
| { |
| "result": { |
| "data": { |
| "@type": "g:List", |
| "@value": [] |
| } |
| }, |
| "status": { |
| "code": 500, |
| "message": "A timeout occurred during traversal evaluation", |
| "exception": "ServerTimeoutExceededException" |
| } |
| } |
| ---- |
| |
| [source,json] |
| ---- |
| { |
| "result": { |
| "data": [] |
| }, |
| "status": { |
| "code": 500, |
| "message": "A timeout occurred during traversal evaluation", |
| "exception": "ServerTimeoutExceededException" |
| } |
| } |
| ---- |
| |
| Note that the "extended" types require the addition of the separate `GraphSONXModuleV4d0` module as follows: |
| |
| [source,java] |
| ---- |
| mapper = GraphSONMapper.build(). |
| typeInfo(TypeInfo.PARTIAL_TYPES). |
| addCustomModule(GraphSONXModuleV4.build()). |
| version(GraphSONVersion.V4_0).create().createMapper() |
| ---- |
| |
| === BigDecimal |
| |
| A JSON Number. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:BigDecimal", |
| "@value" : 123456789987654321123456789987654321 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 123456789987654321123456789987654321 |
| ---- |
| |
| === BigInteger |
| |
| A JSON Number. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:BigInteger", |
| "@value" : 123456789987654321123456789987654321 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 123456789987654321123456789987654321 |
| ---- |
| |
| === Byte |
| |
| A JSON Number with the same range as a 1-byte signed integer. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Byte", |
| "@value" : 1 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 1 |
| ---- |
| |
| === Binary |
| |
| JSON String containing base64-encoded bytes |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Binary", |
| "@value" : "c29tZSBieXRlcyBmb3IgeW91" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "c29tZSBieXRlcyBmb3IgeW91" |
| ---- |
| |
| === Char |
| |
| A JSON String containing a single UTF-8 encoded character. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Char", |
| "@value" : "x" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "x" |
| ---- |
| |
| === Duration |
| |
| JSON String with ISO-8601 seconds based representation. The following example is a `Duration` of five days. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Duration", |
| "@value" : "PT120H" |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| "PT120H" |
| ---- |
| |
| === Short |
| |
| A JSON Number with the same range as a 2-byte signed integer. |
| |
| [source,json] |
| ---- |
| { |
| "@type" : "g:Int16", |
| "@value" : 100 |
| } |
| ---- |
| |
| [source,text] |
| ---- |
| 100 |
| ---- |