30,567
edits
Line 785: | Line 785: | ||
==Authority Record Generator== | ==Authority Record Generator== | ||
This query generates a list of authority records in the Wikibase by authority value type (i.e., all items which are an ''instance of'' a particular Authority Type). | This query generates a list of authority records in the Wikibase by authority value type (i.e., all items which are an ''instance of'' a particular Authority Type). | ||
===Languages=== | |||
<syntaxhighlight lang="SPARQL"> | |||
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:Q12 as ?authorityType) # language authority | |||
?authorityValue wdt:P16 ?authorityType . | |||
# find authority records by authority type specified above | |||
OPTIONAL { ?authorityValue wdt:P42 ?QID . } | |||
# find Wikidata QIDs matched to authority value | |||
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID) | |||
# render QIDs as URLs | |||
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> | |||
===Materials, Places, Terms (Genres and Subjects)=== | ===Materials, Places, Terms (Genres and Subjects)=== | ||
Line 810: | Line 844: | ||
?authorityValue wdt:P16 ?authorityType . | ?authorityValue wdt:P16 ?authorityType . | ||
# find authority records by authority type specified above | # find authority records by authority type specified above | ||
OPTIONAL { ?authorityValue wdt:P44 | OPTIONAL { ?authorityValue wdt:P44 ?externalID . } | ||
# find external IDs matched to authority value | # find external IDs matched to authority value | ||