query-434bab8683ab6aa841e23e19d7fac40b

rq turtle/ttl

Kosovo citiziens that have an article in EN or DE wiki but not in SQ SELECT ?item ?itemLabel (COUNT(distinct ?article) as ?count) { { SELECT ?item { { hint:Query hint:optimizer "None" .
?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q1246 . MINUS {?sitelinksq schema:about ?item . ?sitelinksq schema:isPartOf https://sq.wikipedia.org/} } ?article schema:about ?item . { ?article schema:isPartOf https://de.wikipedia.org/ } UNION { ?article schema:isPartOf https://en.wikipedia.org/ } } } ?article schema:about ?item . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" } } GROUP BY ?item ?itemLabel ORDER BY DESC(?count)

Use at

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#>
# Kosovo citiziens that have an article in EN or DE wiki but not in SQ
SELECT ?item ?itemLabel (COUNT(distinct ?article) as ?count)
{
    {
        SELECT ?item
        {
            {

                ?item wdt:P31 wd:Q5  .
                ?item wdt:P27 wd:Q1246 .
                MINUS {?sitelinksq schema:about ?item . ?sitelinksq schema:isPartOf <https://sq.wikipedia.org/>}
            }
          ?article schema:about ?item .
              {
            ?article schema:isPartOf <https://de.wikipedia.org/>
              }
             UNION 
              {
            ?article schema:isPartOf <https://en.wikipedia.org/>
              }
        }
    }
    ?article schema:about ?item .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" }
}
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; v4("?article"):::projected v5("?count") v2("?item"):::projected v3("?sitelinksq") c8([https://de.wikipedia.org/]):::iri c13(["en,de"]):::literal c7([https://sq.wikipedia.org/]):::iri c9([https://en.wikipedia.org/]):::iri c11(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c4(["wd:Q1246"]):::iri v2 --"wdt:P31"--> c2 v2 --"wdt:P27"--> c4 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v3 --"schema:about"--> v2 v3 --"schema:isPartOf"--> c7 end v4 --"schema:about"--> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"schema:isPartOf"--> c9 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"schema:isPartOf"--> c8 end union0r <== or ==> union0l end v4 --"schema:about"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind2[/"count(?article)"/] v4 --o bind2 bind2 --as--o v5