query-9706c336a725ac0f2a3f9386dfa94b51
Searching by label, we can easily get the unencoded title that we need for the API request: T148923The example query assumes that the Wikidata label is the same as the Wikipedia title. Wouldn’t it be better to use the enwiki sitelink for this? Thanks to
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 * WHERE {
?laureate wdt:P166 wd:Q38104.
?article a schema:Article;
schema:about ?laureate;
schema:isPartOf <https://en.wikipedia.org/>;
schema:name ?title.
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Categories";
wikibase:endpoint "en.wikipedia.org";
mwapi:titles ?title;
mwapi:category ?category;
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?article"):::projected
v4("?category"):::projected
v1("?laureate"):::projected
v3("?title"):::projected
c4(["schema:Article"]):::iri
c12(["Categories"]):::literal
c2(["wd:Q38104"]):::iri
c7([https://en.wikipedia.org/]):::iri
c14(["en.wikipedia.org"]):::literal
c10(["bd:serviceParam"]):::iri
v1 --"wdt:P166"--> c2
v2 --"a"--> c4
v2 --"schema:about"--> v1
v2 --"schema:isPartOf"--> c7
v2 --"schema:name"--> v3
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c10 --"mwapi:api"--> c12
c10 --"mwapi:endpoint"--> c14
c10 --"mwapi:titles"--> v3
c10 --"mwapi:category"--> v4
end