Skip to content

Latest commit

 

History

History
110 lines (76 loc) · 3.46 KB

README.adoc

File metadata and controls

110 lines (76 loc) · 3.46 KB

Java client for Franz AllegroGraph

This is the Java client for the Franz AllegroGraph Knowledge base/triple store. It contains Sesame/RDF4J- and Jena-compatible APIs.

Client prerequisites

For client version >= 5.0.0 Java 17 or newer is required. For client version < 5.0.0 Java 8 or newer is required.

Installation via Maven

The recommended way of using the client API is to create a dependency on its Maven artifact. To do this in a Maven project, add the following to your dependencies:

<dependency>
  <groupId>com.franz</groupId>
  <artifactId>agraph-java-client</artifactId>
  <version>5.0.2-SNAPSHOT</version>
  <scope>compile</scope>
</dependency>

Development

Prerequisites

An AllegroGraph server must be up and running in order to run the tutorials.

The class for each tutorial declares a number of variables near the top of its respective class definition, which provide the information necessary to communicate with AllegroGraph. If necessary, modify these variables to match the settings for your server before compiling each tutorial.

By default, each tutorial looks for AllegroGraph on localhost at port 10035. Each will create a repository named after the respective tutorial in the "java-catalog" catalog.

In order for the tutorial to run successfully, you must ensure that the "java-catalog" catalog has been defined in your agraph.cfg prior to starting AG, or change the value of CATALOG_ID to name a catalog that exists on your server. Use the empty string ("") or null to indicate the root catalog. All other variables must be updated to correspond to your server configuration as well.

Building and testing

This will build and run the tests:

mvn package

Tutorials

There are three tutorials located in tutorials/ that can be compiled and run. They are:

sesame/

Example usage of the AG Sesame/RDF4J interface

jena/

Example usage of the AG Jena interface

attributes/

Example usage of AG Triple Attributes

Compiling Tutorials

Each tutorial is a separate Maven project. To compile the tutorials first install the AllegroGraph Java client into your local repository. This process is described in the 'Usage' section. One way of the installation is a 2-step process. Build and install the agraph-java-client-5.0.2-SNAPSHOT.jar locally by executing the following command in the repository root:

mvn package
mvn install:install-file -Dfile=./target/agraph-java-client-{version}-SNAPSHOT.jar -DpomFile=pom.xml

Then run the following command in the directory containing the tutorial:

mvn compile

Running Tutorials

To run one of the tutorials, use the following command line:

mvn exec:java

in the directory containing the tutorial you wish to run.

Sesame and Jena tutorials contain multiple, numbered examples. It is possible to run just the specified examples by passing their numbers as arguments in the following way:

mvn exec:java -Dexec.args="1 2 3 5 8 13 21"

The argument 'all' indicates that all examples should be run.

License

The license for this code is in the file LICENSE in this directory.