Re: Geoshape property in remote gremlin query, GraphSON


Robert Dale <rob...@...>
 

It seems Geoshape GraphSON support is hardcoded to v1 although I couldn't get it to work with that either.  If you have to use GraphSON instead of Gryo, then you could checkout master, apply this patch, and rebuild. I created an  issue to support multiple versions of serializers  https://github.com/JanusGraph/janusgraph/issues/420

diff --git a/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/io/graphson/JanusGraphSONModule.java b/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/io/graphson/JanusGraphSONModule.java
index
6ef907b..8168309 100644
--- a/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/io/graphson/JanusGraphSONModule.java
+++ b/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/io/graphson/JanusGraphSONModule.java
@@ -50,10 +50,10 @@ public class JanusGraphSONModule extends TinkerPopJacksonModule {
     
private JanusGraphSONModule() {
         
super("janusgraph");
         addSerializer
(RelationIdentifier.class, new RelationIdentifierSerializer());
-        addSerializer(Geoshape.class, new Geoshape.GeoshapeGsonSerializerV1d0());
+        addSerializer(Geoshape.class, new Geoshape.GeoshapeGsonSerializerV2d0());
 
         addDeserializer
(RelationIdentifier.class, new RelationIdentifierDeserializer());
-        addDeserializer(Geoshape.class, new Geoshape.GeoshapeGsonDeserializerV1d0());
+        addDeserializer(Geoshape.class, new Geoshape.GeoshapeGsonDeserializerV2d0());
     
}
 
     
private static final JanusGraphSONModule INSTANCE = new JanusGraphSONModule();



On Tuesday, July 18, 2017 at 5:47:50 PM UTC-4, Conrad Rosenbrock wrote:
I am trying to assign a value to a property with the native Geoshape type. I have it serialized into JSON as follows (where g is aliased to the traversal on gremlin server):

{"@value": {"type": "point", "coordinates": [{"@value": 1.1, "@type": "g:Double"}, {"@value": 2.2, "@type": "g:Double"}]}, "@type": "g:Geoshape"}

In the gremlin console, I can easily type 

Geoshape.point(1.1, 2.2)

and it works perfectly. I am sure that it is something quite simple. Here is the error:

Request [PooledUnsafeDirectByteBuf(ridx: 653, widx: 653, cap: 687)] could not be deserialized by org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV2d0.

For reference, I do have the following serializer in the gremlin server config:

{ className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}

which should direct gremlin server to the relevant deserializer in Janus.

Thanks!

Join {janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.