EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #09197
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] get_all_documents from eprint trigger on commit
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] get_all_documents from eprint trigger on commit
- From: James Kerwin <jkerwin2101@gmail.com>
- Date: Tue, 7 Feb 2023 09:28:48 +0000
CAUTION: This e-mail originated outside the University of Southampton.
Hi All,
I'm doing some work around our rights retention policy. It involves checking if something was deposited before or after the date it comes into effect. Quite a big piece of work for me and I'm happy to share code/workflow etc.
I have a script that is kicked off by an eprint trigger on commit. Is it possible for me to use "get_alldocuments" from this? I was able to do this in a /bin script using:
my $eprintid = 3000633;
my $eprint = $ds->dataobj($eprintid);
my @documents_list = $eprint->get_all_documents;
foreach my $document (@documents_list) {
$document->set_value('license','cc_by_4');
$document->commit();
Carrying this over into a trigger which starts with:}
$c->add_dataset_trigger( 'eprint', EP_TRIGGER_AFTER_COMMIT, sub
{
my( %args ) = @_;
my( $repo, $eprint, $changes ) = @args{qw( repository dataobj changed )};
{
my( %args ) = @_;
my( $repo, $eprint, $changes ) = @args{qw( repository dataobj changed )};
I was at it until 3am trying all sorts of different things. Using Data:Dumper to print the content of @documents to the error log, along with some other checkpoints, I can see that the section of code is entered into, but it just moves past @documents
without printing anything and gets to the print statement immediately after. The only reasonable conclusion being that it isn't finding any documents. It seems reasonable that as this is an "eprint" trigger I can't access documents, but I know that in a slightly
different script I can grab all the documents with only an EPrint ID, which I have here along with the $repo.
Can anybody please tell me if this approach is possible and maybe what I'm doing wrong? (Happy to share the entire script and everything else related to this project whether advice is forthcoming or not). If it isn't possible, my solution would be to push
all of the IDs into a file, then have a script that slurps them up and does the "get_all_documents" on them, but that would be a far worse solution in terms of workflow.
Thanks,
James
- Follow-Ups:
- [EP-tech] get_all_documents from eprint trigger on commit
- From: James Kerwin <jkerwin2101@gmail.com>
- [EP-tech] get_all_documents from eprint trigger on commit
- References:
- [EP-tech] get_all_documents from eprint trigger on commit
- From: James Kerwin <jkerwin2101@gmail.com>
- [EP-tech] get_all_documents from eprint trigger on commit
- Prev by Date: Re: [EP-tech] Problem with XML export
- Next by Date: Re: [EP-tech] get_all_documents from eprint trigger on commit
- Previous by thread: [EP-tech] EPrints/CRIS
- Next by thread: [EP-tech] DOI handling in orcid_support_advance
- Index(es):