query-b865ea53a425a60521c7801857ca2255
Find number of steps in article text at Wikipedia
by Jura1, 2017-07-03
last checked: July 2017, some 28 false positives remain (enwiki)
change "en.wikipedia.org" and search term for other wikis
SELECT ?itemLabel ?item ?art
WHERE
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
bd:serviceParam mwapi:generator "search" .
bd:serviceParam mwapi:gsrsearch "steps lighthouse" .
bd:serviceParam mwapi:gsrlimit "max" .
?item wikibase:apiOutputItem mwapi:item .
}
?item wdt:P31 wd:Q39715
FILTER NOT EXISTS { ?item wdt:P2670 wd:Q3289701 }
?art schema:about ?item ; schema:isPartOf https://en.wikipedia.org/
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(xsd:integer(SUBSTR(STR(?item),33)))
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
# Find number of steps in article text at Wikipedia
# by Jura1, 2017-07-03
# last checked: July 2017, some 28 false positives remain (enwiki)
# change "en.wikipedia.org" and search term for other wikis
SELECT ?itemLabel ?item ?art
WHERE
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
bd:serviceParam mwapi:generator "search" .
bd:serviceParam mwapi:gsrsearch "steps lighthouse" .
bd:serviceParam mwapi:gsrlimit "max" .
?item wikibase:apiOutputItem mwapi:item .
}
?item wdt:P31 wd:Q39715
FILTER NOT EXISTS { ?item wdt:P2670 wd:Q3289701 }
?art schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/>
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(xsd:integer(SUBSTR(STR(?item),33)))
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?art"):::projected
v1("?item"):::projected
c17(["mwapi:item"]):::iri
c9(["en.wikipedia.org"]):::literal
c11(["search"]):::literal
c22([https://en.wikipedia.org/]):::iri
c5(["bd:serviceParam"]):::iri
c3(["wd:Q3289701"]):::iri
c13(["steps lighthouse"]):::literal
c19(["wd:Q39715"]):::iri
c15(["max"]):::literal
c25(["en"]):::literal
c7(["Generator"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P2670"--> e0c2
e0v1("?item"):::projected
e0c2(["wd:Q3289701"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c2
f0 --> c3
v1 --"wdt:P2670"--> c3
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c5 --"mwapi:api"--> c7
c5 --"mwapi:endpoint"--> c9
c5 --"mwapi:generator"--> c11
c5 --"mwapi:gsrsearch"--> c13
c5 --"mwapi:gsrlimit"--> c15
v1 --"mwapi:apiOutputItem"--> c17
end
v1 --"wdt:P31"--> c19
v2 --"schema:about"--> v1
v2 --"schema:isPartOf"--> c22
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c5 --"mwapi:language"--> c25
end