Я помещаю пример вершины GraphSON из g:Vertex
в файл:
$ cat vertex.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 } } } } ] } } }
Пытаясь прочитать его на Python Сервер Gremlin:
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
g.io("/home/ubuntu/vertex.json").read().iterate()
выдает ошибку:
GremlinServerError: 500: org. apache .tinkerpop.shaded.jackson.databind.JsonMappingException: Не удалось десериализовать значение JSON, как требуется. Вложенное исключение: java .lang.InstantiationException: Невозможно десериализовать значение с обнаруженным типом, содержащимся в JSON ('g: Vertex'), в тип, указанный в параметре для сопоставителя объектов (интерфейс java .util. Карта). Эти типы несовместимы. в [Source: (ByteArrayInputStream); строка: 1, столбец: 36]
Я пытался связываться с параметрами graphson_reader
и message_serializer
DriverRemoteConnection
, чтобы указать GraphSONSerializersV3d0
, но не могу обойти эту ошибку ,
Как можно прочитать приведенную выше примерную вершину GraphSON в графе с сервера Python Gremlin?