python - 如何通过带灯泡的 rexster 连接到 orientdb graph?

标签 python orientdb tinkerpop bulbs rexster

因此,我在带有 rexster 和 orientdb 的 mac-osx 上使用 python3.2 和灯泡。详情:

orientdb - 从他们的页面标准下载

~/workspace/orientdb-community-1.7-rc1

运行服务器,./bin/server.sh

数据库 - orientdb数据库 ~/databases/orientdb/dev-db-01

rexster - 来自 github 的标准结帐 git clone git://github.com/tinkerpop/rexster.wiki.git ~/workspace/

配置/rexster.xml:

        ...
        <graph>
        <graph-enabled>true</graph-enabled>
        <graph-name>dev-db-01</graph-name>
        <graph-type>orientgraph</graph-type>
        <graph-location>local:*<path to...>*/databases/orientdb/dev-db-01</graph-location>
        <properties>
            <username>admin</username>
            <password>admin</password>
        </properties>
        <extensions>
            <allows>
                <allow>tp:gremlin</allow>
            </allows>
        </extensions>
    </graph>
    ...

Python代码:

from bulbs.rexster import Graph
from bulbs.config import Config
config = Config("http://localhost:8182/dev-db-01/", username="admin", password="admin")
g = Graph(config)

问题:

Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/bulbs/rexster/graph.py", li ne 56, in __init__                                                 

    super(Graph, self).__init__(config)   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/bulbs/base/graph.py", line  58, in __init__                                                 

    self.vertices = self.build_proxy(Vertex)   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(element_class, index_class)   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/bulbs/factory.py", line 19,  in build_element_proxy                                      

    primary_index = self.get_index(element_class,index_class,index_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", li ne 80, in get_or_create                                            

    resp = self.client.get_or_create_vertex_index(index_name, index_params)   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/bulbs/rexster/client.py", l ine 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", l ine 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, i n 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, i n request                                                 

    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", l ine 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", l ine 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 39, in  not_found                                                

    raise LookupError(http_resp) LookupError: ({'date': 'Thu, 20 Feb 2014 07:08:20 GMT', 'status': '404', 'access-control-allow-origin': '*', 'content-lengt h': '0', 'server': 'grizzly/2.2.16'}, b'')

认为 是 python 代码配置中的 url 不正确(我尝试了各种变体)。但我不知道;如果我保持 rexster.xml 不变并只使用标准图形构造函数,它就会工作;但这是一个问题,因为它没有将节点添加到我想要的 orientdb 数据库,dev-db-01,而是将它们放在默认数据库中。因此,为了确保我连接到正确的数据库,我禁用了除我创建的 orientdb 数据库之外的所有数据库。

如何让它正确连接?

最佳答案

URL 应在路径中包含/graphs/:

http://localhost:8182/graphs/dev-db-01/

关于python - 如何通过带灯泡的 rexster 连接到 orientdb graph?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21905557/

相关文章:

python - 碰撞矩形

python - dask 数据框如何将列转换为 to_datetime

database - OrientDb 是否提供任何地理空间支持?

javascript - 使用 OrientJS 创建带有链接列表的记录时出错

gremlin - 在tinkerpop gremlin 中,如何搜索属性值是参数子集的顶点?

python - 在 Tinkerpop 中使用 Python 创建图形处理程序的可能性

Python Split 特定案例处理

java - Orientdb 错误 : can't load log handler "java.util.logging.FileHandler" etc

azure-cosmosdb - 在 Azure Cosmos DB 中使用 Gremlin 重命名属性

python - 将 pandas dataframe 转换为 PySpark RDD 时遇到问题?