Re: [EP-underground] Batch data loading

GNU EPrints Support <[email protected]> Thu, 9 Oct 2003 12:26:51 +0100
Newsgroups gmane.comp.web.eprints.general
Message-ID <[email protected]>
The simple option is to get your data into the the XML format used
by eprints. Type

export_xml archivename archive

to export your current archive in this format. Roughly it looks like 
this...
<eprintsdata>
  <record >
    <field   name="eprintid">8283</field>
    <field   name="userid">343</field>
    <field   name="dir">disk0/00/00/82/83</field>
    <field   name="datestamp">2003-09-26</field>
    <field   name="type">article</field>
    <field   name="succeeds">4441</field>
    <field   id="2351"  name="authors"><part   name="given">S.</part><part   nam
e="family">Chen</part></field>
    <field   id="13"  name="authors"><part   name="given">L.</part><part   name=
"family">Hanzo</part></field>
    <field   id=""  name="authors"><part   name="given">B.</part><part   name="f
amily">Mulgrew</part></field>
    <field   name="chapter"></field>
  </record>
.
.
.
</eprintsdata>

you can then import this data using the import_eprints command.
this does not add the files. Which is, I admit, annoying.

.................

a more complicated but useful option is to use the eprints API to 
 create new eprint objects, 
 set their properties, 
 commit them to the database
 add documents to these eprints
 add files to these documents
 commit the documents to the database

This is easier than it sounds... to make a single new record...

my $session = new EPrints::Session( 1 , $ARGV[0] );
exit( 1 ) unless( defined $session );
my $ds = $session->get_archive()->get_dataset("archive" );

my $data = {
	userid => 1, 
	title => "demo paper", 
	abstract => "blah blah blah", 
	authors => [
			{ main =>{ family=>"gutteridge",given=>"chris"},
			  id=>"[email protected]"
			},
			{ main =>{ family=>"fenderson",given=>"marvin"},
			  id=>"[email protected]"
			} ]
};

my $eprint = EPrints::EPrint::create( $session, $ds, $data )ñ
my $doc = EPrints::EPrint::create( $session, $eprint );
$doc->set_format( "html" );
my $fh;
open( $fh, "/path/to/doc.html" );
$doc->upload( $fh, "doc.html" );
close $fh;
$doc->set_main( "doc.html" );
$doc->commit;
$eprint->generate_static;



This code can easily be made to add documents from whatever
source. 



On Tue, Oct 07, 2003 at 03:43:20 +0800, Peter Law wrote:
> Hello everybody,
> 
> I came across ePrints function of entering metadata in bulk in the list.
> 
> I would like to know more about the following:
> 1) are there any tools/steps provided by ePrints software for loading a large amount of full-text files and metadata into ePrints?
> 2) in what format the metadata and uploaded files has to be in order that ePrints software can perform the batch uploading?
> 3) according to your experience, do you have any idea of how long it takes and how many people are involved in doing so?
> 4) in our planning stage, we would also like to know about any difficulties encountered by the former adopters in preparing the data and uploading the data.
> 
> Thanks.
> 
> Peter Law

-- 

 Christopher Gutteridge                   [email protected]
 ePrints2 Coder, Support and Stuff        +44 23 8059 4833