Gremlin-Python: Returning a fully populated subgraph

720 views
Skip to first unread message

Terell Brown

unread,
Jan 27, 2017, 2:40:32 PM1/27/17
to Gremlin-users
As the topic describes I am using the Gremlin-Python Client to query Gremlin Server with a neo4j backend. 
Running the following query:

graph = Graph()
g
= graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
sg
= g.E().subgraph('a').cap('a').next()



returns a subgraph containing a list of edges and vertices. 

The problem is the vertices only contain their associated id and label. The vertex properties are missing.
Here's what I want:

{ "@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" } }]
}


Here's what I get:

{ "@type": "g:Vertex", "@value": { "id": { "@type": "g:Int32", "@value": 1 }, "label": "person" }

I've also already configured Gremlin Server to support returning TinkerGraph responses:

serializers
:
 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo-lite
 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+json
 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }} # application/vnd.gremlin-v2.0+json
 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }} # application/vnd.gremlin-v3.0+json


 
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/json


Does anyone know how to configure gremlin-server to return a fully populated subgraph?

Marko Rodriguez

unread,
Jan 27, 2017, 2:43:10 PM1/27/17
to gremli...@googlegroups.com
Hi,

Gremlin-Python’s GraphSON serializers currently don’t support full “detachment.” This is something that we will be addressing in TinkerPop 3.3.0 as we redesign our “element detachment framework” to better accommodate the numerous stakeholders:

1. Gremlin language variants (like Gremlin-Python)
2. OLAP GraphComputers (like SparkGraphComputer)
3. OLAP GraphActors (like AkkaGraphActors)
4. RemoteConnection servers (like GremlinServer)
5. …

Marko.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/8918a256-f4cc-4624-b783-afecf12d798f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Marko Rodriguez

unread,
Jan 27, 2017, 5:36:31 PM1/27/17
to gremli...@googlegroups.com
Hi,

1. Do you have a timeline for when TinkerPop 3.3.0 will be available? 

I don’t think there is a set date. I suspect (though I don’t know) probably around mid-Spring.

2. Also is there anywhere that I can keep up with the progress of this feature implementation?


3. Lastly, I'd like to further understand the issue hear:

We sort of threw together our “detachment framework.” What is detachment? Any element in the graph (a vertex, edge, or vertex property) can be “detached” as an isolated, un-traversable object. Moreover, it can later be re-attached. This is means by which element data is serialized to various systems. Now, its not so simple as having one type of detachment. For OLAP systems (GraphComputer/GraphActors) you only want to message pass the smallest amount of information necessary to re-attach the element at the respective partition in the cluster. For this, we have ReferenceXXX — ReferenceVertex simply has the vertex ID and label. For GUI applications, they typically want a vertex and all of its properties. For this, there is DetachedXXX.

We have realized, that there is a continum of requirements for detachment and thus, we need to not only come up with a suite of “detachment” scenarios, we also need to define a way for users/systems to specify how they want their elements to be both attached and re-attached.

Our redesign will require lots of internal refactoring and deprecation and thus, will be slated for TinkerPop 3.3.0.

HTH,
Marko.



Terell Brown

unread,
Jan 31, 2017, 5:38:44 PM1/31/17
to Gremlin-users
Great explanation. Thanks Marko!

Moses Ebenezer Christopher

unread,
Jan 4, 2019, 4:25:52 PM1/4/19
to Gremlin-users
Hi Marko,

Would you have some example sample code of how a subgraph data can be gathered using gremlinpython?


Many thanks,
Moses

Stephen Mallette

unread,
Jan 5, 2019, 7:22:40 AM1/5/19
to gremli...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages