python - 如何将 ArangoDB 与灯泡和 rexster 一起使用?

标签 python bulbs rexster arangodb

我目前正在尝试使用 Bulbs 和 Rexster 访问 ArangoDB 数据库。 我需要这样做,因为我想使用 Bulbs ( http://bulbflow.com ) 从 Python 启动一些 gremlin 查询。 (我真的很喜欢 AQL 和 arangosh,但我已经有了很多可用的 gremlin 脚本)

这是我在尝试使用 Bulbs 的 Rexster 之前所做的:

  • 我成功编译了 ArangoDB BluePrint 驱动程序并得到:blueprints-arangodb-graph-1.0.4-SNAPSHOT-jar-with-dependencies.jar
  • 我下载了 Gremlin2.4 和 Rexster 2.4 二进制文件,并在(分别)lib 和 ext 文件夹中复制了 blueprints-arangodb-graph-1.0.4-SNAPSHOT-jar-with-dependencies.jar

然后我遇到了几个问题:

第一,(不是灯泡问题)我没有成功使 ArangoDB 与当前版本的 Gremlin (2.4.0) 和/或 Rexster (2.4.0) 一起正常工作

在 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]

在 bash 中,启动 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)

看到一些使用 Gremlin 和 Rexster 2.2 版的示例,我下载了它们并再次安装了 arangodb 蓝图驱动程序

这一次,它在 Gremlin 2.2 和 Rexster 2.2 中都有效:

  • g.E.count() 返回了一些东西(<->因此被支持)
  • Rexster 服务器已启动,我可以在端口 8182 上访问 Rexster api

但是,第二个问题是以下 Python 代码:

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

返回:

({'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":[...]

我不知道如何解决这个问题(顺便说一句,我不是 Java 程序员)

这是我的环境:

  • Ubuntu 11.10
  • Java 版本“1.7.0_45”
  • Java(TM) SE 运行时环境(build 1.7.0_45-b18)
  • Java HotSpot(TM) 64 位服务器虚拟机(build 24.45-b08,混合模式)

这是我在 rexster.xml 中的 Arango 配置(它允许我从 Rexster REST API 访问 arangodb):

[...]
<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>
[...]

提前感谢您的任何想法/帮助:)

最佳答案

我没有使用 ArangoDB Blueprints 实现,但您肯定有一些版本控制问题导致了这个问题。根据pom ,看起来 1.0.4-SNAPSHOT 可以与 TinkerPop 2.3.0 一起使用。我会首先确保您使用 Gremlin/Rexster 2.3.0 作为解决此问题的第一步。第二步,确保 Rexster 在尝试 Bulbs 之前工作正常。换句话说,通过 Rexster 的 Gremlin Extension 执行一些脚本。并验证结果将是确保 Bulbs 在您尝试通过 Python 连接时正常工作的良好开端。

关于python - 如何将 ArangoDB 与灯泡和 rexster 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21003801/

相关文章:

python - AWS Elastic Beanstalk 不使用我的 virtualenv : "No module named boto"

python - Matplotlib 错误栏仅包含 xerrors - 错误的图例符号

python - 如何在Python中纠正像 "\u8bf8\u845b\u4eae"这样的unicode字符串?

python - 在 Rexster 中测试从 Groovy 命令行创建顶点

python - Gremlin 使用灯泡通过 Groovy 脚本进行查询

c++ - Rexster/蓝图、Neo4j 和 C++

python - 如何使用原始数据中的id导出k-means算法的输出(簇标签)

python - 您可以将 BulbFlow(灯泡)Python ORM 与 OrientDB 的图形模式约束一起使用吗?

python - 灯泡 python 连接到远程 TitanDB + Rexster

java - 泰坦,RexterClient :Message received response timeoutConnection (8000 s) at com.tinkerpop.rexster.client.RexsterClient.execute(RexsterClient.java:185)