query-39cbda8eded5fe31e7a8fb51c14f8aea

rq turtle/ttl

Items with RISM-ID and deWikipedia excluding items which have Template:RISM set in deWiki already included. i am totally unsure, if my solution especially with bound() works well. My first idea to build this with two subqueries and substracting them with MINUS run into timeout. Template:Vorlage:RISM and sitelink to German Wikipedia and i want to exclude all the items which already have on their German Wikipedia page the template (P5504)RISM ID the following query should return items, which have the Vorlage:RISMAbfrage aller Items mit RISM-ID und deWikipedia-Artikel auf deren Wikipedia-Seiten die Vorlage:RISM nicht gesetzt ist.

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?deWP ?rism (CONCAT("[[:Template:RISM]]") AS ?VorlageRISM) WHERE {
  {
    SELECT ?item ?deWP ?rism  WHERE {
      ?item wdt:P5504 ?rism.
      ?deWP schema:about ?item;
        schema:isPartOf <https://de.wikipedia.org/>.
        OPTIONAL {
      SERVICE wikibase:mwapi {
     # in
     bd:serviceParam wikibase:endpoint "de.wikipedia.org";
                     wikibase:api "Generator";
                     mwapi:generator "embeddedin";
                     mwapi:geititle "Vorlage:RISM";
                     mwapi:geinamespace "0".

     # out
     ?rismItem wikibase:apiOutputItem mwapi:item.

    } 
    }

  }
  }
   FILTER(!bound(?rismItem))
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?VorlageRISM") v4("?deWP"):::projected v2("?item"):::projected v3("?rism"):::projected v1("?rismItem") c4([https://de.wikipedia.org/]):::iri c18(["mwapi:item"]):::iri c14(["Vorlage:RISM"]):::literal c16(["0"]):::literal c8(["de.wikipedia.org"]):::literal c6(["bd:serviceParam"]):::iri c12(["embeddedin"]):::literal c10(["Generator"]):::literal f0[["not bound(?rismItem)"]] f0 --> v1 v2 --"wdt:P5504"--> v3 v4 --"schema:about"--> v2 v4 --"schema:isPartOf"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c6 -."mwapi:endpoint".-> c8 c6 --"mwapi:api"--> c10 c6 --"mwapi:generator"--> c12 c6 --"mwapi:geititle"--> c14 c6 --"mwapi:geinamespace"--> c16 v1 --"mwapi:apiOutputItem"--> c18 end end bind1[/"concat('#91;#91;:Template:RISM#93;#93;')"/] bind1 --as--o v5