Competency Questions and sample SPARQL Queries
Libraries (FaBiO)
CQ1
- Look for all works of author “Schiller”
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gnd: <http://d-nb.info/gnd/>
PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?title ?work ?author
WHERE {
?work rdf:type fabio:Work ;
dcterms:title ?title ;
dcterms:creator ?author .
?author foaf:name ?author_name FILTER regex(?author_name, "Schiller", "i") .
}
Download Results
CQ2
- Look for all items created by “Schiller” with title “RΓ€uber”, exclude partial objects.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gnd: <http://d-nb.info/gnd/>
PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?ddbitem ?title ?author
WHERE {
?ddbitem rdf:type fabio:AnalogItem .
?ddbitem dcterms:creator ?author FILTER (
!EXISTS {
?ddbitem dcterms:isPartOf ?parent
}
)
?author foaf:name ?author_name FILTER regex(str(?author_name), "Schiller", "i") .
?ddbitem dcterms:title ?title FILTER regex(?title, "RΓ€uber", "i") .
}
Download Results
CQ3
- Look for digitized copies of “Die RΓ€uber”
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gnd: <http://d-nb.info/gnd/>
PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?title ?ddbitem ?type ?epub
WHERE {
?work rdf:type fabio:Work ;
fabio:hasRealization ?expression .
?expression fabio:hasRepresentation ?ddbitem ;
dcterms:title ?title
FILTER regex(?title, "Die RΓ€uber", "i") .
?ddbitem dcterms:type ?type ;
fabio:hasReproduction ?di .
?di fabio:isExemplarOf ?epub .
}
Download Results
CQ4
- What are the works of Thomas Mann and the DDB primary objects associated with them?
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gnd: <http://d-nb.info/gnd/>
PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?title ?ddbitem
WHERE {
?work rdf:type fabio:Work .
?work fabio:hasPortrayal ?ddbitem FILTER (
!EXISTS {
?ddbitem dcterms:isPartOf ?parent
}
) .
?work dcterms:creator ?author .
?author foaf:name ?author_name FILTER (regex(?author_name, "Thomas Mann", "i") || regex(?author_name, "Mann, Thomas", "i")).
?work dcterms:title ?title .
}
Download Results
CQ5
- Which languages was Johann Wolfgang von Goethe’s Faust was translated into and how many objects exist per translations?
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gnd: <http://d-nb.info/gnd/>
PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?lang (COUNT (?lang) as ?items)
WHERE {
?expression dcterms:creator ?author .
?author foaf:name ?author_name FILTER (regex(?author_name, "Johann Wolfgang von Goethe", "i") || regex(str(?author_name), "Goethe, Johann Wolfgang von", "i")) .
?expression dcterms:title ?title FILTER regex(?title, "Faust", "i") .
?expression dcterms:language ?lang .
?expression fabio:hasRepresentation ?ddbitem FILTER (
!EXISTS {
?ddbitem dcterms:isPartOf ?parent
}
) .
} GROUP BY ?lang
Download Results
CQ6
- Look for all notable works of Friedrich Schiller as listed in DBPedia that are available in the DDB.
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dbc: <http://dbpedia.org/resource/Category:>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://www.schema.org/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
SELECT DISTINCT ?workLabel ?ddbitem ?digitized ?owner ?ownerName ?thumbnail WHERE {
SERVICE <http://dbpedia.org/sparql> {
?s rdfs:label "Friedrich Schiller"@de .
?s dbo:notableWork ?notableWork .
?notableWork rdfs:label ?workLabel FILTER (LANG(?workLabel)="de") .
}
?ddbitem rdf:type fabio:AnalogItem FILTER (
!EXISTS {
?ddbitem dcterms:isPartOf ?parent
}
)
?ddbitem dcterms:title ?title FILTER regex(?title, ?workLabel, "i") .
?ddbitem fabio:hasReproduction ?digitizedItem .
?digitizedItem fabio:isExemplarOf ?digitized .
?digitized frbr:owner ?owner .
optional { ?owner foaf:name ?ownerName }
optional { ?digitizedItem schema:thumbnail ?thumbnail }
}
CQ7
- What are the notable works (wdt:p800) according to Wikidata?
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dbc: <http://dbpedia.org/resource/Category:>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://www.schema.org/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
SELECT DISTINCT ?workLabel ?ownerName ?ddbitem ?digitized ?thumbnail WHERE {
SERVICE <https://query.wikidata.org/sparql> {
wd:Q22670 wdt:P800 ?notableWork . #Friedrich Schiller
?notableWork rdfs:label ?workLabel FILTER (LANG(?workLabel)="de") .
}
?ddbitem rdf:type fabio:AnalogItem FILTER (
!EXISTS {
?ddbitem dcterms:isPartOf ?parent
}
)
?ddbitem dcterms:title ?title FILTER regex(?title, ?workLabel, "i") .
?ddbitem fabio:hasReproduction ?digitizedItem .
?digitizedItem fabio:isExemplarOf ?digitized .
?digitized frbr:owner ?owner .
optional { ?owner foaf:name ?ownerName }
optional { ?digitizedItem schema:thumbnail ?thumbnail }
}
Download Results
CQ8
- Have there been stage performances of Friedrich Schiller’s works plays? (with Linked Stage Graph lookup)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?title ?lsgUri ?date ?desc (COUNT(?image) AS ?images)
WHERE {
?ddbitem a fabio:Work ;
dcterms:title ?title ;
dcterms:creator ?author .
?author foaf:name ?author_name
FILTER regex(?author_name, "Schiller, Friedrich", "i") .
SERVICE <https://slod.fiz-karlsruhe.de/sparql> {
?lsgUri dcterms:title ?lsgTitle ;
foaf:depiction ?image ;
dcterms:date ?date ;
dcterms:description ?desc .
}
FILTER regex(?lsgTitle, ?title, "i") .
}
Download Results
CQ9
- Look for Schiller’s Jeanne D’Arc (with Wikidata lookup)
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?altName ?author_name ?title ?ddbitem WHERE {
SERVICE <https://query.wikidata.org/sparql> {
wd:Q7226 skos:altLabel ?altName FILTER(lang(?altName)="de").
}
?ddbitem dcterms:title ?title FILTER regex(?title, SUBSTR(?altName,1,12), "i") .
?ddbitem dcterms:creator ?author .
?author foaf:name ?author_name FILTER regex(?author_name, "Friedrich Schiller", "i") .
}
CQ10
- Look for items by other authors belonging to the same literary movement as Friedrich Schiller (with DBPedia lookup)
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dbc: <http://dbpedia.org/resource/Category:>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://www.schema.org/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
SELECT DISTINCT ?otherAuthors ?title ?ddbitem WHERE {
SERVICE <http://dbpedia.org/sparql> {
?s rdfs:label "Friedrich Schiller"@de .
?s dbo:movement ?movement .
?other dbo:movement ?othermovement .
?other rdfs:label ?otherAuthors FILTER (LANG(?otherAuthors)="de") .
FILTER ((?movement = ?othermovement) AND (?other != ?s))
}
?ddbitem rdf:type fabio:AnalogItem FILTER (
!EXISTS {
?ddbitem dcterms:isPartOf ?parent
}
)
?ddbitem dcterms:title ?title ;
dcterms:creator ?creator .
?creator a foaf:Person ;
foaf:lastName ?lastName ;
foaf:givenName ?firstName .
BIND (CONCAT(?firstName, " ", ?lastName) AS ?ddbName ).
FILTER regex(?ddbName, ?otherAuthors, "i")
}
Audio
CQ11
- Which audio objects have musical content?
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?ddbitem ?item WHERE {
?ddbobj rdf:type mo:MusicalItem ;
dcterms:title ?title ;
owl:sameAs ?ddbitem FILTER regex(?ddbitem, "deutsche-digitale-bibliothek", "i")
}
CQ12
- How many objects in the DDB are recordings of Arias?
PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX fabio: <http://purl.org/spar/fabio/>
SELECT DISTINCT COUNT(?ddbobj) WHERE {
?ddbobj rdf:type mo:MusicalItem ;
fabio:hasSubjectTerm ?subject .
?subject skos:prefLabel ?subject_label FILTER regex(?subject_label, "arie", "i")
}
CQ13
- How many objects in the DDB are recordings of animal sounds?
PREFIX aco: <https://w3id.org/ac-ontology/aco#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX fabio: <http://purl.org/spar/fabio/>
SELECT DISTINCT COUNT(?ddbobj) WHERE {
?ddbobj rdf:type aco:AudioItem;
fabio:hasSubjectTerm ?subject .
?subject skos:prefLabel ?subject_label FILTER regex(?subject_label, "tierstimme", "i")
}
CQ14
- Are there audio books in the DDB?
PREFIX aco: <https://w3id.org/ac-ontology/aco#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX fabio: <http://purl.org/spar/fabio/>
SELECT DISTINCT ?ddbitem ?title WHERE {
?ddbobj rdf:type aco:AudioItem;
dcterms:title ?title ;
dcterms:type ?obj_type ;
owl:sameAs ?ddbitem FILTER regex(?ddbitem, "deutsche-digitale-bibliothek", "i") .
?obj_type skos:prefLabel ?type_label FILTER regex(?type_label, "monografie", "i")
}
CQ15
- Are there recordings of arias from Puccini’s Tosca?
PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?ddbitem ?title WHERE {
?ddbobj rdf:type mo:MusicalItem ;
dcterms:creator ?creator ;
dcterms:title ?title FILTER regex (?title, "tosca", "i") .
?ddbobj owl:sameAs ?ddbitem FILTER regex(?ddbitem, "deutsche-digitale-bibliothek", "i") .
?creator foaf:name ?creator_name FILTER regex(?creator_name, "puccini", "i") .
}
CQ16
- How many objects were provided by museums and who are these providers?
PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX aco: <https://w3id.org/ac-ontology/aco#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?provider_name (COUNT(?ddbobj) as ?NumObjects) WHERE {
VALUES (?type) { (mo:MusicalItem) (aco:AudioItem) }
?ddbobj prov:wasDerivedFrom ?dataset .
?dataset prov:wasAttributedTo ?provider .
?provider dcterms:type ?sparte ;
foaf:name ?provider_name .
FILTER regex(?sparte, "sparte006")
} GROUP BY ?provider_name
Last updated on Aug 25, 2021