├── .circleci.settings.xml
├── .deepsource.toml
├── .github
├── dependabot.yml
├── release-drafter-config.yml
└── workflows
│ ├── codeql.yml
│ ├── release-drafter.yml
│ └── version-and-release.yml
├── .gitignore
├── LICENSE
├── README.md
├── pom.xml
└── src
├── main
└── java
│ ├── META-INF
│ └── MANIFEST.MF
│ └── com
│ └── redislabs
│ └── redisgraph
│ ├── Header.java
│ ├── Record.java
│ ├── RedisGraph.java
│ ├── RedisGraphContext.java
│ ├── RedisGraphContextGenerator.java
│ ├── RedisGraphPipeline.java
│ ├── RedisGraphTransaction.java
│ ├── ResultSet.java
│ ├── Statistics.java
│ ├── exceptions
│ └── JRedisGraphException.java
│ ├── graph_entities
│ ├── Edge.java
│ ├── GraphEntity.java
│ ├── Node.java
│ ├── Path.java
│ ├── Point.java
│ └── Property.java
│ └── impl
│ ├── Utils.java
│ ├── api
│ ├── AbstractRedisGraph.java
│ ├── ContextedRedisGraph.java
│ ├── RedisGraph.java
│ ├── RedisGraphCacheHolder.java
│ ├── RedisGraphCommand.java
│ ├── RedisGraphPipeline.java
│ └── RedisGraphTransaction.java
│ ├── graph_cache
│ ├── GraphCache.java
│ ├── GraphCacheList.java
│ └── RedisGraphCaches.java
│ └── resultset
│ ├── HeaderImpl.java
│ ├── RecordImpl.java
│ ├── ResultSetImpl.java
│ ├── ResultSetScalarTypes.java
│ └── StatisticsImpl.java
└── test
└── java
└── com
└── redislabs
└── redisgraph
├── InstantiationTest.java
├── IterableTest.java
├── PipelineTest.java
├── RedisGraphAPITest.java
├── TransactionTest.java
├── exceptions
└── JRedisGraphErrorTest.java
├── graph_entities
└── PathTest.java
├── impl
└── UtilsTest.java
└── test
└── utils
├── PathBuilder.java
└── PathBuilderTest.java
/.circleci.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ossrh
5 | ${env.OSSH_USERNAME}
6 | ${env.OSSH_PASSWORD}
7 |
8 |
9 | gpg.passphrase
10 | ${env.GPG_PASSPHRASE}
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.deepsource.toml:
--------------------------------------------------------------------------------
1 | version = 1
2 |
3 | [[analyzers]]
4 | name = "java"
5 | enabled = true
6 |
7 | [analyzers.meta]
8 | runtime_version = "8"
9 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
--------------------------------------------------------------------------------
/.github/release-drafter-config.yml:
--------------------------------------------------------------------------------
1 | name-template: 'Version $NEXT_PATCH_VERSION'
2 | tag-template: 'v$NEXT_PATCH_VERSION'
3 | categories:
4 | - title: 'Features'
5 | labels:
6 | - 'feature'
7 | - 'enhancement'
8 | - title: 'Bug Fixes'
9 | labels:
10 | - 'fix'
11 | - 'bugfix'
12 | - 'bug'
13 | - title: 'Maintenance'
14 | label: 'chore'
15 | change-template: '- $TITLE (#$NUMBER)'
16 | exclude-labels:
17 | - 'skip-changelog'
18 | template: |
19 | ## Changes
20 |
21 | $CHANGES
22 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | name: "CodeQL"
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | pull_request:
7 | branches: [ "master" ]
8 | schedule:
9 | - cron: "56 20 * * 3"
10 |
11 | jobs:
12 | analyze:
13 | name: Analyze
14 | runs-on: ubuntu-latest
15 | permissions:
16 | actions: read
17 | contents: read
18 | security-events: write
19 |
20 | strategy:
21 | fail-fast: false
22 | matrix:
23 | language: [ java ]
24 |
25 | steps:
26 | - name: Checkout
27 | uses: actions/checkout@v3
28 |
29 | - name: Initialize CodeQL
30 | uses: github/codeql-action/init@v2
31 | with:
32 | languages: ${{ matrix.language }}
33 | queries: +security-and-quality
34 |
35 | - name: Autobuild
36 | uses: github/codeql-action/autobuild@v2
37 |
38 | - name: Perform CodeQL Analysis
39 | uses: github/codeql-action/analyze@v2
40 | with:
41 | category: "/language:${{ matrix.language }}"
42 |
--------------------------------------------------------------------------------
/.github/workflows/release-drafter.yml:
--------------------------------------------------------------------------------
1 | name: Release Drafter
2 |
3 | on:
4 | push:
5 | # branches to consider in the event; optional, defaults to all
6 | branches:
7 | - master
8 |
9 | jobs:
10 | update_release_draft:
11 | runs-on: ubuntu-latest
12 | steps:
13 | # Drafts your next Release notes as Pull Requests are merged into "master"
14 | - uses: release-drafter/release-drafter@v5
15 | with:
16 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
17 | config-name: release-drafter-config.yml
18 | env:
19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 |
--------------------------------------------------------------------------------
/.github/workflows/version-and-release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 |
11 | steps:
12 | - uses: actions/checkout@v2
13 |
14 | - name: get version from tag
15 | id: get_version
16 | run: |
17 | realversion="${GITHUB_REF/refs\/tags\//}"
18 | realversion="${realversion//v/}"
19 | echo "::set-output name=VERSION::$realversion"
20 |
21 | - name: Set up publishing to maven central
22 | uses: actions/setup-java@v2
23 | with:
24 | java-version: '8'
25 | distribution: 'adopt'
26 | server-id: ossrh
27 | server-username: MAVEN_USERNAME
28 | server-password: MAVEN_PASSWORD
29 |
30 | - name: mvn versions
31 | run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
32 |
33 | - name: Install gpg key
34 | run: |
35 | cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import
36 | gpg --list-secret-keys --keyid-format LONG
37 |
38 | - name: Publish
39 | run: |
40 | mvn --no-transfer-progress \
41 | --batch-mode \
42 | -Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \
43 | -DskipTests deploy -P release
44 | env:
45 | MAVEN_USERNAME: ${{secrets.OSSH_USERNAME}}
46 | MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}}
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 | /bin/
4 | /target/
5 | /test-output/
6 |
7 |
8 | # Log file
9 | *.log
10 |
11 | # BlueJ files
12 | *.ctxt
13 |
14 | # Mobile Tools for Java (J2ME)
15 | .mtj.tmp/
16 |
17 | # Package Files #
18 | *.jar
19 | *.war
20 | *.ear
21 | *.zip
22 | *.tar.gz
23 | *.rar
24 |
25 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
26 | hs_err_pid*
27 |
28 | #eclispe
29 | .classpath
30 | .project
31 | /.settings/
32 |
33 | #intelij
34 | .idea
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2018, Redis Labs
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/RedisGraph/JRedisGraph/blob/master/LICENSE)
2 | [](https://github.com/RedisGraph/JRedisGraph/releases/latest)
3 | [](https://maven-badges.herokuapp.com/maven-central/com.redislabs/jredisgraph)
4 | [](https://www.javadoc.io/doc/com.redislabs/jredisgraph)
5 | [](https://codecov.io/gh/RedisGraph/JRedisGraph)
6 | [](https://snyk.io/test/github/RedisGraph/JRedisGraph?targetFile=pom.xml)
7 |
8 | # JRedisGraph
9 | [](https://forum.redislabs.com/c/modules/redisgraph)
10 | [](https://discord.gg/gWBRT6P)
11 |
12 | RedisGraph Java client
13 |
14 | ## Deprecation notice
15 |
16 | 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).
17 |
18 | ### Official Releases
19 |
20 | ```xml
21 |
22 |
23 | com.redislabs
24 | jredisgraph
25 | 2.5.1
26 |
27 |
28 | ```
29 |
30 | ### Snapshots
31 | ```xml
32 |
33 |
34 | snapshots-repo
35 | https://oss.sonatype.org/content/repositories/snapshots
36 |
37 |
38 | ```
39 |
40 | and
41 |
42 | ```xml
43 |
44 |
45 | com.redislabs
46 | jredisgraph
47 | 2.6.0-SNAPSHOT
48 |
49 |
50 | ```
51 |
52 | ## Example: Using the Java Client
53 | ```java
54 | package com.redislabs.redisgraph;
55 |
56 | import com.redislabs.redisgraph.graph_entities.Edge;
57 | import com.redislabs.redisgraph.graph_entities.Node;
58 | import com.redislabs.redisgraph.graph_entities.Path;
59 | import com.redislabs.redisgraph.impl.api.RedisGraph;
60 |
61 | import java.util.List;
62 |
63 | public class RedisGraphExample {
64 | public static void main(String[] args) {
65 | // general context api. Not bound to graph key or connection
66 | RedisGraph graph = new RedisGraph();
67 |
68 | Map params = new HashMap<>();
69 | params.put("age", 30);
70 | params.put("name", "amit");
71 |
72 | // send queries to a specific graph called "social"
73 | graph.query("social","CREATE (:person{name:'roi',age:32})");
74 | graph.query("social","CREATE (:person{name:$name,age:$age})", params);
75 | graph.query("social","MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
76 |
77 | ResultSet resultSet = graph.query("social", "MATCH (a:person)-[r:knows]->(b:person) RETURN a, r, b");
78 | while(resultSet.hasNext()) {
79 | Record record = resultSet.next();
80 | // get values
81 | Node a = record.getValue("a");
82 | Edge r = record.getValue("r");
83 |
84 | //print record
85 | System.out.println(record.toString());
86 | }
87 |
88 | resultSet = graph.query("social", "MATCH p = (:person)-[:knows]->(:person) RETURN p");
89 | while(resultSet.hasNext()) {
90 | Record record = resultSet.next();
91 | Path p = record.getValue("p");
92 |
93 | // More path API at Javadoc.
94 | System.out.println(p.nodeCount());
95 | }
96 |
97 | // delete graph
98 | graph.deleteGraph("social");
99 |
100 | // get connection context - closable object
101 | try(RedisGraphContext context = graph.getContext()) {
102 | context.query("contextSocial","CREATE (:person{name:'roi',age:32})");
103 | context.query("social","CREATE (:person{name:$name,age:$age})", params);
104 | context.query("contextSocial", "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
105 | // WATCH/MULTI/EXEC
106 | context.watch("contextSocial");
107 | RedisGraphTransaction t = context.multi();
108 | t.query("contextSocial", "MATCH (a:person)-[r:knows]->(b:person{name:$name,age:$age}) RETURN a, r, b", params);
109 | // support for Redis/Jedis native commands in transaction
110 | t.set("x", "1");
111 | t.get("x");
112 | // get multi/exec results
113 | List