• Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Client API and data importer of Nebula Graph in Java

nebula-java

LICENSE GitHub release GitHub release date codecov

Nebula Java is a Java client for developers to connect their projects to Nebula Graph.

Please be noted that nebula-JDBC(based on nebula-java) is the JDBC implementing for nebula graph.

NOTE: Nebula Java is not thread-safe.

Two main branches of this repository

In this repository, you can find two branches for the source code of Nebula Java of different versions.

The master branch

The master branch is for Nebula Java v2.0, which works with Nebula Graph v2.0 nightly.

This README file provides Java developers with instructions on how to connect to Nebula Graph v2.0.

The v1.0 branch

In the v1.0 branch, you can find source code of these:

  • Nebula Java v1.0, which works with Nebula Graph v1.1.0 and earlier versions only.
  • Nebula Graph Exchange, Nebula Spark Connector, Nebula Flink Connector, and nebula-algorithm.

For more information, see README of v1.0.

The v2.0.0-rc branch

The v2.0.0-rc branch works with Nebula Graph v2.0.0-beta and v2.0.0-rc1, but not for the latest nightly Nebula Graph.

Prerequisites

To use this Java client, do a check of these:

Modify pom.xml

If you use Maven to manage your project, add the following dependency to your pom.xml file. Replace 3.0-SNAPSHOT with an appropriate Nebula Java version. For more versions, visit releases.

  <dependency>
    <groupId>com.vesoft</groupId>
    <artifactId>client</artifactId>
    <version>3.0-SNAPSHOT</version>
  </dependency>

There are the version correspondence between client and Nebula:

Client version Nebula Version
1.0.0 1.0.0
1.0.1 1.1.0,1.2.0
1.1.0 1.1.0,1.2.0
1.2.0 1.1.0,1.2.0,1.2.1
2.0.0-beta 2.0.0-beta
2.0.0-rc1 2.0.0-rc1
2.0.0 2.0.0,2.0.1
2.0.1 2.0.0,2.0.1
2.5.0 2.5.0,2.5.1
2.6.0 2.6.0,2.6.1
2.6.1 2.6.0,2.6.1
3.0.0 3.0.x,3.1.x,3.2.x
3.0-SNAPSHOT nightly

Graph client example

To connect to the nebula-graphd process of Nebula Graph:

NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
nebulaPoolConfig.setMaxConnSize(10);
List<HostAddress> addresses = Arrays.asList(new HostAddress("127.0.0.1", 9669),
        new HostAddress("127.0.0.1", 9670));
NebulaPool pool = new NebulaPool();
pool.init(addresses, nebulaPoolConfig);
Session session = pool.getSession("root", "nebula", false);
session.execute("SHOW HOSTS;");
session.release();
pool.close();

Graph SessionPool example

To use SessionPool, you must config the space to connect for SessionPool. And please notice that SessionPool does not support reconnect for broken connection.

List<HostAddress> addresses = Arrays.asList(new HostAddress("127.0.0.1", 9669));
String spaceName = "test";
String user = "root";
String password = "nebula";
SessionPoolConfig sessionPoolConfig = new SessionPoolConfig(addresses, spaceName, user, password);
SessionPool sessionPool = new SessionPool(sessionPoolConfig);
if (!sessionPool.init()) {
   log.error("session pool init failed.");
   return;
}
ResultSet resultSet;
try {
    resultSet = sessionPool.execute("match (v:player) return v limit 1;");
    System.out.println(resultSet.toString());
} catch (IOErrorException | ClientServerIncompatibleException | AuthFailedException | BindSpaceFailedException e) {
    e.printStackTrace();
    System.exit(1);
} finally {
    sessionPool.close();
}



More Repositories

1

nebula

A distributed, fast open-source graph database featuring horizontal scalability and high availability
C++
10,313
star
2

nebula-graph

A distributed, fast open-source graph database featuring horizontal scalability and high availability. This is an archived repo for v2.5 only, from 2.6.0 +, NebulaGraph switched back to https://github.com/vesoft-inc/nebula
C++
844
star
3

github-statistics

A react static app for displaying github repo statistics like Star History, Fork History and more.
JavaScript
311
star
4

nebula-studio

NebulaGraph Web GUI Tools
TypeScript
188
star
5

nebula-python

Client API of Nebula Graph in Python
Python
181
star
6

nebula-go

Nebula client in Golang
Go
127
star
7

nebula-docker-compose

Docker compose for Nebula Graph
Smarty
101
star
8

nebula-importer

Nebula Graph Importer with Go
Go
88
star
9

nebulagraph-veditor

A Highly customizable JavaScript Diagramming Lib with SVG, HTML, Canvas support.
TypeScript
80
star
10

nebula-operator

Operation utilities for Nebula Graph
Go
77
star
11

nebula-algorithm

Nebula-Algorithm is a Spark Application based on GraphX, which enables state of art Graph Algorithms to run on top of NebulaGraph and write back results to NebulaGraph.
Scala
67
star
12

nebula-storage

A distributed consistent graph storage. This is an archived repo for v2.5 only, from 2.6.0 +, NebulaGraph switched back to https://github.com/vesoft-inc/nebula
C++
59
star
13

nebula-console

Command line interface for the Nebula Graph service
Go
54
star
14

nebula-community

A place where community members and learn from and collaborate with each other.
53
star
15

nebula-docs-cn

Repository for the Chinese documentations
HTML
52
star
16

nebula-docs

Documentations for the Nebula Graph project
HTML
51
star
17

nebula-flink-connector

Flink Connector for Nebula Graph
Java
47
star
18

nebula-spark-connector

Scala
39
star
19

nebula-rust

Nebula Graph Client API in Rust
Rust
34
star
20

nebula-common

Common code for all Nebula projects. This is an archived repo for v2.5 only, from 2.6.0 +, NebulaGraph switched back to https://github.com/vesoft-inc/nebula
C++
31
star
21

nebula-dashboard

Nebula Graph Service Monitor Tool
TypeScript
28
star
22

nebula-exchange

NebulaGraph Exchange is an Apache Spark application to parse data from different sources to NebulaGraph in a distributed environment. It supports both batch and streaming data in various formats and sources including other Graph Databases, RDBMS, Data warehouses, NoSQL, Message Bus, File systems, etc.
Scala
28
star
23

nebula-http-gateway

Gateway to provide HTTP endpoints for the Nebula Graph service.
Go
25
star
24

nebula-spark-utils

Spark related libraries and tools
Scala
23
star
25

nebula-third-party

Project to build third-party dependencies of Nebula Graph
CMake
18
star
26

nebula-cpp

Nebula Graph Client API in C++
C++
17
star
27

nebula-dev-docker

Nebula docker image for development
Shell
15
star
28

nebula-stats-exporter

Data exporter of Nebula Graph
Go
15
star
29

nebula-clients

API of Nebula Graph in different programming languages.
Java
15
star
30

nebula-br

Backup and restore utility for Nebula Graph
Go
14
star
31

k6-plugin

Go
9
star
32

nebula-chaos

Chaos framework for the Storage Service
C++
9
star
33

nebula-ansible

Jinja
6
star
34

nebula-agent

Go
6
star
35

nebula-gears

Gears for Nebula Graph
Shell
3
star
36

auto-sync-repos

sync repos automatically
Python
2
star
37

.github

Smarty
1
star
38

go-pkg

Go
1
star
39

auto-merge-pr

JavaScript
1
star