Permalink
Browse files

Added the 'Q' to the start of wikidata identifiers

  • Loading branch information...
1 parent c247da1 commit c3e32b6095572faa687b2cf0fcf56762d550d0c2 @njh committed Dec 22, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 dbpedialite.rb
View
10 dbpedialite.rb
@@ -84,9 +84,9 @@ def redirect_from_wikidata(id)
begin
sitelink = WikidataApi.get_sitelink(id)
redirect_from_title sitelink['title']
- rescue MediaWiki::NotFound => e
+ rescue MediaWikiApi::NotFound => e
not_found e.to_s
- rescue MediaWiki::Exception => e
+ rescue MediaWikiApi::Exception => e
error 500, "Wikidata API excpetion: #{e}"
end
redirect_from_title(title)
@@ -189,11 +189,11 @@ def format_iso8061(datetime)
redirect_from_title(title)
end
- get %r{^/wikidata/[qQ](\d+)$} do |id|
+ get %r{^/wikidata/([qQ]\d+)$} do |id|
redirect_from_wikidata(id)
end
- get %r{^/things/[Qq](\d+)$} do |id|
+ get %r{^/things/([Qq]\d+)$} do |id|
redirect_from_wikidata(id)
end
@@ -243,7 +243,7 @@ def format_iso8061(datetime)
redirect_from_title($2)
elsif params[:url] =~ %r{^http://dbpedia.org/(page|resource|data)/(.+)$}
redirect_from_title($2)
- elsif params[:url] =~ %r{^http://(www\.)?wikidata.org/wiki/Q(\d+)$}
+ elsif params[:url] =~ %r{^http://(www\.)?wikidata.org/wiki/(Q\d+)$}
redirect_from_wikidata($2)
elsif params[:url] =~ %r{^http://www.freebase.com/(view|inspect|edit/topic)(/.+)$}
begin

0 comments on commit c3e32b6

Please sign in to comment.