简体   繁体   中英

How to use ArangoDB with bulbs & rexster?

I'm currently trying to access an ArangoDB database by using Bulbs and Rexster. I need to do that because I want to use Bulbs ( http://bulbflow.com ) to launch some gremlin queries from Python. (I really like AQL and arangosh but I already have a lot of working gremlin scripts)

Here is what I did before trying to use Rexster from Bulbs :

  • I successfully compiled ArangoDB BluePrint driver and got : blueprints-arangodb-graph-1.0.4-SNAPSHOT-jar-with-dependencies.jar
  • I downloaded Gremlin2.4 an Rexster 2.4 binaries and copied blueprints-arangodb-graph-1.0.4-SNAPSHOT-jar-with-dependencies.jar in (respectively) lib and ext folder

I then faced several issues :

1st, (not an Bulbs issue) I didn't succeed in making ArangoDB work correctly with current version of Gremlin (2.4.0) and/or Rexster (2.4.0)

In gremlin 2.4 :

gremlin> import com.tinkerpop.blueprints.impls.arangodb.*
[...]
gremlin> g = ArangoDBGraphFactory.createArangoDBGraph();
==>arangodbgraph[{"_id":"_graphs\/factory_graph","_rev":"20228207","_key":"factory_graph","vertices":"factory_vertices","edges":"factory_edges"}]
gremlin> g.E.count()
Not supported yet.
Display stack trace? [yN]

In bash, while launching Rexster 2.4 :

Exception in thread "main" java.lang.NoSuchFieldError: isRDFModel
    at com.tinkerpop.blueprints.impls.arangodb.ArangoDBGraph.<clinit>(ArangoDBGraph.java:44)
    at com.tinkerpop.blueprints.impls.arangodb.utils.ArangoDBConfiguration.configureGraphInstance(ArangoDBConfiguration.java:60)
    at com.tinkerpop.rexster.config.GraphConfigurationContainer.getGraphFromConfiguration(GraphConfigurationContainer.java:119)
    at com.tinkerpop.rexster.config.GraphConfigurationContainer.<init>(GraphConfigurationContainer.java:54)
    at com.tinkerpop.rexster.server.XmlRexsterApplication.reconfigure(XmlRexsterApplication.java:99)
    at com.tinkerpop.rexster.server.XmlRexsterApplication.<init>(XmlRexsterApplication.java:47)
    at com.tinkerpop.rexster.Application.<init>(Application.java:96)
    at com.tinkerpop.rexster.Application.main(Application.java:188)

Seing some examples using version 2.2 of both Gremlin and Rexster, I downloaded them and installed again arangodb blueprint driver

This time, it worked in both Gremlin 2.2 and Rexster 2.2 :

  • gEcount() returned something (<-> thus is supported)
  • Rexster server launched and I could access Rexster api on port 8182

BUT, the 2nd issue is that the following Python code :

from bulbs.rexster import Graph
from bulbs.config import Config
config = Config('http://localhost:8182/graphs/arangodb')
g = Graph(config)

returned :

({'status': '500', 'transfer-encoding': 'chunked', 'server': 'grizzly/2.2.18', 'connection': 'close', 'date': 'Wed, 08 Jan 2014 17:30:29 GMT', 'access-control-allow-origin': '*', 'content-type': 'application/json'}, '{"message":"","error":"javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException.rollback() is applicable for argument types: () values: []\\nPossible solutions: collect(), collect(groovy.lang.Closure), collect(java.util.Collection, groovy.lang.Closure)","api":{"description":"evaluate an ad-hoc Gremlin script for a graph.","parameters":{"rexster.returnKeys":[...]

I don't know how this could be fixed (I'm not a Java programmer, btw)

Here is my env :

  • Ubuntu 11.10
  • java version "1.7.0_45"
  • Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
  • Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Here is my Arango config in rexster.xml (which let me access arangodb from Rexster REST API) :

[...]
<graph>
    <graph-name>arangodb</graph-name>
    <graph-type>com.tinkerpop.blueprints.impls.arangodb.utils.ArangoDBConfiguration</graph-type>
    <properties>
        <graph-name>arangodb-rexster-graph</graph-name>
        <vertex-name>arangodb-rexster-graph-vertices</vertex-name>
        <edge-name>arangodb-rexster-graph-edges</edge-name>
        <host>localhost</host>
        <port>8529</port>
    </properties>
</graph>
[...]

Thanks in advance for any ideas/help :)

I've not used the ArangoDB Blueprints implementation, but you definitely have some versioning issues contributing to the problem. According to the pom , it looks like the 1.0.4-SNAPSHOT works with TinkerPop 2.3.0. I would start by making sure you use Gremlin/Rexster 2.3.0 as a first step to solving this problem. As a second step, make sure that the Rexster is serving properly prior to trying Bulbs. In other words, executing a few scripts through Rexster's Gremlin Extension and validating the results would be a good start to ensuring Bulbs works nicely when you try to connect via Python.

关于rexster 2.4问题:你可以在https://github.com/triAGENS/blueprints-arangodb-graph中找到一个2.4分支,它应该与rexster / gremlin 2.4一起使用

Yes, what Stephen Mallete said, and make sure the gremlin extension is configured in your rexster.xml config file. Then use curl to test Rexster from the command line to ensure it's working. This will help you isolate any issues since it's a new DB.

According to the connection to ArangoDB: there seems to be a problem with the gremlin server included in rexster and our driver implementation. i managed to execute your code successfully in stand-alone gremlin, but get the problem in rexster server. We are fixing the blueprint driver + documentation st it will work again.

Concerning your problem with

g.E.count()

I tried to use the same syntax with orient-DB. It's not supported there, too. So I think it has a smell of a bug within gremlin 2.4

A workaround is simple, use

g.getEdges().count()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM