angularjs - MediaWiki Query and/or WikidataQuery to find Wikipedia article -


this isn't question abut angularjs wikimedia , wikidata query api's.

although trying display content of wikipedia article in angularjs after doing query isn't problem. know how display it... problem search article or articles.

i'm trying query wikipedia historical event date as well geo-location.

let's pick random event, event. let's "1986 mozambican tupolev tu-134 crash". link: http://en.wikipedia.org/wiki/1986_mozambican_tupolev_tu-134_crash

from article, can see exact date: 19 october 1986
geo-location of event: -25.911389, 31.957222

i'm trying build search in angularjs can use either date-range and/or geolocation coordinates find event.

i aware mediawiki has geolocation api now, , able find above event either keyword or coordinates. result turns other articles exist within radius around using this:

http://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=10000&gscoord=-25.911389|31.957222&prop=extracts|info&exintro&titles=1986_mozambican_tupolev_tu-134_crash&format=json&explaintext&redirects&inprop=url&indexpageids&format=json&callback=json_callback

however, there no way search mediawiki point in time or date of event.

wikidata on other hand has 2 methods of searching data... has date range geolocation.

however, when query run, have no idea being returned.

for example, when use query string:

https://wdq.wmflabs.org/api?q=around[625,-25.911389,31.957222,5]%20and%20between[585,1985,1987] 

it returns this:

{"status":{"error":"ok","items":1,"querytime":"544ms","parsed_query":"(around[625,-25.9114,31.9572,5] , between[585,+00000001985-00-00t00:00:00z,+00000001987-00-00t00:00:00z])"},"items":[950273]}

using wikidata's query tool:

http://tools.wmflabs.org/autolist/autolist1.html?q=around[625,-25.911389,31.957222,5]%20and%20between[585,1985,1987]

i can see 950273 represents article in way. i'm not sure how use direct me actual article in wikipedia.

i don't know "items": [950273]" represents, or how use me wikipedia article , display contents of article in angularjs.

is there way both query date of historical event geolocation. either using mediawiki or wikidata or combination of two?


edit: solution question above. seems bit of hack... works. enough now. here controller.

.controller('wikiqueryctrl', ['$scope', '$http', function($scope, $http) {     $http({             //these geo coordinates , date ranges dynamic.             url: 'https://wdq.wmflabs.org/api?q=around[625,-25.911389,31.957222,5]%20and%20between[585,1985,1987]&callback=json_callback',             method: 'jsonp'         })         .success(function(response) {             var items = response.items;             $scope.jason = items;             var wikidatastring = 'http://www.wikidata.org/w/api.php?action=wbgetentities&format=json&ids=q' + items + '&props=sitelinks%7csitelinks%2furls&callback=json_callback';             $http({                     url: wikidatastring,                     method: 'jsonp'                 })                 .success(function(response2) {                     $scope.jason2 = response2;                     var url = response2.entities["q" + items].sitelinks.enwiki.url;                     var wikipediatitle = url.substr(24, url.length);                     var wikipediaurl = 'http://en.wikipedia.org/w/api.php?action=query&prop=extracts|info&exintro&titles=' + wikipediatitle + '&format=json&explaintext&redirects&inprop=url&indexpageids&format=json&callback=json_callback';                     $http({                         url: wikipediaurl,                         method: 'jsonp'                      }).success(function(response4) {                         var query = response4.query;                         var pageid = response4.query.pageids;                         var title = response4.query.pages[pageid].title;                         var fullurl = response4.query.pages[pageid].fullurl;                         var content = response4.query.pages[pageid].extract;                         $scope.title = title;                         $scope.content = content;                         $scope.fullurl = fullurl;                         $scope.jason = query;                     });                 });         }); }]); 

950273 wikidata entity id. find entity @ https://www.wikidata.org/wiki/q950273

by using can query wikidata articles connected using api , action wbgetentities , ask sitelinks , sitelinks/url this: http://wikidata.org/w/api.php?action=wbgetentities&format=json&ids=q950273&props=sitelinks%7csitelinks%2furls

or try going language version of choice directly using special:gotolinkedpage. eg. https://www.wikidata.org/wiki/special:gotolinkedpage/enwiki/q950273


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -