Can generate lists from a SPARQL query

Linked (Open) Data - From theory to practice

An RDF data set always represents a sequence of triples, as the following example of the description of the 1974 film "The Great Gatsby" shows:

<rdf:Descriptionrdf:about="http://example.org/movies/TheGreatGatsby1974.rdf"><rdf:typerdf:resource="http://schema.org/Movie"/><schema:name>The Great Gatsby</schema:name><schema:inLanguage>en</schema:inLanguage><schema:directorrdf:resource="http://www.wikidata.org/wiki/Special:EntityData/Q17887.rdf"/><schema:copyrightYear>1974</schema:copyrightYear></rdf:Description>

A SPARQL query specifies the triples to be found in the queried records. In order to find all triples of a data set and to get them as results, the following simple query is necessary:

selectdistinct? S? p? O where {? S? p? O} limit50

The identifiers with a preceding question mark (? S,? P,? O) represent variables; the result of a found pattern is assigned to them. The triple pattern of interest is enclosed in curly brackets ({? S? P? O}). Limit 50 limits the result list.

In order to find only certain triples from several data sets, the corresponding component (subject, predicate, object) is specified. For this purpose, the SPARQL query must be given which namespace (which vocabulary) is required for this (PREFIX). For example, in order to find and display the directors in a list of short film descriptions, the following SPARQL query could be formulated:

PREFIX schema: selectdistinct? S? Director where {? Sschema: director? Director} limit50

The result looks like this:

In order to find the name of the director of the film "Die Herbstzeitlosen", a SPARQL query on Wikidata would have to follow.

The above queries were made with a public SPARQL endpoint. The datasets are available on the web at http://bscw5.fh-htwchur.ch/pub/bscw.cgi/379616/FilmsAndDirectors.rdf.