GithubHelp home page GithubHelp logo

firepation / nebula-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vesoft-inc/nebula-java

0.0 0.0 0.0 885 KB

Client API and data importer of Nebula Graph in Java

Java 97.48% Scala 1.86% Python 0.66%

nebula-java's Introduction

nebula-java

star this repo fork this repo

This guide provides instructions and options for connecting Nebula Graph for Java developer. However, Nebula Java is not not thread-safe.

Prerequisites

When developing with this Java driver, please use Java 8+. Depending on the version of Nebula Graph that you are connecting to, you will have to use a different version of this client.

Nebula version Nebula Java version
1.0.0 1.0.0

Nebula Graph Java Driver

When using Maven, add dependency to your pom.xml file:

<dependency>
    <groupId>com.vesoft</groupId>
    <artifactId>client</artifactId>
    <version>1.0.0</version>
</dependency>

For more versions, please refer to releases.

Graph Client Example

Connect to the graphd:

GraphClient client = new GraphClientImpl("127.0.0.1", 3699);
client.setUser("user");
client.setPassword("password");
client.connect();

Use a space:

int code = client.switchSpace("space_test");

Execute a query:

int code = client.execute("CREATE TAG course(name string, credits int);");

If query executes successfully, 0 will be returned. For a more complete example, refer to Graph Java client example.

Storage Client

If you only use the interface of RPC, nothing to worry about.

If you want to directly use storage client to encode/decode, you need to use the jni interface. We have already package a libnebula_codec.so in the nebula-utils jar, but if it doesn't work in your environment, please compile the dynamic link library. And mvn install the jni jar in your local maven repo.

See more Storage Client Examples for how to scan edges and vertices from storage directly.

Meta Client

See Meta Client Example to access graph schemas.

FAQ

Q: Error occurs when building from the source code.

Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (default) on project client: Exit code: 2 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (default) on project client: Exit code: 2

A: This means that you need to have a key to sign the jars

gpg --gen-key #generate your key pair
gpg --list-secret-keys #check if keys are generated successfully

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.