query-f5fb1a94ab69c1b4af81d469ef1107df
With further work, we were able to combine our two queries using subqueries:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?person ?personLabel ?school ?schoolLabel
WHERE {
?person wdt:P69 ?school.
{
SELECT ?school
WHERE {
?school wdt:P856 ?schoolurl.
#using star because an item might be an instance of educational institution
?school (wdt:P31/wdt:P279*) wd:Q2385804.
FILTER contains(str(?schoolurl), "newschool.edu")
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
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;
v1("?person"):::projected
v2("?school"):::projected
v3("?schoolurl")
a1((" "))
c6(["wd:Q2385804"]):::iri
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P69"--> v2
f0[["contains(str(?schoolurl),'newschool.edu')"]]
f0 --> v3
v2 --"wdt:P856"--> v3
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end