Assuming the field name itself doesn’t vary, you are probably best to create 
the new identifier field in your metadata registry (probably create a new 
custom schema for it to separate it from your DC metadata), then you’ll be able 
to INSERT a bunch of new entries in ‘metadatavalue’ – metadata_field_id will be 
the id that was created in metadatafieldregistry when you added the new 
metadata field via the admin interface. You should only need to INSERT values 
into item_id, metadata_field_id, text_value, text_lang and place – I imagine 
metadata_value_id is an auto-increment primary key.

 

So, the SQL should look something like this (untested! And silly example 
values):

 

INSERT INTO metadatavalue (item_id, metadata_field_id, text_value, text_lang, 
place) VALUES (‘123’, ’45’, ‘Actual value’, ‘en_US’, ‘’);

 

In saying this, I’ve just realised I’m looking at the Dspace 1.5 database 
schema :P - it’s not too different from 1.4.2, though, you just might have to 
tweak it a bit.

 

Cheers,

 

Kim

 

From: Steve Thomas [mailto:[EMAIL PROTECTED] 
Sent: Friday, 14 November 2008 2:17 p.m.
To: Dspace-Tech
Subject: [Dspace-tech] Using SQL to add a metadata field to records?

 

Hi.

We have a need to add a new metadata field (a unique identifier) to many 
records in our DSpace (1.4.2) database. Basically, we will have a list of 
DOI-identifier pairs, and for each item matching the DOI, we'll want to add a 
new identifier field with the identifier value.

Can anyone offer me a clue as to how I do this? I.e. what SQL code do I need to 
create a new metadata field for an item?

I can see that I need to INSERT into METADATAVALUE, but .. where do I get 
METADATA_VALUE_ID? 


Cheers,
Steve

-- 

Stephen Thomas,
Senior Systems Analyst,
University of Adelaide Library
UNIVERSITY OF ADELAIDE SA 5005 AUSTRALIA
Phone: +61 8 830 35190
Fax: +61 8 830 34369
Email: [EMAIL PROTECTED]
URL: http://www.adelaide.edu.au/directory/stephen.thomas
CRICOS Provider Number 00123M 

P please consider the environment before printing.

This email message is intended only for the addressee(s) and contains 
information that may be confidential and/or copyright. If you are not the 
intended recipient please notify the sender by reply email and immediately 
delete this email. Use, disclosure or reproduction of this email by anyone 
other than the intended recipient(s) is strictly prohibited. No representation 
is made that this email or any attachments are free of viruses. Virus scanning 
is recommended and is the responsibility of the recipient. 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to