Tech List

[index] [prev] [next] [options] [help]
See the Mailing Lists Page for how to subscribe and unsubscribe.

eprints_tech messages

Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.

Re: [EP-tech] Adding an institutional id to creators_id

From: Ian Stuart <Ian.Stuart AT ed.ac.uk>
Date: Thu, 26 Jun 2008 14:12:55 +0100


Threading: [EP-tech] Adding an institutional id to creators_id from M.D.Mcfarlane AT lse.ac.uk
      • This Message

*** 
http://www.eprints.org/tech.php/id/%3CEMEW-k5PEEQ7c4b78d119a20ddf9873c09a00f20943-486395D7.5000704%40ed.ac.uk%3E
*** EPrints community wiki - http://wiki.eprints.org/

M.D.Mcfarlane AT lse.ac.uk wrote:
> *** 
http://www.eprints.org/tech.php/id/%3CEMEW-k5PDS3d3547ebf816155ed06ea53c300d2db03-5A885756137C76448B1DFEADAF4EAD4F043B1261%40EXCHF2.lse.ac.uk%3E
> *** EPrints community wiki - http://wiki.eprints.org/
> 
> Hi,
> 
> We would like to add an institutional id for our eprint creators/editors
> so that other departments within the school can harvest records with the
> key linking field being the institutional id (which, as you can gather,
> used institutional wide).
> 
> We don't want to do anything too fancy (for the time being we are just
> going to do an UPDATE matching on email) and I have tried adding a field
> eprint_creators_instid to eprints_creators_id, but cannot get at the
> instid via a MODS export.
I've done this for the Depot.... not particularly difficult:
1) In cfg/cfg.d/eprint_fields.pl, extend the creators (and/or editors, etc):
           {
             'name' => 'creators',
             'type' => 'compound',
             'multiple' => 1,
             'fields' => [
                           {
                             'sub_name' => 'name',
                             'type' => 'name',
                             'hide_honourific' => 1,
                             'hide_lineage' => 1,
                             'family_first' => 1,
                           },
                          {
                             'sub_name' => 'id',
                             'type' => 'text',
                             'input_cols' => 20,
                             'allow_null' => 1,
                           },
                          # my new field
                          {
                             'sub_name' => 'institution',
                             'type' => 'text',
                             'input_cols' => 20,
                             #'allow_null' => 1,
                           }
                         ],
             'input_boxes' => 4,
             'input_ordered' => 0,
           },
**don't forget to add the column to the creator, editor, etc tables**

in cfg/lan/en/phrases/eprint_fields.xml:
     <epp:phrase 
id="eprint_fieldname_creators_institution">Institution</epp:phrase>
     <epp:phrase id="eprint_fieldhelp_creators_institution">The 

instutution that this person is associated with.</epp:phrase>

(ditto for editors, etc)

The only problem now is getting the auto-update to work. This is done in 
cgi/users/lookup/name:

You need something like an SQL query of:
my $sql = "SELECT COUNT(eprint.eprintid) AS 
num_matches,creators_name_honourific,creators_name_given,creators_name_family,creators_name_lineage,creators_id,creators_institution 
from
  eprint_creators_name
   LEFT JOIN eprint_creators_id ON eprint_creators_name.pos = 
eprint_creators_id.pos
   AND eprint_creators_name.eprintid = eprint_creators_id.eprintid LEFT 
JOIN eprint ON eprint_creators_name.eprintid = eprint.eprintid
   LEFT JOIN eprint_creators_institution ON 
eprint_creators_institution.pos = eprint_creators_id.pos
   AND eprint_creators_institution.eprintid = eprint_creators_id.eprintid
   WHERE eprint.eprint_status = 'archive' ";

and a print sequence of:
	print "<ul>";
	print "<li 
id='for:value:relative:_name_family'>$f</li>";
	print "<li id='for:value:relative:_name_given'>$g</li>";
	print "<li 
id='for:value:relative:_name_honourific'>$h</li>";
	print "<li 
id='for:value:relative:_name_lineage'>$l</li>";
	print "<li id='for:value:relative:_id'>$id</li>";
	print "<li 
id='for:value:relative:_institution'>$institution</li>";
	print "</ul></li>\n";

... and Robert is your father's brother....
-- 

Ian Stuart.
Bibliographics and Multimedia Service Delivery team,
EDINA,
The University of Edinburgh.

http://edina.ac.uk/

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


[index] [prev] [next] [options] [help]