espeed / bulbs

A Python persistence framework for graph databases like Neo4j, OrientDB and Titan.
http://bulbflow.org
Other
622 stars 83 forks source link

Adding Values for Titan Cardinality.SET / Cardinality.LIST Properties Fails #146

Open jjo-sec opened 10 years ago

jjo-sec commented 10 years ago

I did not test this functionality in the 0.4.X series, so I do not know if titan behavior has changed and broken bulbs support, but in 0.5.0 to add a property to a SET/LIST property addProperty must be used instead of SetProperty

example titan property creation in 0.5.0: g = TitanFactory.open('conf/titan-cassandra-es.properties') mgmt = g.getManagementSystem() rrname = mgmt.makePropertyKey('rrname').dataType(String.class).cardinality(Cardinality.SINGLE).make() cat = mgmt.makePropertyKey('category').dataType(String.class).cardinality(Cardinality.SET).make()

Associated error seen in in bulbs when attempting to add a vertex with a category property ( tried value as both list and string ) and see the same error message back saying to use addProperty:

g.vertices.create(rrname='evil.net',_data={'category':['evil']}) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/element.py", line 565, in create resp = self.client.create_vertex(data, keys=_keys) File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/rexster/client.py", line 375, in create_vertex return self.request.post(vertex_path, data) File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/rest.py", line 131, in post return self.request(POST, path, params) File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/rest.py", line 186, in request return self.response_class(http_resp, self.config) File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/rexster/client.py", line 198, in init self.handle_response(response) File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/rexster/client.py", line 222, in handle_response response_handler(http_resp) File "/usr/local/lib/python2.7/dist-packages/bulbs-0.3.29_20140417-py2.7.egg/bulbs/rest.py", line 50, in server_error raise SystemError(http_resp) SystemError: ({'status': '500', 'transfer-encoding': 'chunked', 'vary': 'Accept', 'server': 'grizzly/2.2.16', 'connection': 'close', 'date': 'Wed, 20 Aug 2014 14:51:14 GMT', 'access-control-allow-origin': '*', 'content-type': 'application/json;charset=UTF-8'}, '{"message":"Not an single key: category. Use addProperty instead","error":"Not an single key: category. Use addProperty instead"}')