|
| 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 associated agents recorded |
| 13 | +SELECT ?record ?recordLabel ?nameString (GROUP_CONCAT(?nameLabel;separator="|") as ?associatedAgents) (GROUP_CONCAT(?externalID;separator="|") as ?externalIDs) |
| 14 | +WHERE { |
| 15 | +# bind query variables |
| 16 | + BIND(p:P14 AS ?nameAsRecordedStatement). |
| 17 | + BIND(pq:P15 AS ?hasRole). |
| 18 | + BIND(ps:P14 AS ?nameAsRecorded). |
| 19 | + BIND(pq:P17 AS ?hasName). |
| 20 | + BIND(wdt:P42 AS ?hasWikidataQID). |
| 21 | +# statement: manuscript record has statement for associated name |
| 22 | + ?record ?nameAsRecordedStatement ?nameStatement . |
| 23 | +# statement: associated name has role of associated agent |
| 24 | + ?nameStatement ?hasRole wd:Q1284 . |
| 25 | +# statement: name statement has name object recorded as string value |
| 26 | + ?nameStatement ?nameAsRecorded ?nameString . |
| 27 | +# statement: name statement has qualifier for structured/authority value |
| 28 | +# statement: authority value is represented by URI in external controlled vocabulary |
| 29 | + OPTIONAL { |
| 30 | + ?nameStatement ?hasName ?name . |
| 31 | + ?name ?hasWikidataQID ?QID . |
| 32 | + } |
| 33 | + |
| 34 | +# render QIDs as URLs |
| 35 | + BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID) |
| 36 | + |
| 37 | +# return English language labels |
| 38 | + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". |
| 39 | + ?record rdfs:label ?recordLabel . |
| 40 | + ?name rdfs:label ?nameLabel . |
| 41 | + } |
| 42 | + } |
| 43 | +GROUP BY ?record ?recordLabel ?nameString |
| 44 | +ORDER BY ?recordLabel |
0 commit comments