Skip to content

Commit 49445f9

Browse files
Create by-subjects
1 parent 48e9619 commit 49445f9

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
# find manuscript records with subject terms
13+
SELECT ?record ?recordLabel ?subjectString (GROUP_CONCAT(?termLabel;separator="|") as ?terms) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
14+
WHERE {
15+
# bind query variables
16+
BIND(p:P19 AS ?subjectAsRecordedStatement).
17+
BIND(ps:P19 AS ?subjectAsRecorded).
18+
BIND(pq:P20 AS ?hasTerm).
19+
BIND(wdt:P44 AS ?hasExternalURI).
20+
# statement: manuscript record has statement for subject
21+
?record ?subjectAsRecordedStatement ?subjectStatement .
22+
# statement: subject statement has subject object recorded as string value
23+
?subjectStatement ?subjectAsRecorded ?subjectString .
24+
# statement: subject statement may have qualifier for structured/authority value
25+
# statement: authority value is represented by URI in external controlled vocabulary
26+
OPTIONAL {
27+
?subjectStatement ?hasTerm ?term .
28+
?term ?hasExternalURI ?externalID .
29+
}
30+
31+
# return English language labels
32+
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
33+
?record rdfs:label ?recordLabel .
34+
?term rdfs:label ?termLabel .
35+
}
36+
}
37+
GROUP BY ?record ?recordLabel ?subjectString
38+
ORDER BY ?recordLabel

0 commit comments

Comments
 (0)