|
| 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 with title information |
| 13 | +SELECT ?record ?recordLabel ?titleString ?uniformTitleString (GROUP_CONCAT(?standardTitleLabel;separator="|") as ?standardTitles) |
| 14 | +WHERE { |
| 15 | +# bind query variables |
| 16 | + BIND(p:P10 AS ?titleAsRecordedStatement) |
| 17 | + BIND(ps:P10 AS ?titleAsRecorded). |
| 18 | + BIND(wdt:P12 AS ?uniformTitleAsRecorded). |
| 19 | + BIND(pq:P11 AS ?hasStandardTitle). |
| 20 | + |
| 21 | +# statement: manuscript record has statement for title |
| 22 | + ?record ?titleAsRecordedStatement ?titleStatement . |
| 23 | +# statement: title statement has title object recorded as string value |
| 24 | + ?titleStatement ?titleAsRecorded ?titleString . |
| 25 | +# statement: manuscript record may have statement for uniform title |
| 26 | + OPTIONAL { ?record ?uniformTitleAsRecorded ?uniformTitleString . } |
| 27 | +# statement: title statement may have qualifier for standard title value |
| 28 | + OPTIONAL { ?titleStatement ?hasStandardTitle ?standardTitle . } |
| 29 | + |
| 30 | +# return English language labels |
| 31 | + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". |
| 32 | + ?record rdfs:label ?recordLabel . |
| 33 | + ?standardTitle rdfs:label ?standardTitleLabel . |
| 34 | + } |
| 35 | + } |
| 36 | +GROUP BY ?record ?recordLabel ?titleString ?uniformTitleString |
| 37 | +ORDER BY ?recordLabel |
0 commit comments