How do I connect to orientdb graph through rexster with bulbs?
Asked Answered
L

1

6

So, I'm using python3.2 and bulbs on mac-osx with rexster and orientdb. Details:

orientdb - standard download from their page

~/workspace/orientdb-community-1.7-rc1

Running the server, ./bin/server.sh

database - orientdb database ~/databases/orientdb/dev-db-01

rexster - standard checkout from github git clone git://github.com/tinkerpop/rexster.wiki.git ~/workspace/

config/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 code:

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)

Problem:

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'')

What I think is that the url in the config of the python code is incorrect (I've tried all kinds of variations). But I don't know that; it works if I leave the rexster.xml untouched and just use the standard graph constructor; but then that's a problem, because it's not adding nodes to the orientdb database that I want, dev-db-01, it's putting them in a default database. So to make sure that I connected to the right database, I disabled all but the orientdb database I had created.

How do I make it connect properly?

Lichfield answered 20/2, 2014 at 10:54 Comment(0)
D
3

The URL should include /graphs/ in the path:

http://localhost:8182/graphs/dev-db-01/
Dean answered 20/2, 2014 at 20:54 Comment(5)
Thanks so much man, you are a life saver and a complete boss! A true gentleman and scholar. Perhaps the documents should reflect this, and also expand a bit more about connecting to rexster... I could write up an example if you think you would like that. :)Lichfield
Hi @AdamMiller - yes, the docs need to be updated -- Rexster added the /graphs/ path prefix a while back so the Bulbs docs need to reflect it. You're right, the Bulbs Quickstart is based on Neo4j Server, but it might be good to switch that to TinkerPop Rexster since it's becoming the standard. More docs and pull requests are always welcome :) Thanks Adam.Dean
Sure I'll try and work on that for you. :) You helped me, I want to help back.Lichfield
Hey, would you know about using bulbs with datomic behind rexster, specifically for the temporal capabilities? If you believe that bulbs wouldn't work with datomic, then do you think you could explain how it could be extended to do so?Lichfield
@AdamMiller Yes, there is a Blueprints-Datomic implementation that you can behind Rexster with Bulbs. See my answer in the Gremlin Users Group groups.google.com/d/msg/gremlin-users/SolXnD1-F7k/IYYiobOoeigJDean

© 2022 - 2024 — McMap. All rights reserved.