Discussion:
[Dspace-tech] Permanently Deleting Items
Lighton Phiri
2013-02-04 11:18:56 UTC
Permalink
With regards to permanently deleting items from DSpace,

1. Are there alternative options other than using import utility with
mapfile [1]. I currently have to query PostgreSQL to get (ITEM_ID
HANDLE_ID) and then create a map-file to feed to import utility.

[dspace]/bin dspace import --delete --mapfile dspace-item-delete-mapfile.txt

2. When an item id deleted from repository, is there a way to reset
the counter for item_id?

[1] https://wiki.duraspace.org/display/DSDOC3x/Importing+and+Exporting+Items+via+Simple+Archive+Format#ImportingandExportingItemsviaSimpleArchiveFormat-DeletingorUnimportingItemsinaCollection

Lighton Phiri
http://lightonphiri.org
helix84
2013-02-04 12:01:51 UTC
Permalink
Post by Lighton Phiri
1. Are there alternative options other than using import utility with
mapfile [1]. I currently have to query PostgreSQL to get (ITEM_ID
HANDLE_ID) and then create a map-file to feed to import utility.
So you have item_ids and you just want to skip the lookup part?

One thing you can try is writing a curation task [1]. I've recently
started experimenting with writing them in Jython [2], but you can use
Java or one of several scripting languages.

Another alternative I wanted to suggest is using "[dspace]/bin/dspace
dsrun" to run a class, but I didn't find any class that would just
accept an item_id and delete it for you. processDeleteItem(Context
context, int itemID) seems to be the closest - but there's no way for
you to specify context from command line. So you could write such
class, but that's actually very similar to just writing a curation
task in Java.
Post by Lighton Phiri
2. When an item id deleted from repository, is there a way to reset
the counter for item_id?
Yes, the following script will do it for you. But there shouldn't
really be any need for you to care what the ids are. If you still
decide to run that script, make sure to run it while DSpace is not
running!
[dspace]/etc/postgres/update-sequences.sql

[1] https://wiki.duraspace.org/display/DSDOC3x/Curation+System
[2] https://wiki.duraspace.org/display/DSDOC3x/Curation+tasks+in+Jython


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
Lighton Phiri
2013-02-04 12:28:35 UTC
Permalink
Post by helix84
So you have item_ids and you just want to skip the lookup part?
Yes, the curation task route sounds like the way to go. Thank you. I
had actually hoped there was already something available to do that :)
Post by helix84
[dspace]/etc/postgres/update-sequences.sql
Exactly what I was looking for. Thank you.
Lighton Phiri
http://lightonphiri.org
Post by helix84
Post by Lighton Phiri
1. Are there alternative options other than using import utility with
mapfile [1]. I currently have to query PostgreSQL to get (ITEM_ID
HANDLE_ID) and then create a map-file to feed to import utility.
So you have item_ids and you just want to skip the lookup part?
One thing you can try is writing a curation task [1]. I've recently
started experimenting with writing them in Jython [2], but you can use
Java or one of several scripting languages.
Another alternative I wanted to suggest is using "[dspace]/bin/dspace
dsrun" to run a class, but I didn't find any class that would just
accept an item_id and delete it for you. processDeleteItem(Context
context, int itemID) seems to be the closest - but there's no way for
you to specify context from command line. So you could write such
class, but that's actually very similar to just writing a curation
task in Java.
Post by Lighton Phiri
2. When an item id deleted from repository, is there a way to reset
the counter for item_id?
Yes, the following script will do it for you. But there shouldn't
really be any need for you to care what the ids are. If you still
decide to run that script, make sure to run it while DSpace is not
running!
[dspace]/etc/postgres/update-sequences.sql
[1] https://wiki.duraspace.org/display/DSDOC3x/Curation+System
[2] https://wiki.duraspace.org/display/DSDOC3x/Curation+tasks+in+Jython
Regards,
~~helix84
Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
Continue reading on narkive:
Loading...