query-2457df4c6252db0d56b5d59bc2f72a6c
Redundant classifications SELECT DISTINCT ?item ?label ?class_a ?label_a ?class_b ?label_b WHERE { # Working set: american ships ?item wdt:P31/wdt:P279* wd:Q11446; wdt:P8047 wd:Q30. # Rest of query ?item wdt:P31 ?class_a; wdt:P31 ?class_b. ?class_a wdt:P279+ ?class_b. # Labels ?item rdfs:label ?label_nb. FILTER(LANG(?label_nb) = "nb") ?item rdfs:label ?label_en. FILTER(LANG(?label_en) = "en") BIND(COALESCE(?label_nb, ?label_en) AS ?label) ?class_a rdfs:label ?label_a_nb. FILTER(LANG(?label_a_nb) = "nb") ?class_a rdfs:label ?label_a_en. FILTER(LANG(?label_a_en) = "en") BIND(COALESCE(?label_a_nb, ?label_a_en) AS ?label_a) ?class_b rdfs:label ?label_b_nb. FILTER(LANG(?label_b_nb) = "nb") ?class_b rdfs:label ?label_b_en. FILTER(LANG(?label_b_en) = "en") BIND(COALESCE(?label_b_nb, ?label_b_en) AS ?label_b) }
Use at
- https://query.wikidata.org/sparql
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#>
# Redundant classifications
SELECT DISTINCT ?item ?label ?class_a ?label_a ?class_b ?label_b
WHERE {
# Working set: american ships
?item wdt:P31/wdt:P279* wd:Q11446;
wdt:P8047 wd:Q30.
# Rest of query
?item wdt:P31 ?class_a;
wdt:P31 ?class_b.
?class_a wdt:P279+ ?class_b.
# Labels
?item rdfs:label ?label_nb. FILTER(LANG(?label_nb) = "nb")
?item rdfs:label ?label_en. FILTER(LANG(?label_en) = "en")
BIND(COALESCE(?label_nb, ?label_en) AS ?label)
?class_a rdfs:label ?label_a_nb. FILTER(LANG(?label_a_nb) = "nb")
?class_a rdfs:label ?label_a_en. FILTER(LANG(?label_a_en) = "en")
BIND(COALESCE(?label_a_nb, ?label_a_en) AS ?label_a)
?class_b rdfs:label ?label_b_nb. FILTER(LANG(?label_b_nb) = "nb")
?class_b rdfs:label ?label_b_en. FILTER(LANG(?label_b_en) = "en")
BIND(COALESCE(?label_b_nb, ?label_b_en) AS ?label_b)
}