2
votes

Wikidata has now redirections that make some concepts pointing to others that have the same meaning. This is great but my app works with Wikidata and old concepts in my database are now absent from the new dump, and the linking with the new concept is not possible.

For example this link is the item I get when requesting the item "Q3840848" on Wikidata.

However those redirections are absent in the Json Dump. I tried to find the previous item "Q3840848" with a simple grep and didn't get any results, furthermore I got no parse error when I parse the dump according to the doc, so how can I retrieve all the redirections from a Json Dump ?

2
I'm not aware of any solution regarding the dump and redirections, but can't you just keep using those old item ids as aliases, given all your requests will be redirected to the new items? - maxlath
I got a solution, a sql file can be found among their dumps. just parse the sql and you can get all the redirects even if it's not an elegant solution - Remzouz

2 Answers

0
votes

The dump you mentioned in the comments is no longer maintained. If you really want to get the redirection you have to parse entirely the .ttl file.

0
votes

We just ran into the same issue, you can query the redirects from the SPARQL endpoint:

#Redirect
SELECT ?primary ?secondary 
WHERE 
{ ?primary wdt:P31 wd:Q11173 . #Example: instance of chemical compoun
 
  ?secondary owl:sameAs ?primary. # redirect
} LIMIT 50