query-5048313b66dba46a4862b4885709ebe5
and not, you can use an OPTIONAL clause e.g. like this: (Q1233)Sandro Pertini . To get results both named after LuckyzHi 11:32, 18 April 2020 (UTC)) talk (Andrew Gray). You'll have to do a little manual cleanup to pick only the relevant items, but it should be reasonably easy. aliases (named in the (Q528184)Turin Airport ) or description (where Pertini is mentioned in the (Q1239022)Carla Voltolina The problem is that it can't search in labels only, so you also get things like should do it. It finds anything matching "Sandro Pertini" in the label/alias/description fields, and removes anything known (from SPARQL) to be named after him.This query: You can do this through PetScan - one of the options there is the "normal" Wikidata search. Dipsacus fullonum, Luckyz@ did the job. In the meantime, I don't understand what's wrong with my query:Andrew GrayThanks both, I think
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?itemDescription ?named_afterLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
?item wdt:P31 wd:Q126807.
?item rdfs:label ?label.
FILTER CONTAINS(?label, "Sandro Pertini")
OPTIONAL
{
?item wdt:P138 wd:Q1233.
VALUES ?named_after_Q1233 { true }
}
OPTIONAL { ?item wdt:P138 ?named_after }
SERVICE wikibase:label { bd:serviceParam wikibase:language "it,[AUTO_LANGUAGE],en" .
?named_after rdfs:label ?named_afterLabel .
}
}