DS Catalog:SPARQL Query Service/example queries: Difference between revisions

Line 863: Line 863:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


# find manuscript records for manuscripts in Chinese, Japanese, or Korean
# find manuscript records for manuscripts in particular language(s)
SELECT ?record ?recordLabel ?languageString (GROUP_CONCAT(?languageLabel;separator="|") as ?languages)
SELECT ?record ?recordLabel ?languageString (GROUP_CONCAT(?languageLabel;separator="|") as ?languages)
WHERE {  
WHERE {  
Line 889: Line 889:
ORDER BY ?recordLabel
ORDER BY ?recordLabel
</syntaxhighlight>
</syntaxhighlight>
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20in%20Chinese%2C%20Japanese%2C%20or%20Korean%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FlanguageString%20%28GROUP_CONCAT%28%3FlanguageLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Flanguages%29%0AWHERE%20%7B%20%0A%23%20set%20variable%20value%20for%20language%20or%20languages%20to%20be%20queried%0A%20%20VALUES%20%3Flanguage%20%7B%20wd%3AQ12711%20wd%3AQ12712%20wd%3AQ12715%20%7D%20%23%20Japanese%2C%20Korean%2C%20and%20Chinese%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP21%20AS%20%3FlanguageAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP21%20AS%20%3FlanguageAsRecorded%29.%0A%20%20BIND%28pq%3AP22%20AS%20%3FhasLanguage%29.%0A%20%20%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20language%0A%20%20%3Frecord%20%3FlanguageAsRecordedStatement%20%3FlanguageStatement%20.%0A%23%20statement%3A%20language%20statement%20has%20language%20object%20recorded%20as%20string%20value%0A%20%20%3FlanguageStatement%20%3FlanguageAsRecorded%20%3FlanguageString%20.%0A%23%20statement%3A%20language%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FlanguageStatement%20%3FhasLanguage%20%3Flanguage%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Flanguage%20rdfs%3Alabel%20%3FlanguageLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FlanguageString%0AORDER%20BY%20%3FrecordLabel here].
Try it [https://catalog.digital-scriptorium.org/query/#%23%20prefixes%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2F%3E%0APREFIX%20wds%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fentity%2Fstatement%2F%3E%0APREFIX%20wdv%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fvalue%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttps%3A%2F%2Fcatalog.digital-scriptorium.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0A%23%20find%20manuscript%20records%20for%20manuscripts%20in%20particular%20language%28s%29%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FlanguageString%20%28GROUP_CONCAT%28%3FlanguageLabel%3Bseparator%3D%22%7C%22%29%20as%20%3Flanguages%29%0AWHERE%20%7B%20%0A%23%20set%20variable%20value%20for%20language%20or%20languages%20to%20be%20queried%0A%20%20VALUES%20%3Flanguage%20%7B%20wd%3AQ12711%20wd%3AQ12712%20wd%3AQ12715%20%7D%20%23%20Japanese%2C%20Korean%2C%20and%20Chinese%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP21%20AS%20%3FlanguageAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP21%20AS%20%3FlanguageAsRecorded%29.%0A%20%20BIND%28pq%3AP22%20AS%20%3FhasLanguage%29.%0A%20%20%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20language%0A%20%20%3Frecord%20%3FlanguageAsRecordedStatement%20%3FlanguageStatement%20.%0A%23%20statement%3A%20language%20statement%20has%20language%20object%20recorded%20as%20string%20value%0A%20%20%3FlanguageStatement%20%3FlanguageAsRecorded%20%3FlanguageString%20.%0A%23%20statement%3A%20language%20statement%20has%20qualifier%20for%20structured%2Fauthority%20value%0A%20%20%3FlanguageStatement%20%3FhasLanguage%20%3Flanguage%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Frecord%20rdfs%3Alabel%20%3FrecordLabel%20.%0A%20%20%20%20%3Flanguage%20rdfs%3Alabel%20%3FlanguageLabel%20.%0A%20%20%7D%0A%20%20%7D%0AGROUP%20BY%20%3Frecord%20%3FrecordLabel%20%3FlanguageString%0AORDER%20BY%20%3FrecordLabel here].


====Material====
====Material====
Bots, Bureaucrats, emailconfirmed, Administrators
30,537

edits