30,537
edits
(→Title) |
|||
Line 1,118: | Line 1,118: | ||
====Title==== | ====Title==== | ||
<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 { | |||
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%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== | ==User generated examples== |