query-ef3ef866a0ffae584dfc80487b7be0e1
Configured templateEach API request should have a configured template that describes inputs and outputs. This is required (at least for now) because of the difference of how Mediawiki API and Query service sees the data - for the former, the input is and URL and the output is a tree-like data structure, for the latter, the data is either triples or tabular. Currently the template must be pre-configured, but if that model works, we may allow to create dynamic definitions right in the query. Example service configuration: } ] "www.wikidata.org" ,"www.mediawiki.org" ,".wikipedia.org" [ :"endpoints" }, } } } "/api/query/pages/page/@title" :"title" ,"@title" :"category" { :"vars" ,"/api/query/pages/page/categories/cl" :"items" { :"output" }, } 500 :"default" ,"int" :"type" { :"cllimit" }, "list" :"type" { :"titles" ,"categories" :"prop" ,"query" :"action" { :"params" { :"Categories" { :"services" {. Categories API, implementing CategoriesThis defines one service, named Example API query:
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT * WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Categories" .
bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
bd:serviceParam mwapi:titles "Albert Einstein" .
bd:serviceParam mwapi:category ?category .
bd:serviceParam mwapi:title ?title .
}
}