query-484c3e5dbefba08428ca3124a3926195
title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews)) title: Getting pageviews for all articles in a category SELECT ?title ?pageviews ?date WHERE { VALUES ?item { wd:Q16326821 } # Change category here ?sitelink schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ ; # To change language version first change here schema:name ?name . SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator"; wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here mwapi:generator "categorymembers"; mwapi:prop "pageviews"; mwapi:gcmtitle ?name ; mwapi:pvipdays "1"; # How many days back in time to get the pageviews for mwapi:gcmlimit "500". # Max articles to get the results for ?title wikibase:apiOutput mwapi:title . ?pageviews wikibase:apiOutput "pageviews/pvip/text()". ?date wikibase:apiOutput "pageviews/pvip/@date" . } FILTER(?pageviews != "1") # Filters out results with no views } ORDER BY DESC(xsd:integer(?pageviews))
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 wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Getting pageviews for all articles in a category
SELECT ?title ?pageviews ?date WHERE {
VALUES ?item { wd:Q16326821 } # Change category here
?sitelink schema:about ?item ;
schema:isPartOf <https://en.wikipedia.org/> ; # To change language version first change here
schema:name ?name .
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator";
wikibase:endpoint "en.wikipedia.org"; # then also change to the same language here
mwapi:generator "categorymembers";
mwapi:prop "pageviews";
mwapi:gcmtitle ?name ;
mwapi:pvipdays "1"; # How many days back in time to get the pageviews for
mwapi:gcmlimit "500". # Max articles to get the results for
?title wikibase:apiOutput mwapi:title .
?pageviews wikibase:apiOutput "pageviews/pvip/text()".
?date wikibase:apiOutput "pageviews/pvip/@date" .
}
FILTER(?pageviews != "1") # Filters out results with no views
} ORDER BY DESC(xsd:integer(?pageviews))
Query found at
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh