espeed / bulbs

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

Cannot create vertex proxy with rexster #126

Closed KennethAdamMiller closed 10 years ago

KennethAdamMiller commented 10 years ago

The following code:

import bulbs from bulbs.model import Node, Relationship from bulbs.rexster import Graph from bulbs.config import Config class Read(Relationship): count=0 g.add_proxy("Reads", Read)

Gives the following error: Traceback (most recent call last): File "", line 1, in File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/base/graph.py", line 104, in add_proxy
proxy = self.build_proxy(element_class, index_class) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/base/graph.py", line 124, in build_proxy
return self.factory.build_element_proxy(elementclass, index class)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/factory.py", line 19, in bui ld_element_proxy
primary_index = self.get_index(element_class,index_class,inde x_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/factory.py", line 27, in get _index
index = index_proxy.get_or_create(index_name) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rexster/index.py", line 80, in get_or_create
resp = self.client.get_or_create_vertex_index(index_name, ind ex_params)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rexster/client.py", line 668 , in get_or_create_vertex_index
resp = self.gremlin(script, params) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rexster/client.py", line 356 , in gremlin
return self.request.post(gremlin_path, params) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rest.py", line 131, in post return self.request(POST, path, params) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rest.py", line 186, in reque st
return self.response_class(http_resp, self.config) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rexster/client.py", line 198 , in init
self.handle_response(response) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rexster/client.py", line 222 , in handle_response
response_handler(http_resp) File "/opt/local/Library/Frameworks/Python.framework/Versions/3 .2/lib/python3.2/site-packages/bulbs/rest.py", line 50, in server _error
raise SystemError(http_resp) SystemError: ({'status': '500', 'transfer-encoding': 'chunked', ' server': 'grizzly/2.2.16', 'connection': 'close', 'date': 'Mon, 2 4 Feb 2014 13:55:36 GMT', 'access-control-allow-origin': '*', 'co ntent-type': 'application/json'}, b'{"message":"","error":"javax. script.ScriptException: java.lang.NullPointerException","api":{"d escription":"evaluate an ad-hoc Gremlin script for a graph.","par ameters":{"rexster.returnKeys":"an array of element property keys to return (default is to return all element properties)","rexste r.showTypes":"displays the properties of the elements with their native data type (default is false)","load":"a list of \'stored p rocedures\' to execute prior to the \'script\' (if \'script\' is not specified then the last script in this argument will return t he values","rexster.offset.end":"end index for a paged set of dat a to be returned","rexster.offset.start":"start index for a paged set of data to be returned","params":"a map of parameters to bin d to the script engine","language":"the gremlin language flavor t o use (default to groovy)","script":"the Gremlin script to be eva luated"}},"success":false}')

espeed commented 10 years ago

You need to add the label definition to the top your Relationship model.

KennethAdamMiller commented 10 years ago

Oh sorry, yeah I actually figured that out, it just took me forever since I had had the element_type name set in the Relationship model. So, this is not an issue anymore.

espeed commented 10 years ago

Resolved.