query-c87274f1872e12b52ba14140aaf8cf72
copy main subject based on label
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 ?label ?subject1Label ?item2 ?subject1 WHERE {
?item1 wdt:P170 wd:Q381238 .
?item2 wdt:P170 wd:Q381238 .
?item1 wdt:P921 ?subject1 .
minus{ ?item2 wdt:P921 ?subject2 . }
?item1 rdfs:label ?label .
FILTER(LANG(?label) = 'pl') .
FILTER(?subject1 != wd:Q381238) .
?item2 rdfs:label ?label .
FILTER(LANG(?label) = 'pl') .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?item1")
v4("?item2"):::projected
v1("?label"):::projected
v2("?subject1"):::projected
v5("?subject2")
c2(["wd:Q381238"]):::iri
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
f0[["?label = 'pl'"]]
f0 --> v1
f1[["?subject1 != 'wd:Q381238'"]]
f1 --> v2
f2[["?label = 'pl'"]]
f2 --> v1
v3 --"wdt:P170"--> c2
v4 --"wdt:P170"--> c2
v3 --"wdt:P921"--> v2
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v4 --"wdt:P921"--> v5
end
v3 --"rdfs:label"--> v1
v4 --"rdfs:label"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end