De/serialization via Gryo loses properties of cardinality `set`

18 views
Skip to first unread message

lennart...@googlemail.com

unread,
Aug 6, 2017, 1:59:06 PM8/6/17
to Gremlin-users
Hi,

i am not sure whether this is a bug or whether i am missing an opportunity to configure something differently.

This happens in Java, but for testing i've written this short script in Jython which reproduces the problem.
The property `foo` is set multiples times with cardinality `set`. When writing/reading to/from Kryo one property value gets lost:

database_path = 'test.kryo'

graph_orginal = TinkerGraph.open()

vertex_orginial = graph_orginal.addVertex()
vertex_orginial.property(Cardinality.set, u'foo', u'Bar')
vertex_orginial.property(Cardinality.set, u'foo', u'Baz')

graph_orginal.io(IoCore.gryo()).writeGraph(database_path)


graph_loaded = TinkerGraph.open()
graph_loaded.io(IoCore.gryo()).readGraph(database_path)

print 'Original:'

for vp in vertex_orginial.properties():
print vp

print 'Loaded:'

for vertex_loaded in graph_loaded.vertices():
for vp in vertex_loaded.properties():
print vp


This script gives:

Original

vp[foo->Bar]

vp[foo->Baz]

Loaded

vp[foo->Baz]


I guess that the properties are read with cardinality `single`.

Any thoughts?

Cheers
Lennart

Robert Dale

unread,
Aug 7, 2017, 6:35:55 AM8/7/17
to gremli...@googlegroups.com
Maybe this will help:


It is important to consider the data being imported to TinkerGraph with respect to defaultVertexPropertyCardinalitysetting. For example, if a .gryo file is known to contain multi-property data, be sure to set the default cardinality to list or else the data will import as single. Consider the following:


Robert Dale

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/83b57301-6f54-4211-a5c5-47d2d2e81750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lennart...@googlemail.com

unread,
Aug 7, 2017, 12:34:08 PM8/7/17
to Gremlin-users
Hi Robert,

thank you, that helped.

Robert Dale

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages