query-30f7659c537c6d6b2ef6853a436af571
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (COUNT(DISTINCT ?article) AS ?Wikipedias) (COUNT(?badge) AS ?badges)
WHERE
{
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "search" .
bd:serviceParam mwapi:gsrsearch 'inlabel:"Environmental impact of"' .
bd:serviceParam mwapi:gsrlimit "max" .
?item wikibase:apiOutputItem mwapi:title .
}
?item rdfs:label ?label.
FILTER CONTAINS(?label, "Environmental impact of")
OPTIONAL
{
?article schema:about ?item .
?article schema:isPartOf ?wp .
OPTIONAL { ?article wikibase:badge ?badge }
?wp wikibase:wikiGroup "wikipedia" .
}
SERVICE wikibase:label
{
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?item rdfs:label ?itemLabel .
}
}
GROUP BY ?item ?itemLabel
ORDER BY DESC(?Wikipedias) ASC(?itemLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?Wikipedias")
v5("?article"):::projected
v7("?badge"):::projected
v8("?badges")
v4("?item"):::projected
v2("?itemLabel"):::projected
v3("?label")
v6("?wp")
c5(["www.wikidata.org"]):::literal
c13(["max"]):::literal
c9(["search"]):::literal
c3(["bd:serviceParam"]):::iri
c24(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c20(["wikipedia"]):::literal
c15(["mwapi:title"]):::iri
c11(["inlabel:"Environmental impact of""]):::literal
c7(["Generator"]):::literal
f0[["contains(?label,'Environmental impact of')"]]
f0 --> v3
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c3 --"mwapi:endpoint"--> c5
c3 --"mwapi:api"--> c7
c3 --"mwapi:generator"--> c9
c3 --"mwapi:gsrsearch"--> c11
c3 --"mwapi:gsrlimit"--> c13
v4 --"mwapi:apiOutputItem"--> c15
end
v4 --"rdfs:label"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."schema:about".-> v4
v5 --"schema:isPartOf"--> v6
v6 --"mwapi:wikiGroup"--> c20
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."mwapi:badge".-> v7
end
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c3 --"mwapi:language"--> c24
v4 --"rdfs:label"--> v2
end
bind3[/"count(?article)"/]
v5 --o bind3
bind3 --as--o v8
bind4[/"count(?badge)"/]
v7 --o bind4
bind4 --as--o v8