query-83cce75873d2709b80fce833be423ea3
TODO
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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item1 ?item1Label ?labelnew1 ?item2 ?item2Label WHERE {
{
SELECT DISTINCT ?item1 ( STR( SUBSTR( ?label1, 1, STRLEN( ?label1 ) - 1 ) ) AS ?labelnew1 ) {
?item1 wdt:P31 wd:Q44559; rdfs:label ?label1 .
MINUS { ?item1 p:P397 [] }.
FILTER( LANG( ?label1 ) = "en" ) .
}
}.
{
SELECT DISTINCT ?item2 ( STR( ?label ) AS ?label2 ) {
?item2 wdt:P31 wd:Q523; rdfs:label ?label .
FILTER( LANG( ?label ) = "en" ) .
}
}.
FILTER( ?label2 = ?labelnew1 ) .
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;
v4("?item1"):::projected
v6("?item2"):::projected
v5("?label")
v3("?label1")
v7("?label2")
v5("?labelnew1"):::projected
a1((" "))
c6(["wd:Q523"]):::iri
c8(["bd:serviceParam"]):::iri
c1(["en"]):::literal
c3(["wd:Q44559"]):::iri
f0[["?label2 = ?labelnew1"]]
f0 --> v7
f0 --> v5
f1[["?label1 = 'en'"]]
f1 --> v3
v4 --"p:direct/P31"--> c3
v4 --"rdfs:label"--> v3
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v4 --"p:P397"--> a1
end
bind3[/"str(substring(?label1,'1^^xsd:integer',string-length(?label1) - '1^^xsd:integer'))"/]
v3 --o bind3
bind3 --as--o v5
f4[["?label = 'en'"]]
f4 --> v5
v6 --"p:direct/P31"--> c6
v6 --"rdfs:label"--> v5
bind5[/"str(?label)"/]
v5 --o bind5
bind5 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c1
end