我正在使用pythonbulbs
和。我正在尝试创建边缘,但出现此错误:Rexster
OrientDB
>> g.edges.create(g.V[0], "aoeu", g.V[1])
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/bulbs/element.py", line 879, in create
resp = self.client.create_edge(outV, label, inV, data, keys=_keys)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 454, in create_edge
return self.create_indexed_edge(outV,label,inV,data,index_name,keys=keys)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 990, in create_indexed_edge
resp = self.gremlin(script,params)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 356, in gremlin
return self.request.post(gremlin_path, params)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 131, in post
return self.request(POST, path, params)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 186, in request
return self.response_class(http_resp, self.config)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 198, in __init__
self.handle_response(response)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 222, in handle_response
response_handler(http_resp)
File "/usr/local/lib/python2.7/dist-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': 'Fri, 24 Jan 2014 19:49:10 GMT', 'access-control-allow-origin': '*', 'content-type':
'application/json'}, '{"message":"","error":"javax.script.ScriptException: java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to com.orientechnologies.orient.core.re
cord.ORecord","api":{"description":"evaluate an ad-hoc Gremlin script for a graph.","parameters":{"rexster.returnKeys":"an array of element property keys to return (default is to return all element propertie
s)","rexster.showTypes":"displays the properties of the elements with their native data type (default is false)","load":"a list of \'stored procedures\' to execute prior to the \'script\' (if \'script\' is n
ot specified then the last script in this argument will return the values","rexster.offset.end":"end index for a paged set of data to be returned","rexster.offset.start":"start index for a paged set of data
to be returned","params":"a map of parameters to bind to the script engine","language":"the gremlin language flavor to use (default to groovy)","script":"the Gremlin script to be evaluated"}},"success":false
}')
有趣的是,当我再次执行命令时,它可以工作,但是我创建了 2 个边缘,这是错误的。
在我的Rexster
服务器上,
我收到这个错误
....
at Script5.run(Script5.groovy:23)
at com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:219)
... 58 more
[WARN] GraphResource - The [tp:gremlin+*] extension raised an error response.
我的图形配置
<graph>
<graph-enabled>true</graph-enabled>
<graph-name>orientdb</graph-name>
<graph-type>orientgraph</graph-type>
<graph-location>local:/tmp/orientdb</graph-location>
<properties>
<username>admin</username>
<password>admin</password>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
我不断收到的错误是什么,我该如何解决?
添加了调试信息:
>>> from bulbs.rexster import DEBUG
>>> g.config.set_logger(DEBUG)
>>> g.edges.create(g.V[0], "a", g.V[1])
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST body: {"params": null, "script": "g.getVertices()"}
POST body: {"params": null, "script": "g.getVertices()"}
POST body: {"params": null, "script": "g.getVertices()"}
POST body: {"params": null, "script": "g.getVertices()"}
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST body: {"params": null, "script": "g.getVertices()"}
POST body: {"params": null, "script": "g.getVertices()"}
POST body: {"params": null, "script": "g.getVertices()"}
POST body: {"params": null, "script": "g.getVertices()"}
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST url: http://localhost:8182/graphs/orientdb/tp/gremlin
POST body: {"params": {"label_var": "label", "outV": "#9:0", "keys": null, "data": {}, "inV": "#9:1", "index_name": "edge", "label": "a"}, "script": "def createIndexedEdge = {\n index = g.idx(index_name)\n edge = g.addEdge(g.v(outV),g.v(inV),label)\n for (entry in data.entrySet()) {\n if (entry.value == null) continue;\n edge.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n\tindex.put(entry.key,String.valueOf(entry.value),edge)\n }\n index.put(label_var,String.valueOf(label),edge)\n return edge\n }\n def transaction = { final Closure closure ->\n try {\n results = closure();\n g.commit();\n return results; \n } catch (e) {\n g.rollback();\n throw e;\n }\n }\n return transaction(createIndexedEdge);"}
POST body: {"params": {"label_var": "label", "outV": "#9:0", "keys": null, "data": {}, "inV": "#9:1", "index_name": "edge", "label": "a"}, "script": "def createIndexedEdge = {\n index = g.idx(index_name)\n edge = g.addEdge(g.v(outV),g.v(inV),label)\n for (entry in data.entrySet()) {\n if (entry.value == null) continue;\n edge.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n\tindex.put(entry.key,String.valueOf(entry.value),edge)\n }\n index.put(label_var,String.valueOf(label),edge)\n return edge\n }\n def transaction = { final Closure closure ->\n try {\n results = closure();\n g.commit();\n return results; \n } catch (e) {\n g.rollback();\n throw e;\n }\n }\n return transaction(createIndexedEdge);"}
POST body: {"params": {"label_var": "label", "outV": "#9:0", "keys": null, "data": {}, "inV": "#9:1", "index_name": "edge", "label": "a"}, "script": "def createIndexedEdge = {\n index = g.idx(index_name)\n edge = g.addEdge(g.v(outV),g.v(inV),label)\n for (entry in data.entrySet()) {\n if (entry.value == null) continue;\n edge.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n\tindex.put(entry.key,String.valueOf(entry.value),edge)\n }\n index.put(label_var,String.valueOf(label),edge)\n return edge\n }\n def transaction = { final Closure closure ->\n try {\n results = closure();\n g.commit();\n return results; \n } catch (e) {\n g.rollback();\n throw e;\n }\n }\n return transaction(createIndexedEdge);"}
POST body: {"params": {"label_var": "label", "outV": "#9:0", "keys": null, "data": {}, "inV": "#9:1", "index_name": "edge", "label": "a"}, "script": "def createIndexedEdge = {\n index = g.idx(index_name)\n edge = g.addEdge(g.v(outV),g.v(inV),label)\n for (entry in data.entrySet()) {\n if (entry.value == null) continue;\n edge.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n\tindex.put(entry.key,String.valueOf(entry.value),edge)\n }\n index.put(label_var,String.valueOf(label),edge)\n return edge\n }\n def transaction = { final Closure closure ->\n try {\n results = closure();\n g.commit();\n return results; \n } catch (e) {\n g.rollback();\n throw e;\n }\n }\n return transaction(createIndexedEdge);"}
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/bulbs/element.py", line 879, in create
resp = self.client.create_edge(outV, label, inV, data, keys=_keys)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 454, in create_edge
return self.create_indexed_edge(outV,label,inV,data,index_name,keys=keys)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 990, in create_indexed_edge
resp = self.gremlin(script,params)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 356, in gremlin
return self.request.post(gremlin_path, params)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 131, in post
return self.request(POST, path, params)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rest.py", line 186, in request
return self.response_class(http_resp, self.config)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 198, in __init__
self.handle_response(response)
File "/usr/local/lib/python2.7/dist-packages/bulbs/rexster/client.py", line 222, in handle_response
response_handler(http_resp)
File "/usr/local/lib/python2.7/dist-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, 27 Jan 2014 18:33:00 GMT', 'access-control-allow-origin': '*', 'content-type': 'application/json'}, '{"message":"","error":"javax.script.ScriptException: java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to com.orientechnologies.orient.core.record.ORecord","api":{"description":"evaluate an ad-hoc Gremlin script for a graph.","parameters":{"rexster.returnKeys":"an array of element property keys to return (default is to return all element properties)","rexster.showTypes":"displays the properties of the elements with their native data type (default is false)","load":"a list of \'stored procedures\' to execute prior to the \'script\' (if \'script\' is not specified then the last script in this argument will return the values","rexster.offset.end":"end index for a paged set of data to be returned","rexster.offset.start":"start index for a paged set of data to be returned","params":"a map of parameters to bind to the script engine","language":"the gremlin language flavor to use (default to groovy)","script":"the Gremlin script to be evaluated"}},"success":false}')