query-9538fdf06d81c38a680507fe07a17cb4

rq turtle/ttl

TODO

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?title_en ?article_en
  (IF(BOUND(?article_no), IF(BOUND(?badge_no), ?badge_noLabel, "yes"), "no") as ?no)
  (IF(BOUND(?article_sv), IF(BOUND(?badge_sv), ?badge_svLabel, "yes"), "no") as ?sv)
  (IF(BOUND(?article_da), IF(BOUND(?badge_da), ?badge_daLabel, "yes"), "no") as ?da)
  (IF(BOUND(?article_nn), IF(BOUND(?badge_nn), ?badge_nnLabel, "yes"), "no") as ?nn)
WHERE
{

{
  SELECT ?title_en ?article_en
  WHERE
  {
    SERVICE wikibase:mwapi
    {
      bd:serviceParam wikibase:endpoint "en.wikipedia.org" .

      # Generator to get all transclusions of the Template "WikiProject Climate change"
      bd:serviceParam wikibase:api "Generator" .
      bd:serviceParam mwapi:generator "alltransclusions" .
      bd:serviceParam mwapi:gatfrom "WikiProject Climate change" .
      bd:serviceParam mwapi:gatto "WikiProject Climate change" .
      bd:serviceParam mwapi:gatlimit "max" .

      # Use the info module to get the name of associated page
      # (the template is on talk pages, so this gives the subject pages)
      bd:serviceParam mwapi:prop "info" .
      bd:serviceParam mwapi:inprop "associatedpage" .

      # Output
      # (There is no point in trying to get associated items, because that would be for the found talk pages) 
      ?title wikibase:apiOutput "@associatedpage" .
    }
    BIND (STRLANG(?title, "en") AS ?title_en)
    OPTIONAL { ?article_en schema:name ?title_en . }
    FILTER BOUND(?article_en)
  }
}  ?article_en schema:isPartOf <https://en.wikipedia.org/> .
  ?article_en schema:about ?item .

  OPTIONAL
  {
    ?article_no schema:about ?item ; schema:isPartOf <https://no.wikipedia.org/> .
    OPTIONAL { ?article_no  wikibase:badge ?badge_no . }
  }
  OPTIONAL
  {
    ?article_da schema:about ?item ; schema:isPartOf <https://da.wikipedia.org/> .
    OPTIONAL { ?article_da  wikibase:badge ?badge_da . }
  }
  OPTIONAL
  {
    ?article_sv schema:about ?item ; schema:isPartOf <https://sv.wikipedia.org/> .
    OPTIONAL { ?article_sv  wikibase:badge ?badge_sv . }
  }
  OPTIONAL
  {
    ?article_nn schema:about ?item ; schema:isPartOf <https://nn.wikipedia.org/> .
    OPTIONAL { ?article_nn  wikibase:badge ?badge_nn . }
  }
  SERVICE wikibase:label
  {
    bd:serviceParam wikibase:language "en" .
    ?badge_no rdfs:label ?badge_noLabel .
    ?badge_da rdfs:label ?badge_daLabel .
    ?badge_sv rdfs:label ?badge_svLabel .
    ?badge_nn rdfs:label ?badge_nnLabel .
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?article_da"):::projected v1("?article_en"):::projected v11("?article_nn"):::projected v5("?article_no"):::projected v9("?article_sv"):::projected v8("?badge_da"):::projected v14("?badge_daLabel"):::projected v12("?badge_nn"):::projected v16("?badge_nnLabel"):::projected v6("?badge_no"):::projected v13("?badge_noLabel"):::projected v10("?badge_sv"):::projected v15("?badge_svLabel"):::projected v19("?da") v4("?item") v20("?nn") v17("?no") v18("?sv") v2("?title") v3("?title_en"):::projected c4(["en.wikipedia.org"]):::literal c22([https://en.wikipedia.org/]):::iri c2(["bd:serviceParam"]):::iri c24([https://no.wikipedia.org/]):::iri c17(["associatedpage"]):::literal c15(["info"]):::literal c8(["alltransclusions"]):::literal c28([https://nn.wikipedia.org/]):::iri c13(["max"]):::literal c31(["en"]):::literal c10(["WikiProject Climate change"]):::literal c19(["@associatedpage"]):::literal c26([https://da.wikipedia.org/]):::iri c27([https://sv.wikipedia.org/]):::iri c6(["Generator"]):::literal f0[["bound(?article_en)"]] f0 --> v1 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:endpoint"--> c4 c2 --"mwapi:api"--> c6 c2 --"mwapi:generator"--> c8 c2 --"mwapi:gatfrom"--> c10 c2 --"mwapi:gatto"--> c10 c2 --"mwapi:gatlimit"--> c13 c2 --"mwapi:prop"--> c15 c2 --"mwapi:inprop"--> c17 v2 --"mwapi:apiOutput"--> c19 end bind1[/"STRLANG(?title,'en')"/] v2 --o bind1 bind1 --as--o v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."schema:name".-> v3 end v1 --"schema:isPartOf"--> c22 v1 --"schema:about"--> v4 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."schema:about".-> v4 v5 --"schema:isPartOf"--> c24 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."mwapi:badge".-> v6 end end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v7 -."schema:about".-> v4 v7 --"schema:isPartOf"--> c26 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v7 -."mwapi:badge".-> v8 end end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v9 -."schema:about".-> v4 v9 --"schema:isPartOf"--> c27 subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v9 -."mwapi:badge".-> v10 end end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v11 -."schema:about".-> v4 v11 --"schema:isPartOf"--> c28 subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v11 -."mwapi:badge".-> v12 end end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c2 --"mwapi:language"--> c31 v6 --"rdfs:label"--> v13 v8 --"rdfs:label"--> v14 v10 --"rdfs:label"--> v15 v12 --"rdfs:label"--> v16 end bind2[/"if(bound(?article_no),if(bound(?badge_no),?badge_noLabel,'yes'),'no')"/] v5 --o bind2 v6 --o bind2 v13 --o bind2 bind2 --as--o v17 bind3[/"if(bound(?article_sv),if(bound(?badge_sv),?badge_svLabel,'yes'),'no')"/] v9 --o bind3 v10 --o bind3 v15 --o bind3 bind3 --as--o v18 bind4[/"if(bound(?article_da),if(bound(?badge_da),?badge_daLabel,'yes'),'no')"/] v7 --o bind4 v8 --o bind4 v14 --o bind4 bind4 --as--o v19 bind5[/"if(bound(?article_nn),if(bound(?badge_nn),?badge_nnLabel,'yes'),'no')"/] v11 --o bind5 v12 --o bind5 v16 --o bind5 bind5 --as--o v20