|
| 1 | +# prefixes |
| 2 | +PREFIX wd: <https://catalog.digital-scriptorium.org/entity/> |
| 3 | +PREFIX wds: <https://catalog.digital-scriptorium.org/entity/statement/> |
| 4 | +PREFIX wdv: <https://catalog.digital-scriptorium.org/value/> |
| 5 | +PREFIX wdt: <https://catalog.digital-scriptorium.org/prop/direct/> |
| 6 | +PREFIX p: <https://catalog.digital-scriptorium.org/prop/> |
| 7 | +PREFIX ps: <https://catalog.digital-scriptorium.org/prop/statement/> |
| 8 | +PREFIX pq: <https://catalog.digital-scriptorium.org/prop/qualifier/> |
| 9 | +PREFIX wikibase: <http://wikiba.se/ontology#> |
| 10 | +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
| 11 | + |
| 12 | +# find manuscript records by latest date |
| 13 | +SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate |
| 14 | +WHERE { |
| 15 | +# bind query variables |
| 16 | + BIND(p:P23 AS ?dateAsRecordedStatement). |
| 17 | + BIND(ps:P23 AS ?dateAsRecorded). |
| 18 | + BIND(pq:P37 AS ?hasEarliestDate). |
| 19 | + BIND(pq:P36 AS ?hasLatestDate). |
| 20 | +# render datetime values as years |
| 21 | + BIND(year(?earlyDate) AS ?earliestDate). |
| 22 | + BIND(year(?lateDate) AS ?latestDate). |
| 23 | + |
| 24 | +# statement: manuscript record has statement for date of production |
| 25 | + ?record ?dateAsRecordedStatement ?dateStatement . |
| 26 | +# statement: manuscript record has statement for date of production |
| 27 | + ?dateStatement ?dateAsRecorded ?dateString . |
| 28 | +# statement: date statement has qualifier values for earliest and latest dates (datetime values) |
| 29 | + ?dateStatement ?hasEarliestDate ?earlyDate . |
| 30 | + ?dateStatement ?hasLatestDate ?lateDate . |
| 31 | +# filter datetime values by year less than 1812 |
| 32 | + FILTER (YEAR(?lateDate) < 1812) . |
| 33 | + |
| 34 | +# return English language labels |
| 35 | + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". |
| 36 | + } |
| 37 | + } |
| 38 | +ORDER BY ?latestDate ?recordLabel |
0 commit comments