[EP-tech] Re: Updating Subjects
J.Salter at leeds.ac.uk
Mon Mar 17 12:26:38 GMT 2014
I’d support Seb’s response – I always thought my way was ‘hacky’.
Maybe I need to write a tool to do this…
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Sebastien Francois
Sent: 17 March 2014 12:05
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: Updating Subjects
If I may add to this.... You shouldn't use direct SQL unless there are no other choices - this potentially breaks the relational model.
So instead, you should write a script that transfer objects from one subject id to another, using the EPrints API.
On 17/03/14 09:53, John Salter wrote:
There’s two sides to this:
- getting the new subjects created
- moving eprints from the old subjects to the new ones.
If possible, I’d look at getting the new subjects into order first – as you’ve already identified, either via the web interface or the import (you might want to look at the subject export too – which might be useful to do, add your new subjects and then re-import).
Creating a new set of nodes is (IMO) easier than trying to rework the existing ones as they are stored in the database as both child and parent trees, so you’d possibly have to make changes to stuff in all these tables:
To move the eprints from one node to another, if it’s a straight swap (e.g. subjectid_A is replaced by subjected_1; subjectid_B is replaced by subjectid_2 etc.), it’s fairly easy to do in the database (you could even clone the eprint_subjects table and do the updates in the new copy to be on the safe side).
mysql> UPDATE eprint_subjects SET subject = newSubjectID where subject = oldSubjectID;
I find the following query useful to see if there are any subjects use, but not defined:
mysql> select count(*), subject, pos from eprint_subjects where subject NOT IN (select subjectid from subject) group by subject, pos;
Hope that helps a bit – someone else might have some better/easier ways of doing this!
From: eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk> [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Eliseo Gatchalian
Sent: 17 March 2014 03:06
To: eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>
Subject: [EP-tech] Updating Subjects
I know that we can add and edit the subjects by logging in as admin and can also import a subject_xml file, but If we are to merge some subjects with different subject code into one, is there an automatic way to update the subject codes for the items already submitted in the archive?
I saw the eprints_subject table wherein we can replace the subject field with the new codes and update the items but I’m not sure if there are anything else that we need to update?
Private Bag 3036, Waikato Mail Centre, Hamilton 3240
Phone: +64-(0)7-834 8800 ext 8633
Fax: +64-(0)7-838 8257
Email: ellis.gatchalian at wintec.ac.nz<mailto:ellis.gatchalian at wintec.ac.nz>
[cid:image001.gif at 01CF41DC.21FD4250]
This electronic mail transmission is intended for the named recipients only. It may contain private and confidential information. If this has come to you in error you must take no action based upon it, nor must you copy it or show it to anyone; please telephone or email the sender at Wintec immediately and return the original email. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment which may be included with this message.
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5148 bytes
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20140317/1565cf42/attachment-0001.gif
More information about the Eprints-tech