I wanted to add the instance of property to this example query to get only items which are an instance of human.
This is the example query:
SELECT ?entityLabel (YEAR(?date) as ?year)
WHERE
{
BIND(MONTH(NOW()) AS ?nowMonth)
BIND(DAY(NOW()) AS ?nowDay)
?entity wdt:P569 ?date .
FILTER (MONTH(?date) = ?nowMonth && DAY(?date) = ?nowDay)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
LIMIT 10
And this my adjusted version with the instance of property:
SELECT ?entityLabel (YEAR(?date) as ?year)
WHERE
{
?entity wdt:P31 wd:Q5 .
BIND(MONTH(NOW()) AS ?nowMonth)
BIND(DAY(NOW()) AS ?nowDay)
?entity wdt:P569 ?date .
FILTER (MONTH(?date) = ?nowMonth && DAY(?date) = ?nowDay)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
LIMIT 10
But also I added just the one line I now get a query timeout. Does anyone know how I cloud improve my query so that I don't get a timeout.
This will time out because the query service will attempt to start with all wdt:P31 wd:Q5 before limiting them.
You can see more details in: https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With