query-e320b3083e3c94ff7712ae10dc35ce08

rq turtle/ttl

TODO

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
#defaultView:BarChart
SELECT ?label ?itemCount ?wiki WHERE {
  {
    SELECT ?label ?wiki (COUNT(DISTINCT ?item) AS ?itemCount) WHERE {
      ?item wdt:P31 wd:Q5;
        wdt:P8713 ?wikiDD.
      ?wikiPage schema:about ?item;
        schema:isPartOf ?wikiUrl;
        schema:inLanguage ?inLang;
        schema:name ?pageTitle.
      BIND("withWP" AS ?label)
      BIND("StadtwikiDD" AS ?wiki)
      FILTER(CONTAINS(STR(?wikiUrl), "wikipedia.org"))
    }
    GROUP BY ?label ?wiki
  }
  UNION
  {
    SELECT ?label ?wiki (COUNT(DISTINCT ?item) AS ?itemCount) WHERE {
      ?item wdt:P31 wd:Q5;
        wdt:P8713 ?wikiDD.
      FILTER(NOT EXISTS {
        ?wikiPage schema:about ?item;
          schema:isPartOf ?wikiUrl;
          schema:inLanguage ?inLang;
          schema:name ?pageTitle.
        FILTER(CONTAINS(STR(?wikiUrl), "wikipedia.org"))
      })
      BIND("noWP" AS ?label)
      BIND("StadtwikiDD" AS ?wiki)
    }
    GROUP BY ?label ?wiki
  }
  UNION
  {
    SELECT ?label ?wiki (COUNT(DISTINCT ?item) AS ?itemCount) WHERE {
      ?item wdt:P31 wd:Q5;
        wdt:P6228 ?wgwID.
      ?wikiPage schema:about ?item;
        schema:isPartOf ?wikiUrl;
        schema:inLanguage ?inLang;
        schema:name ?pageTitle.
      BIND("withWP" AS ?label)
      BIND("RegiowikiAt" AS ?wiki)
      FILTER(CONTAINS(STR(?wikiUrl), "wikipedia.org"))
    }
    GROUP BY ?label ?wiki
  }
  UNION
  {
    SELECT ?label ?wiki (COUNT(DISTINCT ?item) AS ?itemCount) WHERE {
      ?item wdt:P31 wd:Q5;
        wdt:P6228 ?wgwID.
      FILTER(NOT EXISTS {
        ?wikiPage schema:about ?item;
          schema:isPartOf ?wikiUrl;
          schema:inLanguage ?inLang;
          schema:name ?pageTitle.
        FILTER(CONTAINS(STR(?wikiUrl), "wikipedia.org"))
      })
      BIND("noWP" AS ?label)
      BIND("RegiowikiAt" AS ?wiki)
    }
    GROUP BY ?label ?wiki
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?inLang") v2("?item") v11("?itemCount"):::projected v11("?label"):::projected v6("?pageTitle") v10("?wgwID") v11("?wiki"):::projected v3("?wikiDD") v4("?wikiPage") v1("?wikiUrl") c3(["wd:Q5"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["contains(str(?wikiUrl),'wikipedia.org')"]] e0f0 --> e0v1 e0v2 --"schema:about"--> e0v3 e0v2 --"schema:isPartOf"--> e0v1 e0v2 --"schema:inLanguage"--> e0v4 e0v2 --"schema:name"--> e0v5 e0v4("?inLang"):::projected e0v3("?item"):::projected e0v5("?pageTitle"):::projected e0v2("?wikiPage"):::projected e0v1("?wikiUrl"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> v4 f0 --> c5 f0 --> v2 f0 --> c6 f0 --> c7 f0 --> v5 f0 --> c8 f0 --> v6 f1[["contains(str(?wikiUrl),'wikipedia.org')"]] f1 --> v1 v4 --"schema:about"--> v2 v4 --"schema:isPartOf"--> v1 v4 --"schema:inLanguage"--> v5 v4 --"schema:name"--> v6 v2 --"wdt:P31"--> c3 v2 --"wdt:P6228"--> v10 bind2[/"'noWP'"/] bind2 --as--o v11 bind3[/"'RegiowikiAt'"/] bind3 --as--o v11 bind5[/"count(?item)"/] v2 --o bind5 bind5 --as--o v11 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; f6[["contains(str(?wikiUrl),'wikipedia.org')"]] f6 --> v1 v2 --"wdt:P31"--> c3 v2 --"wdt:P6228"--> v10 v4 --"schema:about"--> v2 v4 --"schema:isPartOf"--> v1 v4 --"schema:inLanguage"--> v5 v4 --"schema:name"--> v6 bind7[/"'withWP'"/] bind7 --as--o v11 bind8[/"'RegiowikiAt'"/] bind8 --as--o v11 bind10[/"count(?item)"/] v2 --o bind10 bind10 --as--o v11 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; f11[["not "]] subgraph f11e1["Exists Clause"] e1f0[["contains(str(?wikiUrl),'wikipedia.org')"]] e1f0 --> e1v1 e1v2 --"schema:about"--> e1v3 e1v2 --"schema:isPartOf"--> e1v1 e1v2 --"schema:inLanguage"--> e1v4 e1v2 --"schema:name"--> e1v5 e1v4("?inLang"):::projected e1v3("?item"):::projected e1v5("?pageTitle"):::projected e1v2("?wikiPage"):::projected e1v1("?wikiUrl"):::projected end f11--EXISTS--> f11e1 f11 --> v1 f11 --> v4 f11 --> c5 f11 --> v2 f11 --> c6 f11 --> c7 f11 --> v5 f11 --> c8 f11 --> v6 f12[["contains(str(?wikiUrl),'wikipedia.org')"]] f12 --> v1 v4 --"schema:about"--> v2 v4 --"schema:isPartOf"--> v1 v4 --"schema:inLanguage"--> v5 v4 --"schema:name"--> v6 v2 --"wdt:P31"--> c3 v2 --"wdt:P8713"--> v3 bind13[/"'noWP'"/] bind13 --as--o v11 bind14[/"'StadtwikiDD'"/] bind14 --as--o v11 bind16[/"count(?item)"/] v2 --o bind16 bind16 --as--o v11 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f17[["contains(str(?wikiUrl),'wikipedia.org')"]] f17 --> v1 v2 --"wdt:P31"--> c3 v2 --"wdt:P8713"--> v3 v4 --"schema:about"--> v2 v4 --"schema:isPartOf"--> v1 v4 --"schema:inLanguage"--> v5 v4 --"schema:name"--> v6 bind18[/"'withWP'"/] bind18 --as--o v11 bind19[/"'StadtwikiDD'"/] bind19 --as--o v11 bind21[/"count(?item)"/] v2 --o bind21 bind21 --as--o v11 end union0r <== or ==> union0l end