Hi!
I have written a very small Groovy application that queries a TitanGraph.
I am using the titan09 branch from a couple of days ago (52ce310b24fa0625760d47a92a629cc4bbe86432).
This is an extract of my Groovy class:
TitanGraph tg = TitanFactory.build().set('storage.backend','inmemory').open()
def mgmt = tg.openManagement()
mgmt.makePropertyKey('important').dataType(Boolean.class).cardinality(Cardinality.SINGLE).make()
mgmt.makeVertexLabel('person').make()
mgmt.commit()
Graph g = tg
def person = g.addVertex('person')
person.property('important', true) // Exception happens here
And this is the exception I get when I run the application:
com.thinkaurelius.titan.core.SchemaViolationException: Value [true] is not an instance of the expected data type for property key [important] and cannot be converted. Expected: boolean, found: class java.lang.Boolean
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.verifyAttribute(StandardTitanTx.java:577)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addPropertyInternal(StandardTitanTx.java:721)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:706)
at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.property(AbstractVertex.java:139)
I have also tried to cast the boolean:
person.property(IMPORTANT, (boolean) true)
But the same error happens.
This also happens with the Long data type: I have a property called 'user_id' of type Long which I use in some vertices to store the id of the user vertex. This is the error I get then:
Value [256] is not an instance of the expected data type for property key [user_id] and cannot be converted. Expected: long, found: class java.lang.Long
Is this a bug or am I doing something wrong?
Any help is greatly appreciated.
Thanks!!