I've updated the example query with your pro tip.
Thanks
FabC
On 07/05/2019 23:37, Eugene Alvin Villar wrote:
> Hi,
>
> You can fix the query by replacing the following SPARQL statement:
>
> ?country wdt:P31 wd:Q6256.
>
>
> ...with the following 2 statements:
>
> ?country p:P31 ?countryStatement.
> ?countryStatement ps:P31 wd:Q6256.
Pro tip: you can also write
?country p:P31/ps:P31 wd:Q6256.
so the query looks almost as simple as before. Replacing wdt:Pxxx with
p:Pxxx/ps:Pxxx is a general pattern to switch from "preferred"
statements to "all" statements.
This will include deprecated statements though. To filter those, one
would need the longer version and write something like
?country p:P31 ?statement .
?statement ps:P31 wd:Q6256 .
FILTER NOT EXISTS {?statement wikibase:rank wikibase:DeprecatedRank}
Markus
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata
--