query-ad1f9ad146cfdcfd02c7f430e34b3b70
16:22, 17 January 2022 (UTC)) talk (Piecesofuk: Just changing the OPTIONAL around the label extraction line to a MINUS should get you those items with missing English labels:UnlimitedRed@ 16:29, 17 January 2022 (UTC)) talk (UnlimitedRedThat seems to do the trick. Everything has atleast 1 link. And I can delete duplicates as I go. I appreciate it. Can we do the same thing with the ones that have no labels?
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?cid ?country ?article ?language WHERE {
VALUES ?language { "en" "hr" "ru" "sh" "sr" }
?cid wdt:P31 wd:Q178561 .
MINUS {
?cid rdfs:label ?country filter (lang(?country) = "en") .
}
OPTIONAL {
?article schema:about ?cid .
?article schema:inLanguage ?language .
?article schema:isPartOf [ wikibase:wikiGroup "wikipedia" ] .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?article"):::projected
v2("?cid"):::projected
v3("?country"):::projected
v1("?language"):::projected
a1((" "))
c2(["wd:Q178561"]):::iri
c8(["wikipedia"]):::literal
bind0[/VALUES ?language/]
bind0-->v1
bind00(["en"])
bind00 --> bind0
bind01(["hr"])
bind01 --> bind0
bind02(["ru"])
bind02 --> bind0
bind03(["sh"])
bind03 --> bind0
bind04(["sr"])
bind04 --> bind0
v2 --"wdt:P31"--> c2
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
f2[["?country = 'en'"]]
f2 --> v3
v2 --"rdfs:label"--> v3
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."schema:about".-> v2
v4 --"schema:inLanguage"--> v1
a1 --"wikibase:wikiGroup"--> c8
v4 --"schema:isPartOf"--> a1
end