Content Negotiation/Serialization

Go to “LIDO Terminology – LOD Interface”

Go to “LIDO overview”

LIDO Concepts from the LIDO Terminology can be requested in several formats. Invoking a URI from a web browser will be answered with a human-readable HTML rendering from the xTree vocabulary management system. This works for all forms of URIs as described → here.

For client applications or other machine processing, RDF serializations can be obtained in commonly used formats. Tabular data from SPARQL queries can also be supplied in a CSV format.

The desired serialization format for URI requests can be selected using one of the two methods described below. For SPARQL queries, the response format can be set using a format parameter.

Filename extension

The response format for URI requests can be set by appending a filename extension. URIs invoked from a web browser without such extension will be redirected to an HTML rendering. Suffixes for other response formats are the following:

.rdf or .rdf.xml – the XML syntax for RDF.

.ttl – the Turtle syntax.

.json , .jsonld or .json-ld – the JSON-LD representation.

.nt – the N-Triples respresentation.

.trig – Turtle extended with named graphs, TriG.

Responses in XML or JSON will carry a corresponding MIME type in the “Content-Type” entry of the HTTP header. All other formats will be sent as MIME type “text/plain”, which prevents unintended conversion in web browsers.

Example

GET http://terminology.lido-schema.org/lido00141.rdf HTTP/1.1

HTTP header

Instead of appending a filename extension, the response format to a URI request can also be set using the “Accept” entry in the HTTP protocol request header. Permitted values for this reader entry are:

Accept: text/html – response will be redirected to the HTML rendering.

Accept: text/turtle – response will be in the Turtle syntax.

Accept: application/ld+json – response will be in the JSON-LD format.

Accept: application/json – in this context equivalent to application/ld+json.

Accept: application/rdf+xml – response will be in the XML syntax for RDF.

Example

GET http://terminology.lido-schema.org/lido00141 HTTP/1.1
Accept: text/turtle

SPARQL queries

Serialization formats for SPARQL query responses can only be selected through the format parameter. “Accept” entries in the HTTP header will be ignored.

SELECT

Responses to SELECT queries are in tabular form. If no format parameter is given, then the result will be serialized in a JSON format for SPARQL results. If a different response format is desired, this can be requested by setting a format parameter in addition to the query parameter. The following values for format are supported:

xml –  XML/RDF for SPARQL queries.

json – JSON for SPARQL queries.

csv – CSV for SPQRQL queries.

Example

POST /sparql HTTP/1.1
Host: terminology.lido-schema.org:80

query=PREFIX+dct%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E
%0A%0ASELECT+%3Flatest+WHERE+%7B+%3Fs+dct%3Amodified+%3Flatest+
%7D+ORDER+BY+DESC(%3Flatest)+LIMIT+5&format=csv

CONSTRUCT and DESCRIBE

These query types deliver RDF graphs as results. The default serialization format is JSON-LD. The format parameter for such queries can have the following values:

ttl – Turtle

xml – XML/RDF

json – JSON-LD

nt – N-Triples

trig – TriG (Turtle extension with support for named graphs).

Example

POST /sparql HTTP/1.1
Host: terminology.lido-schema.org:80

query=DESCRIBE+%3Chttp%3A%2F%2Fterminology.lido-schema.org%2Flido00141
%3E&format=nt