Amazon Neptune
User Guide (API Version 2017-11-29)

Connect to Neptune Using Java and SPARQL with Version 4 Signing (RDF4J and Jena)

This section shows how to connect to Neptune using either RDF4J or Apache Jena with Signature Version 4 authentication.

Prerequisites

To connect to Neptune using either RDF4J or Apache Jena with Version 4 signing

  1. Clone the sample repository from GitHub.

    git clone https://github.com/aws/amazon-neptune-sparql-java-sigv4.git
  2. Change into the cloned directory.

    cd amazon-neptune-sparql-java-sigv4
  3. Type one of the following commands to compile and run the example code.

    Replace your-neptune-endpoint with the hostname or IP address of your Neptune DB instance. The default port is 8182.

    Note

    For information about finding the hostname of your Neptune DB instance, see the Amazon Neptune Endpoints section.

    Eclipse RDF4J

    Type the following to run the RDF4J example.

    mvn compile exec:java \ -Dexec.mainClass="com.amazonaws.neptune.client.rdf4j.NeptuneRdf4JSigV4Example" \ -Dexec.args="http://your-neptune-endpoint:8182"

    Apache Jena

    Type the following to run the RDF4J example.

    mvn compile exec:java \ -Dexec.mainClass="com.amazonaws.neptune.client.jena.NeptuneJenaSigV4Example" \ -Dexec.args="http://your-neptune-endpoint:8182"
  4. To view the source code for the example, see the examples in the src/main/java/com/amazonaws/neptune/client/ directory.

To use the SigV4 signing driver in your own Java application, add the amazon-neptune-sigv4-signer Maven package to the <dependencies> section of your pom.xml. We recommend you use the examples as a starting point.