30,537
edits
Line 849: | Line 849: | ||
====Holding Institution==== | ====Holding Institution==== | ||
This example identifies manuscripts held by public libraries currently in 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#> | |||
# 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 | |||
</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==== | ====Language==== | ||
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. | 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. |