query-d47642c6cddab0ae963a0abd78fe2dd1
Wikidata:SPARQL query service/query optimization#Fixed values and ranges
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(?p31label;SEPARATOR=', ') AS ?type) (YEAR(?p577) AS ?year) ?sitelinks ?sitelink ?article WHERE {
{
SELECT DISTINCT ?item ?p577 ?sitelinks WHERE {
?item wdt:P31 wd:Q7725634 .
?item wdt:P407 wd:Q652 .
?item wdt:P577 ?p577 . hint:Prior hint:rangeSafe true .
FILTER ("1980-00-00"^^xsd:date <= ?p577 && ?p577 < "2021-00-00"^^xsd:dat) # change the year limits if needed
?item wikibase:sitelinks ?sitelinks .
} } ?item wdt:P31 [rdfs:label ?p31label] . FILTER(LANG(?p31label)='it') # change the language code if needed
OPTIONAL { ?article schema:about ?item ;
schema:isPartOf <https://en.wikipedia.org/> ;
schema:name ?sitelink .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en,es,pl,uk". }
} GROUP BY ?item ?itemLabel ?itemDescription ?type ?p577 ?sitelinks ?sitelink ?article ORDER BY DESC(?sitelinks) ?itemLabel