query-64f645a46709d533c027c171ba616017

rq turtle/ttl

Armenien citiziens that have an article in EN or RU wiki but not in HY SELECT ?item ?itemLabel (COUNT(distinct ?article) as ?count) { { SELECT ?item { { hint:Query hint:optimizer "None" .
?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q399 . MINUS {?sitelinkhy schema:about ?item . ?sitelinkhy schema:isPartOf https://hy.wikipedia.org/} } ?article schema:about ?item . { ?article schema:isPartOf https://ru.wikipedia.org/ } UNION { ?article schema:isPartOf https://en.wikipedia.org/ } } } ?article schema:about ?item . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ru" } } 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#>
# Armenien citiziens that have an article in EN or RU wiki but not in HY
SELECT ?item ?itemLabel (COUNT(distinct ?article) as ?count)
{
    {
        SELECT ?item
        {
            {

                ?item wdt:P31 wd:Q5  .
                ?item wdt:P27 wd:Q399 .
                MINUS {?sitelinkhy schema:about ?item . ?sitelinkhy schema:isPartOf <https://hy.wikipedia.org/>}
            }
          ?article schema:about ?item .
              {
            ?article schema:isPartOf <https://ru.wikipedia.org/>
              }
             UNION 
              {
            ?article schema:isPartOf <https://en.wikipedia.org/>
              }
        }
    }
    ?article schema:about ?item .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ru" }
}
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("?sitelinkhy") c13(["en,ru"]):::literal c9([https://en.wikipedia.org/]):::iri c4(["wd:Q399"]):::iri c11(["bd:serviceParam"]):::iri c8([https://ru.wikipedia.org/]):::iri c2(["wd:Q5"]):::iri c7([https://hy.wikipedia.org/]):::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