https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40308 --- Comment #5 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 183813 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183813&action=edit Bug 40308: add a command-line tool that updates authorities en masse In Bugs 40309, 40310, and 40311 we will add three new Authority Framework plugins that allow for easy DDC lookups using OCLC's Dewey Linked Data API while cataloguing authorities in the Staff Interface. However, users may want to retroactively enrich their existing authorities using a command-line tool that can modify authorities en masse. This patch adds misc/maintenance/fetch_oclc_dewey_linked_data.pl, which is a Perl script that can accept a number of options in order to facilitate selective operation on specific authority types, or even authid ranges. Test plan (NOTE: you need to have an organizational account with OCLC and an active WebDewey subscription associated with it in order to request a WSKey for accessing the Dewey Linked Data API): [ I recommend working with two KTD instances in parallel. ] 0) First of all, run: ktd_proxy --start 1) Then, edit your KTD .env file so that: KOHA_MARC_FLAVOUR=marc21 Then: ktd --proxy --name marc21 up Wait until it starts up. Then, in a different terminal, edit your KTD .env file so that: KOHA_MARC_FLAVOUR=unimarc Then: ktd --proxy --name unimarc up Wait until it starts up. You now have two KTDs running, one for each MARC flavour you want to test. 2) Get inside the MARC21 Koha container: ktd --name marc21 --shell Download the sample MARC21 authority records (sample_auth_records_marc21.mrc) attached to this Bug report (the file contains 15 records): wget -O sample_auth_records_marc21.mrc https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183809 Then, import the authorities: misc/migration_tools/bulkmarcimport.pl -a --file sample_auth_records_marc21.mrc -v -c MARC21 -m ISO2709 Repeat for the UNIMARC Koha container: ktd --name unimarc --shell Download the sample UNIMARC authority records (sample_auth_records_unimarc.mrc) attached to this Bug report (the file contains 12 records): wget -O sample_auth_records_unimarc.mrc https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183810 Then, import the authorities: misc/migration_tools/bulkmarcimport.pl -a --file sample_auth_records_unimarc.mrc -v -c UNIMARC -m ISO2709 3) Once the sample authorities have been imported, you must fill in these two System Preferences (this is the tricky part, as, in order to request a WSKey you need to have an organizational account with OCLC and an active WebDewey subscription associated with it): - OCLCAPIWSKeyClientID - OCLCAPIWSKeyClientSecret 4) When the above System Preferences have been filled in, try running the new script (passing as many variations of the command-line options as you can). For example: cd misc/maintenance/ ./fetch_oclc_dewey_linked_data.pl -h ./fetch_oclc_dewey_linked_data.pl --man | cat ./fetch_oclc_dewey_linked_data.pl -v ./fetch_oclc_dewey_linked_data.pl -v -l el ./fetch_oclc_dewey_linked_data.pl -v -a SNC ./fetch_oclc_dewey_linked_data.pl -v -a SNC -w "authid = 5955" ./fetch_oclc_dewey_linked_data.pl -v -a SNC -w "authid = 5955" -c ./fetch_oclc_dewey_linked_data.pl -v -a SNC -w "authid = 5955" -l it ./fetch_oclc_dewey_linked_data.pl -v -a SNC -w "authid = 5955" -l it -f ./fetch_oclc_dewey_linked_data.pl -v -l no -f ./fetch_oclc_dewey_linked_data.pl ...etc The output of the script for the above commands should resemble what is being depicted in the following asciinema screencast: https://asciinema.org/a/FKxWqNHLeZbxcgCBwYWZ4fod9 If all goes well, you should have updated all authorities that have a DDC field with their matching Dewey Linked Data. -- You are receiving this mail because: You are watching all bug changes.