diff --git a/.circleci.settings.xml b/.circleci.settings.xml
index 709cbf4..b3e253a 100644
--- a/.circleci.settings.xml
+++ b/.circleci.settings.xml
@@ -2,12 +2,12 @@
ossrh
- ${env.OSSRH_USERNMAE}
- ${env.OSSRH_PASSWORD}
+ ${env.OSSH_USERNAME}
+ ${env.OSSH_PASSWORD}
gpg.passphrase
${env.GPG_PASSPHRASE}
-
\ No newline at end of file
+
diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index abebfaf..0000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-# Java Maven CircleCI 2.0 configuration file
-#
-# Check https://circleci.com/docs/2.0/language-java/ for more details
-#
-version: 2
-jobs:
- build:
- docker:
- - image: circleci/openjdk:8u171-jdk
-
- - image: redislabs/redisgraph:2.0-edge
- port: 6379:6379
-
- working_directory: ~/repo
-
- environment:
- # Customize the JVM maximum heap limit
- MAVEN_OPTS: -Xmx3200m
-
- steps:
-
- - checkout
-
- # Download and cache dependencies
- - restore_cache:
- keys:
- - v1-dependencies-{{ checksum "pom.xml" }}
- # fallback to using the latest cache if no exact match is found
- - v1-dependencies-
-
- - run: mvn dependency:go-offline
-
- - save_cache:
- paths:
- - ~/.m2
- key: v1-dependencies-{{ checksum "pom.xml" }}
-
- # run tests!
- # - run: mvn pmd:check
-
- - run: mvn integration-test
-
- - run: mvn cobertura:cobertura
-
- - run: bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
-
- - run: mvn -s .circleci.settings.xml -DskipTests deploy
-
-workflows:
- version: 2
- commit:
- jobs:
- - build
- nightly:
- triggers:
- - schedule:
- cron: "0 0 * * *"
- filters:
- branches:
- only:
- - master
- jobs:
- - build
-
diff --git a/.deepsource.toml b/.deepsource.toml
new file mode 100644
index 0000000..424f975
--- /dev/null
+++ b/.deepsource.toml
@@ -0,0 +1,8 @@
+version = 1
+
+[[analyzers]]
+name = "java"
+enabled = true
+
+ [analyzers.meta]
+ runtime_version = "8"
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..ac6621f
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "" # See documentation for possible values
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "weekly"
diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml
new file mode 100644
index 0000000..0eb1ee3
--- /dev/null
+++ b/.github/release-drafter-config.yml
@@ -0,0 +1,21 @@
+name-template: 'Version $NEXT_PATCH_VERSION'
+tag-template: 'v$NEXT_PATCH_VERSION'
+categories:
+ - title: 'Features'
+ labels:
+ - 'feature'
+ - 'enhancement'
+ - title: 'Bug Fixes'
+ labels:
+ - 'fix'
+ - 'bugfix'
+ - 'bug'
+ - title: 'Maintenance'
+ label: 'chore'
+change-template: '- $TITLE (#$NUMBER)'
+exclude-labels:
+ - 'skip-changelog'
+template: |
+ ## Changes
+
+ $CHANGES
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000..bf5c325
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,41 @@
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+ schedule:
+ - cron: "56 20 * * 3"
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ java ]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ queries: +security-and-quality
+
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v2
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{ matrix.language }}"
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
new file mode 100644
index 0000000..ec2d88b
--- /dev/null
+++ b/.github/workflows/release-drafter.yml
@@ -0,0 +1,19 @@
+name: Release Drafter
+
+on:
+ push:
+ # branches to consider in the event; optional, defaults to all
+ branches:
+ - master
+
+jobs:
+ update_release_draft:
+ runs-on: ubuntu-latest
+ steps:
+ # Drafts your next Release notes as Pull Requests are merged into "master"
+ - uses: release-drafter/release-drafter@v5
+ with:
+ # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
+ config-name: release-drafter-config.yml
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/version-and-release.yml b/.github/workflows/version-and-release.yml
new file mode 100644
index 0000000..255c634
--- /dev/null
+++ b/.github/workflows/version-and-release.yml
@@ -0,0 +1,46 @@
+name: Release
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: get version from tag
+ id: get_version
+ run: |
+ realversion="${GITHUB_REF/refs\/tags\//}"
+ realversion="${realversion//v/}"
+ echo "::set-output name=VERSION::$realversion"
+
+ - name: Set up publishing to maven central
+ uses: actions/setup-java@v2
+ with:
+ java-version: '8'
+ distribution: 'adopt'
+ server-id: ossrh
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+
+ - name: mvn versions
+ run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
+
+ - name: Install gpg key
+ run: |
+ cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import
+ gpg --list-secret-keys --keyid-format LONG
+
+ - name: Publish
+ run: |
+ mvn --no-transfer-progress \
+ --batch-mode \
+ -Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \
+ -DskipTests deploy -P release
+ env:
+ MAVEN_USERNAME: ${{secrets.OSSH_USERNAME}}
+ MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}}
diff --git a/README.md b/README.md
index 8ae38a7..5b492ff 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,19 @@
-[](https://github.com/RedisGraph/JRedisGraph)
-[](https://circleci.com/gh/RedisGraph/JRedisGraph/tree/master)
-[](https://maven-badges.herokuapp.com/maven-central/com.redislabs/jredisgraph)
+[](https://github.com/RedisGraph/JRedisGraph/blob/master/LICENSE)
[](https://github.com/RedisGraph/JRedisGraph/releases/latest)
+[](https://maven-badges.herokuapp.com/maven-central/com.redislabs/jredisgraph)
[](https://www.javadoc.io/doc/com.redislabs/jredisgraph)
[](https://codecov.io/gh/RedisGraph/JRedisGraph)
+[](https://snyk.io/test/github/RedisGraph/JRedisGraph?targetFile=pom.xml)
# JRedisGraph
+[](https://forum.redislabs.com/c/modules/redisgraph)
+[](https://discord.gg/gWBRT6P)
+
RedisGraph Java client
+## Deprecation notice
+
+As of [Jedis](https://github.com/redis/jedis) version 4.2.0, this library is deprecated. Its features have been merged into Jedis. Please either install it from [maven](https://mvnrepository.com/artifact/redis.clients/jedis) or [the repo](https://github.com/redis/jedis).
### Official Releases
@@ -16,14 +22,12 @@ RedisGraph Java client
com.redislabs
jredisgraph
- 1.0.4
+ 2.5.1
```
### Snapshots
-To be used with RedisGraph 2.0 (not officially released)
-
```xml
@@ -40,33 +44,81 @@ and
com.redislabs
jredisgraph
- 2.0.0-SNAPSHOT
+ 2.6.0-SNAPSHOT
```
-# Example: Using the Java Client
-
+## Example: Using the Java Client
```java
package com.redislabs.redisgraph;
-public class RedisGraphExample {
- public static void main(String[] args) {
-
- RedisGraphAPI api = new RedisGraphAPI("social");
-
- api.query("CREATE (:person{name:'roi',age:32})");
- api.query("CREATE (:person{name:%s,age:%d})", "amit", 30);
+import com.redislabs.redisgraph.graph_entities.Edge;
+import com.redislabs.redisgraph.graph_entities.Node;
+import com.redislabs.redisgraph.graph_entities.Path;
+import com.redislabs.redisgraph.impl.api.RedisGraph;
- api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
+import java.util.List;
- ResultSet resultSet = api.query("MATCH (a:person)-[:knows]->(b:person) RETURN a, b");
-
- while(resultSet.hasNext()){
- Record record = resultSet.next();
- System.out.println(record.getString("a.name"));
- }
- }
+public class RedisGraphExample {
+ public static void main(String[] args) {
+ // general context api. Not bound to graph key or connection
+ RedisGraph graph = new RedisGraph();
+
+ Map params = new HashMap<>();
+ params.put("age", 30);
+ params.put("name", "amit");
+
+ // send queries to a specific graph called "social"
+ graph.query("social","CREATE (:person{name:'roi',age:32})");
+ graph.query("social","CREATE (:person{name:$name,age:$age})", params);
+ graph.query("social","MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
+
+ ResultSet resultSet = graph.query("social", "MATCH (a:person)-[r:knows]->(b:person) RETURN a, r, b");
+ while(resultSet.hasNext()) {
+ Record record = resultSet.next();
+ // get values
+ Node a = record.getValue("a");
+ Edge r = record.getValue("r");
+
+ //print record
+ System.out.println(record.toString());
+ }
+
+ resultSet = graph.query("social", "MATCH p = (:person)-[:knows]->(:person) RETURN p");
+ while(resultSet.hasNext()) {
+ Record record = resultSet.next();
+ Path p = record.getValue("p");
+
+ // More path API at Javadoc.
+ System.out.println(p.nodeCount());
+ }
+
+ // delete graph
+ graph.deleteGraph("social");
+
+ // get connection context - closable object
+ try(RedisGraphContext context = graph.getContext()) {
+ context.query("contextSocial","CREATE (:person{name:'roi',age:32})");
+ context.query("social","CREATE (:person{name:$name,age:$age})", params);
+ context.query("contextSocial", "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
+ // WATCH/MULTI/EXEC
+ context.watch("contextSocial");
+ RedisGraphTransaction t = context.multi();
+ t.query("contextSocial", "MATCH (a:person)-[r:knows]->(b:person{name:$name,age:$age}) RETURN a, r, b", params);
+ // support for Redis/Jedis native commands in transaction
+ t.set("x", "1");
+ t.get("x");
+ // get multi/exec results
+ List