简体   繁体   English

Neo4j客户端-服务器API

[英]Neo4j client-server API

What is the way to use Java API in client-server setup of Neo4j? 什么是使用Java API中的Neo4j的客户端 - 服务器设置的方式吗?

Do I miss some kind of Java connector ? 我会错过某种Java连接器吗? Only thing I found so far was REST api: http://neo4j.com/docs/stable/server-java-rest-client-example.html , but I have no idea how to use objects like: 只有我迄今发现的事情是REST API: http://neo4j.com/docs/stable/server-java-rest-client-example.html ,但我不知道如何使用对象,如:

org.neo4j.graphdb.GraphDatabaseService;
org.neo4j.graphdb.Label;
org.neo4j.graphdb.Node;
org.neo4j.graphdb.Transaction;
org.neo4j.graphdb.factory.GraphDatabaseFactory;
org.neo4j.graphdb.factory.GraphDatabaseSettings;
org.neo4j.graphdb.schema.ConstraintDefinition;
org.neo4j.graphdb.schema.ConstraintType;    

over REST. 通过REST。 I want to avoid constructing cumbersome URLs and parse string responses. 我想避免构造繁琐的URL和解析字符串响应。 I want to migrate from my application from embedded to client-server, but so far it seems to impossible. 我想从我的应用程序迁移从嵌入到客户端 - 服务器,但到目前为止,它似乎是不可能的。

Actually there is a JDBC connector for Neo4j, check out: 实际上,有一个用于Neo4j的JDBC连接器,请查看:

http://neo4j.com/developer/java/#_using_neo4j_server_with_jdbc http://neo4j.com/developer/java/#_using_neo4j_server_with_jdbc

And: 和:

https://github.com/neo4j-contrib/neo4j-jdbc#minimum-viable-snippet https://github.com/neo4j-contrib/neo4j-jdbc#minimum-viable-snippet

// Make sure Neo4j Driver is registered
Class.forName("org.neo4j.jdbc.Driver");

// Connect
Connection con = DriverManager.getConnection("jdbc:neo4j://localhost:7474/");

// Querying
try(Statement stmt = con.createStatement())
{
    ResultSet rs = stmt.executeQuery("MATCH (n:User) RETURN n.name");
    while(rs.next())
    {
        System.out.println(rs.getString("n.name"));
    }
}

I think FrobberOfBits answered this one right. 我认为FrobberOfBits回答了这一权利。 Theres no Java API for client-server. 没有用于客户端服务器的Java API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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