query-6aaf8a0d0ea396ff7812dda1488f881a
DCausse (WMF)TomT0m
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 ?otitle ?item ?itemLabel ?genreLabel ?article ?name (lang(?name) as ?lang) ?category {
?item wdt:P31 wd:Q5 ;
wdt:P106/wdt:P279* wd:Q266569 .
optional {
?item wdt:P21 ?genre
}
filter (?genre != wd:Q6581097 ).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?article schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> ; schema:name ?name
########### find articles by their ratings on enwiki
# compute the name of the talk page on enwiki
bind (concat("Talk:", ?name) as ?title)
# find the categories of the talkpage using mwapi
SERVICE wikibase:mwapi {
# Categories that contain these pages
bd:serviceParam wikibase:api "Categories";
wikibase:endpoint "en.wikipedia.org";
mwapi:cllimit "max" ;
mwapi:titles ?title ;
mwapi:clcategories "Category:Start-Class biography articles|Category:Stub-Class biography articles|Category:C-Class biography articles" .
# Output the page title
?otitle wikibase:apiOutput mwapi:title.
?category wikibase:apiOutput mwapi:category.
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?article"):::projected
v7("?category"):::projected
v1("?genre")
v2("?item"):::projected
v8("?lang")
v4("?name"):::projected
v6("?otitle"):::projected
v5("?title")
a1((" "))
c14([https://en.wikipedia.org/]):::iri
c20(["en.wikipedia.org"]):::literal
c9(["bd:serviceParam"]):::iri
c28(["mwapi:category"]):::iri
c3(["wd:Q5"]):::iri
c18(["Categories"]):::literal
c22(["max"]):::literal
c25(["Category:Start-Class biography articles|Category:Stub-Class biography articles|Category:C-Class biography articles"]):::literal
c6(["wd:Q266569"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c27(["mwapi:title"]):::iri
f0[["?genre != 'wd:Q6581097'"]]
f0 --> v1
v2 --"wdt:P31"--> c3
v2 --"wdt:P106"--> a1
a1 --"wdt:P279"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P21".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"mwapi:language"--> c11
end
v3 --"schema:about"--> v2
v3 --"schema:isPartOf"--> c14
v3 --"schema:name"--> v4
bind1[/"concat('Talk:',?name)"/]
v4 --o bind1
bind1 --as--o v5
subgraph s2["http://wikiba.se/ontology#mwapi"]
style s2 stroke-width:4px;
c9 --"mwapi:api"--> c18
c9 --"mwapi:endpoint"--> c20
c9 --"mwapi:cllimit"--> c22
c9 --"mwapi:titles"--> v5
c9 --"mwapi:clcategories"--> c25
v6 --"mwapi:apiOutput"--> c27
v7 --"mwapi:apiOutput"--> c28
end
bind2[/"?name"/]
v4 --o bind2
bind2 --as--o v8