Custom attribute serializer
J MacNaught <jma...@...>
Hi all, I was able to define a custom serializer for certain Java types, for example, ArrayList. I cannot get this to work in JanusGraph. I have this in my configuration: root.attributes.custom.attribute1.attribute-class=java.util.HashMap root.attributes.custom.attribute1.serializer-class=com.ibm.research.psyche.core.serializer.GenericSerializer root.attributes.custom.attribute2.attribute-class = java.util.LinkedHashMap root.attributes.custom.attribute2.serializer-class = com.ibm.research.psyche.core.serializer.GenericSerializer root.attributes.custom.attribute3.attribute-class = java.util.ArrayList root.attributes.custom.attribute3.serializer-class = com.ibm.research.psyche.core.serializer.GenericSerializer root.attributes.custom.attribute4.attribute-class = java.util.LinkedList root.attributes.custom.attribute4.serializer-class = com.ibm.research.psyche.core.serializer.GenericSerializer I get this error when defining the property: java.lang.IllegalArgumentException: Not a supported data type: class java.util.ArrayList at com.google.common.base.Preconditions.checkArgument(Preconditions.java:120) ~[guava-15.0.jar:?] at org.janusgraph.graphdb.types.StandardPropertyKeyMaker.make(StandardPropertyKeyMaker.java:93) ~[janusgraph-core-0.1.1.jar:?] ..... Are custom attributes supported anymore? Note that the Configuration Reference in the documentations says that the option name should be this: attributes.custom.[X].attribute-class But you get this error: java.lang.IllegalStateException: Need to set configuration value: root.attributes.custom.attribute-class Thanks! |
|
Jason Plurad <plu...@...>
That functionality works. I've ported my Titan example over to JanusGraph. You shouldn't have "root." on your properties. Note that JanusGraph registers a standard serializer for HashMap, so an exception would have been thrown if you attempted to register one for it. On Monday, September 11, 2017 at 5:42:02 PM UTC-4, J MacNaught wrote:
|
|
J MacNaught <jma...@...>
Thank you for the example, it helped to know it was supposed to work. However, I couldn't get your example to work at first. I still got this error: java.lang. which is really not helpful because if you change the option name to "root.xxx" the error messages go away, but it's not really fixed. Ultimately, the only way I could get it to work was to delete my cassandra database and start over. I thought that options which were GLOBAL_OFFLINE could still be configured after DB initialization. On Wednesday, September 13, 2017 at 2:42:44 PM UTC-4, Jason Plurad wrote:
|
|
Robert Dale <rob...@...>
You can change it, just not through the properties file. You have to use the Management interface. See http://docs.janusgraph.org/latest/configuration.html#configuration-global Robert Dale On Wed, Sep 13, 2017 at 5:30 PM, J MacNaught <jma...@...> wrote:
|
|
J MacNaught <jma...@...>
Aha! Perhaps it would be best to configure it programmatically from the beginning. I already have a java program to define all my schema elements. On Wednesday, September 13, 2017 at 5:33:45 PM UTC-4, Robert Dale wrote:
|
|
Rohit <rohit....@...>
I am getting below exception while running gremlin server. Caused by: java.lang.IllegalArgumentException: Duplicate attribute registration: class java.util.HashMap and class java.util.HashMap How to resolve this issue?
|
|
Jason Plurad <plu...@...>
Do you have a stack trace? That would be helpful, as would more details on how you are registering your custom attribute serialization. On Wednesday, September 26, 2018 at 4:20:31 AM UTC-4, Rohit wrote:
|
|
Rohit <rohit....@...>
Hi We might have define custom attribute serializer for same class. I have the attribute via Java Client. mgmt = graph.openManagement(); mgmt.set("attributes.custom.attribute68.attribute-class", "java.util.HashMap"); mgmt.set("attributes.custom.attribute68.serializer-class", "com.vz.attribute.serializer.HashMapSerializer"); mgmt.commit(); And I am getting the below line printed as well *** HashMapSerializer constructor For the serializer , I have taken inputs from Janusgraph documentation plus your github repo. however , In the next step I getting below Error java.lang.IllegalArgumentException: Encountered missing datatype registration for number: 68 at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer.getDataType(StandardSerializer.java:192) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer.access$600(StandardSerializer.java:56) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer$ClassSerializer.getClass(StandardSerializer.java:432) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer$ClassSerializer.read(StandardSerializer.java:426) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer$ClassSerializer.read(StandardSerializer.java:410) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer.readObjectNotNullInternal(StandardSerializer.java:264) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.serialize.StandardSerializer.readClassAndObject(StandardSerializer.java:273) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.EdgeSerializer.readPropertyValue(EdgeSerializer.java:198) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.EdgeSerializer.readPropertyValue(EdgeSerializer.java:193) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.EdgeSerializer.parseRelation(EdgeSerializer.java:136) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.database.EdgeSerializer.readRelation(EdgeSerializer.java:73) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.transaction.RelationConstructor.readRelation(RelationConstructor.java:75) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.transaction.RelationConstructor$1$1.next(RelationConstructor.java:60) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.transaction.RelationConstructor$1$1.next(RelationConstructor.java:48) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.types.vertices.JanusGraphSchemaVertex.getDefinition(JanusGraphSchemaVertex.java:87) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.types.vertices.RelationTypeVertex.multiplicity(RelationTypeVertex.java:65) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.types.vertices.PropertyKeyVertex.cardinality(PropertyKeyVertex.java:36) ~[janusgraph-core-0.2.0.jar:na] at org.janusgraph.graphdb.tinkerpop.JanusGraphFeatures$JanusGraphVertexFeatures.getCardinality(JanusGraphFeatures.java:160) ~[janusgraph-core-0.2.0.jar:na] at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.lambda$createVertex$12(Attachable.java:296) ~[gremlin-core-3.3.1.jar:3.3.1] at java.util.Iterator.forEachRemaining(Unknown Source) ~[na:1.8.0_73] at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.createVertex(Attachable.java:293) ~[gremlin-core-3.3.1.jar:3.3.1] at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.lambda$create$10(Attachable.java:149) ~[gremlin-core-3.3.1.jar:3.3.1] at org.apache.tinkerpop.gremlin.structure.util.Attachable.attach(Attachable.java:63) ~[gremlin-core-3.3.1.jar:3.3.1] at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.lambda$readGraph$1(GraphSONReader.java:107) ~[gremlin-core-3.3.1.jar:3.3.1] at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) ~[na:1.8.0_73] at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_73] at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_73] at java.util.ArrayList$Itr.forEachRemaining(Unknown Source) ~[na:1.8.0_73] at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[na:1.8.0_73] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:1.8.0_73] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_73] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) ~[na:1.8.0_73] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) ~[na:1.8.0_73] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:1.8.0_73] at java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[na:1.8.0_73] at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.readGraph(GraphSONReader.java:105) ~[gremlin-core-3.3.1.jar:3.3.1] On Wednesday, September 26, 2018 at 8:45:28 PM UTC+5:30, Jason Plurad wrote:
|
|
rohit....@...
I want this hashmap for data loading via graphson On Thursday, September 27, 2018 at 7:31:33 PM UTC+5:30, Rohit wrote:
|
|
as...@...
I am getting error: Need to set configuration value: root.attributes.custom.attribute-class while following https://github.com/pluradj/janusgraph-attribute-serializer Please help me, someone. |
|