80,516
edits
Line 78: | Line 78: | ||
ORDER BY desc(?count) | ORDER BY desc(?count) | ||
=== | ===Number of kazas between 1800 and 1900=== | ||
*This query is not working yet.* The query below returns the number of vilayets between 1750 and 1760. Thanks to [https://stackoverflow.com/users/7879193/stanislav-kralin Stanislav Kralin] for [https://stackoverflow.com/questions/75137894/counting-items-over-time-using-sparql help]. [ run] | |||
PREFIX wd: <http://www.wikidata.org/entity/> | PREFIX wd: <http://www.wikidata.org/entity/> | ||
PREFIX wdt: <http://www.wikidata.org/prop/direct/> | PREFIX wdt: <http://www.wikidata.org/prop/direct/> | ||
SELECT ?number (count(*) as ?count) | SELECT ?number (count(*) as ?count) { | ||
SERVICE <https://query.wikidata.org/sparql> { | |||
? | ?year wdt:P31 wd:Q21199 ; wdt:P1181 ?number | ||
? | FILTER (?number >= 1750 && ?number <= 1760) | ||
?statement ogps:P15 og: | } | ||
?vilayet ogt:P15 og:Q5. | |||
?vilayet ogp:P15 ?statement. | |||
?statement ogps:P15 og:Q5. | |||
?statement ogpq:P7 ?starttime. | ?statement ogpq:P7 ?starttime. | ||
OPTIONAL{?statement ogpq:P8 ?endtime.} | OPTIONAL{?statement ogpq:P8 ?endtime.} | ||
OPTIONAL{?statement ogpq:P22 ?endtime.} | OPTIONAL{?statement ogpq:P22 ?endtime.} | ||
BIND (YEAR(?starttime) AS ?year1) | BIND (YEAR(?starttime) AS ?year1) | ||
BIND (YEAR(COALESCE(?endtime, NOW())) AS ?year2) | BIND (YEAR(COALESCE(?endtime, NOW())) AS ?year2) | ||
FILTER (?number >= ?year1 && ?number <= ?year2) | FILTER (?number >= ?year1 && ?number <= ?year2) | ||
} | } |