query-234a834d10578031fe3ba3bf4f32e559
Sphilbrick
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?person ?articleTitle ?school ?schoolLabel
WHERE {
?person wdt:P166/wdt:P31 wd:Q5892712.
OPTIONAL
{
?person wdt:P69 ?school .
?school wdt:P31 / wdt:P279 * wd:Q38723 .
}
?sitelink schema:about ?person .
?sitelink schema:isPartOf <https://en.wikipedia.org/> .
?sitelink schema:name ?articleTitle .
OPTIONAL
{
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
bd:serviceParam wikibase:limit "once" .
bd:serviceParam mwapi:generator "allpages" .
bd:serviceParam mwapi:gapfrom ?articleTitle .
bd:serviceParam mwapi:gaplimit "1" .
bd:serviceParam mwapi:prop "images|pageprops" .
bd:serviceParam mwapi:ppprop "wikibase_item" .
bd:serviceParam mwapi:imlimit "1" .
?item wikibase:apiOutputItem mwapi:item .
?image wikibase:apiOutput "images/im/@title" .
}
}
FILTER (! BOUND(?image))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?articleTitle"):::projected
v1("?image")
v6("?item")
v2("?person"):::projected
v3("?school"):::projected
v4("?sitelink")
a1((" "))
a2((" "))
c30(["mwapi:item"]):::iri
c9([https://en.wikipedia.org/]):::iri
c16(["en.wikipedia.org"]):::literal
c12(["bd:serviceParam"]):::iri
c20(["allpages"]):::literal
c32(["images/im/@title"]):::literal
c6(["wd:Q38723"]):::iri
c27(["wikibase_item"]):::literal
c23(["1"]):::literal
c18(["once"]):::literal
c25(["images|pageprops"]):::literal
c35(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q5892712"]):::iri
c14(["Generator"]):::literal
f0[["not bound(?image)"]]
f0 --> v1
v2 --"wdt:P166"--> a1
a1 --"wdt:P31"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P69".-> v3
v3 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c6
end
v4 --"schema:about"--> v2
v4 --"schema:isPartOf"--> c9
v4 --"schema:name"--> v5
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c12 -."mwapi:api".-> c14
c12 --"mwapi:endpoint"--> c16
c12 --"mwapi:limit"--> c18
c12 --"mwapi:generator"--> c20
c12 --"mwapi:gapfrom"--> v5
c12 --"mwapi:gaplimit"--> c23
c12 --"mwapi:prop"--> c25
c12 --"mwapi:ppprop"--> c27
c12 --"mwapi:imlimit"--> c23
v6 --"mwapi:apiOutputItem"--> c30
v1 --"mwapi:apiOutput"--> c32
end
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c12 --"mwapi:language"--> c35
end