DS Catalog:SPARQL Query Service/example queries: Difference between revisions

Line 1,764: Line 1,764:


===Terms (Genres and Subjects)===
===Terms (Genres and Subjects)===
<syntaxhighlight lang="SPARQL">
# prefixes
PREFIX wd: <https://catalog.digital-scriptorium.org/entity/>
PREFIX wds: <https://catalog.digital-scriptorium.org/entity/statement/>
PREFIX wdv: <https://catalog.digital-scriptorium.org/value/>
PREFIX wdt: <https://catalog.digital-scriptorium.org/prop/direct/>
PREFIX p: <https://catalog.digital-scriptorium.org/prop/>
PREFIX ps: <https://catalog.digital-scriptorium.org/prop/statement/>
PREFIX pq: <https://catalog.digital-scriptorium.org/prop/qualifier/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?authorityValue ?authorityValueLabel ?authorityTypeLabel ?externalID
WHERE {
BIND (wd:Q11 as ?authorityType) # term authority (genre and subject terms)
?authorityValue wdt:P16 ?authorityType .
    # find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P44 ?externalID . }
    # find external IDs matched to authority value
 
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
      # allows English language labels to be returned for Wikibase items
  }
}
ORDER BY ASC (?authorityValueLabel)
</syntaxhighlight>


==Dated Classification Generator==
==Dated Classification Generator==
Bots, Bureaucrats, emailconfirmed, Administrators
30,537

edits