Reputation: 60193
I want all Wikidata items that have ended, so I wrote this:
?item wdt:P582 ?endtime.
Problem: it does not include items that have been "abolished".
abolished is a subproperty of end time.
QUESTION: How to encompass all subproperties?
Current query that does not include subproperties:
SELECT
?item ?endtime
WHERE {
?item p:P31/ps:P31/wdt:P279* wd:Q3917681. # Embassies...
?item wdt:P582 ?endtime. # ... that have ended
}
I could do a UNION with all known sub-properies, but new sub-properties may appear in the future.
Upvotes: 3
Views: 983
Reputation: 10822
Like Stanislav wrote in his comment, you have to get the prefixes right and also include directClaim
:
?p_ wdt:P1647* wd:P582 .
?p_ wikibase:directClaim ?p .
?item ?p ?endtime .
I have found this to return duplicate rows per item though (due to the *
) which I couldn't get rid off, even with proper GROUP BY
logic. I solved this by doing what the question suggested, UNION with all known sub-properies
Upvotes: 0
Reputation: 85813
If Wikidata includes subproperty relationships, you just need:
?p rdfs:subPropertyOf* wdt:P582 .
?item ?p ?endtime.
Upvotes: 2