【发布时间】:2017-10-07 06:08:52
【问题描述】:
如何将结果计数(罢工发生次数)过滤到特定年份(1970 年)?我的解决方案提供了意想不到的结果。在查询中,我写下了我尝试过的替代方案及其结果。
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gg: <http://www.gemeentegeschiedenis.nl/gg-schema#>
PREFIX strikes: <https://iisg.amsterdam/vocab/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?muni ?sdate (COUNT(?muni) as ?muniCount)
WHERE {
?strike strikes:place ?splace .
?strike strikes:date ?sdate .
?muni rdf:type gg:Municipality .
?muni rdfs:label ?ggplace .
FILTER regex(?splace, ?ggplace)
### TASK: Filter results above to strikes in 1970 only
# solution 1: extract year and FILTER on 1970
# FILTER ( year(?sdate) = 1970 )
### Virtuoso 22003 Error SR586: Incomplete RDF box as argument 0 for year().
# solution 2: filter on ?sdate
# FILTER ( ?sdate >= '1970-01-01'^^xsd:date && ?sdate <= '1970-12-31'^^xsd:date )
### Virtuoso 2201B Error SR098: regexp error at '? [Arnhem ( Gelderland )]' column 0 (nothing to repeat)
####### Why? This was no problem under solution 1 ?!
####### Also: note that each of these works seperately, but not together(!):
# FILTER ( ?sdate >= '1970-01-01'^^xsd:date )
# FILTER ( ?sdate <= '1970-12-31'^^xsd:date )
}
LIMIT 10
【问题讨论】: