Extreme Curation Techniques
WARNING! The techniques described on this page are dangerous. Use with caution, and ensure you have a backup in place.
Contents |
See Also
Locating Content
Locating an item/bitstream, given a DOI
In the database:
select * from metadatavalue where text_value='TARGET_DOI'; select * from item2bundle where item_id=ITEM_ID; select * from bundle2bitstream where bundle_id=BUNDLE_ID; select * from bitstream where bitstream_id=BITSTREAM_ID;
Once you have the information from the bitstream table, you can look in the assetstore for the file with the appropriate internal_id.
Replacing a Bitstream
There are times when the interface won't let you directly replace a bitstream (e.g., certain places within the submission workflow).
- Locate the appropriate bitstream on disk (see above)
- Replace the file (ensure the filename stays the same).
- Update the metadata in the bitstream table of the database:
update bitstream set size_bytes=NEW_SIZE,name='NEW_NAME', source='NEW_NAME',
checksum='NEW_MD5_CHECKSUM' where bitstream_id=BITSTREAM_ID;
Changing Bitstream Formats
- Create the appropriate format in the format registry
- Note the id number for the format
- Update the metadata in the bitstream table:
update bitstream set bitstream_format_id=43 where name like '%.zip';
Altering workflow tables
There have been a number of cases where submissions have gotten into broken states that render normal curation impossible. Workflow processing is described in detail at Workflow State in Database.
Adding rows to workflow tables
Adding a row to workflow tables (e.g., workflowitem, taskowner, tasklistitem) requires generating a new row id for the row (this is actually the case for most dryad tables). There is a function for doing this - getnextid('tablename') - where tablename is just the name of the table you're adding to. For example, the following statement adds a new task with associated workflow_item to the taskowner table and sets the processing to the initial step (and action) and specifies the owner (curator) assigned to this workflow:
INSERT INTO taskowner(task_owner_id,workflow_item_id,step_id,action_id,workflow_id,owner_id) VALUES (getnextid('taskowner'),9999,dryadAcceptEditReject,dryadAcceptEditRejectAction,default,1001);
The following statement creates a new row in the workflowitem table (for a data file):
INSERT INTO workflowitem(workflow_id,item_id,collection_id,multiple_titles,published_before,multiple_files) VALUES (getnextid('workflowitem'),999999,1,'f','f','f');
Moving content between databases
To migrate content from one database to another:
- exported database rows for selected items:
psql -U postgres -d dryad_repo -c "copy (select * from metadatavalue where item_id in (43612,43611,43610,43604,43602,43600,43599,43598,43597,43596,43595,43594,43593,43591)) to stdout" >emMetadataValue.out
- copy the exported file to the location of the target database
- import tables to postgres
psql -U dryad_app -d dryad_repo -c "copy metadatavalue from stdin" < emMetadataValue.out
- update postgres sequences -- this is required so primary keys are generated properly!
SELECT setval('metadatavalue_seq', (SELECT MAX(metadata_value_id) FROM metadatavalue)+1);
Moving content to your control
Sometimes, it is useful to remove an item from the original submitter's control, and pretend it was originally submitted by you. To do this, update the item's owner in two tables:
- item
- taskowner