|
| 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 for manuscripts assigned particular subject(s) |
| 13 | +SELECT ?record ?recordLabel ?subjectString (GROUP_CONCAT(?termLabel;separator="|") as ?subjects) |
| 14 | +WHERE { |
| 15 | +# set variable value for subject or subjects to be queried |
| 16 | +VALUES ?term { wd:Q3035 } # Astronomy, Arab |
| 17 | +# bind query variables |
| 18 | + BIND(p:P19 AS ?subjectAsRecordedStatement). |
| 19 | + BIND(ps:P19 AS ?subjectAsRecorded). |
| 20 | + BIND(pq:P20 AS ?hasTerm). |
| 21 | + |
| 22 | +# statement: manuscript record has statement for subject |
| 23 | + ?record ?subjectAsRecordedStatement ?subjectStatement . |
| 24 | +# statement: subject statement has subject object recorded as string value |
| 25 | + ?subjectStatement ?subjectAsRecorded ?subjectString . |
| 26 | +# statement: subject statement has qualifier for structured/authority value |
| 27 | + ?subjectStatement ?hasTerm ?term . |
| 28 | + |
| 29 | +# return English language labels |
| 30 | + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". |
| 31 | + ?record rdfs:label ?recordLabel . |
| 32 | + ?term rdfs:label ?termLabel . |
| 33 | + } |
| 34 | + } |
| 35 | +GROUP BY ?record ?recordLabel ?subjectString |
| 36 | +ORDER BY ?recordLabel |
0 commit comments