Andy, the key of the author in the Edition is different from the key of
Work's author, as you can see in the JSON.

The problem in these items is that the author shown on the web is the
work's author, but that the edition record contains a reference to an
author that is deleted (type=/type/delete) or merged
(type=/type/redirect)​. The server does not accept deleted records or
redirects as references. You need to update the reference(s) in the Edition
record or delete the bad reference(s) altogether (which you can't using the
web interface). VacuumBot encountered these same errors and now uses the
following strategy:
1. check whether the edition has a reference to a work.
1-yes: check whether the work has at least one author
1-yes-yes: delete the authors from the edition
1-yes-no: throw error
1-no: 2a

2a. download the author record
2b. follow the 'location' field value that points to the replacing record
2c. see if the new record is an author
2c-yes: put this key as author in the edition
2c-no: 3a

3a: is the new record again a redirect?
3a-yes: 2a
3a-no: is the new record deleted?
3a-no-yes: undelete the author (set type=/type/author)

See https://github.com/bencomp/VacuumBot/blob/master/vacuumbot.py#L241 for
code (it works for me, but I should use real loggers and refactor into OOP
(just created issue #1 for that). pull requests welcome).

Regards,

Ben
_______________________________________________
Ol-discuss mailing list - Ol-discuss@archive.org
http://mail.archive.org/cgi-bin/mailman/listinfo/ol-discuss
Archives: http://www.mail-archive.com/ol-discuss@archive.org/
To unsubscribe from this mailing list, send email to 
ol-discuss-unsubscr...@archive.org

Reply via email to