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

Jump to navigation Jump to search
Line 810: Line 810:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


# find manuscript records by latest date
# find manuscript records by earliest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
WHERE {
Line 838: Line 838:
ORDER BY ?latestDate ?recordLabel
ORDER BY ?latestDate ?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%20by%20latest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20equal%20to%201515%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3D%201515%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here].<br><br>
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%20by%20earliest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20year%20equal%20to%201515%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3D%201515%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here].<br><br>
''Before earliest date''<br>
''Before earliest date''<br>
This example identifies records for manuscripts with an earliest production date before 1066.
This example identifies records for manuscripts with an earliest production date before 1066.
Line 853: Line 853:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


# find manuscript records by latest date
# find manuscript records by earliest date
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
SELECT ?record ?recordLabel ?dateString ?earliestDate ?latestDate
WHERE {
WHERE {
Line 881: Line 881:
ORDER BY ?latestDate ?recordLabel
ORDER BY ?latestDate ?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%20by%20latest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20less%20than%201066%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3C%201066%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here].<br><br>
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%20by%20earliest%20date%0ASELECT%20%3Frecord%20%3FrecordLabel%20%3FdateString%20%3FearliestDate%20%3FlatestDate%0AWHERE%20%7B%0A%23%20bind%20query%20variables%0A%20%20BIND%28p%3AP23%20AS%20%3FdateAsRecordedStatement%29.%0A%20%20BIND%28ps%3AP23%20AS%20%3FdateAsRecorded%29.%0A%20%20BIND%28pq%3AP37%20AS%20%3FhasEarliestDate%29.%0A%20%20BIND%28pq%3AP36%20AS%20%3FhasLatestDate%29.%0A%23%20render%20datetime%20values%20as%20years%0A%20%20BIND%28year%28%3FearlyDate%29%20AS%20%3FearliestDate%29.%0A%20%20BIND%28year%28%3FlateDate%29%20AS%20%3FlatestDate%29.%0A%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3Frecord%20%3FdateAsRecordedStatement%20%3FdateStatement%20.%0A%23%20statement%3A%20manuscript%20record%20has%20statement%20for%20date%20of%20production%0A%20%20%3FdateStatement%20%3FdateAsRecorded%20%3FdateString%20.%0A%23%20statement%3A%20date%20statement%20has%20qualifier%20values%20for%20earliest%20and%20latest%20dates%20%28datetime%20values%29%0A%20%20%3FdateStatement%20%3FhasEarliestDate%20%3FearlyDate%20.%0A%20%20%3FdateStatement%20%3FhasLatestDate%20%3FlateDate%20.%0A%23%20filter%20datetime%20values%20by%20less%20than%201066%0A%20%20FILTER%20%28YEAR%28%3FearlyDate%29%20%3C%201066%29%20.%0A%0A%23%20return%20English%20language%20labels%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%0A%20%20%7D%0A%20%20%7D%0AORDER%20BY%20%3FlatestDate%20%3FrecordLabel here].<br><br>
''After earliest date''<br>
''After earliest date''<br>
This example identifies records for manuscripts with an earliest production date after 1066.  
This example identifies records for manuscripts with an earliest production date after 1066.  
Bots, Bureaucrats, emailconfirmed, Administrators
30,537

edits

Navigation menu