query-e3ce4e08b0ac6227e482a0ecbc90da85
Items for rural councils in Ukraine, with article in RU.WP, but not in RO.WP, and with less than 2 sitelinks (only one) SELECT ?item ?itemLabel (COUNT(distinct ?sitelink) as ?count) (GROUP_CONCAT(distinct(?sitelink); separator=", ") as ?sitelinks) WHERE { ?item wdt:P31 wd:Q4414033 . ?item wdt:P17 wd:Q212 . ?sitelink schema:about ?item . ?item wikibase:sitelinks ?s . FILTER (?s < 2 ) FILTER EXISTS { ?wen schema:about ?item . ?wen schema:inLanguage "ru" } FILTER NOT EXISTS { ?wfr schema:about ?item . ?wfr schema:inLanguage "ro" } SERVICE wikibase:label { bd:serviceParam wikibase:language "ru,en" . } } GROUP BY ?item ?itemLabel ORDER BY DESC(?count)
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 bd: <http://www.bigdata.com/rdf#>
#Items for rural councils in Ukraine, with article in RU.WP, but not in RO.WP, and with less than 2 sitelinks (only one)
SELECT
?item ?itemLabel
(COUNT(distinct ?sitelink) as ?count)
(GROUP_CONCAT(distinct(?sitelink); separator=", ") as ?sitelinks)
WHERE
{
?item wdt:P31 wd:Q4414033 .
?item wdt:P17 wd:Q212 .
?sitelink schema:about ?item .
?item wikibase:sitelinks ?s .
FILTER (?s < 2 )
FILTER EXISTS { ?wen schema:about ?item . ?wen schema:inLanguage "ru" }
FILTER NOT EXISTS { ?wfr schema:about ?item . ?wfr schema:inLanguage "ro" }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
}
GROUP BY ?item ?itemLabel
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?count")
v3("?item"):::projected
v5("?s")
v6("?sitelink"):::projected
v7("?sitelinks")
v4("?wen")
v2("?wfr")
c7(["wd:Q4414033"]):::iri
c4(["ru"]):::literal
c14(["ru,en"]):::literal
c9(["wd:Q212"]):::iri
c12(["bd:serviceParam"]):::iri
c3(["ro"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"schema:about"--> e0v2
e0v1 --"schema:inLanguage"--> e0c3
e0v2("?item"):::projected
e0v1("?wfr"):::projected
e0c3(["ro"]):::literal
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
f0 --> c2
f0 --> c3
v2 --"schema:about"--> v3
v2 --"schema:inLanguage"--> c3
f1[[" "]]
subgraph f1e1["Exists Clause"]
e1v1 --"schema:about"--> e1v2
e1v1 --"schema:inLanguage"--> e1c3
e1v2("?item"):::projected
e1v1("?wen"):::projected
e1c3(["ru"]):::literal
end
f1--EXISTS--> f1e1
f1 --> v4
f1 --> c1
f1 --> v3
f1 --> c2
f1 --> c4
v4 --"schema:about"--> v3
v4 --"schema:inLanguage"--> c4
f2[["?s < '2^^xsd:integer'"]]
f2 --> v5
v3 --"wdt:P31"--> c7
v3 --"wdt:P17"--> c9
v6 --"schema:about"--> v3
v3 --"wikibase:sitelinks"--> v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind5[/"count(?sitelink)"/]
v6 --o bind5
bind5 --as--o v7
bind6[/"?sitelink"/]
v6 --o bind6
bind6 --as--o v7