|
| 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 place of production recorded |
| 13 | +SELECT ?record ?recordLabel ?placeString (GROUP_CONCAT(?placeLabel;separator="|") as ?places) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs) |
| 14 | +WHERE { |
| 15 | +# bind query variables |
| 16 | + BIND(p:P27 AS ?placeAsRecordedStatement). |
| 17 | + BIND(ps:P27 AS ?placeAsRecorded). |
| 18 | + BIND(pq:P28 AS ?hasPlace). |
| 19 | + BIND(wdt:P44 AS ?hasExternalID). |
| 20 | +# statement: manuscript record has statement for place of production |
| 21 | + ?record ?placeAsRecordedStatement ?placeStatement . |
| 22 | +# statement: place statement has place object recorded as string value |
| 23 | + ?placeStatement ?placeAsRecorded ?placeString . |
| 24 | +# statement: place statement may have qualifier for structured/authority value |
| 25 | +# statement: authority value is represented by URI in external controlled vocabulary |
| 26 | + OPTIONAL { |
| 27 | + ?placeStatement ?hasPlace ?place . |
| 28 | + ?place ?hasExternalID ?externalID . |
| 29 | + } |
| 30 | + |
| 31 | +# return English language labels |
| 32 | + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". |
| 33 | + ?record rdfs:label ?recordLabel . |
| 34 | + ?place rdfs:label ?placeLabel . |
| 35 | + } |
| 36 | + } |
| 37 | +GROUP BY ?record ?recordLabel ?placeString |
| 38 | +ORDER BY ?recordLabel |
0 commit comments