See eg. P297 at Q37024, there are a qualifier (P582).
Show/debug
This query is wrong, how to show the endtime's like the Q37024 case?
SELECT ?item ?iso2_code ?endtime
WHERE {
?item wdt:P297 ?iso2_code
OPTIONAL { ?iso2_code pq:P582 ?endtime }
}
Filter
I need all items that has no endtime.
Notes about real case
I am querying
SELECT DISTINCT ?iso2_code ?wd_id
WHERE {
?item wdt:P297 ?iso2_code
BIND(strafter(STR(?item),"http://www.wikidata.org/entity/") as ?wd_id).
} ORDER BY ?iso2_code
but retriving duplicates,
- AI | {Q25228,Q1450765} | Q1450765 use P582, Q25228 not
- CS | {Q33946,Q37024} ...
- DK | {Q35,Q756617}
- GE | {Q230,Q1050859}
- NL | {Q55,Q29999}
- PS | {Q219060,Q407199}
- YU | {Q83286,Q838261}
so I need to exclude one, but the correct one: by endtime.
PS: there are a handbook about WIKIDATA Qualifiers but with no real case of retrieving datasets.