1

我一直在尝试构建示例 GetAll neo4j 服务器扩展,但不幸的是我无法使其工作。我安装了 Windows 版本的 neo4j 并将其作为服务器运行。我还安装了 Python neo4jrestclient,我正在通过 Python 脚本访问 neo4j。以下工作正常: from neo4jrestclient.client import GraphDatabase gdb = GraphDatabase("http://localhost:7474/db/data/") print gdb.extensions

它给了我“CypherPlugin”和“GremlinPlugin”。我想构建示例 GetAll 服务器扩展,即 Java。我正在使用 Eclipse。我可以在文件夹“c:\neo4j_installation_root\neo4j-community-1.7\plugins\GetAll.jar”中创建 jar 文件,但是当我重新启动 neo4j 服务器并运行 neo4jrestclient 时,它不显示 GetAll 服务器扩展。我搜索了很多,但徒劳无功。我在 C++ 和 Python 方面有很多经验,但对 Java 很陌生。我将非常感谢能够构建 neo4j 服务器扩展的一些帮助。这对我对 neo4j 的评估至关重要。

4

2 回答 2

1

您确定有一个 META-INF/services 等列出了插件类,并且 jar 文件是使用中间目录创建的(这不是 Eclipse 导出设置中的默认值),所以类加载器可以看到目录?

在http://docs.neo4j.org/chunked/snapshot/server-plugins.html查看提示

于 2012-05-24T11:58:13.047 回答
0

您可以使用 Bulbs ( http://bulbflow.com ) 完成所有操作,而无需构建扩展:

>>> from bulbs.neo4jserver import Graph
>>> g = Graph()
>>> g.vertices.get_all()
>>> g.edges.get_all()

自定义模型的工作方式相同:

# people.py

from bulbs.model import Node, Relationship
from bulbs.property import String, Integer, DateTime
from bulbs.utils import current_datetime

class Person(Node):

    element_type = "person"

    name = String(nullable=False)
    age = Integer()


class Knows(Relationship):

    label = "knows"

    created = DateTime(default=current_datetime, nullable=False)

然后在模型代理上调用 get_all:

>>> from people import Person, Knows
>>> from bulbs.neo4jserver import Graph

>>> g = Graph()
>>> g.add_proxy("people", Person)
>>> g.add_proxy("knows", Knows)

>>> james = g.people.create(name="James")
>>> julie = g.people.create(name="Julie")
>>> g.knows.create(james, julie)

>>> g.people.get_all()
>>> g.knows.get_all()
于 2012-05-24T19:14:53.563 回答