diff --git a/src/graph_notebook/magics/graph_magic.py b/src/graph_notebook/magics/graph_magic.py index 54c3b9d5..ab7a560e 100644 --- a/src/graph_notebook/magics/graph_magic.py +++ b/src/graph_notebook/magics/graph_magic.py @@ -1351,6 +1351,12 @@ def gremlin(self, line, cell, local_ns: dict = None): query_res_http_json = json.loads(query_res_fixed) if 'result' in query_res_http_json: query_res = query_res_http_json['result']['data'] + # Handle typed GraphSON format where data is {"@type": "g:List", "@value": [...]} + if isinstance(query_res, dict) and '@type' in query_res and '@value' in query_res: + from gremlin_python.structure.io.graphsonV3d0 import GraphSONReader + reader = GraphSONReader() + query_res = reader.to_object(query_res) + using_http = False # results are now deserialized objects like WS path else: if 'reason' in query_res_http_json: logger.debug('Query failed with internal error, see response.') diff --git a/src/graph_notebook/neptune/client.py b/src/graph_notebook/neptune/client.py index 35fa1602..818ae607 100644 --- a/src/graph_notebook/neptune/client.py +++ b/src/graph_notebook/neptune/client.py @@ -154,7 +154,7 @@ GREMLIN_SERIALIZERS_HTTP = [GRAPHSONV1, GRAPHSONV1_UNTYPED, GRAPHSONV2_UNTYPED, GRAPHSONV3_UNTYPED] GREMLIN_SERIALIZERS_HTTP_NEXT = [GRAPHSONV4, GRAPHSONV4_UNTYPED] GREMLIN_SERIALIZERS_ALL = GREMLIN_SERIALIZERS_WS + GREMLIN_SERIALIZERS_HTTP + GREMLIN_SERIALIZERS_HTTP_NEXT -NEPTUNE_GREMLIN_SERIALIZERS_HTTP = [GRAPHSONV1_UNTYPED, GRAPHSONV2_UNTYPED, GRAPHSONV3_UNTYPED] +NEPTUNE_GREMLIN_SERIALIZERS_HTTP = [GRAPHSONV1_UNTYPED, GRAPHSONV2_UNTYPED, GRAPHSONV3_UNTYPED, GRAPHSONV3] NEPTUNE_GREMLIN_SERIALIZERS_HTTP_NEXT = NEPTUNE_GREMLIN_SERIALIZERS_HTTP + [GRAPHSONV4_UNTYPED] DEFAULT_GREMLIN_WS_SERIALIZER = GRAPHSONV3 DEFAULT_GREMLIN_HTTP_SERIALIZER = GRAPHSONV3_UNTYPED