query-f6f2726657fd7288d5e0139f92a311c5

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 ?item ?itemLabel_en ?sitelink ?itemLabel_it
{

  SERVICE wikibase:mwapi {
     bd:serviceParam wikibase:endpoint "it.wikipedia.org";
                     wikibase:api "Generator";
                     mwapi:generator "categorymembers";
                     mwapi:gcmtitle "Categoria:Politici italiani del XXI secolo" ;         
                     mwapi:gcmprop "ids|title|type";
                     mwapi:gcmlimit "max".
     # out
     ?name wikibase:apiOutput mwapi:title.        # en-wikipedia article / category name
     ?item wikibase:apiOutputItem mwapi:item.            # wikidata QId for the person's item
    }
  ?article schema:about ?item ;
           schema:name ?sitelink ;
           schema:isPartOf <https://it.wikipedia.org/> .
  FILTER NOT EXISTS { ?item rdfs:label ?itemLabel_it . filter(lang(?itemLabel_it)="it") }
  OPTIONAL { ?item rdfs:label ?itemLabel_en . filter(lang(?itemLabel_en)="en") }
  FILTER (str(?itemLabel_en) != str(?sitelink))
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?article") v4("?item"):::projected v1("?itemLabel_en"):::projected v3("?itemLabel_it"):::projected v5("?name") v2("?sitelink"):::projected c21(["mwapi:item"]):::iri c13(["Categoria:Politici italiani del XXI secolo"]):::literal c25([https://it.wikipedia.org/]):::iri c7(["it.wikipedia.org"]):::literal c5(["bd:serviceParam"]):::iri c17(["max"]):::literal c11(["categorymembers"]):::literal c19(["mwapi:title"]):::iri c15(["ids|title|type"]):::literal c9(["Generator"]):::literal f0[["str(?itemLabel_en) != str(?sitelink)"]] f0 --> v1 f0 --> v2 f1[["not "]] subgraph f1e0["Exists Clause"] e0f0[["?itemLabel_it = 'it'"]] e0f0 --> e0v1 e0v2 --"rdfs:label"--> e0v1 e0v2("?item"):::projected e0v1("?itemLabel_it"):::projected end f1--EXISTS--> f1e0 f1 --> v3 f1 --> v4 f1 --> c2 f2[["?itemLabel_it = 'it'"]] f2 --> v3 v4 --"rdfs:label"--> v3 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c5 --"mwapi:endpoint"--> c7 c5 --"mwapi:api"--> c9 c5 --"mwapi:generator"--> c11 c5 --"mwapi:gcmtitle"--> c13 c5 --"mwapi:gcmprop"--> c15 c5 --"mwapi:gcmlimit"--> c17 v5 --"mwapi:apiOutput"--> c19 v4 --"mwapi:apiOutputItem"--> c21 end v6 --"schema:about"--> v4 v6 --"schema:name"--> v2 v6 --"schema:isPartOf"--> c25 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."rdfs:label".-> v1 end