EPrints Technical Mailing List Archive

Message: #03969


< 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 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/