query-ab507d4ecf55d879a52f5960d57ac893
In such cases it is often advisable to quickly restrict the item set very early, here with a subquery: 14:15, 9 January 2018 (UTC)) talk (Tagishsimon in my example ... I understand & defer to your approach, but I'd still like to know why I failed to establish a relationship between the ?item ?dob and the ?leapyear label. And to know what was going on with ?itemLabel. --filter(?yearname=?strdobyear)Thank you very much, MisterSynergy. Several things learnt from that example; precision I was aware of; would have been the next thing to be tackled. Can I come back to the failed 17:41, 9 January 2018 (UTC)) talk (TagishsimonThank you again, MisterSynergy. I appreciate the time you spent explaining all of the above. Much obliged. -- 14:35, 9 January 2018 (UTC)) talk (MisterSynergy— Two more hints to your query: make sure that you always reduce the number of involved items as quick as possible, thus add criterions ordered from most specific to most general. Try to avoid string-based operations if ever possible, they have relatively bad performance. and so on is advisable. Unlike the query service variables, you can access and use these one inside the query.FILTER(LANG(?label) = 'en') only inside the query. Mind that this must not be wrapped into a label service command. It binds pairs of terms in any language available, so a subsequent ?item explicitly for variable ?item skos:altLabel ?alias and ?item schema:description ?description, ?item rdfs:label ?labelThe other method is to use variables are for output only; thus do it in the end always.?…Description and ?…Label. You do not have to specify for which variables labels and descriptions should be bound, it just does it for all applicable ones (which is why this is a very expensive operation if large result sets are processed). Important to note: you cannot access these variables inside the queries itself, the ?… variables with English terms (where available) for all item- or property-type variables ?…Description and ?…Label should be done in the end, and it adds SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }The label service works differently than you think. Actually, there are two mechanisms to access labels (same for descriptions, not sure about aliases right not): :, who responded (substantially more competently than I) to a tweet which started this whole January in a leap year business ... Request a Query archives are improved by providing great coding examples from which we can steal later. FnielsenLet me add this query from @
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
(COUNT(?page) AS ?count) ?person ?personLabel
WHERE {
{
SELECT DISTINCT ?person WHERE {
?person wdt:P569 ?birthdate .
BIND(MONTH(?birthdate) AS ?month)
FILTER (?month = 1)
?person p:P569/psv:P569 ?timenode .
?timenode wikibase:timePrecision 11 .
VALUES ?year { 1964 1968 1972 1976 1980 1984 1988 1992 1996 2004 2008 }
BIND(YEAR(?birthdate) AS ?year)
}
LIMIT 1000
} ?page schema:about ?person .
?person wdt:P31 wd:Q5 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?person ?personLabel
ORDER BY DESC(?count)