This is an automated email from the ASF dual-hosted git repository. xiazcy pushed a commit to branch graphbinary-label-list in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 79ccf459bad5ace3452d09c12196ec67c61d66c4 Author: Yang Xia <[email protected]> AuthorDate: Mon Sep 16 20:42:09 2024 -0700 serialize label as list in python --- .../gremlin_python/structure/io/graphbinaryV4.py | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py index 3cf8f53a3e..41fc8a47dd 100644 --- a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py +++ b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py @@ -535,11 +535,12 @@ class EdgeIO(_GraphBinaryTypeIO): cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) writer.to_dict(obj.id, to_extend) - StringIO.dictify(obj.label, writer, to_extend, True, False) + # serializing label as list here for now according to GraphBinaryV4 + ListIO.dictify([obj.label], writer, to_extend, True, False) writer.to_dict(obj.inV.id, to_extend) - StringIO.dictify(obj.inV.label, writer, to_extend, True, False) + ListIO.dictify([obj.inV.label], writer, to_extend, True, False) writer.to_dict(obj.outV.id, to_extend) - StringIO.dictify(obj.outV.label, writer, to_extend, True, False) + ListIO.dictify([obj.outV.label], writer, to_extend, True, False) to_extend.extend(NULL_BYTES) to_extend.extend(NULL_BYTES) @@ -552,9 +553,10 @@ class EdgeIO(_GraphBinaryTypeIO): @classmethod def _read_edge(cls, b, r): edgeid = r.read_object(b) - edgelbl = r.to_object(b, DataType.string, False) - inv = Vertex(r.read_object(b), r.to_object(b, DataType.string, False)) - outv = Vertex(r.read_object(b), r.to_object(b, DataType.string, False)) + # reading single string value for now according to GraphBinaryV4 + edgelbl = r.to_object(b, DataType.list, False)[0] + inv = Vertex(r.read_object(b), r.to_object(b, DataType.list, False)[0]) + outv = Vertex(r.read_object(b), r.to_object(b, DataType.list, False)[0]) b.read(2) properties = r.read_object(b) edge = Edge(edgeid, outv, edgelbl, inv, properties) @@ -625,7 +627,8 @@ class VertexIO(_GraphBinaryTypeIO): def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) writer.to_dict(obj.id, to_extend) - StringIO.dictify(obj.label, writer, to_extend, True, False) + # serializing label as list here for now according to GraphBinaryV4 + ListIO.dictify([obj.label], writer, to_extend, True, False) to_extend.extend(NULL_BYTES) return to_extend @@ -635,7 +638,8 @@ class VertexIO(_GraphBinaryTypeIO): @classmethod def _read_vertex(cls, b, r): - vertex = Vertex(r.read_object(b), r.to_object(b, DataType.string, False), r.read_object(b)) + # reading single string value for now according to GraphBinaryV4 + vertex = Vertex(r.read_object(b), r.to_object(b, DataType.list, False)[0], r.read_object(b)) return vertex @@ -648,7 +652,8 @@ class VertexPropertyIO(_GraphBinaryTypeIO): def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) writer.to_dict(obj.id, to_extend) - StringIO.dictify(obj.label, writer, to_extend, True, False) + # serializing label as list here for now according to GraphBinaryV4 + ListIO.dictify([obj.label], writer, to_extend, True, False) writer.to_dict(obj.value, to_extend) to_extend.extend(NULL_BYTES) to_extend.extend(NULL_BYTES) @@ -660,7 +665,8 @@ class VertexPropertyIO(_GraphBinaryTypeIO): @classmethod def _read_vertexproperty(cls, b, r): - vp = VertexProperty(r.read_object(b), r.to_object(b, DataType.string, False), r.read_object(b), None) + # reading single string value for now according to GraphBinaryV4 + vp = VertexProperty(r.read_object(b), r.to_object(b, DataType.list, False)[0], r.read_object(b), None) b.read(2) vp.properties = r.read_object(b) return vp
