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

SPARQL HTTP API

SPARQL HTTP requests are accepted at the following endpoint: http://your-neptune-endpoint:8182/sparql

For more information about connecting to Amazon Neptune with SPARQL, see Accessing the Neptune Graph with SPARQL.

For more information about the SPARQL protocol and query language, see the SPARQL 1.1 Protocol and the SPARQL 1.1 Query Language specification.

SPARQL Default Graph and Named Graphs

Amazon Neptune associates every triple with a named graph. The default graph is defined as the union of all named graphs.

Default Graph for Queries

If you submit a SPARQL query without explicitly specifying a graph via the GRAPH keyword or constructs such as FROM NAMED, Neptune will always consider all triples in your DB instance. For example, the following query returns all triples from a Neptune SPARQL endpoint: SELECT * WHERE { ?s ?p ?o }. Triples that appear in more than one graph are returned only once.

For information about the default graph specification, see the RDF Dataset section of the SPARQL 1.1 Query Language specification.

Specifying the Named Graph for Loading, Inserts, or Updates

If you don't specify a named graph when loading, inserting, or updating triples, Neptune uses the fallback named graph defined by the URI http://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph.

Neptune supports the following types of formats for loading Resource Description Framework (RDF) data.

  • Triplesntriples, turtle, and rdfxml formats.

  • Quadsnquads format.

When you issue a Neptune Load request using a triple-based format, you can specify the named graph to use for all triples by using the parserConfiguration: namedGraphUri parameter. For information about the Load command syntax, see Loader Command.

Important

If you don't use this parameter, and you don't specify a named graph, the fallback URI is used: http://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph.

This fallback named graph is also used if you load triples via SPARQL UPDATE without explicitly providing a named graph target.

You can use the quads-based format NQuads to specify a named graph for each triple in the database.

Note

NQuads allows you to leave the named graph blank. In this case, http://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph is used.

You can override the default named graph for NQuads by using the namedGraphUri parser configuration option.

SPARQL UPDATE

  • SPARQL UPDATE LOAD from URI works only with resources that are within the same virtual private cloud (VPC). This includes Amazon S3 URLs in the us-east-1 Region with an Amazon S3 VPC endpoint created. For information about creating a VPC endpoint, see Amazon S3 VPC Endpoint.

  • SPARQL UPDATE LOAD URI must start with http:// or https://. This includes Amazon S3 URIs.

    Any Amazon S3 authentication must be included in the URL. For more information, see Authenticating Requests: Using Query Parameters.

If you need to load data from a file, we recommend that you use the Amazon Neptune loader API. For more information, see Loading Data into Neptune.