Developer Information
Basic URI Space Setup, Endpoints and Content
The URI space of the KTBL LOD service contains the following elements:
- https://srv.ktbl.de/vocabulary: core property and class definitions for the entities delivered through the service
- https://srv.ktbl.de/data: the currently published content from the KTBL database accessible via Linked Open Data mechanisms
- https://srv.ktbl.de/taxonomy: terminological hierarchies used
- https://srv.ktbl.de/query: an endpoint for direct queries using the SPARQL query language conforming to version 1.1 of the W3C SPARQL recommendation
Currently available data sets include:
- Machines: https://srv.ktbl.de/data/MachineClass/, including their properties like purchase price, repair costs etc. but also physical parameters like parking width, maximum speed
- Field work processes: https://srv.ktbl.de/data/Workprocess/ including sub-tasks (https://srv.ktbl.de/data/Task/) and machines commonly used for that process
You can retrieve data for a specific data entity by attaching its identifying number to the URL. Issueing for example a HTTP GET towards the URL https://srv.ktbl.de/data/MachineClass/3076 gives the data available for machine number 3076, which is a standard four wheel drive tractor. Per default a html representation of the requested objects is delivered. The Datasets are served using the 303-Mechanism (redirects to the respective requested resource). You can request serializations of the data in other formats using either HTTP content negotiation requesting within the Accept-Header the respective mime types or by attaching the respective suffixes to the request URL as given in the table below. Formats available are:
Format | Suffix | mime type |
---|---|---|
HTML | .html | text/html |
RDF Turtle Syntax | .ttl | text/turtle |
N-Triples | .nt | text/n-triples |
Note that currently no entity list view is implemented. To e. g. get a list of all machines or field work processes available you have thus to use a query against the SPARQL endpoint as given below or the KTBL website search.
Available Classes and Properties
You can find a specification including term definitions here. An RDF(S) version of the vocabulary is available in Turtle Syntax. You can get this version by either HTTP GETing https://srv.ktbl.de/vocabulary.ttl directly or by using content negotiation as described below.
SPARQL Endpoint
The SPARQL endpoint can be reached at https://srv.ktbl.de/query. The endpoint does not support UPDATEs. Queries have to be URL encoded or can be sent via a HTTP POST request. For testing purposes, you can use one of the many SPARQL clients available on the web. The endpoint supports SPARQL 1.1. Tabular query output is supported in the following formats:
Format | mime type |
---|---|
JSON | application/sparql-results+json |
XML | application/sparql-results+xml |
plain text | text/plain |
Comma Separated Values (CSV) | text/csv |
Tab Separated Values (TSV) | text/tab-separated-values |
Thrift | application/sparql-results+thrift |
The following output formats are supported for graph model output (DESCRIBE and CONSTRUCT queries):
Format | mime type |
---|---|
JSON-LD | application/ld+json |
JSON-RDF | application/rdf+json |
RDF/XML | application/rdf+xml |
Turtle | text/turtle |
N-Triples | application/n-triples |
SPARQL Query Examples
Querying all available classes within the endpoint:
SELECT DISTINCT ?class
WHERE { [] a ?class }
ORDER BY ?class
Querying all available properties within and endpoint:
SELECT DISTINCT ?property
WHERE { [] ?property [] }
ORDER BY ?property
Query all machines and their labels:
PREFIX ktblvoc: <https://srv.ktbl.de/vocabulary#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?uri ?label WHERE {
?uri a ktblvoc:MachineClass .
?uri rdfs:label ?label .
}
Query the purchase price value:
PREFIX ktblvoc: <https://srv.ktbl.de/vocabulary#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?uri ?value WHERE {
?uri a ktblvoc:MachineClass .
?uri ktblvoc:purchasePrice ?blank .
?blank rdf:value ?value .
}
Query the purchase price value + unit:
PREFIX ktblvoc: <https://srv.ktbl.de/vocabulary#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?uri ?value ?unit WHERE {
?uri a ktblvoc:MachineClass .
?uri ktblvoc:purchasePrice ?blank .
?blank rdf:value ?value .
?blank ktblvoc:unit ?unit .
}
Query all machines with a purchase price value > 100000:
PREFIX ktblvoc: <https://srv.ktbl.de/vocabulary#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?uri ?value ?unit WHERE {
?uri a ktblvoc:MachineClass .
?uri ktblvoc:purchasePrice ?blank .
?blank rdf:value ?value .
?blank ktblvoc:unit ?unit .
FILTER (?value > 100000) .
}
The same query with order and offset instead of filtering:
PREFIX ktblvoc: <https://srv.ktbl.de/vocabulary#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?uri ?value ?unit WHERE {
?uri a ktblvoc:MachineClass .
?uri ktblvoc:purchasePrice ?blank .
?blank rdf:value ?value .
?blank ktblvoc:unit ?unit .
} ORDER BY ?uri LIMIT 10 OFFSET 100