query-1d8556024454aba4844357101a9cdbeb
Links to a particular domain from the Wikipedia biographies of artists in a given collection
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 ?artistpage ?extlink WHERE {
{SELECT DISTINCT ?name ?artistpage WHERE {
?item wdt:P195 wd:Q636400; wdt:P170 ?artist. # Artists in the Ashmolean
?artistpage schema:about ?artist;
schema:isPartOf <https://en.wikipedia.org/>; # ENWP articles about them
schema:name ?name # Title of article
}
}
OPTIONAL {SERVICE wikibase:mwapi { # External links from each article
bd:serviceParam wikibase:api "Generator";
wikibase:endpoint "en.wikipedia.org";
mwapi:generator "allpages";
mwapi:gapfrom ?name;
mwapi:gapto ?name;
mwapi:prop "extlinks".
?extlink wikibase:apiOutput "extlinks/el/text()".
}
FILTER CONTAINS(?extlink, "rkd.nl")
}
} ORDER BY ?artistpage
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?artist")
v1("?artistpage"):::projected
v2("?extlink"):::projected
v3("?item")
v5("?name")
c22(["extlinks/el/text()"]):::literal
c20(["extlinks"]):::literal
c7([https://en.wikipedia.org/]):::iri
c14(["en.wikipedia.org"]):::literal
c10(["bd:serviceParam"]):::iri
c16(["allpages"]):::literal
c3(["wd:Q636400"]):::iri
c12(["Generator"]):::literal
v3 --"wdt:P195"--> c3
v3 --"wdt:P170"--> v4
v1 --"schema:about"--> v4
v1 --"schema:isPartOf"--> c7
v1 --"schema:name"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c10 -."mwapi:api".-> c12
c10 --"mwapi:endpoint"--> c14
c10 --"mwapi:generator"--> c16
c10 --"mwapi:gapfrom"--> v5
c10 --"mwapi:gapto"--> v5
c10 --"mwapi:prop"--> c20
v2 --"mwapi:apiOutput"--> c22
end
end