EPrints Technical Mailing List Archive

Message: #03983


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Populating Eprints Repository with data from an OAI Data Provider


Hi Admire,

The import command line tool is documented here:
http://wiki.eprints.org/w/API:bin/import

You will see that "dataset" argument is explained like this:

   The name of the dataset to import into, such as "eprint","archive", "subject" or "user"."

Eprint data can be imported into a particular user's workspace (not visible to public) or  live archive (visible to the public).  

For example, the following command: 

	import REPOSITORYID --verbose --user batchimporter eprint XML data.xml

would import, into REPOSITORYID, the data in  data.xml  (formatted as EPrints XML data), using the Import::XML plugin, into the user's workspace of the user "batchimporter".

Best wishes,

Tomasz


-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Admire Mutsikiwa
Sent: February-25-15 3:02 PM
To: 'Field A.N.'; eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Populating Eprints Repository with data from an OAI Data Provider

Hi Adam,

Hope I am not becoming a bother. I have decided to use the method for importing that is explained here http://www.nottingham.ac.uk/~uazmjg/eprints/archives/000074.html .

I have managed to create an xml file formatted as the one given.  I now want to go to step number  3  of importing into archive. The steps are :
	
	bin/import_eprints archiveid dataset xmlfilename
	then run generate_views archiveid.

What I am not sure of is, is the keyword "dataset"   an argument that needs
replacement as with archiveid  and  xmlfilename? If it is an argument, how or where should I get its value?



-----Original Message-----
From: eprints-tech-bounces@ecs.soton .ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Admire Mutsikiwa
Sent: Tuesday, 24 February 2015 4:52 PM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Populating Eprints Repository with data from an OAI Data Provider

Hi Adam,

Thanks for the information and on the advice of not using SQL directly. I have been trying to follow the code and  also looking at the tables in the database, in particular the eprint table, where most of my harvested data is destined to reside in. However, I am not sure how the authors of the articles  harvested via OAI would be linked to the other imported data as the authors are clearly stored in another table. I will appreciate having any idea of the relationships between the table capturing the author names and the eprint table;

Regards,

Admire

-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk
[mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Field A.N.
Sent: Monday, 23 February 2015 12:19 PM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Populating Eprints Repository with data from an OAI Data Provider

Hi

	I would strongly recommend against using SQL to write directly to the database.  Using the EPrints API is the best way to do this, and you can read more about that on the wiki (e.g.
http://wiki.eprints.org/w/Core_API#DataObj ).  Your code would look something like this:


sub create_eprint_record
{
	my ($repository, $oai_data) = @_;
	#$oai_data is a hashref of fields that have been harvested via OAI for a single record


	my $oai_data = get_oai_reco
	my $data = {};

	$data->{title} = $oai_data->{Title};

	#map the type from the harvester to the type in EPrints
	my $type_map = {
		'oai_type_1' => 'eprints_type_1',
		'oai_type_1' => 'eprints_type_2',
		'etc' => 'etc',
	}
	$data->{type} = 'article'; #default type
	if ($type_map->{$oai_data->{'Material Type'}})
	{
		$data->{type} = $type_map->{$oai_data->{'Material Type'}};
	}


	#more mapping



	#now that $data is complete, convert it into an eprint
	my $eprint = $repository->dataset('eprint')->create_dataobj($data);

	return $eprint;
}

Note that this was just typed directly into my email, so is almost certainly not correct, but should get you started on writing your own function.

Best Wishes

--
Adam Field
Business Relationship Manager and Community Lead EPrints Services




On 19 Feb 2015, at 12:39, Admire Mutsikiwa wrote:

> Hi
> I am in the process of implementing an OAI Service Provider (
> Harvester)
using the  Net::OAI::Harvester. I have managed to harvest from the data provider the following metadata:
>  
> Title,
> Author,
> Material Type,
> Item URL ,
> Date of Last Modification,
> Language,
> Keywords,
> Descriptions,
> item oai_identifier
>  
> I would appreciate the mapping that should be done to EPrints tables 
> to
create a complete item record in EPrints.  An SQL statement would be most appropriate.
>  
>  
>  
> Kind Regards,
>  
> Admire Mutsikiwa (Mr)
> ICT Manager
> Libraries
> University of Zimbabwe
> Tel:+263-4-303276
> Mob:+263782476883
>  
> "It is easy to dodge our responsibilities, but we cannot dodge the 
> consequences of dodging our responsibilities."  Josiah Charles Stamp
>  
> *** Options: 
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/