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

RDF Media Types Used by SPARQL in Neptune

Resource Description Framework (RDF) data can be serialized in many different ways, most of which SPARQL can consume or output:

RDF Serialization Formats Used by Neptune SPARQL

  • RDF/XML  –   XML serialization of RDF, defined in RDF 1.1 XML Syntax. Media type: application/rdf+xml. Typical file extension: .rdf.

  • N-Triples  –   A line-based, plain-text format for encoding an RDF graph, defined in RDF 1.1 N-Triples. Media type: application/n-triples, text/turtle, or text/plain. Typical file extension: .nt.

  • N-Quads  –   A line-based, plain-text format for encoding an RDF graph, defined in RDF 1.1 N-Quads. It is an extension of N-Triples. Media type: application/n-quads, or text/x-nquads when encoded with 7-bit US-ASCII. Typical file extension: .nq.

  • Turtle  –   A textual syntax for RDF defined in RDF 1.1 Turtle that allows an RDF graph to be completely written in a compact and natural text form, with abbreviations for common usage patterns and datatypes. Turtle provides levels of compatibility with the N-Triples format as well as SPARQL's triple pattern syntax. Media type: text/turtleTypical file extension: .ttl.

  • TriG  –   A textual syntax for RDF defined in RDF 1.1 TriG that allows an RDF graph to be completely written in a compact and natural text form, with abbreviations for common usage patterns and datatypes. TriG is an extension of the Turtle format. Media type: application/trig. Typical file extension: .trig.

  • N3 (Notation3)  –   An assertion and logic language defined in Notation3 (N3): A readable RDF syntax. N3 extends the RDF data model by adding formulae (literals which are graphs themselves), variables, logical implication, and functional predicates, and provides a textual syntax alternative to RDF/XML. Media type: text/n3. Typical file extension: .n3.

  • JSON-LD  –   A data serialization and messaging format defined in JSON-LD 1.0.Media type: application/ld+json. Typical file extension: .jsonld.

  • TriX  –   A serialization of RDF in XML, defined in TriX: RDF Triples in XML. Media type: application/trix. Typical file extension: .trix.

  • SPARQL JSON Results  –   A serialization of RDF using the SPARQL 1.1 Query Results JSON Format. Media type: application/sparql-results+json. Typical file extension: .srj.

SPARQL Result Serialization Formats Used by Neptune SPARQL

  • SPARQL XML Results  –   An XML format for the variable binding and boolean results formats provided by the SPARQL query language, defined in SPARQL Query Results XML Format (Second Edition). Media type: application/sparql-results+xml. Typical file extension: .srx.

  • SPARQL CSV and TSV Results  –   The use of comma-separated values and tab-separated values to express SPARQL query results from SELECT queries, defined in SPARQL 1.1 Query Results CSV and TSV Formats. Media type: text/csv for comma-separated values, and text/tab-separated-values for tab-separated values. Typical file extensions: .csv for comma-separated values, and .tsv for tab-separated values.

  • RDF4J Binary Format  –   A binary format for encoding RDF data, documented in RDF4J Binary RDF Format. Media type: application/x-binary-rdf.

  • Binary Results Table  –   A binary format for encoding the output of SPARQL queries. Media type: application/x-binary-rdf-results-table.

  • SPARQL JSON Results  –   A serialization of RDF using the SPARQL 1.1 Query Results JSON Format. Media type: application/sparql-results+json.

Media-Types that Neptune Can Use to Import RDF Data

Media-types supported by the Neptune bulk-loader

Media-types that SPARQL UDATE LOAD can import

Media-Types that Neptune Can Use to Export Query Results

To specify the output format for a SPARQL query response, send an "Accept: media-type" header with the query request. For example:

curl -H "Accept: application/nquads" ...

RDF media-types that SPARQL SELECT can output from Neptune

RDF media-types that SPARQL ASK can output from Neptune

RDF media-types that SPARQL CONSTRUCT can output from Neptune

RDF media-types that SPARQL DESCRIBE can output from Neptune