-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsparql-query-template
More file actions
155 lines (138 loc) · 4.86 KB
/
sparql-query-template
File metadata and controls
155 lines (138 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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
?signature
(CONCAT("manuscript containing ",(GROUP_CONCAT(DISTINCT ?titleRecorded;separator="; "))) as ?description)
?instanceOf
(GROUP_CONCAT(DISTINCT ?materialAuthority;separator="|") as ?materialDS)
(GROUP_CONCAT(DISTINCT ?centuryAuthority;separator="|") as ?centuryDS)
(GROUP_CONCAT(DISTINCT ?earliestDateYear;separator="|") as ?earliestDate)
(GROUP_CONCAT(DISTINCT ?latestDateYear;separator="|") as ?latestDate)
(GROUP_CONCAT(DISTINCT ?placeAuthority;separator="|") as ?placeDS)
(GROUP_CONCAT(DISTINCT ?scribeID;separator="|") as ?scribeWikidata)
(GROUP_CONCAT(DISTINCT ?artistID;separator="|") as ?artistWikidata)
(GROUP_CONCAT(DISTINCT ?scriptNote;separator="|") as ?scriptNotes)
(GROUP_CONCAT(DISTINCT ?languageID;separator="|") as ?languageWikidata)
(GROUP_CONCAT(DISTINCT ?titleRecorded;separator="|") as ?titleRecord)
(GROUP_CONCAT(DISTINCT ?standardTitleLabel;separator="|") as ?titleStandard)
(GROUP_CONCAT(DISTINCT ?standardTitle;separator="|") as ?titleDS)
(GROUP_CONCAT(DISTINCT ?authorID;separator="|") as ?authorWikidata)
(GROUP_CONCAT(DISTINCT ?ownerID;separator="|") as ?ownerWikidata)
?holderWikidata
?DSID
?institutionalID
?shelfmark
(GROUP_CONCAT(DISTINCT ?iiifManifest;separator="|") as ?iiifURL)
?record
?search
?link
?dsItemID
WHERE {
BIND("Q87167" as ?instanceOf)
BIND(wd:Q42440 as ?holderDS) # DS QID for holding institution
?record wdt:P16 wd:Q3 .
# material information
OPTIONAL {
?record p:P30 ?materialStatement .
?materialStatement pq:P31 ?materialAuthority .
?materialAuthority wdt:P44 ?materialID .
}
# date information
OPTIONAL {
?record p:P23 ?dateStatement .
?dateStatement pq:P24 ?centuryAuthority .
?centuryAuthority wdt:P44 ?centuryID .
?dateStatement pq:P37 ?earliestDateValue .
?dateStatement pq:P36 ?latestDateValue .
BIND(year(?earliestDateValue) AS ?earliestDateYear)
BIND(year(?latestDateValue) AS ?latestDateYear)
}
# place information
OPTIONAL {
?record p:P27 ?placeStatement .
?placeStatement pq:P28 ?placeAuthority .
?placeAuthority wdt:P44 ?placeID .
}
# scribe information
OPTIONAL {
?record p:P14 ?nameStatement .
?nameStatement pq:P15 wd:Q20 .
?nameStatement pq:P17 ?scribeAuthority .
?scribeAuthority wdt:P42 ?scribeID .
}
# artist information
OPTIONAL {
?record p:P14 ?nameStatement .
?nameStatement pq:P15 wd:Q19 .
?nameStatement pq:P17 ?artistAuthority .
?artistAuthority wdt:P42 ?artistID .
}
# script information
OPTIONAL {
?record wdt:P32 ?note .
FILTER CONTAINS(?note,"Script:")
BIND (?note as ?scriptNote )
}
# language information
OPTIONAL {
?record p:P21 ?languageStatement .
?languageStatement pq:P22 ?languageAuthority .
?languageAuthority wdt:P42 ?languageID .
}
# title information
OPTIONAL {
?record p:P10 ?titleStatement .
?titleStatement ps:P10 ?titleRecorded .
}
OPTIONAL {
?record p:P10 ?titleStatement .
?titleStatement pq:P11 ?standardTitle .
?standardTitle rdfs:label ?standardTitleLabel .
}
# author information
OPTIONAL {
?record p:P14 ?nameStatement .
?nameStatement pq:P15 wd:Q18 .
?nameStatement pq:P17 ?authorAuthority .
?authorAuthority wdt:P42 ?authorID .
}
# former owner information
OPTIONAL {
?record p:P14 ?nameStatement .
?nameStatement pq:P15 wd:Q21 .
?nameStatement pq:P17 ?ownerAuthority .
?ownerAuthority wdt:P42 ?ownerID .
}
?record wdt:P3 ?dsItemID .
?dsItemID wdt:P1 ?DSID .
?dsItemID wdt:P2 ?holdingRecord .
?holdingRecord wdt:P6 wd:Q4 .
?holdingRecord p:P5 ?institutionStatement .
?institutionStatement pq:P4 ?holderDS .
?holderDS rdfs:label ?holderDSLabel .
?holderDS wdt:P42 ?holderWikidata .
# holding information
OPTIONAL {
?holdingRecord wdt:P8 ?shelfmark .
}
OPTIONAL {
?holdingRecord wdt:P7 ?institutionalID .
}
OPTIONAL {
?holdingRecord wdt:P9 ?link .
}
# iiif manifest
OPTIONAL {
?record wdt:P41 ?iiifManifest .
}
BIND(CONCAT("Saint Louis, Missouri, ",?holderDSLabel,", ",?shelfmark) as ?signature) # hard code location for institution
BIND(CONCAT("https://search.digital-scriptorium.org/catalog/",?DSID) as ?search)
}
GROUP BY ?signature ?instanceOf ?holderDS ?holderWikidata ?DSID ?institutionalID ?shelfmark ?record ?link ?search ?dsItemID