Skip to content

Commit 4bfdd8e

Browse files
Create receipt-generator
1 parent f9ffc3f commit 4bfdd8e

1 file changed

Lines changed: 127 additions & 0 deletions

File tree

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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
13+
# Variables for holding values used in the construction of the receipt
14+
(?holderName as ?holding_institution)
15+
(?holder as ?ds_holding_inst_url)
16+
(?dsid as ?ds_id)
17+
(?manuscript as ?ds_manuscript_url)
18+
(?shelfmark as ?holding_inst_shelfmark)
19+
(?institutionalID as ?holding_inst_id)
20+
(?linkToRecord as ?holding_inst_link)
21+
(?iiifManifest as ?iiif_manifest)
22+
(?holdingLabel as ?ds_holding)
23+
(?holding as ?ds_holding_info_url)
24+
(?dateAdded as ?date_added_to_ds)
25+
(?ds20RecordLabel as ?ds_record)
26+
(?ds20Record as ?ds_record_url)
27+
(?lastUpdated as ?ds_record_last_updated)
28+
{
29+
30+
# Specify a holding institution (remove comment tag)
31+
# BIND (wd:Q16442 as ?holder) # bpl - Boston Public Library
32+
# BIND (wd:Q28019 as ?holder) # burke - Burke Library at Union Theological Seminary
33+
# BIND (wd:Q27887 as ?holder) # columbia - Columbia University Rare Book and Manuscript Library
34+
# BIND (wd:Q667 as ?holder) # conception - Conception Abbey and Seminary
35+
# BIND (wd:Q825 as ?holder) # csl - California State Library
36+
# BIND (wd:Q858 as ?holder) # cuny - City College of New York
37+
# BIND (wd:Q48982 as ?holder) # cornell - Cornell University
38+
# BIND (wd:Q18629 as ?holder) # flp - Free Library of Philadelphia
39+
# BIND (wd:Q868 as ?holder) # grolier - Grolier Club
40+
# BIND (wd:Q1487 as ?holder) # gts - General Theological Seminary
41+
# BIND (wd:Q42438 as ?holder) # harvard - Harvard University
42+
# BIND (wd:Q17632 as ?holder) # hrc - Harry Ransom Center
43+
# BIND (wd:Q42439 as ?holder) # huntington - The Huntington
44+
# BIND (wd:Q1521 as ?holder) # indiana - Indiana University
45+
# BIND (wd:Q6060 as ?holder) # kansas - University of Kansas
46+
# BIND (wd:Q42433 as ?holder) # missouri - University of Missouri
47+
# BIND (wd:Q1123 as ?holder) # nelsonatkins - Nelson-Atkins Museum of Art
48+
# BIND (wd:Q42265 as ?holder) # nyam - New York Academy of Medicine
49+
# BIND (wd:Q1914 as ?holder) # nyu - New York University
50+
# BIND (wd:Q10856 as ?holder) # oregon - University of Oregon
51+
# BIND (wd:Q42431 as ?holder) # osu - Ohio State University
52+
# BIND (wd:Q374 as ?holder) # penn - University of Pennsylvania
53+
# BIND (wd:Q12264 as ?holder) # princeton - Princeton University
54+
# BIND (wd:Q801 as ?holder) # providence - Providence Public Library
55+
# BIND (wd:Q1101 as ?holder) # rome - American Academy in Rome
56+
# BIND (wd:Q1936 as ?holder) # rutgers - Rutgers University
57+
# BIND (wd:Q27854 as ?holder) # shi - Science History Institute
58+
# BIND (wd:Q42440 as ?holder) # slu - Saint Louis University
59+
# BIND (wd:Q1247 as ?holder) # smith - Smith College
60+
# BIND (wd:Q42437 as ?holder) # ucb - University of California, Berkeley
61+
# BIND (wd:Q42441 as ?holder) # ucdavis - University of California, Davis
62+
# BIND (wd:Q42442 as ?holder) # ucr - University of California, Riverside
63+
# BIND (wd:Q17745 as ?holder) # vassar - Vassar College
64+
# BIND (wd:Q42432 as ?holder) # vermont - University of Vermont
65+
# BIND (wd:Q27869 as ?holder) # wmu - Western Michigan University
66+
67+
# holding and holding properties
68+
BIND ( wd:Q2 as ?holdingType )
69+
BIND ( wdt:P16 as ?instanceOf )
70+
BIND ( wdt:P2 as ?hasHolding )
71+
BIND ( pq:P4 as ?qualifierHoldingInstInAuthFile )
72+
BIND ( p:P5 as ?holdingInstitutionAsRecStmt )
73+
BIND ( ps:P5 as ?holdingInstAsRecValue )
74+
BIND ( wdt:P7 as ?hasInstID )
75+
BIND ( wdt:P8 as ?hasShelfmark )
76+
BIND ( wdt:P9 as ?hasLinkToInstRecord )
77+
BIND ( wdt:P38 as ?hasHoldingAddedDate )
78+
BIND ( wdt:P39 as ?hasHoldingEndDate )
79+
80+
# manuscript properties
81+
BIND ( wdt:P1 as ?hasDSID )
82+
83+
# DS 2.0 Record properties
84+
BIND ( wdt:P3 as ?describesManuscript )
85+
BIND ( wdt:P35 as ?hasDateLastUpdated )
86+
BIND ( wdt:P41 as ?hasIIIFManifest )
87+
88+
89+
# holding information
90+
?holding ?instanceOf ?holdingType ;
91+
?holdingInstitutionAsRecStmt ?holdingInstStatement ;
92+
?hasHoldingAddedDate ?dateAdded .
93+
94+
OPTIONAL { ?holding ?hasInstID ?institutionalID }
95+
OPTIONAL { ?holding ?hasShelfmark ?shelfmark }
96+
OPTIONAL { ?holding ?hasLinkToInstRecord ?linkToRecord }
97+
98+
?holdingInstStatement ?qualifierHoldingInstInAuthFie ?holder .
99+
?holder rdfs:label ?holderName .
100+
101+
# finding linked manuscript objects to holding information patterns above
102+
?manuscript ?hasHolding ?holding ;
103+
?hasDSID ?dsid .
104+
?holding rdfs:label ?holdingLabel .
105+
106+
# finding linked DS records to manuscript object patterns above
107+
?ds20Record ?describesManuscript ?manuscript ;
108+
?hasDateLastUpdated ?lastUpdated ;
109+
rdfs:label ?ds20RecordLabel .
110+
111+
# filter results by a period of time when records were last updated
112+
#FILTER ((?lastUpdated > "2024-01-01"^^xsd:dateTime) && (?lastUpdated < "2025-01-01"^^xsd:dateTime)).
113+
114+
# display IIIF manifest URLs if present
115+
OPTIONAL { ?ds20Record ?hasIIIFManifest ?iiifManifest }
116+
117+
# get alphanumerical IDs from Wikibase URIs
118+
BIND (STRDT(REPLACE(STR(?holder), "http.+/entity/", ""), xsd:integer) as ?holderQID)
119+
BIND (STRDT(REPLACE(STR(?holding), "http.+/entity/", ""), xsd:integer) as ?holdingQID)
120+
BIND (STRDT(REPLACE(STR(?manuscript), "http.+/entity/", ""), xsd:integer) as ?manuscriptQID)
121+
122+
SERVICE wikibase:label {
123+
bd:serviceParam wikibase:language "en" .
124+
# allows English language labels to be returned for Wikibase items
125+
}
126+
} ORDER BY DESC(?lastUpdated) ASC(?shelfmark)
127+
# sort results by date updated in Wikibase and then by shelfmark

0 commit comments

Comments
 (0)