Skip to content

Commit ac4b60e

Browse files
Create names
1 parent 07ff360 commit ac4b60e

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

  • sparql/beta/authority-record-generator
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# prefixes
2+
PREFIX wd: <https://catalog.digital-scriptorium.org/entity/>
3+
PREFIX wds: <https://catalog.digital-scriptorium.org/entity/statement/>
4+
PREFIX wdv: <https://catalog.digital-scriptorium.org/value/>
5+
PREFIX wdt: <https://catalog.digital-scriptorium.org/prop/direct/>
6+
PREFIX p: <https://catalog.digital-scriptorium.org/prop/>
7+
PREFIX ps: <https://catalog.digital-scriptorium.org/prop/statement/>
8+
PREFIX pq: <https://catalog.digital-scriptorium.org/prop/qualifier/>
9+
PREFIX wikibase: <http://wikiba.se/ontology#>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
SELECT ?authorityValue ?authorityValueLabel ?authorityTypeLabel ?DSID ?externalID
13+
14+
WHERE {
15+
16+
VALUES ?authorityType { wd:Q8 wd:Q9 }
17+
18+
?authorityValue wdt:P16 ?authorityType .
19+
# find authority records by authority type specified above
20+
OPTIONAL { ?authorityValue wdt:P42 ?QID . }
21+
# find Wikidata QIDs matched to authority value
22+
OPTIONAL { ?authorityValue wdt:P1 ?DSID . }
23+
# return DSID for names
24+
25+
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
26+
# render QIDs as URLs
27+
28+
SERVICE wikibase:label {
29+
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
30+
# allows English language labels to be returned for Wikibase items
31+
}
32+
}
33+
ORDER BY ASC (?authorityValueLabel)

0 commit comments

Comments
 (0)