DS Catalog:SPARQL Query Service/example queries: Difference between revisions
(→Genre) |
|||
(71 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
The decision to separate but link metadata descriptions from their manuscript objects was purposeful so as not to make any direct claims or assertions about the manuscript object other than its existence (which happens through assignment of a unique persistent identifier: the DS ID). In this way, the DS Record is conceptualized as a document which makes statements about a manuscript object which are not inherent to the manuscript object itself and can be revised at any time. Although the DS data model is designed to have only one DS Record linked to a Manuscript, this conceptualization of descriptive documents as separate from described objects potentially allows many different (and potentially competing) descriptions to be linked to the same object simultaneously. | The decision to separate but link metadata descriptions from their manuscript objects was purposeful so as not to make any direct claims or assertions about the manuscript object other than its existence (which happens through assignment of a unique persistent identifier: the DS ID). In this way, the DS Record is conceptualized as a document which makes statements about a manuscript object which are not inherent to the manuscript object itself and can be revised at any time. Although the DS data model is designed to have only one DS Record linked to a Manuscript, this conceptualization of descriptive documents as separate from described objects potentially allows many different (and potentially competing) descriptions to be linked to the same object simultaneously. | ||
Because of this data structure, unlike traditional library catalogs or search interfaces ([https://search.digital-scriptorium.org/ like the one for the DS Catalog]), users may find that SPARQL queries seem at first circuitous in comparison to other search and retrieval systems. This is because graphs databases like the DS Wikibase are queried on the basis of pattern matching for particular entities (items) and relationships between entities. A machine rapidly traverses the graph finding patterns that match the path indicated by the query. For purposes of querying DS data, that means that seemingly disparate elements of DS Records, Manuscripts, and even [https://catalog.digital-scriptorium.org/entity/Q2 Holding Information] (i.e., information about and assigned by the institution that owns and/or contributes data about a manuscript object) may all need to be invoked as part of a constructed queried in order to get solutions to seemingly simple questions (such as which institutions own items with texts authored by Avicenna). Taking some time to understand the items, properties, and linking structures in the DS data model and its substantiation in the DS Wikibase will help to elucidate how queries of this nature can be constructed. | Because of this data structure, unlike traditional library catalogs or search interfaces ([https://search.digital-scriptorium.org/ like the one for the DS Catalog]), users may find that SPARQL queries seem at first circuitous in comparison to other search and retrieval systems. This is because graphs databases like the DS Wikibase are queried on the basis of pattern matching for particular entities (items) and relationships between entities. A machine rapidly traverses the graph finding patterns that match the path indicated by the query. For purposes of querying DS data, that means that seemingly disparate elements of DS Records, Manuscripts, and even [https://catalog.digital-scriptorium.org/entity/Q2 Holding Information] (i.e., information about and assigned by the institution that owns and/or contributes data about a manuscript object) may all need to be invoked as part of a constructed queried in order to get solutions to seemingly simple questions ([https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20with%20authors%20recorded%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FnameString%20%3FauthorLabel%20%3FinstitutionLabel%20%3Fshelfmark%0AWHERE%20%7B%0A%20%20%0A%23%20author%20is%20Avicenna%0AVALUES%20%3Fauthor%20%7B%20wd%3AQ2845%20%7D%0A%20%20%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP14%20AS%20%3FnameAsRecordedStatement%29.%0A%20%20BIND%28pq%3AP15%20AS%20%3FhasRole%29.%0A%20%20BIND%28ps%3AP14%20AS%20%3FnameAsRecorded%29.%0A%20%20BIND%28pq%3AP17%20AS%20%3FhasName%29.%0A%20%20BIND%28wdt%3AP3%20AS%20%3Fdescribes%29.%0A%20%20BIND%28wdt%3AP2%20AS%20%3FhasHoldingInformation%29.%0A%20%20BIND%28p%3AP5%20AS%20%3FhasInstitutionStatement%29.%0A%20%20BIND%28pq%3AP4%20AS%20%3FhasInstitution%29.%0A%20%20BIND%28wdt%3AP8%20AS%20%3FhasShelfmark%29.%0A%20%20%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20associated%20name%0A%20%20%3Frecord%20%3FnameAsRecordedStatement%20%3FnameStatement%20.%0A%23%20statement%3A%20name%20statement%20has%20name%20object%20recorded%20as%20string%20value%0A%20%20%3FnameStatement%20%3FnameAsRecorded%20%3FnameString%20.%0A%23%20statement%3A%20associated%20name%20has%20role%20of%20author%0A%20%20%3FnameStatement%20%3FhasRole%20wd%3AQ18%20.%0A%23%20statement%3A%20name%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%20%22Avicenna%22%0A%20%20%3FnameStatement%20%3FhasName%20%3Fauthor%20.%0A%23%20statement%3A%20manuscript%20record%20describes%20manuscript%20object%0A%20%20%3Frecord%20%3Fdescribes%20%3Fmanuscript%20.%0A%23%20statement%3A%20manuscript%20has%20holding%20information%0A%20%20%3Fmanuscript%20%3FhasHoldingInformation%20%3Fholding%20.%0A%23%20statement%3A%20holding%20has%20statement%20about%20holding%20institution%0A%20%20%3Fholding%20%3FhasInstitutionStatement%20%3FinstitutionStatement%20.%0A%23%20statement%3A%20institution%20statement%20is%20qualified%20by%20authority%20value%0A%20%20%3FinstitutionStatement%20%3FhasInstitution%20%3Finstitution%20.%0A%23%20statement%3A%20holding%20has%20statement%20about%20shelfmark%0A%20%20%3Fholding%20%3FhasShelfmark%20%3Fshelfmark%20.%0A%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FrecordLabel such as which institutions own items with texts authored by Avicenna]). Taking some time to understand the items, properties, and linking structures in the DS data model and its substantiation in the DS Wikibase will help to elucidate how queries of this nature can be constructed. | ||
To help users better understand how queries are constructed, the example queries found below provide comments (which are proceeded by # tags) to explain how clauses and asserted triple patterns function in the context of a query. We hope that working through some of these examples will allow users to construct their own more complex queries as they learn more about how the DS data model operates in concert with their research questions. | To help users better understand how queries are constructed, the example queries found below provide comments (which are proceeded by # tags) to explain how clauses and asserted triple patterns function in the context of a query. We hope that working through some of these examples will allow users to construct their own more complex queries as they learn more about how the DS data model operates in concert with their research questions. | ||
Line 28: | Line 28: | ||
<https://catalog.digital-scriptorium.org/entity/Q88> <https://catalog.digital-scriptorium.org/prop/direct/P16> <https://catalog.digital-scriptorium.org/entity/Q13> . | <https://catalog.digital-scriptorium.org/entity/Q88> <https://catalog.digital-scriptorium.org/prop/direct/P16> <https://catalog.digital-scriptorium.org/entity/Q13> . | ||
</syntaxhighlight> | </syntaxhighlight> | ||
after declaring prefixes, you can type | after declaring prefixes, you can type | ||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
wd:Q88 wdt:P16 wd:Q13 . | wd:Q88 wdt:P16 wd:Q13 . | ||
Line 49: | Line 49: | ||
=Basic Example Queries= | =Basic Example Queries= | ||
Below is a taxonomy of two types of basic queries based on whether the records in the DS Catalog are described by a particular data element in general (e.g., have any author, any assigned genre, or any place of production) or whether the records meet certain criteria (e.g., were produced by a specific author, were assigned a specific genre, or identified as produced in a particular place). The following queries were originally developed by L.P. Coladangelo (DS Catalog and Data Manager) for prototype testing, and adapted by LEADING Fellows Mace Jones and Jade Snelling as part of their | Below is a taxonomy of two types of basic queries based on whether the records in the DS Catalog are described by a particular data element in general (e.g., have any author, any assigned genre, or any place of production) or whether the records meet certain criteria (e.g., were produced by a specific author, were assigned a specific genre, or identified as produced in a particular place). The following queries were originally developed by L.P. Coladangelo (DS Catalog and Data Manager) for prototype testing, and adapted by LEADING Fellows Mace Jones and Jade Snelling as part of their [https://mrc.cci.drexel.edu/leading/fellows/ 2023 LEADING Fellowship] research. | ||
==Manuscripts and their DS records by general data type== | ==Manuscripts and their DS records by general data type== | ||
Line 270: | Line 270: | ||
BIND(wdt:P26 AS ?hasDatedStatus). | BIND(wdt:P26 AS ?hasDatedStatus). | ||
# statement: | # statement: record has statement for dated classification | ||
?record ?hasDatedStatus ?datedStatus . | ?record ?hasDatedStatus ?datedStatus . | ||
# statement: manuscript record may have statement for date of production | |||
OPTIONAL { ?record ?dateAsRecordedStatement ?dateStatement . ?dateStatement ?dateAsRecorded ?dateString . } | |||
# return English language labels | # return English language labels | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE] | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | ||
} | } | ||
} | } | ||
Line 284: | Line 282: | ||
LIMIT 10000 | LIMIT 10000 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20with%20dated%20or%20non-dated%20status%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FdatedStatusLabel%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28wdt%3AP26%20AS%20%3FhasDatedStatus%29.%0A%0A%23%20statement%3A | Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20with%20dated%20or%20non-dated%20status%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FdatedStatusLabel%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28wdt%3AP26%20AS%20%3FhasDatedStatus%29.%0A%0A%23%20statement%3A%20record%20has%20statement%20for%20dated%20classification%0A%20%20%3Frecord%20%3FhasDatedStatus%20%3FdatedStatus%20.%0A%23%20statement%3A%20manuscript%20record%20may%20have%20statement%20for%20date%20of%20production%0A%20%20OPTIONAL%20%7B%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%20%7D%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FrecordLabel%0ALIMIT%2010000 here]. | ||
====Former Owners==== | ====Former Owners==== | ||
Line 797: | Line 795: | ||
====Date of Production==== | ====Date of Production==== | ||
These examples identify records for manuscripts based on production date parameters. | |||
=====Earliest date===== | |||
''Exact earliest date''<br> | |||
This example identifies records for manuscripts with an earliest production date of 1515. | |||
This example identifies manuscripts | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 820: | Line 812: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
# find manuscript records | # find manuscript records by earliest date | ||
SELECT ?record ?recordLabel ? | SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | ||
WHERE { | WHERE { | ||
# bind query variables | # bind query variables | ||
BIND(p: | BIND(p:P23 AS ?dateAsRecordedStatement). | ||
BIND(ps: | BIND(ps:P23 AS ?dateAsRecorded). | ||
BIND(pq: | BIND(pq:P37 AS ?hasEarliestDate). | ||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# statement: manuscript record has statement for | # statement: manuscript record has statement for date of production | ||
?record ? | ?record ?dateAsRecordedStatement ?dateStatement . | ||
# statement: | # statement: manuscript record has statement for date of production | ||
? | ?dateStatement ?dateAsRecorded ?dateString . | ||
# statement: | # statement: date statement has qualifier values for earliest and latest dates (datetime values) | ||
? | ?dateStatement ?hasEarliestDate ?earlyDate . | ||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year equal to 1515 | |||
FILTER (YEAR(?earlyDate) = 1515) . | |||
# return English language labels | # return English language labels | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE] | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | ||
} | } | ||
} | } | ||
ORDER BY ?latestDate ?recordLabel | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records% | Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20earliest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20equal%20to%201515%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3D%201515%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here]. | ||
''Before earliest date''<br> | |||
This example identifies records for manuscripts with an earliest production date before 1066. | |||
This example identifies manuscripts | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 863: | Line 857: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
# find manuscript records | # find manuscript records by earliest date | ||
SELECT ?record ?recordLabel ? | SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | ||
WHERE { | WHERE { | ||
# bind query variables | # bind query variables | ||
BIND(p: | BIND(p:P23 AS ?dateAsRecordedStatement). | ||
BIND(ps: | BIND(ps:P23 AS ?dateAsRecorded). | ||
BIND(pq: | BIND(pq:P37 AS ?hasEarliestDate). | ||
BIND(pq:P36 AS ?hasLatestDate). | |||
# statement: manuscript record has statement for | # render datetime values as years | ||
?record ? | BIND(year(?earlyDate) AS ?earliestDate). | ||
# statement: | BIND(year(?lateDate) AS ?latestDate). | ||
? | |||
# statement: | # statement: manuscript record has statement for date of production | ||
? | ?record ?dateAsRecordedStatement ?dateStatement . | ||
# statement: manuscript record has statement for date of production | |||
?dateStatement ?dateAsRecorded ?dateString . | |||
# statement: date statement has qualifier values for earliest and latest dates (datetime values) | |||
?dateStatement ?hasEarliestDate ?earlyDate . | |||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by less than 1066 | |||
FILTER (YEAR(?earlyDate) < 1066) . | |||
# return English language labels | # return English language labels | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE] | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | ||
} | } | ||
} | } | ||
ORDER BY ?latestDate ?recordLabel | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records% | Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20earliest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20less%20than%201066%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3C%201066%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here]. | ||
This example identifies manuscripts | ''After earliest date''<br> | ||
This example identifies records for manuscripts with an earliest production date after 1066. | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 905: | Line 902: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
# find manuscript records | # find manuscript records by earliest date | ||
SELECT ?record ?recordLabel ? | SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | ||
WHERE { | WHERE { | ||
# bind query variables | # bind query variables | ||
BIND(p: | BIND(p:P23 AS ?dateAsRecordedStatement). | ||
BIND(ps: | BIND(ps:P23 AS ?dateAsRecorded). | ||
BIND(pq: | BIND(pq:P37 AS ?hasEarliestDate). | ||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# statement: manuscript record has statement for | # statement: manuscript record has statement for date of production | ||
?record ? | ?record ?dateAsRecordedStatement ?dateStatement . | ||
# statement: | # statement: manuscript record has statement for date of production | ||
? | ?dateStatement ?dateAsRecorded ?dateString . | ||
# statement: | # statement: date statement has qualifier values for earliest and latest dates (datetime values) | ||
? | ?dateStatement ?hasEarliestDate ?earlyDate . | ||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year greater than 1066 | |||
FILTER (YEAR(?earlyDate) > 1066) . | |||
# return English language labels | # return English language labels | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE] | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | ||
} | } | ||
} | } | ||
ORDER BY ?earliestDate ?recordLabel | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records% | Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20earliest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20greater%20than%201066%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3E%201066%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FearliestDate%20%3FrecordLabel here]. | ||
==== | |||
=====Latest date===== | |||
''Exact latest date''<br> | |||
This example identifies manuscripts | This example identifies records for manuscripts with a latest production date of 1515. | ||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 949: | Line 948: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
# find manuscript records | # find manuscript records by latest date | ||
SELECT ?record ?recordLabel ? | SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | ||
WHERE { | WHERE { | ||
# bind query variables | # bind query variables | ||
BIND(p: | BIND(p:P23 AS ?dateAsRecordedStatement). | ||
BIND(ps: | BIND(ps:P23 AS ?dateAsRecorded). | ||
BIND(pq: | BIND(pq:P37 AS ?hasEarliestDate). | ||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# statement: manuscript record has statement for | # statement: manuscript record has statement for date of production | ||
?record ? | ?record ?dateAsRecordedStatement ?dateStatement . | ||
# statement: | # statement: manuscript record has statement for date of production | ||
? | ?dateStatement ?dateAsRecorded ?dateString . | ||
# statement: | # statement: date statement has qualifier values for earliest and latest dates (datetime values) | ||
? | ?dateStatement ?hasEarliestDate ?earlyDate . | ||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year equal to 1515 | |||
FILTER (YEAR(?lateDate) = 1515) . | |||
# return English language labels | # return English language labels | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE] | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | ||
} | } | ||
} | } | ||
ORDER BY ?latestDate ?recordLabel | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records% | Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20latest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20equal%20to%201515%0A%20%20FILTER%20%28YEAR%28%3FlateDate%29%20%3D%201515%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here]. | ||
''Before latest date''<br> | |||
This example identifies records for manuscripts with a latest production date before 1812. | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 999: | Line 993: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ? | # find manuscript records by latest date | ||
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | |||
WHERE { | WHERE { | ||
# bind query variables | |||
BIND(p:P23 AS ?dateAsRecordedStatement). | |||
BIND(ps:P23 AS ?dateAsRecorded). | |||
BIND(pq:P37 AS ?hasEarliestDate). | |||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# statement: manuscript record has statement for date of production | |||
?record ?dateAsRecordedStatement ?dateStatement . | |||
# statement: manuscript record has statement for date of production | |||
?dateStatement ?dateAsRecorded ?dateString . | |||
# statement: date statement has qualifier values for earliest and latest dates (datetime values) | |||
?dateStatement ?hasEarliestDate ?earlyDate . | |||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year less than 1812 | |||
FILTER (YEAR(?lateDate) < 1812) . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | |||
} | |||
} | } | ||
ORDER BY ?latestDate ?recordLabel | |||
ORDER BY | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20latest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20less%20than%201812%0A%20%20FILTER%20%28YEAR%28%3FlateDate%29%20%3C%201812%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here]. | |||
''After latest date''<br> | |||
This example identifies records for manuscripts with a latest production date after 1812. | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 1,034: | Line 1,038: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ? | # find manuscript records by latest date | ||
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | |||
WHERE { | WHERE { | ||
# bind query variables | |||
BIND(p:P23 AS ?dateAsRecordedStatement). | |||
BIND(ps:P23 AS ?dateAsRecorded). | |||
BIND(pq:P37 AS ?hasEarliestDate). | |||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# | # statement: manuscript record has statement for date of production | ||
?record ?dateAsRecordedStatement ?dateStatement . | |||
# statement: manuscript record has statement for date of production | |||
?dateStatement ?dateAsRecorded ?dateString . | |||
# statement: date statement has qualifier values for earliest and latest dates (datetime values) | |||
?dateStatement ?hasEarliestDate ?earlyDate . | |||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year greater than 1812 | |||
FILTER (YEAR(?lateDate) > 1812) . | |||
# | # return English language labels | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | |||
} | |||
} | } | ||
ORDER BY ?latestDate ?recordLabel | |||
ORDER BY | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20latest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20greater%20than%201812%0A%20%20FILTER%20%28YEAR%28%3FlateDate%29%20%3E%201812%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here]. | |||
=== | =====Date range===== | ||
''Inside date range''<br> | |||
This example identifies records for manuscripts produced between 1377 and 1677. | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 1,070: | Line 1,083: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ? | # find manuscript records by earliest and latest dates | ||
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | |||
WHERE { | WHERE { | ||
# bind query variables | |||
BIND(p:P23 AS ?dateAsRecordedStatement). | |||
BIND(ps:P23 AS ?dateAsRecorded). | |||
BIND(pq:P37 AS ?hasEarliestDate). | |||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# | # statement: manuscript record has statement for date of production | ||
?record ?dateAsRecordedStatement ?dateStatement . | |||
# | # statement: manuscript record has statement for date of production | ||
?dateStatement ?dateAsRecorded ?dateString . | |||
# statement: date statement has qualifier values for earliest and latest dates (datetime values) | |||
?dateStatement ?hasEarliestDate ?earlyDate . | |||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year greater than 1377 and less than 1677 | |||
FILTER (YEAR(?earlyDate) > 1377 && YEAR(?lateDate) < 1677 ) . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | |||
} | |||
} | } | ||
ORDER BY ?earliestDate ?latestDate ?recordLabel | |||
ORDER BY | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20earliest%20and%20latest%20dates%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20greater%20than%201377%20and%20less%20than%201677%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3E%201377%20%26%26%20YEAR%28%3FlateDate%29%20%3C%201677%20%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FearliestDate%20%3FlatestDate%20%3FrecordLabel here]. | |||
''Outside date range''<br> | |||
This example identifies records for manuscripts produced before 1377 and after 1677. | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 1,110: | Line 1,128: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ? | # find manuscript records by earliest and latest dates | ||
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate | |||
WHERE { | |||
# bind query variables | |||
BIND(p:P23 AS ?dateAsRecordedStatement). | |||
BIND(ps:P23 AS ?dateAsRecorded). | |||
BIND(pq:P37 AS ?hasEarliestDate). | |||
BIND(pq:P36 AS ?hasLatestDate). | |||
# render datetime values as years | |||
BIND(year(?earlyDate) AS ?earliestDate). | |||
BIND(year(?lateDate) AS ?latestDate). | |||
# statement: manuscript record has statement for date of production | |||
?record ?dateAsRecordedStatement ?dateStatement . | |||
# statement: manuscript record has statement for date of production | |||
?dateStatement ?dateAsRecorded ?dateString . | |||
# statement: date statement has qualifier values for earliest and latest dates (datetime values) | |||
?dateStatement ?hasEarliestDate ?earlyDate . | |||
?dateStatement ?hasLatestDate ?lateDate . | |||
# filter datetime values by year less than 1377 and greater than 1677 | |||
FILTER (YEAR(?lateDate) < 1377 || YEAR(?earlyDate) > 1677). | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | |||
} | |||
} | } | ||
ORDER BY ?earliestDate ?latestDate ?recordLabel | |||
ORDER BY | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20by%20earliest%20and%20latest%20dates%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20less%20than%201377%20and%20greater%20than%201677%0A%20%20FILTER%20%28YEAR%28%3FlateDate%29%20%3C%201377%20%7C%7C%20YEAR%28%3FearlyDate%29%20%3E%201677%29.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FearliestDate%20%3FlatestDate%20%3FrecordLabel here]. | |||
==Dated | ====Dated status==== | ||
This | =====Dated===== | ||
This example provides a list of records for manuscripts which are dated. | |||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 1,142: | Line 1,173: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
# find | # find manuscript records with dated status | ||
SELECT | SELECT ?record ?recordLabel ?dateString ?datedStatusLabel | ||
?record | WHERE { | ||
? | # set variable value for dated classification to be queried | ||
VALUES ?datedStatus { wd:Q14 } # dated | |||
? | # bind query variables | ||
? | BIND(p:P23 AS ?dateAsRecordedStatement). | ||
( | BIND(ps:P23 AS ?dateAsRecorded). | ||
BIND(wdt:P26 AS ?hasDatedStatus). | |||
# statement: record has statement for dated classification | |||
?record ?hasDatedStatus ?datedStatus . | |||
# statement: manuscript record may have statement for date of production | |||
OPTIONAL { ?record ?dateAsRecordedStatement ?dateStatement . ?dateStatement ?dateAsRecorded ?dateString . } | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | |||
# | } | ||
} | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20with%20dated%20status%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FdatedStatusLabel%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20dated%20classification%20to%20be%20queried%0A%20%20VALUES%20%3FdatedStatus%20%7B%20wd%3AQ14%20%7D%20%23%20dated%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28wdt%3AP26%20AS%20%3FhasDatedStatus%29.%0A%0A%23%20statement%3A%20record%20has%20statement%20for%20dated%20classification%0A%20%20%3Frecord%20%3FhasDatedStatus%20%3FdatedStatus%20.%0A%23%20statement%3A%20manuscript%20record%20may%20have%20statement%20for%20date%20of%20production%0A%20%20OPTIONAL%20%7B%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%20%7D%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FrecordLabel here]. | |||
# | |||
=====Non-dated===== | |||
This example provides a list of records for manuscripts which are not dated. | |||
<syntaxhighlight lang="SPARQL"> | |||
== | |||
This | |||
<syntaxhighlight lang="SPARQL> | |||
# prefixes | # prefixes | ||
PREFIX wd: <https://catalog.digital-scriptorium.org/entity/> | PREFIX wd: <https://catalog.digital-scriptorium.org/entity/> | ||
Line 1,188: | Line 1,210: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
# find manuscript records with non-dated status | |||
SELECT ?record ?recordLabel ?dateString ?datedStatusLabel | |||
WHERE { | |||
# set variable value for dated classification to be queried | |||
VALUES ?datedStatus { wd:Q15 } # non-dated | |||
(? | # bind query variables | ||
(? | BIND(p:P23 AS ?dateAsRecordedStatement). | ||
(? | BIND(ps:P23 AS ?dateAsRecorded). | ||
BIND(wdt:P26 AS ?hasDatedStatus). | |||
# statement: record has statement for dated classification | |||
?record ?hasDatedStatus ?datedStatus . | |||
# statement: manuscript record may have statement for date of production | |||
OPTIONAL { ?record ?dateAsRecordedStatement ?dateStatement . ?dateStatement ?dateAsRecorded ?dateString . } | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". | |||
} | |||
} | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
# | Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20with%20non-dated%20status%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FdatedStatusLabel%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20dated%20classification%20to%20be%20queried%0A%20%20VALUES%20%3FdatedStatus%20%7B%20wd%3AQ15%20%7D%20%23%20non-dated%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28wdt%3AP26%20AS%20%3FhasDatedStatus%29.%0A%0A%23%20statement%3A%20record%20has%20statement%20for%20dated%20classification%0A%20%20%3Frecord%20%3FhasDatedStatus%20%3FdatedStatus%20.%0A%23%20statement%3A%20manuscript%20record%20may%20have%20statement%20for%20date%20of%20production%0A%20%20OPTIONAL%20%7B%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%20%7D%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FrecordLabel here]. | ||
====Genre==== | |||
This example identifies manuscripts which are described as [https://catalog.digital-scriptorium.org/entity/Q155 translations]. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | ||
# find manuscript records for manuscripts assigned particular genre term(s) | |||
SELECT ?record ?recordLabel ?genreString (GROUP_CONCAT(?termLabel;separator="|") as ?genres) | |||
WHERE { | |||
# set variable value for genre or genres to be queried | |||
VALUES ?term { wd:Q155 } # translations (documents) | |||
# bind query variables | |||
BIND(p:P18 AS ?genreAsRecordedStatement). | |||
BIND(ps:P18 AS ?genreAsRecorded). | |||
BIND(pq:P20 AS ?hasTerm). | |||
# statement: manuscript record has statement for genre | |||
? | ?record ?genreAsRecordedStatement ?genreStatement . | ||
# statement: genre statement has genre object recorded as string value | |||
?genreStatement ?genreAsRecorded ?genreString . | |||
# statement: genre statement has qualifier for structured/authority value | |||
?genreStatement ?hasTerm ?term . | |||
? | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?term rdfs:label ?termLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?genreString | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20assigned%20particular%20genre%20term%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FgenreString%20%28GROUP_CONCAT%28%3FtermLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Fgenres%29%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20genre%20or%20genres%20to%20be%20queried%0A%20%20VALUES%20%3Fterm%20%7B%20wd%3AQ155%20%7D%20%23%20translations%20%28documents%29%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP18%20AS%20%3FgenreAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP18%20AS%20%3FgenreAsRecorded%29.%0A%20%20BIND%28pq%3AP20%20AS%20%3FhasTerm%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20genre%0A%20%20%3Frecord%20%3FgenreAsRecordedStatement%20%3FgenreStatement%20.%0A%23%20statement%3A%20genre%20statement%20has%20genre%20object%20recorded%20as%20string%20value%0A%20%20%3FgenreStatement%20%3FgenreAsRecorded%20%3FgenreString%20.%0A%23%20statement%3A%20genre%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FgenreStatement%20%3FhasTerm%20%3Fterm%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Fterm%20rdfs%3Alabel%20%3FtermLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FgenreString%0AORDER%20BY%20%3FrecordLabel here]. | |||
====Holding Institution==== | |||
This example identifies manuscripts held by public libraries currently in the DS Catalog. | |||
<syntaxhighlight lang="SPARQL"> | |||
== | |||
This | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | # prefixes | ||
PREFIX wd: <https://catalog.digital-scriptorium.org/entity/> | PREFIX wd: <https://catalog.digital-scriptorium.org/entity/> | ||
Line 1,310: | Line 1,289: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT | # find manuscript records held by particular institution(s) | ||
SELECT ?record ?recordLabel ?holdingInstitutionLabel ?shelfmark ?link | |||
WHERE { | WHERE { | ||
? | # set variable value for institution or institutions to be queried | ||
VALUES ?holdingInstitution { wd:Q801 wd:Q16442 wd:Q18629 } # Providence Public Library, Boston Public Library, Free Library of Philadelphia | |||
# bind query variables | |||
SERVICE wikibase:label { | BIND(wdt:P3 AS ?describes). | ||
BIND(wdt:P2 AS ?hasHoldingInformation). | |||
BIND(p:P5 AS ?holdingInstitutionAsRecordedStatement). | |||
BIND(pq:P4 AS ?hasHoldingInstitution). | |||
BIND(wdt:P8 AS ?hasShelfmark). | |||
BIND(wdt:P9 AS ?hasLink). | |||
# statement: manuscript record describes manuscript object | |||
?record ?describes ?manuscript . | |||
# statement: manuscript object has holding information | |||
?manuscript ?hasHoldingInformation ?holdingInformation . | |||
# statement: holding information has statement for holding institution | |||
?holdingInformation ?holdingInstitutionAsRecordedStatement ?holdingInstitutionStatement . | |||
# statement: holding institution statement has qualifier for structured/authority value | |||
?holdingInstitutionStatement ?hasHoldingInstitution ?holdingInstitution . | |||
# statement: holding information has shelfmark | |||
?holdingInformation ?hasShelfmark ?shelfmark . | |||
# statement: holding information may have link to online catalog record | |||
OPTIONAL { | |||
?holdingInformation ?hasLink ?link . | |||
} | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
} | |||
} | } | ||
ORDER BY ?holdingInstitutionLabel ?recordLabel | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20held%20by%20particular%20institution%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FholdingInstitutionLabel%20%3Fshelfmark%20%3Flink%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20institution%20or%20institutions%20to%20be%20queried%0AVALUES%20%3FholdingInstitution%20%7B%20wd%3AQ801%20wd%3AQ16442%20wd%3AQ18629%20%7D%20%23%20Providence%20Public%20Library%2C%20Boston%20Public%20Library%2C%20Free%20Library%20of%20Philadelphia%0A%23%20bind%20query%20variables%0A%20%20BIND%28wdt%3AP3%20AS%20%3Fdescribes%29.%0A%20%20BIND%28wdt%3AP2%20AS%20%3FhasHoldingInformation%29.%0A%20%20BIND%28p%3AP5%20AS%20%3FholdingInstitutionAsRecordedStatement%29.%0A%20%20BIND%28pq%3AP4%20AS%20%3FhasHoldingInstitution%29.%0A%20%20BIND%28wdt%3AP8%20AS%20%3FhasShelfmark%29.%0A%20%20BIND%28wdt%3AP9%20AS%20%3FhasLink%29.%0A%0A%23%20statement%3A%20manuscript%20record%20describes%20manuscript%20object%0A%20%20%3Frecord%20%3Fdescribes%20%3Fmanuscript%20.%0A%23%20statement%3A%20manuscript%20object%20has%20holding%20information%0A%20%20%3Fmanuscript%20%3FhasHoldingInformation%20%3FholdingInformation%20.%0A%23%20statement%3A%20holding%20information%20has%20statement%20for%20holding%20institution%0A%20%20%3FholdingInformation%20%3FholdingInstitutionAsRecordedStatement%20%3FholdingInstitutionStatement%20.%0A%23%20statement%3A%20holding%20institution%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FholdingInstitutionStatement%20%3FhasHoldingInstitution%20%3FholdingInstitution%20.%0A%23%20statement%3A%20holding%20information%20has%20shelfmark%0A%20%20%3FholdingInformation%20%3FhasShelfmark%20%3Fshelfmark%20.%0A%23%20statement%3A%20holding%20information%20may%20have%20link%20to%20online%20catalog%20record%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3FholdingInformation%20%3FhasLink%20%3Flink%20.%0A%20%20%20%20%7D%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FholdingInstitutionLabel%20%3FrecordLabel here]. | |||
== | ====Language==== | ||
This | This example identifies manuscripts which contain [https://catalog.digital-scriptorium.org/entity/Q12715 Chinese], [https://catalog.digital-scriptorium.org/entity/Q12711 Japanese], or [https://catalog.digital-scriptorium.org/entity/Q12712 Korean] language content. | ||
<syntaxhighlight lang="SPARQL"> | <syntaxhighlight lang="SPARQL"> | ||
# prefixes | # prefixes | ||
Line 1,341: | Line 1,339: | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT | # find manuscript records for manuscripts in particular language(s) | ||
# find values for the | SELECT ?record ?recordLabel ?languageString (GROUP_CONCAT(?languageLabel;separator="|") as ?languages) | ||
?record | WHERE { | ||
# a | # set variable value for language or languages to be queried | ||
VALUES ?language { wd:Q12711 wd:Q12712 wd:Q12715 } # Japanese, Korean, and Chinese | |||
# bind query variables | |||
BIND(p:P21 AS ?languageAsRecordedStatement). | |||
BIND(ps:P21 AS ?languageAsRecorded). | |||
BIND(pq:P22 AS ?hasLanguage). | |||
# statement: manuscript record has statement for language | |||
?record ?languageAsRecordedStatement ?languageStatement . | |||
# statement: language statement has language object recorded as string value | |||
?languageStatement ?languageAsRecorded ?languageString . | |||
# statement: language statement has qualifier for structured/authority value | |||
?languageStatement ?hasLanguage ?language . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?language rdfs:label ?languageLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?languageString | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20in%20particular%20language%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FlanguageString%20%28GROUP_CONCAT%28%3FlanguageLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Flanguages%29%0AWHERE%20%7B%20%0A%23%20set%20variable%20value%20for%20language%20or%20languages%20to%20be%20queried%0A%20%20VALUES%20%3Flanguage%20%7B%20wd%3AQ12711%20wd%3AQ12712%20wd%3AQ12715%20%7D%20%23%20Japanese%2C%20Korean%2C%20and%20Chinese%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP21%20AS%20%3FlanguageAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP21%20AS%20%3FlanguageAsRecorded%29.%0A%20%20BIND%28pq%3AP22%20AS%20%3FhasLanguage%29.%0A%20%20%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20language%0A%20%20%3Frecord%20%3FlanguageAsRecordedStatement%20%3FlanguageStatement%20.%0A%23%20statement%3A%20language%20statement%20has%20language%20object%20recorded%20as%20string%20value%0A%20%20%3FlanguageStatement%20%3FlanguageAsRecorded%20%3FlanguageString%20.%0A%23%20statement%3A%20language%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FlanguageStatement%20%3FhasLanguage%20%3Flanguage%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Flanguage%20rdfs%3Alabel%20%3FlanguageLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FlanguageString%0AORDER%20BY%20%3FrecordLabel here]. | |||
====Material==== | |||
This example identifies manuscripts which are made of [https://catalog.digital-scriptorium.org/entity/Q30 palm leaf]. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | |||
# find manuscript records described as being made of particular material(s) | |||
SELECT ?record ?recordLabel ?materialString (GROUP_CONCAT(?materialLabel;separator="|") as ?materials) | |||
WHERE { | |||
# set variable value for material or materials to be queried | |||
VALUES ?material { wd:Q30 } # palm leaf material | |||
# bind query variables | |||
BIND(p:P30 AS ?materialAsRecordedStatement). | |||
BIND(ps:P30 AS ?materialAsRecorded). | |||
BIND(pq:P31 AS ?hasMaterial). | |||
# statement: manuscript record has statement for material | |||
?record ?materialAsRecordedStatement ?materialStatement . | |||
# statement: material statement has material object recorded as string value | |||
?materialStatement ?materialAsRecorded ?materialString . | |||
# statement: material statement has qualifier for structured/authority value | |||
?materialStatement ?hasMaterial ?material . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?material rdfs:label ?materialLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?materialString | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20described%20as%20being%20made%20of%20particular%20material%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FmaterialString%20%28GROUP_CONCAT%28%3FmaterialLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Fmaterials%29%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20material%20or%20materials%20to%20be%20queried%0AVALUES%20%3Fmaterial%20%7B%20wd%3AQ30%20%7D%20%23%20palm%20leaf%20material%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP30%20AS%20%3FmaterialAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP30%20AS%20%3FmaterialAsRecorded%29.%0A%20%20BIND%28pq%3AP31%20AS%20%3FhasMaterial%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20material%0A%20%20%3Frecord%20%3FmaterialAsRecordedStatement%20%3FmaterialStatement%20.%0A%23%20statement%3A%20material%20statement%20has%20material%20object%20recorded%20as%20string%20value%0A%20%20%3FmaterialStatement%20%3FmaterialAsRecorded%20%3FmaterialString%20.%0A%23%20statement%3A%20material%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FmaterialStatement%20%3FhasMaterial%20%3Fmaterial%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Fmaterial%20rdfs%3Alabel%20%3FmaterialLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FmaterialString%0AORDER%20BY%20%3FrecordLabel here]. | |||
====Named Entity (Person or Organization)==== | |||
This example identifies manuscripts associated with various personal and corporate named entities, including their roles in manuscript production and trade. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | |||
# find manuscript records for manuscripts associated with particular name(s) (personal or corporate entity or entities) | |||
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?names) ?typeLabel ?roleLabel | |||
WHERE { | |||
# set variable value for name or names to be queried | |||
VALUES ?name { wd:Q383 wd:Q425 wd:Q1488 wd:Q3203 wd:Q28158 } # Lawrence Schoenberg, Catholic Church, Masters of the Gold Scrolls, Ali Qushji, Ananda Coomaraswamy | |||
# bind query variables | |||
BIND(p:P14 AS ?nameAsRecordedStatement). | |||
BIND(ps:P14 AS ?nameAsRecorded). | |||
BIND(pq:P17 AS ?hasName). | |||
BIND(pq:P15 AS ?hasRole). | |||
BIND(wdt:P16 AS ?hasType). | |||
# statement: manuscript record has statement for associated name | |||
?record ?nameAsRecordedStatement ?nameStatement . | |||
# statement: name statement has name object recorded as string value | |||
?nameStatement ?nameAsRecorded ?nameString . | |||
# statement: name statement has qualifier for structured/authority value | |||
?nameStatement ?hasName ?name . | |||
# statement: associated name has role | |||
?nameStatement ?hasRole ?role . | |||
# statement: authority value has type (Personal or Corporate) | |||
?name ?hasType ?type . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?name rdfs:label ?nameLabel . | |||
?role rdfs:label ?roleLabel . | |||
?type rdfs:label ?typeLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?nameString ?roleLabel ?typeLabel | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20associated%20with%20particular%20name%28s%29%20%28personal%20or%20corporate%20entity%20or%20entities%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FnameString%20%28GROUP_CONCAT%28%3FnameLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Fnames%29%20%3FtypeLabel%20%3FroleLabel%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20name%20or%20names%20to%20be%20queried%0AVALUES%20%3Fname%20%7B%20wd%3AQ383%20wd%3AQ425%20wd%3AQ1488%20wd%3AQ3203%20wd%3AQ28158%20%7D%20%23%20Lawrence%20Schoenberg%2C%20Catholic%20Church%2C%20Masters%20of%20the%20Gold%20Scrolls%2C%20Ali%20Qushji%2C%20Ananda%20Coomaraswamy%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP14%20AS%20%3FnameAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP14%20AS%20%3FnameAsRecorded%29.%0A%20%20BIND%28pq%3AP17%20AS%20%3FhasName%29.%0A%20%20BIND%28pq%3AP15%20AS%20%3FhasRole%29.%0A%20%20BIND%28wdt%3AP16%20AS%20%3FhasType%29.%0A%20%20%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20associated%20name%0A%20%20%3Frecord%20%3FnameAsRecordedStatement%20%3FnameStatement%20.%0A%23%20statement%3A%20name%20statement%20has%20name%20object%20recorded%20as%20string%20value%0A%20%20%3FnameStatement%20%3FnameAsRecorded%20%3FnameString%20.%0A%23%20statement%3A%20name%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FnameStatement%20%3FhasName%20%3Fname%20.%0A%23%20statement%3A%20associated%20name%20has%20role%0A%20%20%3FnameStatement%20%3FhasRole%20%3Frole%20.%0A%23%20statement%3A%20authority%20value%20has%20type%20%28Personal%20or%20Corporate%29%0A%20%20%3Fname%20%3FhasType%20%3Ftype%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Fname%20rdfs%3Alabel%20%3FnameLabel%20.%0A%20%20%20%20%3Frole%20rdfs%3Alabel%20%3FroleLabel%20.%0A%20%20%20%20%3Ftype%20rdfs%3Alabel%20%3FtypeLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FnameString%20%3FroleLabel%20%3FtypeLabel%0AORDER%20BY%20%3FrecordLabel here]. | |||
====Place of Production==== | |||
This example identifies manuscripts produced in [https://catalog.digital-scriptorium.org/entity/Q3086 Egypt] or [https://catalog.digital-scriptorium.org/entity/Q3093 Cairo]. | |||
A note on place queries: the DS authorities are not hierarchical, so this query only identifies manuscripts specifically described as being produced in Egypt or in Cairo, and not other places in Egypt, such as other cities or other geographic areas contained within Egypt. To find manuscripts produced in those specific locations, the query would have to include each of those specific values. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | |||
# find manuscript records for manuscripts produced in particular place(s) | |||
SELECT ?record ?recordLabel ?placeString (GROUP_CONCAT(?placeLabel;separator="|") as ?places) | |||
WHERE { | |||
# set variable value for place or places to be queried | |||
VALUES ?place { wd:Q3086 wd:Q3093 } | |||
# bind query variables | |||
BIND(p:P27 AS ?placeAsRecordedStatement). | |||
BIND(ps:P27 AS ?placeAsRecorded). | |||
BIND(pq:P28 AS ?hasPlace). | |||
# statement: manuscript record has statement for place of production | |||
?record ?placeAsRecordedStatement ?placeStatement . | |||
# statement: place statement has place object recorded as string value | |||
?placeStatement ?placeAsRecorded ?placeString . | |||
# statement: place statement has qualifier for structured/authority value | |||
?placeStatement ?hasPlace ?place . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?place rdfs:label ?placeLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?placeString | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20produced%20in%20particular%20place%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FplaceString%20%28GROUP_CONCAT%28%3FplaceLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Fplaces%29%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20place%20or%20places%20to%20be%20queried%0AVALUES%20%3Fplace%20%7B%20wd%3AQ3086%20wd%3AQ3093%20%7D%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP27%20AS%20%3FplaceAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP27%20AS%20%3FplaceAsRecorded%29.%0A%20%20BIND%28pq%3AP28%20AS%20%3FhasPlace%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20place%20of%20production%0A%20%20%3Frecord%20%3FplaceAsRecordedStatement%20%3FplaceStatement%20.%0A%23%20statement%3A%20place%20statement%20has%20place%20object%20recorded%20as%20string%20value%0A%20%20%3FplaceStatement%20%3FplaceAsRecorded%20%3FplaceString%20.%0A%23%20statement%3A%20place%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FplaceStatement%20%3FhasPlace%20%3Fplace%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Fplace%20rdfs%3Alabel%20%3FplaceLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FplaceString%0AORDER%20BY%20%3FrecordLabel here]. | |||
====Subject==== | |||
This example identifies manuscripts described as being about [https://catalog.digital-scriptorium.org/entity/Q3035 Arab astronomy]. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | |||
# find manuscript records for manuscripts assigned particular subject(s) | |||
SELECT ?record ?recordLabel ?subjectString (GROUP_CONCAT(?termLabel;separator="|") as ?subjects) | |||
WHERE { | |||
# set variable value for subject or subjects to be queried | |||
VALUES ?term { wd:Q3035 } # Astronomy, Arab | |||
# bind query variables | |||
BIND(p:P19 AS ?subjectAsRecordedStatement). | |||
BIND(ps:P19 AS ?subjectAsRecorded). | |||
BIND(pq:P20 AS ?hasTerm). | |||
# statement: manuscript record has statement for subject | |||
?record ?subjectAsRecordedStatement ?subjectStatement . | |||
# statement: subject statement has subject object recorded as string value | |||
?subjectStatement ?subjectAsRecorded ?subjectString . | |||
# statement: subject statement has qualifier for structured/authority value | |||
?subjectStatement ?hasTerm ?term . | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?term rdfs:label ?termLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?subjectString | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20assigned%20particular%20subject%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FsubjectString%20%28GROUP_CONCAT%28%3FtermLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Fsubjects%29%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20subject%20or%20subjects%20to%20be%20queried%0AVALUES%20%3Fterm%20%7B%20wd%3AQ3035%20%7D%20%23%20Astronomy%2C%20Arab%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP19%20AS%20%3FsubjectAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP19%20AS%20%3FsubjectAsRecorded%29.%0A%20%20BIND%28pq%3AP20%20AS%20%3FhasTerm%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20subject%0A%20%20%3Frecord%20%3FsubjectAsRecordedStatement%20%3FsubjectStatement%20.%0A%23%20statement%3A%20subject%20statement%20has%20subject%20object%20recorded%20as%20string%20value%0A%20%20%3FsubjectStatement%20%3FsubjectAsRecorded%20%3FsubjectString%20.%0A%23%20statement%3A%20subject%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FsubjectStatement%20%3FhasTerm%20%3Fterm%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Fterm%20rdfs%3Alabel%20%3FtermLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FsubjectString%0AORDER%20BY%20%3FrecordLabel here]. | |||
====Standard Title==== | |||
This example identifies manuscripts that have been assigned a standard title for at least one of the four canonical gospels of the New Testament. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | |||
# find manuscript records for manuscripts with particular standard title(s) | |||
SELECT ?record ?recordLabel ?titleString ?uniformTitleString (GROUP_CONCAT(?standardTitleLabel;separator="|") as ?standardTitles) | |||
WHERE { | |||
# set variable value for standard title or titles to be queried | |||
VALUES ?standardTitle { wd:Q6034 wd:Q1389 wd:Q1347 wd:Q1437 wd:Q665 } # Gospels, Gospel of Matthew, Gospel of Mark, Gospel of Luke, Gospel of John | |||
# bind query variables | |||
BIND(p:P10 AS ?titleAsRecordedStatement). | |||
BIND(ps:P10 AS ?titleAsRecorded). | |||
BIND(ps:P12 AS ?uniformTitleAsRecorded). | |||
BIND(pq:P11 AS ?hasStandardTitle). | |||
# statement: manuscript record has statement for title as recorded | |||
?record ?titleAsRecordedStatement ?titleStatement . | |||
# statement: title statement has title object recorded as string value | |||
?titleStatement ?titleAsRecorded ?titleString . | |||
# statement: title statement has qualifier for structured/authority value | |||
?titleStatement ?hasStandardTitle ?standardTitle . | |||
# statement: record may have uniform title recorded | |||
OPTIONAL { ?record ?uniformTitleAsRecorded ?uniformTitleString . } | |||
# return English language labels | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". | |||
?record rdfs:label ?recordLabel . | |||
?standardTitle rdfs:label ?standardTitleLabel . | |||
} | |||
} | |||
GROUP BY ?record ?recordLabel ?titleString ?uniformTitleString | |||
ORDER BY ?recordLabel | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20with%20particular%20standard%20title%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FtitleString%20%3FuniformTitleString%20%28GROUP_CONCAT%28%3FstandardTitleLabel%3Bseparator%3D%22%7C%22%29%20as%20%3FstandardTitles%29%0AWHERE%20%7B%0A%23%20set%20variable%20value%20for%20standard%20title%20or%20titles%20to%20be%20queried%0AVALUES%20%3FstandardTitle%20%7B%20wd%3AQ6034%20wd%3AQ1389%20wd%3AQ1347%20wd%3AQ1437%20wd%3AQ665%20%7D%20%23%20Gospels%2C%20Gospel%20of%20Matthew%2C%20Gospel%20of%20Mark%2C%20Gospel%20of%20Luke%2C%20Gospel%20of%20John%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP10%20AS%20%3FtitleAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP10%20AS%20%3FtitleAsRecorded%29.%0A%20%20BIND%28ps%3AP12%20AS%20%3FuniformTitleAsRecorded%29.%0A%20%20BIND%28pq%3AP11%20AS%20%3FhasStandardTitle%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20title%20as%20recorded%0A%20%20%3Frecord%20%3FtitleAsRecordedStatement%20%3FtitleStatement%20.%0A%23%20statement%3A%20title%20statement%20has%20title%20object%20recorded%20as%20string%20value%0A%20%20%3FtitleStatement%20%3FtitleAsRecorded%20%3FtitleString%20.%0A%23%20statement%3A%20title%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FtitleStatement%20%3FhasStandardTitle%20%3FstandardTitle%20.%0A%23%20statement%3A%20record%20may%20have%20uniform%20title%20recorded%0A%20%20OPTIONAL%20%7B%20%3Frecord%20%3FuniformTitleAsRecorded%20%3FuniformTitleString%20.%20%7D%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3FstandardTitle%20rdfs%3Alabel%20%3FstandardTitleLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FtitleString%20%3FuniformTitleString%0AORDER%20BY%20%3FrecordLabel here]. | |||
==User generated examples== | |||
===Books of Hours with institutional, date, and place information=== | |||
This is a modified version of a query contributed by Dominique Stutzmann, Directeur de recherche (CNRS), Institut de Recherche et d'Histoire des Textes (IRHT); Honorar-Professor, Humboldt-Universität zu Berlin. | |||
<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 schema: <http://schema.org/> | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |||
SELECT ?record ?recordLabel (GROUP_CONCAT(DISTINCT ?titleString;separator="|") as ?titleAsRecorded) ?DSID ?institutionLabel | |||
?shelfmark ?dateAsRecorded ?dated ?placeAsRecorded (GROUP_CONCAT(DISTINCT ?place2;separator="|") as ?place_norm) (GROUP_CONCAT(DISTINCT ?date3;separator="|") as ?earliest_date) (GROUP_CONCAT(DISTINCT ?date4;separator="|") as ?latest_date) | |||
WHERE | |||
{ | |||
?record p:P10 ?titleStatement . # DS record has a title as recorded statement | |||
?titleStatement ps:P10 ?titleString . # title statement has an as recorded string value | |||
?titleStatement pq:P11 wd:Q795 . # title statement has been enriched/aligned with a standard title "Book of hours (Q795)" | |||
?record wdt:P3 ?ms . # DS record describes a manuscript object | |||
?ms wdt:P1 ?DSID . # manuscript object has a DSID | |||
?ms wdt:P2 ?holding . # manuscript object has holding information | |||
?holding wdt:P5 ?institution . # holding is held by institution as recorded | |||
?holding wdt:P8 ?shelfmark . # holding has assigned shelfmark | |||
OPTIONAL { ?record wdt:P23 ?dateAsRecorded . } # DS record provides "production date as recorded" | |||
OPTIONAL { ?record wdt:P26 ?datedInfo . ?datedInfo rdfs:label ?dated . } # DS record provides "dated" / "non-dated" information | |||
OPTIONAL { ?record wdt:P27 ?placeAsRecorded . } # DS record provides "production place as recorded (P27)" | |||
OPTIONAL { ?record p:P27 ?place . ?place pq:P28 ?placeQual . ?placeQual rdfs:label ?place2 . } # DS record provides "place in authority file (P28)" | |||
OPTIONAL { ?record p:P23 ?date . ?date pq:P37 ?earliestDate . } # DS record provides "earliest date (P37)" | |||
OPTIONAL { ?record p:P23 ?date . ?date pq:P36 ?latestDate . } # DS record provides "latest date (P36)" | |||
# render date values as years | |||
BIND(year(?earliestDate) AS ?date3) | |||
BIND(year(?latestDate) AS ?date4) | |||
# return English language labels for Wikibase items where "Label" is appended to variable name | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } | |||
} | |||
GROUP BY ?record ?recordLabel ?msLabel ?DSID ?institutionLabel ?shelfmark ?dateAsRecorded ?dated ?placeAsRecorded ?place_norm | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#PREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0A%0APREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%20%0ASELECT%20%3Frecord%20%3FrecordLabel%20%28GROUP_CONCAT%28DISTINCT%20%3FtitleString%3Bseparator%3D%22%7C%22%29%20as%20%3FtitleAsRecorded%29%20%3FDSID%20%3FinstitutionLabel%0A%3Fshelfmark%20%3FdateAsRecorded%20%3Fdated%20%3FplaceAsRecorded%20%28GROUP_CONCAT%28DISTINCT%20%3Fplace2%3Bseparator%3D%22%7C%22%29%20as%20%3Fplace_norm%29%20%28GROUP_CONCAT%28DISTINCT%20%3Fdate3%3Bseparator%3D%22%7C%22%29%20as%20%3Fearliest_date%29%20%28GROUP_CONCAT%28DISTINCT%20%3Fdate4%3Bseparator%3D%22%7C%22%29%20as%20%3Flatest_date%29%0AWHERE%0A%7B%0A%20%0A%20%20%3Frecord%20p%3AP10%20%3FtitleStatement%20.%20%23%20DS%20record%20has%20a%20title%20as%20recorded%20statement%0A%20%0A%20%20%3FtitleStatement%20ps%3AP10%20%3FtitleString%20.%20%23%20title%20statement%20has%20an%20as%20recorded%20string%20value%0A%20%20%3FtitleStatement%20pq%3AP11%20wd%3AQ795%20.%20%23%20title%20statement%20has%20been%20enriched%2Faligned%20with%20a%20standard%20title%20%22Book%20of%20hours%20%28Q795%29%22%0A%20%0A%20%20%3Frecord%20wdt%3AP3%20%3Fms%20.%20%23%20DS%20record%20describes%20a%20manuscript%20object%0A%20%20%3Fms%20wdt%3AP1%20%3FDSID%20.%20%23%20manuscript%20object%20has%20a%20DSID%0A%20%20%3Fms%20wdt%3AP2%20%3Fholding%20.%20%23%20manuscript%20object%20has%20holding%20information%0A%20%20%3Fholding%20wdt%3AP5%20%3Finstitution%20.%20%23%20holding%20is%20held%20by%20institution%20as%20recorded%0A%20%20%3Fholding%20wdt%3AP8%20%3Fshelfmark%20.%20%23%20holding%20has%20assigned%20shelfmark%0A%20%20OPTIONAL%20%7B%20%20%3Frecord%20wdt%3AP23%20%3FdateAsRecorded%20.%20%7D%20%20%20%20%20%23%20DS%20record%20provides%20%22production%20date%20as%20recorded%22%0A%20%20OPTIONAL%20%7B%20%20%3Frecord%20wdt%3AP26%20%3FdatedInfo%20.%20%3FdatedInfo%20rdfs%3Alabel%20%3Fdated%20.%20%7D%20%20%23%20DS%20record%20provides%20%22dated%22%20%2F%20%22non-dated%22%20information%0A%20%20OPTIONAL%20%7B%20%20%3Frecord%20wdt%3AP27%20%3FplaceAsRecorded%20.%20%7D%20%23%20DS%20record%20provides%20%22production%20place%20as%20recorded%20%28P27%29%22%0A%20%20OPTIONAL%20%7B%20%20%3Frecord%20p%3AP27%20%3Fplace%20.%20%3Fplace%20pq%3AP28%20%3FplaceQual%20.%20%3FplaceQual%20rdfs%3Alabel%20%3Fplace2%20.%20%7D%20%23%20DS%20record%20provides%20%22place%20in%20authority%20file%20%28P28%29%22%0A%20%20OPTIONAL%20%7B%20%20%3Frecord%20p%3AP23%20%3Fdate%20.%20%3Fdate%20pq%3AP37%20%3FearliestDate%20.%20%7D%20%20%23%20DS%20record%20provides%20%22earliest%20date%20%28P37%29%22%0A%20%20OPTIONAL%20%7B%20%20%3Frecord%20p%3AP23%20%3Fdate%20.%20%3Fdate%20pq%3AP36%20%3FlatestDate%20.%20%7D%20%20%23%20DS%20record%20provides%20%22latest%20date%20%28P36%29%22%0A%20%20%0A%20%20%23%20render%20date%20values%20as%20years%0A%20%20BIND%28year%28%3FearliestDate%29%20AS%20%3Fdate3%29%0A%20%20BIND%28year%28%3FlatestDate%29%20AS%20%3Fdate4%29%0A%20%20%0A%20%20%23%20return%20English%20language%20labels%20for%20Wikibase%20items%20where%20%22Label%22%20is%20appended%20to%20variable%20name%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FmsLabel%20%3FDSID%20%3FinstitutionLabel%20%3Fshelfmark%20%3FdateAsRecorded%20%3Fdated%20%3FplaceAsRecorded%20%3Fplace_norm here]. | |||
=Technical Queries= | |||
The following queries are used in the management of DS data, data enrichment, and the DS Wikibase. | |||
==Authority Record Generator== | |||
These queries generate lists 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"> | |||
# prefixes | |||
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=== | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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:Q17 as ?authorityType) # material authority | |||
?authorityValue wdt:P16 ?authorityType . | |||
# find authority records by authority type specified above | |||
OPTIONAL { ?authorityValue wdt:P44 ?externalID . } | |||
# find external IDs matched to authority value | |||
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> | |||
===Names=== | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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 ?DSID ?externalID | |||
WHERE { | |||
VALUES ?authorityType { wd:Q8 wd:Q9 } | |||
?authorityValue wdt:P16 ?authorityType . | |||
# find authority records by authority type specified above | |||
OPTIONAL { ?authorityValue wdt:P42 ?QID . } | |||
# find Wikidata QIDs matched to authority value | |||
OPTIONAL { ?authorityValue wdt:P1 ?DSID . } | |||
# return DSID for names | |||
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> | |||
===Places=== | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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:Q16 as ?authorityType) # place authority | |||
?authorityValue wdt:P16 ?authorityType . | |||
# find authority records by authority type specified above | |||
OPTIONAL { ?authorityValue wdt:P44 ?externalID . } | |||
# find external IDs matched to authority value | |||
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> | |||
===Standard Titles=== | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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 ?DSID ?externalID | |||
WHERE { | |||
BIND (wd:Q6 as ?authorityType) # standard title authority | |||
?authorityValue wdt:P16 ?authorityType . | |||
# find authority records by authority type specified above | |||
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> | |||
===Terms (Genres and Subjects)=== | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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:Q11 as ?authorityType) # term authority (genre and subject terms) | |||
?authorityValue wdt:P16 ?authorityType . | |||
# find authority records by authority type specified above | |||
OPTIONAL { ?authorityValue wdt:P44 ?externalID . } | |||
# find external IDs matched to authority value | |||
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> | |||
==Dated Classification Generator== | |||
This query generates a list of manuscript items which have and have not be classified as [https://catalog.digital-scriptorium.org/wiki/Property:P26 dated]. Classified items will either be [https://catalog.digital-scriptorium.org/wiki/Item:Q14 dated] or [https://catalog.digital-scriptorium.org/wiki/Item:Q15 non-dated]. Items without a classification are pending more information. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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#> | |||
# find holding and dated information for manuscripts with DS records | |||
SELECT | |||
?record | |||
?holdingLabel | |||
?link | |||
?recordLabel | ?recordLabel | ||
# the name/label of the DS record | ?datedStatusLabel | ||
?string | (GROUP_CONCAT(?dateRecorded;separator="|") as ?datesAsRecorded) | ||
# the string value as recorded in the original catalog record | |||
?authority | WHERE | ||
# a link to the authority record to which the string value has been reconciled | { | ||
?authorityLabel | # statement: record is an instance of a DS record | ||
# a label for the the authority record in the DS database | ?record wdt:P16 wd:Q3 . | ||
#?roleLabel | # statements: record may have a date recorded and may have a dated status | ||
# where applicable, a label for role information (un-comment roleLabel variable when querying name data to get role information) | OPTIONAL { ?record wdt:P23 ?dateRecorded } | ||
OPTIONAL { ?record wdt:P26 ?datedStatus } | |||
WHERE | # statement: record describes manuscript object | ||
# the patterns or conditions that need to be met to return values for the above variables | ?record wdt:P3 ?ms . | ||
{ | # statement: manuscript object has holding information | ||
?record p:P14 ?stringStatement . | ?ms wdt:P2 ?holding . | ||
# identifies records with statements with corresponding property (change P-value for as recorded value to be queried) | # statement: holding information may have link to online institutional record | ||
?stringStatement ps:P14 ?string . | OPTIONAL { ?holding wdt:P9 ?link } | ||
# identifies statements that have strings with corresponding property (change P-value for as recorded value to be queried) | |||
FILTER NOT EXISTS { ?stringStatement pq:P17 ?authority . } | # return English language labels | ||
# identifies those statements which have not been enriched with authority values (change P-value for authority file value to be queried) | SERVICE wikibase:label { | ||
#OPTIONAL { ?stringStatement pq:P15 ?role . } | bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } | ||
# only used for name data, un-comment optional clause when querying name data | } | ||
GROUP BY ?record ?holdingLabel ?link ?recordLabel ?datedStatusLabel | |||
ORDER BY DESC (?datedStatusLabel) | |||
</syntaxhighlight> | |||
==Newly Added or Updated Records== | |||
This query generates a list of DS Records which have been newly added or updated, based on a date-time filter. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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 | |||
(?ds_recordLabel as ?ds_record_name) | |||
(?ds_record as ?ds_record_url) | |||
?ds_catalog_url | |||
(?dsidLabel as ?ds_id) | |||
(?holdingInstLabel as ?holding_institution) | |||
?shelfmark | |||
?link_to_inst_record | |||
?date_added_to_DS | |||
?date_updated_in_DS | |||
WHERE { | |||
?ds_record wdt:P16 wd:Q3 ; | |||
wdt:P34 ?date_added_to_DS ; | |||
wdt:P35 ?date_updated_in_DS ; | |||
wdt:P3 ?dsid ; | |||
rdfs:label ?ds_recordLabel . | |||
?dsid wdt:P2 ?holding ; | |||
rdfs:label ?dsidLabel . | |||
?holding wdt:P8 ?shelfmark ; | |||
p:P5 ?holdingStatement . | |||
?holdingStatement pq:P4 ?holdingInst . | |||
?holdingInst rdfs:label ?holdingInstLabel . | |||
OPTIONAL {?holding wdt:P9 ?link_to_inst_record } | |||
BIND(CONCAT("https://search.digital-scriptorium.org/catalog/",?dsidLabel) AS ?ds_catalog_url) | |||
# filter results by a period of time when records were last added | |||
FILTER ((?date_added_to_DS > "2024-08-15"^^xsd:dateTime) && (?date_added_to_DS < "2024-12-31"^^xsd:dateTime)). | |||
# filter results by a period of time when records were last updated | |||
FILTER ((?date_updated_in_DS > "2024-08-15"^^xsd:dateTime) && (?date_updated_in_DS < "2024-12-31"^^xsd:dateTime)). | |||
SERVICE wikibase:label { | |||
bd:serviceParam wikibase:language "en" . | |||
} | |||
} ORDER BY DESC(?date_updated_in_DS) | |||
</syntaxhighlight> | |||
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0ASELECT%0A%28%3Fds_recordLabel%20as%20%3Fds_record_name%29%0A%28%3Fds_record%20as%20%3Fds_record_url%29%0A%3Fds_catalog_url%0A%28%3FdsidLabel%20as%20%3Fds_id%29%0A%28%3FholdingInstLabel%20as%20%3Fholding_institution%29%0A%3Fshelfmark%0A%3Flink_to_inst_record%0A%3Fdate_added_to_DS%0A%3Fdate_updated_in_DS%0A%0AWHERE%20%7B%0A%20%20%3Fds_record%20wdt%3AP16%20wd%3AQ3%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20wdt%3AP34%20%3Fdate_added_to_DS%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20wdt%3AP35%20%3Fdate_updated_in_DS%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20wdt%3AP3%20%3Fdsid%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20rdfs%3Alabel%20%3Fds_recordLabel%20.%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%3Fdsid%20wdt%3AP2%20%3Fholding%20%3B%0A%20%20%20%20%20%20%20%20rdfs%3Alabel%20%3FdsidLabel%20.%0A%20%20%3Fholding%20wdt%3AP8%20%3Fshelfmark%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20p%3AP5%20%3FholdingStatement%20.%0A%20%20%3FholdingStatement%20pq%3AP4%20%3FholdingInst%20.%0A%20%20%3FholdingInst%20rdfs%3Alabel%20%3FholdingInstLabel%20.%0A%20%20%0A%20%20OPTIONAL%20%7B%3Fholding%20wdt%3AP9%20%3Flink_to_inst_record%20%7D%0A%20%20%0A%20%20%20%20%0ABIND%28CONCAT%28%22https%3A%2F%2Fsearch.digital-scriptorium.org%2Fcatalog%2F%22%2C%3FdsidLabel%29%20AS%20%3Fds_catalog_url%29%0A%20%20%0A%23%20filter%20results%20by%20a%20period%20of%20time%20when%20records%20were%20last%20added%0AFILTER%20%28%28%3Fdate_added_to_DS%20%3E%20%222024-08-15%22%5E%5Exsd%3AdateTime%29%20%26%26%20%28%3Fdate_added_to_DS%20%3C%20%222024-12-31%22%5E%5Exsd%3AdateTime%29%29.%0A%0A%23%20filter%20results%20by%20a%20period%20of%20time%20when%20records%20were%20last%20updated%0AFILTER%20%28%28%3Fdate_updated_in_DS%20%3E%20%222024-08-15%22%5E%5Exsd%3AdateTime%29%20%26%26%20%28%3Fdate_updated_in_DS%20%3C%20%222024-12-31%22%5E%5Exsd%3AdateTime%29%29.%0A%20%20%0A%20%20%0ASERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%0A%20%20%7D%0A%0A%20%20%0A%7D%20ORDER%20BY%20DESC%28%3Fdate_updated_in_DS%29 here]. | |||
==Receipt Generator== | |||
This query generates a list of DS Wikibase items which shows successful ingest of DS Records, creation of Manuscript items / DS IDs, and assignment of Holding information for an institution, to serve as a receipt for data contributions made to the DS Catalog. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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 | |||
# Variables for holding values used in the construction of the receipt | |||
(?holderName as ?holding_institution) | |||
(?holder as ?ds_holding_inst_url) | |||
(?dsid as ?ds_id) | |||
(?manuscript as ?ds_manuscript_url) | |||
(?shelfmark as ?holding_inst_shelfmark) | |||
(?institutionalID as ?holding_inst_id) | |||
(?linkToRecord as ?holding_inst_link) | |||
(?iiifManifest as ?iiif_manifest) | |||
(?holdingLabel as ?ds_holding) | |||
(?holding as ?ds_holding_info_url) | |||
(?dateAdded as ?date_added_to_ds) | |||
(?ds20RecordLabel as ?ds_record) | |||
(?ds20Record as ?ds_record_url) | |||
(?lastUpdated as ?ds_record_last_updated) | |||
{ | |||
# Specify a holding institution (remove comment tag) | |||
# BIND (wd:Q16442 as ?holder) # bpl - Boston Public Library | |||
# BIND (wd:Q28019 as ?holder) # burke - Burke Library at Union Theological Seminary | |||
# BIND (wd:Q27887 as ?holder) # columbia - Columbia University Rare Book and Manuscript Library | |||
# BIND (wd:Q667 as ?holder) # conception - Conception Abbey and Seminary | |||
# BIND (wd:Q825 as ?holder) # csl - California State Library | |||
# BIND (wd:Q858 as ?holder) # cuny - City College of New York | |||
# BIND (wd:Q48982 as ?holder) # cornell - Cornell University | |||
# BIND (wd:Q55342 as ?holder) # dayton - University of Dayton | |||
# BIND (wd:Q18629 as ?holder) # flp - Free Library of Philadelphia | |||
# BIND (wd:Q868 as ?holder) # grolier - Grolier Club | |||
# BIND (wd:Q1487 as ?holder) # gts - General Theological Seminary | |||
# BIND (wd:Q42438 as ?holder) # harvard - Harvard University | |||
# BIND (wd:Q17632 as ?holder) # hrc - Harry Ransom Center | |||
# BIND (wd:Q42439 as ?holder) # huntington - The Huntington | |||
# BIND (wd:Q1521 as ?holder) # indiana - Indiana University | |||
# BIND (wd:Q6060 as ?holder) # kansas - University of Kansas | |||
# BIND (wd:Q42433 as ?holder) # missouri - University of Missouri | |||
# BIND (wd:Q1123 as ?holder) # nelsonatkins - Nelson-Atkins Museum of Art | |||
# BIND (wd:Q42265 as ?holder) # nyam - New York Academy of Medicine | |||
# BIND (wd:Q1914 as ?holder) # nyu - New York University | |||
# BIND (wd:Q10856 as ?holder) # oregon - University of Oregon | |||
# BIND (wd:Q42431 as ?holder) # osu - Ohio State University | |||
# BIND (wd:Q374 as ?holder) # penn - University of Pennsylvania | |||
# BIND (wd:Q12264 as ?holder) # princeton - Princeton University | |||
# BIND (wd:Q801 as ?holder) # providence - Providence Public Library | |||
# BIND (wd:Q1101 as ?holder) # rome - American Academy in Rome | |||
# BIND (wd:Q1936 as ?holder) # rutgers - Rutgers University | |||
# BIND (wd:Q27854 as ?holder) # shi - Science History Institute | |||
# BIND (wd:Q42440 as ?holder) # slu - Saint Louis University | |||
# BIND (wd:Q1247 as ?holder) # smith - Smith College | |||
# BIND (wd:Q42437 as ?holder) # ucb - University of California, Berkeley | |||
# BIND (wd:Q42441 as ?holder) # ucdavis - University of California, Davis | |||
# BIND (wd:Q42442 as ?holder) # ucr - University of California, Riverside | |||
# BIND (wd:Q17745 as ?holder) # vassar - Vassar College | |||
# BIND (wd:Q42432 as ?holder) # vermont - University of Vermont | |||
# BIND (wd:Q54115 as ?holder) # wellesley - Wellesley College | |||
# BIND (wd:Q27869 as ?holder) # wmu - Western Michigan University | |||
# holding and holding properties | |||
BIND ( wd:Q2 as ?holdingType ) | |||
BIND ( wdt:P16 as ?instanceOf ) | |||
BIND ( wdt:P2 as ?hasHolding ) | |||
BIND ( pq:P4 as ?qualifierHoldingInstInAuthFile ) | |||
BIND ( p:P5 as ?holdingInstitutionAsRecStmt ) | |||
BIND ( ps:P5 as ?holdingInstAsRecValue ) | |||
BIND ( wdt:P7 as ?hasInstID ) | |||
BIND ( wdt:P8 as ?hasShelfmark ) | |||
BIND ( wdt:P9 as ?hasLinkToInstRecord ) | |||
BIND ( wdt:P38 as ?hasHoldingAddedDate ) | |||
BIND ( wdt:P39 as ?hasHoldingEndDate ) | |||
# manuscript properties | |||
BIND ( wdt:P1 as ?hasDSID ) | |||
# DS 2.0 Record properties | |||
BIND ( wdt:P3 as ?describesManuscript ) | |||
BIND ( wdt:P35 as ?hasDateLastUpdated ) | |||
BIND ( wdt:P41 as ?hasIIIFManifest ) | |||
# holding information | |||
?holding ?instanceOf ?holdingType ; | |||
?holdingInstitutionAsRecStmt ?holdingInstStatement ; | |||
?hasHoldingAddedDate ?dateAdded . | |||
OPTIONAL { ?holding ?hasInstID ?institutionalID } | |||
OPTIONAL { ?holding ?hasShelfmark ?shelfmark } | |||
OPTIONAL { ?holding ?hasLinkToInstRecord ?linkToRecord } | |||
?holdingInstStatement ?qualifierHoldingInstInAuthFie ?holder . | |||
?holder rdfs:label ?holderName . | |||
# finding linked manuscript objects to holding information patterns above | |||
?manuscript ?hasHolding ?holding ; | |||
?hasDSID ?dsid . | |||
?holding rdfs:label ?holdingLabel . | |||
# finding linked DS records to manuscript object patterns above | |||
?ds20Record ?describesManuscript ?manuscript ; | |||
?hasDateLastUpdated ?lastUpdated ; | |||
rdfs:label ?ds20RecordLabel . | |||
# filter results by a period of time when records were last updated | |||
FILTER ((?lastUpdated > "2024-09-01"^^xsd:dateTime) && (?lastUpdated < "2025-01-01"^^xsd:dateTime)). | |||
# display IIIF manifest URLs if present | |||
OPTIONAL { ?ds20Record ?hasIIIFManifest ?iiifManifest } | |||
# get alphanumerical IDs from Wikibase URIs | |||
BIND (STRDT(REPLACE(STR(?holder), "http.+/entity/", ""), xsd:integer) as ?holderQID) | |||
BIND (STRDT(REPLACE(STR(?holding), "http.+/entity/", ""), xsd:integer) as ?holdingQID) | |||
BIND (STRDT(REPLACE(STR(?manuscript), "http.+/entity/", ""), xsd:integer) as ?manuscriptQID) | |||
SERVICE wikibase:label { | |||
bd:serviceParam wikibase:language "en" . | |||
# allows English language labels to be returned for Wikibase items | |||
} | |||
} ORDER BY DESC(?lastUpdated) ASC(?shelfmark) | |||
# sort results by date updated in Wikibase and then by shelfmark | |||
</syntaxhighlight> | |||
==Statement Count Generator== | |||
This query generates a count of the number of statements (triples) in the DS Wikibase matching a particular pattern. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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 (COUNT(?string) AS ?stringCount) | |||
# declared variable that will be counted and passed to another variable to display as a number | |||
WHERE { | |||
?stringStatement ps:P10 ?string . | |||
# use "as recorded" property P-value for the data you want to count | |||
SERVICE wikibase:label { | |||
bd:serviceParam wikibase:language "en" . | |||
# allows English language labels to be returned for Wikibase items | |||
} | |||
} | |||
GROUP BY (?stringCount) | |||
# this sorts the results by number, and is necessary for COUNT clauses | |||
</syntaxhighlight> | |||
==Unenriched Strings Generator== | |||
This query generates a list of string values of a particular type of ''as recorded'' data occurring in a DS Record which have not be qualified by an authority value (i.e., reconciled to its linked data equivalent in a Linked Open Vocabulary or Authority). This example uses properties for name data, but any authority enriched data can be queried using a similar query structure. | |||
<syntaxhighlight lang="SPARQL"> | |||
# prefixes | |||
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 | |||
# find values for the following declared variables matching the below WHERE pattern | |||
?record | |||
# a link to a DS record | |||
?recordLabel | |||
# the name/label of the DS record | |||
?string | |||
# the string value as recorded in the original catalog record | |||
?authority | |||
# a link to the authority record to which the string value has been reconciled | |||
?authorityLabel | |||
# a label for the the authority record in the DS database | |||
#?roleLabel | |||
# where applicable, a label for role information (un-comment roleLabel variable when querying name data to get role information) | |||
WHERE | |||
# the patterns or conditions that need to be met to return values for the above variables | |||
{ | |||
?record p:P14 ?stringStatement . | |||
# identifies records with statements with corresponding property (change P-value for as recorded value to be queried) | |||
?stringStatement ps:P14 ?string . | |||
# identifies statements that have strings with corresponding property (change P-value for as recorded value to be queried) | |||
FILTER NOT EXISTS { ?stringStatement pq:P17 ?authority . } | |||
# identifies those statements which have not been enriched with authority values (change P-value for authority file value to be queried) | |||
#OPTIONAL { ?stringStatement pq:P15 ?role . } | |||
# only used for name data, un-comment optional clause when querying name data | |||
SERVICE wikibase:label { | |||
bd:serviceParam wikibase:language "en" . | |||
# allows English language labels to be returned for Wikibase items | |||
} | |||
} | |||
ORDER BY ASC (?string) | |||
# this sorts the results alphabetically by as recorded string values | |||
</syntaxhighlight> | |||
==Wikidata Uploading Query== | |||
As part of a pilot project, DS is uploading data about manuscripts to represent manuscript objects as Wikidata items. The following query pulls down and formats a dataset which can be loaded in OpenRefine and uploaded to Wikidata using a Wikibase schema. This query is set up to pull records from Saint Louis University, but can be altered for other datasets (see information in commented sections). | |||
<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 | |||
?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) | |||
?scriptNote | |||
(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 | |||
?link | |||
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 ?manuscript . | |||
?manuscript wdt:P1 ?DSID . | |||
?manuscript wdt:P2 ?holdingRecord . | |||
?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 | |||
} | } | ||
GROUP BY ?signature ?instanceOf ?scriptNote ?holderDS ?holderWikidata ?DSID ?institutionalID ?shelfmark ?record ?link | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 18:17, 23 November 2024
Using the SPARQL Query Service for the DS Catalog
This page provides basic example queries for exploring the DS Wikibase using SPARQL, a query language designed for RDF-encoded linked datasets. Familiarity with the properties used in the DS Data Model is helpful for understanding how the queries operate, but the queries also contain comments (noted by the use of hash character "#") to direct users to the individual steps taken to better understand how the query is constructed to derive a solution.
Manuscripts and DS Records
In redeveloping the DS data model, the project team made an explicit choice to differentiate between the metadata description (the DS Record) and the manuscript object (Manuscript). Although separate, the data model links the DS Record to the Manuscript, such that a DS Record contains data about the manuscript object from institutional records that provide metadata about the object itself.
The decision to separate but link metadata descriptions from their manuscript objects was purposeful so as not to make any direct claims or assertions about the manuscript object other than its existence (which happens through assignment of a unique persistent identifier: the DS ID). In this way, the DS Record is conceptualized as a document which makes statements about a manuscript object which are not inherent to the manuscript object itself and can be revised at any time. Although the DS data model is designed to have only one DS Record linked to a Manuscript, this conceptualization of descriptive documents as separate from described objects potentially allows many different (and potentially competing) descriptions to be linked to the same object simultaneously.
Because of this data structure, unlike traditional library catalogs or search interfaces (like the one for the DS Catalog), users may find that SPARQL queries seem at first circuitous in comparison to other search and retrieval systems. This is because graphs databases like the DS Wikibase are queried on the basis of pattern matching for particular entities (items) and relationships between entities. A machine rapidly traverses the graph finding patterns that match the path indicated by the query. For purposes of querying DS data, that means that seemingly disparate elements of DS Records, Manuscripts, and even Holding Information (i.e., information about and assigned by the institution that owns and/or contributes data about a manuscript object) may all need to be invoked as part of a constructed queried in order to get solutions to seemingly simple questions (such as which institutions own items with texts authored by Avicenna). Taking some time to understand the items, properties, and linking structures in the DS data model and its substantiation in the DS Wikibase will help to elucidate how queries of this nature can be constructed.
To help users better understand how queries are constructed, the example queries found below provide comments (which are proceeded by # tags) to explain how clauses and asserted triple patterns function in the context of a query. We hope that working through some of these examples will allow users to construct their own more complex queries as they learn more about how the DS data model operates in concert with their research questions.
Prefix Declarations
Why are they used?
Prefix declarations made at the beginning of a SPARQL query tell you which namespaces (ontologies, data models, or other specifications) will be used by the query to construct its triples. Rather than having to write out a long URI every time an entity is referenced, by declaring prefixes, you can shorthand the URIs used later in the query.
For instance, by declaring the following prefixes at the beginning of the query,
PREFIX wd: <https://catalog.digital-scriptorium.org/entity/>
PREFIX wdt: <https://catalog.digital-scriptorium.org/prop/direct/>
instead of having to type out
<https://catalog.digital-scriptorium.org/entity/Q88> <https://catalog.digital-scriptorium.org/prop/direct/P16> <https://catalog.digital-scriptorium.org/entity/Q13> .
after declaring prefixes, you can type
wd:Q88 wdt:P16 wd:Q13 .
As you can see, the Q and P values are appended to the end of the base URIs, so that you only need to know the prefix (e.g., wd, wdt) and the appropriate Q or P number to construct the triple pattern you want to use. This makes SPARQL queries much more readable and editable by human beings.
Which prefix declarations will I need to use to query the DS Wikibase?
The following prefix declarations should be at the beginning of any SPARQL query made at the DS Wikibase Query Service endpoint.
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#>
Basic Example Queries
Below is a taxonomy of two types of basic queries based on whether the records in the DS Catalog are described by a particular data element in general (e.g., have any author, any assigned genre, or any place of production) or whether the records meet certain criteria (e.g., were produced by a specific author, were assigned a specific genre, or identified as produced in a particular place). The following queries were originally developed by L.P. Coladangelo (DS Catalog and Data Manager) for prototype testing, and adapted by LEADING Fellows Mace Jones and Jade Snelling as part of their 2023 LEADING Fellowship research.
Manuscripts and their DS records by general data type
These queries will return lists of manuscript records and the associated data values for a general data type (authors, languages, genres, subjects, etc.). Data returned includes both the string value as recorded in the original catalog record (the as_recorded value) and the authority value from a Linked Open Vocabulary to which the as_recorded value has been linked (the authority value). Please note that the following queries have been limited to 10000 results so as not to timeout or break the Query Service.
Find DS records describing manuscripts by their...
Artists
# prefixes
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#>
# find manuscript records with artists recorded
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?artists) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P14 AS ?nameAsRecordedStatement).
BIND(pq:P15 AS ?hasRole).
BIND(ps:P14 AS ?nameAsRecorded).
BIND(pq:P17 AS ?hasName).
BIND(wdt:P42 AS ?hasWikidataQID).
# statement: manuscript record has statement for associated name
?record ?nameAsRecordedStatement ?nameStatement .
# statement: associated name has role of artist
?nameStatement ?hasRole wd:Q19 .
# statement: name statement has name object recorded as string value
?nameStatement ?nameAsRecorded ?nameString .
# statement: name statement has qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?nameStatement ?hasName ?name .
?name ?hasWikidataQID ?QID .
}
# render QIDs as URLs
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?name rdfs:label ?nameLabel .
}
}
GROUP BY ?record ?recordLabel ?nameString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Authors
# prefixes
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#>
# find manuscript records with authors recorded
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?authors) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P14 AS ?nameAsRecordedStatement).
BIND(pq:P15 AS ?hasRole).
BIND(ps:P14 AS ?nameAsRecorded).
BIND(pq:P17 AS ?hasName).
BIND(wdt:P42 AS ?hasWikidataQID).
# statement: manuscript record has statement for associated name
?record ?nameAsRecordedStatement ?nameStatement .
# statement: associated name has role of author
?nameStatement ?hasRole wd:Q18 .
# statement: name statement has name object recorded as string value
?nameStatement ?nameAsRecorded ?nameString .
# statement: name statement may have qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?nameStatement ?hasName ?name .
?name ?hasWikidataQID ?QID .
}
# render QIDs as URLs
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?name rdfs:label ?nameLabel .
}
}
GROUP BY ?record ?recordLabel ?nameString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Centuries of Production
# prefixes
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#>
# find manuscript records by century of production (if dates are recorded)
SELECT ?record ?recordLabel ?dateString (GROUP_CONCAT(?centuryLabel;separator="|") as ?centuries) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P24 AS ?hasCentury).
BIND(wdt:P44 AS ?hasExternalID).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: date statement has date object recorded as string value
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier for structured/authority value
?dateStatement ?hasCentury ?century .
# statement: authority value is represented by URI in external controlled vocabulary
?century ?hasExternalID ?externalID .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?century rdfs:label ?centuryLabel .
}
}
GROUP BY ?record ?recordLabel ?dateString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Dates of Production
# prefixes
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#>
# find manuscript records by dates of production as well as records without date information
SELECT ?record ?recordLabel
(GROUP_CONCAT(?dateString;separator="|") as ?datesAsRecorded)
(GROUP_CONCAT(?earliestDateYear;separator="|") as ?earliestDates)
(GROUP_CONCAT(?latestDateYear;separator="|") as ?latestDates)
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
BIND(wdt:P44 AS ?hasExternalID).
# manuscript record is instance of DS record
?record wdt:P16 wd:Q3 .
OPTIONAL {
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: date statement has date object recorded as string value
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier for earliest date
?dateStatement ?hasEarliestDate ?earliestDateValue .
# statement: date statement has qualifier for latest date
?dateStatement ?hasLatestDate ?latestDateValue .
}
# render date values as years
BIND(year(?earliestDateValue) AS ?earliestDateYear)
BIND(year(?latestDateValue) AS ?latestDateYear)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
}
}
GROUP BY ?record ?recordLabel
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Dated status
# prefixes
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#>
# find manuscript records with dated or non-dated status
SELECT ?record ?recordLabel ?dateString ?datedStatusLabel
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(wdt:P26 AS ?hasDatedStatus).
# statement: record has statement for dated classification
?record ?hasDatedStatus ?datedStatus .
# statement: manuscript record may have statement for date of production
OPTIONAL { ?record ?dateAsRecordedStatement ?dateStatement . ?dateStatement ?dateAsRecorded ?dateString . }
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Former Owners
# prefixes
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#>
# find manuscript records with former owners recorded
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?formerOwners) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P14 AS ?nameAsRecordedStatement).
BIND(pq:P15 AS ?hasRole).
BIND(ps:P14 AS ?nameAsRecorded).
BIND(pq:P17 AS ?hasName).
BIND(wdt:P42 AS ?hasWikidataQID).
# statement: manuscript record has statement for associated name
?record ?nameAsRecordedStatement ?nameStatement .
# statement: associated name has role of former owner
?nameStatement ?hasRole wd:Q21 .
# statement: name statement has name object recorded as string value
?nameStatement ?nameAsRecorded ?nameString .
# statement: name statement has qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?nameStatement ?hasName ?name .
?name ?hasWikidataQID ?QID .
}
# render QIDs as URLs
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?name rdfs:label ?nameLabel .
}
}
GROUP BY ?record ?recordLabel ?nameString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Genres
# prefixes
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#>
# find manuscript records with genre terms
SELECT ?record ?recordLabel ?genreString (GROUP_CONCAT(?termLabel;separator="|") as ?terms) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P18 AS ?genreAsRecordedStatement).
BIND(ps:P18 AS ?genreAsRecorded).
BIND(pq:P20 AS ?hasTerm).
BIND(wdt:P44 AS ?hasExternalURI).
# statement: manuscript record has statement for genre
?record ?genreAsRecordedStatement ?genreStatement .
# statement: genre statement has genre object recorded as string value
?genreStatement ?genreAsRecorded ?genreString .
# statement: genre statement may have qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?genreStatement ?hasTerm ?term .
?term ?hasExternalURI ?externalID .
}
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?term rdfs:label ?termLabel .
}
}
GROUP BY ?record ?recordLabel ?genreString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Holding Institutions
# prefixes
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#>
# find manuscript records with holding institution information
SELECT ?record ?recordLabel ?holdingInstitutionLabel ?shelfmark ?link
WHERE {
# bind query variables
BIND(wdt:P3 AS ?describes).
BIND(wdt:P2 AS ?hasHoldingInformation).
BIND(p:P5 AS ?holdingInstitutionAsRecordedStatement).
BIND(pq:P4 AS ?hasHoldingInstitution).
BIND(wdt:P8 AS ?hasShelfmark).
BIND(wdt:P9 AS ?hasLink).
# statement: manuscript record describes manuscript object
?record ?describes ?manuscript .
# statement: manuscript object has holding information
?manuscript ?hasHoldingInformation ?holdingInformation .
# statement: holding information has statement for holding institution
?holdingInformation ?holdingInstitutionAsRecordedStatement ?holdingInstitutionStatement .
# statement: holding institution statement has qualifier for structured/authority value
?holdingInstitutionStatement ?hasHoldingInstitution ?holdingInstitution .
# statement: holding information has shelfmark
?holdingInformation ?hasShelfmark ?shelfmark .
# statement: holding information may have link to online catalog record
OPTIONAL {
?holdingInformation ?hasLink ?link .
}
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
}
}
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Languages
# prefixes
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#>
# find manuscript records with languages recorded
SELECT ?record ?recordLabel ?languageString (GROUP_CONCAT(?languageLabel;separator="|") as ?languages) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P21 AS ?languageAsRecordedStatement).
BIND(ps:P21 AS ?languageAsRecorded).
BIND(pq:P22 AS ?hasLanguage).
BIND(wdt:P42 AS ?hasWikidataQID).
# statement: manuscript record has statement for language
?record ?languageAsRecordedStatement ?languageStatement .
# statement: language statement has language object recorded as string value
?languageStatement ?languageAsRecorded ?languageString .
# statement: language statement may have qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?languageStatement ?hasLanguage ?language .
?language ?hasWikidataQID ?QID .
}
# render QIDs as URLs
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?language rdfs:label ?languageLabel .
}
}
GROUP BY ?record ?recordLabel ?languageString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Materials
# prefixes
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#>
# find manuscript records with materials description
SELECT ?record ?recordLabel ?materialString (GROUP_CONCAT(?materialLabel;separator="|") as ?materials) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P30 AS ?materialAsRecordedStatement).
BIND(ps:P30 AS ?materialAsRecorded).
BIND(pq:P31 AS ?hasMaterial).
BIND(wdt:P44 AS ?hasExternalURI).
# statement: manuscript record has statement for material
?record ?materialAsRecordedStatement ?materialStatement .
# statement: material statement has material object recorded as string value
?materialStatement ?materialAsRecorded ?materialString .
# statement: material statement has qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?materialStatement ?hasMaterial ?material .
?material ?hasExternalURI ?externalID .
}
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?material rdfs:label ?materialLabel .
}
}
GROUP BY ?record ?recordLabel ?materialString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Other associated names/agents
# prefixes
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#>
# find manuscript records with associated agents recorded
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?associatedAgents) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P14 AS ?nameAsRecordedStatement).
BIND(pq:P15 AS ?hasRole).
BIND(ps:P14 AS ?nameAsRecorded).
BIND(pq:P17 AS ?hasName).
BIND(wdt:P42 AS ?hasWikidataQID).
# statement: manuscript record has statement for associated name
?record ?nameAsRecordedStatement ?nameStatement .
# statement: associated name has role of associated agent
?nameStatement ?hasRole wd:Q1284 .
# statement: name statement has name object recorded as string value
?nameStatement ?nameAsRecorded ?nameString .
# statement: name statement has qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?nameStatement ?hasName ?name .
?name ?hasWikidataQID ?QID .
}
# render QIDs as URLs
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?name rdfs:label ?nameLabel .
}
}
GROUP BY ?record ?recordLabel ?nameString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Places of Production
# prefixes
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#>
# find manuscript records with place of production recorded
SELECT ?record ?recordLabel ?placeString (GROUP_CONCAT(?placeLabel;separator="|") as ?places) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P27 AS ?placeAsRecordedStatement).
BIND(ps:P27 AS ?placeAsRecorded).
BIND(pq:P28 AS ?hasPlace).
BIND(wdt:P44 AS ?hasExternalID).
# statement: manuscript record has statement for place of production
?record ?placeAsRecordedStatement ?placeStatement .
# statement: place statement has place object recorded as string value
?placeStatement ?placeAsRecorded ?placeString .
# statement: place statement may have qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?placeStatement ?hasPlace ?place .
?place ?hasExternalID ?externalID .
}
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?place rdfs:label ?placeLabel .
}
}
GROUP BY ?record ?recordLabel ?placeString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Scribes
# prefixes
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#>
# find manuscript records with scribes recorded
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?scribes) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P14 AS ?nameAsRecordedStatement).
BIND(pq:P15 AS ?hasRole).
BIND(ps:P14 AS ?nameAsRecorded).
BIND(pq:P17 AS ?hasName).
BIND(wdt:P42 AS ?hasWikidataQID).
# statement: manuscript record has statement for associated name
?record ?nameAsRecordedStatement ?nameStatement .
# statement: associated name has role of scribe
?nameStatement ?hasRole wd:Q20.
# statement: name statement has name object recorded as string value
?nameStatement ?nameAsRecorded ?nameString .
# statement: name statement may have qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?nameStatement ?hasName ?name .
?name ?hasWikidataQID ?QID .
}
# render QIDs as URLs
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?name rdfs:label ?nameLabel .
}
}
GROUP BY ?record ?recordLabel ?nameString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Subjects
# prefixes
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#>
# find manuscript records with subject terms
SELECT ?record ?recordLabel ?subjectString (GROUP_CONCAT(?termLabel;separator="|") as ?terms) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs)
WHERE {
# bind query variables
BIND(p:P19 AS ?subjectAsRecordedStatement).
BIND(ps:P19 AS ?subjectAsRecorded).
BIND(pq:P20 AS ?hasTerm).
BIND(wdt:P44 AS ?hasExternalURI).
# statement: manuscript record has statement for subject
?record ?subjectAsRecordedStatement ?subjectStatement .
# statement: subject statement has subject object recorded as string value
?subjectStatement ?subjectAsRecorded ?subjectString .
# statement: subject statement may have qualifier for structured/authority value
# statement: authority value is represented by URI in external controlled vocabulary
OPTIONAL {
?subjectStatement ?hasTerm ?term .
?term ?hasExternalURI ?externalID .
}
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?term rdfs:label ?termLabel .
}
}
GROUP BY ?record ?recordLabel ?subjectString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Titles
# prefixes
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#>
# find manuscript records with title information
SELECT ?record ?recordLabel ?titleString ?uniformTitleString (GROUP_CONCAT(?standardTitleLabel;separator="|") as ?standardTitles)
WHERE {
# bind query variables
BIND(p:P10 AS ?titleAsRecordedStatement)
BIND(ps:P10 AS ?titleAsRecorded).
BIND(wdt:P12 AS ?uniformTitleAsRecorded).
BIND(pq:P11 AS ?hasStandardTitle).
# statement: manuscript record has statement for title
?record ?titleAsRecordedStatement ?titleStatement .
# statement: title statement has title object recorded as string value
?titleStatement ?titleAsRecorded ?titleString .
# statement: manuscript record may have statement for uniform title
OPTIONAL { ?record ?uniformTitleAsRecorded ?uniformTitleString . }
# statement: title statement may have qualifier for standard title value
OPTIONAL { ?titleStatement ?hasStandardTitle ?standardTitle . }
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?standardTitle rdfs:label ?standardTitleLabel .
}
}
GROUP BY ?record ?recordLabel ?titleString ?uniformTitleString
ORDER BY ?recordLabel
LIMIT 10000
Try it here.
Manuscripts and their DS records by specific data value
These queries will return lists of manuscript records based on or limited by a specific value from an associated DS authority record, including both the string value as recorded in the original catalog record (the as_recorded value) and the authority value from a Linked Open Vocabulary to which the as_recorded value has been linked (the authority value). You should expect to see a list of all records and manuscripts in the DS Catalog which meet the conditions of having a specific value for the below data types.
Find all DS records describing manuscripts by a specific...
Century of Production
This example identifies manuscripts produced in the thirteenth or fourteenth centuries.
# prefixes
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#>
# find manuscript records for manuscripts produced in a given century or centuries
SELECT ?record ?recordLabel ?dateString (GROUP_CONCAT(?centuryLabel;separator="|") as ?centuries)
WHERE {
# set variable value for century or centuries to be queried
VALUES ?century { wd:Q95 wd:Q96 } # thirteenth and fourteenth centuries
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P24 AS ?hasCentury).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: date statement has date object recorded as string value
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier for structured/authority value
?dateStatement ?hasCentury ?century .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?century rdfs:label ?centuryLabel .
}
}
GROUP BY ?record ?recordLabel ?dateString
ORDER BY ?recordLabel
Try it here.
Date of Production
These examples identify records for manuscripts based on production date parameters.
Earliest date
Exact earliest date
This example identifies records for manuscripts with an earliest production date of 1515.
# prefixes
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#>
# find manuscript records by earliest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year equal to 1515
FILTER (YEAR(?earlyDate) = 1515) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?latestDate ?recordLabel
Try it here.
Before earliest date
This example identifies records for manuscripts with an earliest production date before 1066.
# prefixes
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#>
# find manuscript records by earliest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by less than 1066
FILTER (YEAR(?earlyDate) < 1066) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?latestDate ?recordLabel
Try it here.
After earliest date
This example identifies records for manuscripts with an earliest production date after 1066.
# prefixes
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#>
# find manuscript records by earliest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year greater than 1066
FILTER (YEAR(?earlyDate) > 1066) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?earliestDate ?recordLabel
Try it here.
Latest date
Exact latest date
This example identifies records for manuscripts with a latest production date of 1515.
# prefixes
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#>
# find manuscript records by latest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year equal to 1515
FILTER (YEAR(?lateDate) = 1515) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?latestDate ?recordLabel
Try it here.
Before latest date
This example identifies records for manuscripts with a latest production date before 1812.
# prefixes
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#>
# find manuscript records by latest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year less than 1812
FILTER (YEAR(?lateDate) < 1812) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?latestDate ?recordLabel
Try it here.
After latest date
This example identifies records for manuscripts with a latest production date after 1812.
# prefixes
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#>
# find manuscript records by latest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year greater than 1812
FILTER (YEAR(?lateDate) > 1812) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?latestDate ?recordLabel
Try it here.
Date range
Inside date range
This example identifies records for manuscripts produced between 1377 and 1677.
# prefixes
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#>
# find manuscript records by earliest and latest dates
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year greater than 1377 and less than 1677
FILTER (YEAR(?earlyDate) > 1377 && YEAR(?lateDate) < 1677 ) .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?earliestDate ?latestDate ?recordLabel
Try it here.
Outside date range
This example identifies records for manuscripts produced before 1377 and after 1677.
# prefixes
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#>
# find manuscript records by earliest and latest dates
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(pq:P37 AS ?hasEarliestDate).
BIND(pq:P36 AS ?hasLatestDate).
# render datetime values as years
BIND(year(?earlyDate) AS ?earliestDate).
BIND(year(?lateDate) AS ?latestDate).
# statement: manuscript record has statement for date of production
?record ?dateAsRecordedStatement ?dateStatement .
# statement: manuscript record has statement for date of production
?dateStatement ?dateAsRecorded ?dateString .
# statement: date statement has qualifier values for earliest and latest dates (datetime values)
?dateStatement ?hasEarliestDate ?earlyDate .
?dateStatement ?hasLatestDate ?lateDate .
# filter datetime values by year less than 1377 and greater than 1677
FILTER (YEAR(?lateDate) < 1377 || YEAR(?earlyDate) > 1677).
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?earliestDate ?latestDate ?recordLabel
Try it here.
Dated status
Dated
This example provides a list of records for manuscripts which are dated.
# prefixes
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#>
# find manuscript records with dated status
SELECT ?record ?recordLabel ?dateString ?datedStatusLabel
WHERE {
# set variable value for dated classification to be queried
VALUES ?datedStatus { wd:Q14 } # dated
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(wdt:P26 AS ?hasDatedStatus).
# statement: record has statement for dated classification
?record ?hasDatedStatus ?datedStatus .
# statement: manuscript record may have statement for date of production
OPTIONAL { ?record ?dateAsRecordedStatement ?dateStatement . ?dateStatement ?dateAsRecorded ?dateString . }
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?recordLabel
Try it here.
Non-dated
This example provides a list of records for manuscripts which are not dated.
# prefixes
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#>
# find manuscript records with non-dated status
SELECT ?record ?recordLabel ?dateString ?datedStatusLabel
WHERE {
# set variable value for dated classification to be queried
VALUES ?datedStatus { wd:Q15 } # non-dated
# bind query variables
BIND(p:P23 AS ?dateAsRecordedStatement).
BIND(ps:P23 AS ?dateAsRecorded).
BIND(wdt:P26 AS ?hasDatedStatus).
# statement: record has statement for dated classification
?record ?hasDatedStatus ?datedStatus .
# statement: manuscript record may have statement for date of production
OPTIONAL { ?record ?dateAsRecordedStatement ?dateStatement . ?dateStatement ?dateAsRecorded ?dateString . }
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
}
}
ORDER BY ?recordLabel
Try it here.
Genre
This example identifies manuscripts which are described as translations.
# prefixes
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#>
# find manuscript records for manuscripts assigned particular genre term(s)
SELECT ?record ?recordLabel ?genreString (GROUP_CONCAT(?termLabel;separator="|") as ?genres)
WHERE {
# set variable value for genre or genres to be queried
VALUES ?term { wd:Q155 } # translations (documents)
# bind query variables
BIND(p:P18 AS ?genreAsRecordedStatement).
BIND(ps:P18 AS ?genreAsRecorded).
BIND(pq:P20 AS ?hasTerm).
# statement: manuscript record has statement for genre
?record ?genreAsRecordedStatement ?genreStatement .
# statement: genre statement has genre object recorded as string value
?genreStatement ?genreAsRecorded ?genreString .
# statement: genre statement has qualifier for structured/authority value
?genreStatement ?hasTerm ?term .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?term rdfs:label ?termLabel .
}
}
GROUP BY ?record ?recordLabel ?genreString
ORDER BY ?recordLabel
Try it here.
Holding Institution
This example identifies manuscripts held by public libraries currently in the DS Catalog.
# prefixes
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#>
# find manuscript records held by particular institution(s)
SELECT ?record ?recordLabel ?holdingInstitutionLabel ?shelfmark ?link
WHERE {
# set variable value for institution or institutions to be queried
VALUES ?holdingInstitution { wd:Q801 wd:Q16442 wd:Q18629 } # Providence Public Library, Boston Public Library, Free Library of Philadelphia
# bind query variables
BIND(wdt:P3 AS ?describes).
BIND(wdt:P2 AS ?hasHoldingInformation).
BIND(p:P5 AS ?holdingInstitutionAsRecordedStatement).
BIND(pq:P4 AS ?hasHoldingInstitution).
BIND(wdt:P8 AS ?hasShelfmark).
BIND(wdt:P9 AS ?hasLink).
# statement: manuscript record describes manuscript object
?record ?describes ?manuscript .
# statement: manuscript object has holding information
?manuscript ?hasHoldingInformation ?holdingInformation .
# statement: holding information has statement for holding institution
?holdingInformation ?holdingInstitutionAsRecordedStatement ?holdingInstitutionStatement .
# statement: holding institution statement has qualifier for structured/authority value
?holdingInstitutionStatement ?hasHoldingInstitution ?holdingInstitution .
# statement: holding information has shelfmark
?holdingInformation ?hasShelfmark ?shelfmark .
# statement: holding information may have link to online catalog record
OPTIONAL {
?holdingInformation ?hasLink ?link .
}
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
}
}
ORDER BY ?holdingInstitutionLabel ?recordLabel
Try it here.
Language
This example identifies manuscripts which contain Chinese, Japanese, or Korean language content.
# prefixes
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#>
# find manuscript records for manuscripts in particular language(s)
SELECT ?record ?recordLabel ?languageString (GROUP_CONCAT(?languageLabel;separator="|") as ?languages)
WHERE {
# set variable value for language or languages to be queried
VALUES ?language { wd:Q12711 wd:Q12712 wd:Q12715 } # Japanese, Korean, and Chinese
# bind query variables
BIND(p:P21 AS ?languageAsRecordedStatement).
BIND(ps:P21 AS ?languageAsRecorded).
BIND(pq:P22 AS ?hasLanguage).
# statement: manuscript record has statement for language
?record ?languageAsRecordedStatement ?languageStatement .
# statement: language statement has language object recorded as string value
?languageStatement ?languageAsRecorded ?languageString .
# statement: language statement has qualifier for structured/authority value
?languageStatement ?hasLanguage ?language .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?language rdfs:label ?languageLabel .
}
}
GROUP BY ?record ?recordLabel ?languageString
ORDER BY ?recordLabel
Try it here.
Material
This example identifies manuscripts which are made of palm leaf.
# prefixes
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#>
# find manuscript records described as being made of particular material(s)
SELECT ?record ?recordLabel ?materialString (GROUP_CONCAT(?materialLabel;separator="|") as ?materials)
WHERE {
# set variable value for material or materials to be queried
VALUES ?material { wd:Q30 } # palm leaf material
# bind query variables
BIND(p:P30 AS ?materialAsRecordedStatement).
BIND(ps:P30 AS ?materialAsRecorded).
BIND(pq:P31 AS ?hasMaterial).
# statement: manuscript record has statement for material
?record ?materialAsRecordedStatement ?materialStatement .
# statement: material statement has material object recorded as string value
?materialStatement ?materialAsRecorded ?materialString .
# statement: material statement has qualifier for structured/authority value
?materialStatement ?hasMaterial ?material .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?material rdfs:label ?materialLabel .
}
}
GROUP BY ?record ?recordLabel ?materialString
ORDER BY ?recordLabel
Try it here.
Named Entity (Person or Organization)
This example identifies manuscripts associated with various personal and corporate named entities, including their roles in manuscript production and trade.
# prefixes
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#>
# find manuscript records for manuscripts associated with particular name(s) (personal or corporate entity or entities)
SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?names) ?typeLabel ?roleLabel
WHERE {
# set variable value for name or names to be queried
VALUES ?name { wd:Q383 wd:Q425 wd:Q1488 wd:Q3203 wd:Q28158 } # Lawrence Schoenberg, Catholic Church, Masters of the Gold Scrolls, Ali Qushji, Ananda Coomaraswamy
# bind query variables
BIND(p:P14 AS ?nameAsRecordedStatement).
BIND(ps:P14 AS ?nameAsRecorded).
BIND(pq:P17 AS ?hasName).
BIND(pq:P15 AS ?hasRole).
BIND(wdt:P16 AS ?hasType).
# statement: manuscript record has statement for associated name
?record ?nameAsRecordedStatement ?nameStatement .
# statement: name statement has name object recorded as string value
?nameStatement ?nameAsRecorded ?nameString .
# statement: name statement has qualifier for structured/authority value
?nameStatement ?hasName ?name .
# statement: associated name has role
?nameStatement ?hasRole ?role .
# statement: authority value has type (Personal or Corporate)
?name ?hasType ?type .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?name rdfs:label ?nameLabel .
?role rdfs:label ?roleLabel .
?type rdfs:label ?typeLabel .
}
}
GROUP BY ?record ?recordLabel ?nameString ?roleLabel ?typeLabel
ORDER BY ?recordLabel
Try it here.
Place of Production
This example identifies manuscripts produced in Egypt or Cairo.
A note on place queries: the DS authorities are not hierarchical, so this query only identifies manuscripts specifically described as being produced in Egypt or in Cairo, and not other places in Egypt, such as other cities or other geographic areas contained within Egypt. To find manuscripts produced in those specific locations, the query would have to include each of those specific values.
# prefixes
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#>
# find manuscript records for manuscripts produced in particular place(s)
SELECT ?record ?recordLabel ?placeString (GROUP_CONCAT(?placeLabel;separator="|") as ?places)
WHERE {
# set variable value for place or places to be queried
VALUES ?place { wd:Q3086 wd:Q3093 }
# bind query variables
BIND(p:P27 AS ?placeAsRecordedStatement).
BIND(ps:P27 AS ?placeAsRecorded).
BIND(pq:P28 AS ?hasPlace).
# statement: manuscript record has statement for place of production
?record ?placeAsRecordedStatement ?placeStatement .
# statement: place statement has place object recorded as string value
?placeStatement ?placeAsRecorded ?placeString .
# statement: place statement has qualifier for structured/authority value
?placeStatement ?hasPlace ?place .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?place rdfs:label ?placeLabel .
}
}
GROUP BY ?record ?recordLabel ?placeString
ORDER BY ?recordLabel
Try it here.
Subject
This example identifies manuscripts described as being about Arab astronomy.
# prefixes
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#>
# find manuscript records for manuscripts assigned particular subject(s)
SELECT ?record ?recordLabel ?subjectString (GROUP_CONCAT(?termLabel;separator="|") as ?subjects)
WHERE {
# set variable value for subject or subjects to be queried
VALUES ?term { wd:Q3035 } # Astronomy, Arab
# bind query variables
BIND(p:P19 AS ?subjectAsRecordedStatement).
BIND(ps:P19 AS ?subjectAsRecorded).
BIND(pq:P20 AS ?hasTerm).
# statement: manuscript record has statement for subject
?record ?subjectAsRecordedStatement ?subjectStatement .
# statement: subject statement has subject object recorded as string value
?subjectStatement ?subjectAsRecorded ?subjectString .
# statement: subject statement has qualifier for structured/authority value
?subjectStatement ?hasTerm ?term .
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?term rdfs:label ?termLabel .
}
}
GROUP BY ?record ?recordLabel ?subjectString
ORDER BY ?recordLabel
Try it here.
Standard Title
This example identifies manuscripts that have been assigned a standard title for at least one of the four canonical gospels of the New Testament.
# prefixes
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#>
# find manuscript records for manuscripts with particular standard title(s)
SELECT ?record ?recordLabel ?titleString ?uniformTitleString (GROUP_CONCAT(?standardTitleLabel;separator="|") as ?standardTitles)
WHERE {
# set variable value for standard title or titles to be queried
VALUES ?standardTitle { wd:Q6034 wd:Q1389 wd:Q1347 wd:Q1437 wd:Q665 } # Gospels, Gospel of Matthew, Gospel of Mark, Gospel of Luke, Gospel of John
# bind query variables
BIND(p:P10 AS ?titleAsRecordedStatement).
BIND(ps:P10 AS ?titleAsRecorded).
BIND(ps:P12 AS ?uniformTitleAsRecorded).
BIND(pq:P11 AS ?hasStandardTitle).
# statement: manuscript record has statement for title as recorded
?record ?titleAsRecordedStatement ?titleStatement .
# statement: title statement has title object recorded as string value
?titleStatement ?titleAsRecorded ?titleString .
# statement: title statement has qualifier for structured/authority value
?titleStatement ?hasStandardTitle ?standardTitle .
# statement: record may have uniform title recorded
OPTIONAL { ?record ?uniformTitleAsRecorded ?uniformTitleString . }
# return English language labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?record rdfs:label ?recordLabel .
?standardTitle rdfs:label ?standardTitleLabel .
}
}
GROUP BY ?record ?recordLabel ?titleString ?uniformTitleString
ORDER BY ?recordLabel
Try it here.
User generated examples
Books of Hours with institutional, date, and place information
This is a modified version of a query contributed by Dominique Stutzmann, Directeur de recherche (CNRS), Institut de Recherche et d'Histoire des Textes (IRHT); Honorar-Professor, Humboldt-Universität zu Berlin.
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 schema: <http://schema.org/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?record ?recordLabel (GROUP_CONCAT(DISTINCT ?titleString;separator="|") as ?titleAsRecorded) ?DSID ?institutionLabel
?shelfmark ?dateAsRecorded ?dated ?placeAsRecorded (GROUP_CONCAT(DISTINCT ?place2;separator="|") as ?place_norm) (GROUP_CONCAT(DISTINCT ?date3;separator="|") as ?earliest_date) (GROUP_CONCAT(DISTINCT ?date4;separator="|") as ?latest_date)
WHERE
{
?record p:P10 ?titleStatement . # DS record has a title as recorded statement
?titleStatement ps:P10 ?titleString . # title statement has an as recorded string value
?titleStatement pq:P11 wd:Q795 . # title statement has been enriched/aligned with a standard title "Book of hours (Q795)"
?record wdt:P3 ?ms . # DS record describes a manuscript object
?ms wdt:P1 ?DSID . # manuscript object has a DSID
?ms wdt:P2 ?holding . # manuscript object has holding information
?holding wdt:P5 ?institution . # holding is held by institution as recorded
?holding wdt:P8 ?shelfmark . # holding has assigned shelfmark
OPTIONAL { ?record wdt:P23 ?dateAsRecorded . } # DS record provides "production date as recorded"
OPTIONAL { ?record wdt:P26 ?datedInfo . ?datedInfo rdfs:label ?dated . } # DS record provides "dated" / "non-dated" information
OPTIONAL { ?record wdt:P27 ?placeAsRecorded . } # DS record provides "production place as recorded (P27)"
OPTIONAL { ?record p:P27 ?place . ?place pq:P28 ?placeQual . ?placeQual rdfs:label ?place2 . } # DS record provides "place in authority file (P28)"
OPTIONAL { ?record p:P23 ?date . ?date pq:P37 ?earliestDate . } # DS record provides "earliest date (P37)"
OPTIONAL { ?record p:P23 ?date . ?date pq:P36 ?latestDate . } # DS record provides "latest date (P36)"
# render date values as years
BIND(year(?earliestDate) AS ?date3)
BIND(year(?latestDate) AS ?date4)
# return English language labels for Wikibase items where "Label" is appended to variable name
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
GROUP BY ?record ?recordLabel ?msLabel ?DSID ?institutionLabel ?shelfmark ?dateAsRecorded ?dated ?placeAsRecorded ?place_norm
Try it here.
Technical Queries
The following queries are used in the management of DS data, data enrichment, and the DS Wikibase.
Authority Record Generator
These queries generate lists of authority records in the Wikibase by authority value type (i.e., all items which are an instance of a particular Authority Type).
Languages
# prefixes
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)
Materials
# prefixes
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:Q17 as ?authorityType) # material authority
?authorityValue wdt:P16 ?authorityType .
# find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P44 ?externalID . }
# find external IDs matched to authority value
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
# allows English language labels to be returned for Wikibase items
}
}
ORDER BY ASC (?authorityValueLabel)
Names
# prefixes
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 ?DSID ?externalID
WHERE {
VALUES ?authorityType { wd:Q8 wd:Q9 }
?authorityValue wdt:P16 ?authorityType .
# find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P42 ?QID . }
# find Wikidata QIDs matched to authority value
OPTIONAL { ?authorityValue wdt:P1 ?DSID . }
# return DSID for names
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)
Places
# prefixes
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:Q16 as ?authorityType) # place authority
?authorityValue wdt:P16 ?authorityType .
# find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P44 ?externalID . }
# find external IDs matched to authority value
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
# allows English language labels to be returned for Wikibase items
}
}
ORDER BY ASC (?authorityValueLabel)
Standard Titles
# prefixes
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 ?DSID ?externalID
WHERE {
BIND (wd:Q6 as ?authorityType) # standard title authority
?authorityValue wdt:P16 ?authorityType .
# find authority records by authority type specified above
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
# allows English language labels to be returned for Wikibase items
}
}
ORDER BY ASC (?authorityValueLabel)
Terms (Genres and Subjects)
# prefixes
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:Q11 as ?authorityType) # term authority (genre and subject terms)
?authorityValue wdt:P16 ?authorityType .
# find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P44 ?externalID . }
# find external IDs matched to authority value
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
# allows English language labels to be returned for Wikibase items
}
}
ORDER BY ASC (?authorityValueLabel)
Dated Classification Generator
This query generates a list of manuscript items which have and have not be classified as dated. Classified items will either be dated or non-dated. Items without a classification are pending more information.
# prefixes
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#>
# find holding and dated information for manuscripts with DS records
SELECT
?record
?holdingLabel
?link
?recordLabel
?datedStatusLabel
(GROUP_CONCAT(?dateRecorded;separator="|") as ?datesAsRecorded)
WHERE
{
# statement: record is an instance of a DS record
?record wdt:P16 wd:Q3 .
# statements: record may have a date recorded and may have a dated status
OPTIONAL { ?record wdt:P23 ?dateRecorded }
OPTIONAL { ?record wdt:P26 ?datedStatus }
# statement: record describes manuscript object
?record wdt:P3 ?ms .
# statement: manuscript object has holding information
?ms wdt:P2 ?holding .
# statement: holding information may have link to online institutional record
OPTIONAL { ?holding wdt:P9 ?link }
# return English language labels
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
GROUP BY ?record ?holdingLabel ?link ?recordLabel ?datedStatusLabel
ORDER BY DESC (?datedStatusLabel)
Newly Added or Updated Records
This query generates a list of DS Records which have been newly added or updated, based on a date-time filter.
# prefixes
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
(?ds_recordLabel as ?ds_record_name)
(?ds_record as ?ds_record_url)
?ds_catalog_url
(?dsidLabel as ?ds_id)
(?holdingInstLabel as ?holding_institution)
?shelfmark
?link_to_inst_record
?date_added_to_DS
?date_updated_in_DS
WHERE {
?ds_record wdt:P16 wd:Q3 ;
wdt:P34 ?date_added_to_DS ;
wdt:P35 ?date_updated_in_DS ;
wdt:P3 ?dsid ;
rdfs:label ?ds_recordLabel .
?dsid wdt:P2 ?holding ;
rdfs:label ?dsidLabel .
?holding wdt:P8 ?shelfmark ;
p:P5 ?holdingStatement .
?holdingStatement pq:P4 ?holdingInst .
?holdingInst rdfs:label ?holdingInstLabel .
OPTIONAL {?holding wdt:P9 ?link_to_inst_record }
BIND(CONCAT("https://search.digital-scriptorium.org/catalog/",?dsidLabel) AS ?ds_catalog_url)
# filter results by a period of time when records were last added
FILTER ((?date_added_to_DS > "2024-08-15"^^xsd:dateTime) && (?date_added_to_DS < "2024-12-31"^^xsd:dateTime)).
# filter results by a period of time when records were last updated
FILTER ((?date_updated_in_DS > "2024-08-15"^^xsd:dateTime) && (?date_updated_in_DS < "2024-12-31"^^xsd:dateTime)).
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY DESC(?date_updated_in_DS)
Try it here.
Receipt Generator
This query generates a list of DS Wikibase items which shows successful ingest of DS Records, creation of Manuscript items / DS IDs, and assignment of Holding information for an institution, to serve as a receipt for data contributions made to the DS Catalog.
# prefixes
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
# Variables for holding values used in the construction of the receipt
(?holderName as ?holding_institution)
(?holder as ?ds_holding_inst_url)
(?dsid as ?ds_id)
(?manuscript as ?ds_manuscript_url)
(?shelfmark as ?holding_inst_shelfmark)
(?institutionalID as ?holding_inst_id)
(?linkToRecord as ?holding_inst_link)
(?iiifManifest as ?iiif_manifest)
(?holdingLabel as ?ds_holding)
(?holding as ?ds_holding_info_url)
(?dateAdded as ?date_added_to_ds)
(?ds20RecordLabel as ?ds_record)
(?ds20Record as ?ds_record_url)
(?lastUpdated as ?ds_record_last_updated)
{
# Specify a holding institution (remove comment tag)
# BIND (wd:Q16442 as ?holder) # bpl - Boston Public Library
# BIND (wd:Q28019 as ?holder) # burke - Burke Library at Union Theological Seminary
# BIND (wd:Q27887 as ?holder) # columbia - Columbia University Rare Book and Manuscript Library
# BIND (wd:Q667 as ?holder) # conception - Conception Abbey and Seminary
# BIND (wd:Q825 as ?holder) # csl - California State Library
# BIND (wd:Q858 as ?holder) # cuny - City College of New York
# BIND (wd:Q48982 as ?holder) # cornell - Cornell University
# BIND (wd:Q55342 as ?holder) # dayton - University of Dayton
# BIND (wd:Q18629 as ?holder) # flp - Free Library of Philadelphia
# BIND (wd:Q868 as ?holder) # grolier - Grolier Club
# BIND (wd:Q1487 as ?holder) # gts - General Theological Seminary
# BIND (wd:Q42438 as ?holder) # harvard - Harvard University
# BIND (wd:Q17632 as ?holder) # hrc - Harry Ransom Center
# BIND (wd:Q42439 as ?holder) # huntington - The Huntington
# BIND (wd:Q1521 as ?holder) # indiana - Indiana University
# BIND (wd:Q6060 as ?holder) # kansas - University of Kansas
# BIND (wd:Q42433 as ?holder) # missouri - University of Missouri
# BIND (wd:Q1123 as ?holder) # nelsonatkins - Nelson-Atkins Museum of Art
# BIND (wd:Q42265 as ?holder) # nyam - New York Academy of Medicine
# BIND (wd:Q1914 as ?holder) # nyu - New York University
# BIND (wd:Q10856 as ?holder) # oregon - University of Oregon
# BIND (wd:Q42431 as ?holder) # osu - Ohio State University
# BIND (wd:Q374 as ?holder) # penn - University of Pennsylvania
# BIND (wd:Q12264 as ?holder) # princeton - Princeton University
# BIND (wd:Q801 as ?holder) # providence - Providence Public Library
# BIND (wd:Q1101 as ?holder) # rome - American Academy in Rome
# BIND (wd:Q1936 as ?holder) # rutgers - Rutgers University
# BIND (wd:Q27854 as ?holder) # shi - Science History Institute
# BIND (wd:Q42440 as ?holder) # slu - Saint Louis University
# BIND (wd:Q1247 as ?holder) # smith - Smith College
# BIND (wd:Q42437 as ?holder) # ucb - University of California, Berkeley
# BIND (wd:Q42441 as ?holder) # ucdavis - University of California, Davis
# BIND (wd:Q42442 as ?holder) # ucr - University of California, Riverside
# BIND (wd:Q17745 as ?holder) # vassar - Vassar College
# BIND (wd:Q42432 as ?holder) # vermont - University of Vermont
# BIND (wd:Q54115 as ?holder) # wellesley - Wellesley College
# BIND (wd:Q27869 as ?holder) # wmu - Western Michigan University
# holding and holding properties
BIND ( wd:Q2 as ?holdingType )
BIND ( wdt:P16 as ?instanceOf )
BIND ( wdt:P2 as ?hasHolding )
BIND ( pq:P4 as ?qualifierHoldingInstInAuthFile )
BIND ( p:P5 as ?holdingInstitutionAsRecStmt )
BIND ( ps:P5 as ?holdingInstAsRecValue )
BIND ( wdt:P7 as ?hasInstID )
BIND ( wdt:P8 as ?hasShelfmark )
BIND ( wdt:P9 as ?hasLinkToInstRecord )
BIND ( wdt:P38 as ?hasHoldingAddedDate )
BIND ( wdt:P39 as ?hasHoldingEndDate )
# manuscript properties
BIND ( wdt:P1 as ?hasDSID )
# DS 2.0 Record properties
BIND ( wdt:P3 as ?describesManuscript )
BIND ( wdt:P35 as ?hasDateLastUpdated )
BIND ( wdt:P41 as ?hasIIIFManifest )
# holding information
?holding ?instanceOf ?holdingType ;
?holdingInstitutionAsRecStmt ?holdingInstStatement ;
?hasHoldingAddedDate ?dateAdded .
OPTIONAL { ?holding ?hasInstID ?institutionalID }
OPTIONAL { ?holding ?hasShelfmark ?shelfmark }
OPTIONAL { ?holding ?hasLinkToInstRecord ?linkToRecord }
?holdingInstStatement ?qualifierHoldingInstInAuthFie ?holder .
?holder rdfs:label ?holderName .
# finding linked manuscript objects to holding information patterns above
?manuscript ?hasHolding ?holding ;
?hasDSID ?dsid .
?holding rdfs:label ?holdingLabel .
# finding linked DS records to manuscript object patterns above
?ds20Record ?describesManuscript ?manuscript ;
?hasDateLastUpdated ?lastUpdated ;
rdfs:label ?ds20RecordLabel .
# filter results by a period of time when records were last updated
FILTER ((?lastUpdated > "2024-09-01"^^xsd:dateTime) && (?lastUpdated < "2025-01-01"^^xsd:dateTime)).
# display IIIF manifest URLs if present
OPTIONAL { ?ds20Record ?hasIIIFManifest ?iiifManifest }
# get alphanumerical IDs from Wikibase URIs
BIND (STRDT(REPLACE(STR(?holder), "http.+/entity/", ""), xsd:integer) as ?holderQID)
BIND (STRDT(REPLACE(STR(?holding), "http.+/entity/", ""), xsd:integer) as ?holdingQID)
BIND (STRDT(REPLACE(STR(?manuscript), "http.+/entity/", ""), xsd:integer) as ?manuscriptQID)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
# allows English language labels to be returned for Wikibase items
}
} ORDER BY DESC(?lastUpdated) ASC(?shelfmark)
# sort results by date updated in Wikibase and then by shelfmark
Statement Count Generator
This query generates a count of the number of statements (triples) in the DS Wikibase matching a particular pattern.
# prefixes
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 (COUNT(?string) AS ?stringCount)
# declared variable that will be counted and passed to another variable to display as a number
WHERE {
?stringStatement ps:P10 ?string .
# use "as recorded" property P-value for the data you want to count
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
# allows English language labels to be returned for Wikibase items
}
}
GROUP BY (?stringCount)
# this sorts the results by number, and is necessary for COUNT clauses
Unenriched Strings Generator
This query generates a list of string values of a particular type of as recorded data occurring in a DS Record which have not be qualified by an authority value (i.e., reconciled to its linked data equivalent in a Linked Open Vocabulary or Authority). This example uses properties for name data, but any authority enriched data can be queried using a similar query structure.
# prefixes
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
# find values for the following declared variables matching the below WHERE pattern
?record
# a link to a DS record
?recordLabel
# the name/label of the DS record
?string
# the string value as recorded in the original catalog record
?authority
# a link to the authority record to which the string value has been reconciled
?authorityLabel
# a label for the the authority record in the DS database
#?roleLabel
# where applicable, a label for role information (un-comment roleLabel variable when querying name data to get role information)
WHERE
# the patterns or conditions that need to be met to return values for the above variables
{
?record p:P14 ?stringStatement .
# identifies records with statements with corresponding property (change P-value for as recorded value to be queried)
?stringStatement ps:P14 ?string .
# identifies statements that have strings with corresponding property (change P-value for as recorded value to be queried)
FILTER NOT EXISTS { ?stringStatement pq:P17 ?authority . }
# identifies those statements which have not been enriched with authority values (change P-value for authority file value to be queried)
#OPTIONAL { ?stringStatement pq:P15 ?role . }
# only used for name data, un-comment optional clause when querying name data
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
# allows English language labels to be returned for Wikibase items
}
}
ORDER BY ASC (?string)
# this sorts the results alphabetically by as recorded string values
Wikidata Uploading Query
As part of a pilot project, DS is uploading data about manuscripts to represent manuscript objects as Wikidata items. The following query pulls down and formats a dataset which can be loaded in OpenRefine and uploaded to Wikidata using a Wikibase schema. This query is set up to pull records from Saint Louis University, but can be altered for other datasets (see information in commented sections).
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)
?scriptNote
(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
?link
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 ?manuscript .
?manuscript wdt:P1 ?DSID .
?manuscript wdt:P2 ?holdingRecord .
?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
}
GROUP BY ?signature ?instanceOf ?scriptNote ?holderDS ?holderWikidata ?DSID ?institutionalID ?shelfmark ?record ?link