SPARQL Examples
List titles alongside their DOI, where one is recorded.
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?titleLabel ?doi WHERE {
?title dcterms:title ?titleLabel ; owl:sameAs ?doi .
FILTER(CONTAINS(STR(?doi), "doi.org"))
} LIMIT 20
Join titles to their creators (authors) by name.
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?titleLabel ?creatorName WHERE {
?title dcterms:title ?titleLabel ; dcterms:creator ?creator .
?creator foaf:name ?creatorName .
} LIMIT 20
Creators (authors) whose identity is linked to an external identifier, here filtered to Wikidata.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?creator ?name ?linked WHERE {
?creator foaf:name ?name ; owl:sameAs ?linked .
FILTER(CONTAINS(STR(?linked), "wikidata.org"))
} LIMIT 20
Count digitized items per holding institution.
PREFIX bhlv: <https://www.biodiversitylibrary.org/vocab/>
SELECT ?institution (COUNT(*) AS ?n) WHERE {
?item bhlv:institution ?institution .
} GROUP BY ?institution ORDER BY DESC(?n)
Every page BHL's automated name-finder tagged with the four-eyed fish Anableps anableps, with its containing item and publication year.
PREFIX dwc: <http://rs.tdwg.org/dwc/terms/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?page ?item ?year WHERE {
GRAPH <https://koetai.semscape.org/u/0000-0001-9773-4008/bhl/data> {
?page dwc:scientificName "Anableps anableps" ;
dcterms:isPartOf ?item ;
dcterms:date ?year .
}
}
Find titles whose subject heading contains a given word (here: botany).
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?title ?label WHERE {
?title dcterms:subject ?subj ; dcterms:title ?label .
FILTER(CONTAINS(LCASE(?subj), "botany"))
}
List bibliographic titles with their language code and issue year.
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?title ?lang ?year WHERE {
?title dcterms:title ?t ; dcterms:language ?lang ; dcterms:issued ?year .
} LIMIT 20