Closed mad closed 5 years ago
Hello @mad,
this PR allows to produce translation for setting collections in properties. However in my case it still fails on JanusGraph with Property value [[1, 2]] is of type class java.util.ArrayList is not supported
.
Have you managed to configure it on JanusGraph side? If so, could you please share configuration.
Hello @dwitry
I defined property with String[].class datatype, and StringArraySerializer do conversion from Iterable to String[]
Hello @mad,
could you please share your JanusGraph configuration?
attributes.custom.attribute1.attribute-class = java.lang.String[].class
attributes.custom.attribute1.serializer-class = org.janusgraph.graphdb.database.serialize.attribute.StringArraySerializer
Fails on startup in my case.
Hello @dwitry
class Scratch {
public static void main(String[] args) {
JanusGraph graph = JanusGraphFactory.open("inmemory");
JanusGraphManagement mgmt = graph.openManagement();
mgmt.makePropertyKey("P").dataType(String[].class).make();
mgmt.commit();
GraphTraversalSource traversal = graph.traversal();
traversal.addV("A").property("P", Lists.newArrayList("a", "b")).iterate();
Assert.assertArrayEquals(new String[] { "a", "b" }, (String[]) traversal.V().values("P").next());
graph.close();
}
}
ArrayList<String>
serialization not String[]
, @mad please correct if I'm wrongtinkerpop334
@dwitry
No, default StringArraySerializer it is enough for handle String[]
and all Iterable<String>
see StandardSerializer and ArraySerializer.convertInternal
But if we defined property with ArrayList data type we need to register special serializer that provided by https://github.com/pluradj/janusgraph-attribute-serializer
236
Signed-off-by: Pavel Ershov owner.mad.epa@gmail.com