query-3b3e0223abf018a6b2d7b01ce4f09119
?sitelink?nameFILTER BOUND (?item)
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel_en ?name ?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
}
FILTER BOUND (?item)
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) != ?name)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item"):::projected
v1("?itemLabel_en"):::projected
v3("?itemLabel_it"):::projected
v2("?name"):::projected
c21(["mwapi:item"]):::iri
c17(["max"]):::literal
c13(["Categoria:Politici italiani del XXI secolo"]):::literal
c7(["it.wikipedia.org"]):::literal
c11(["categorymembers"]):::literal
c5(["bd:serviceParam"]):::iri
c19(["mwapi:title"]):::iri
c15(["ids|title|type"]):::literal
c9(["Generator"]):::literal
f0[["str(?itemLabel_en) != ?name"]]
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
f3[["bound(?item)"]]
f3 --> v4
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
v2 --"mwapi:apiOutput"--> c19
v4 --"mwapi:apiOutputItem"--> c21
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."rdfs:label".-> v1
end