Difference between revisions of "API:EPrints/DataObj/Import"

From EPrints Documentation
Jump to: navigation, search
(New page: <!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost. -...)
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
<!-- Pod2Wiki=_preamble_  
 
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost.
+
This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/Import.pm|package_name=EPrints::DataObj::Import}}[[Category:API|Import]]<!-- End of Pod2Wiki -->
+
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/Import.pm|package_name=EPrints::DataObj::Import}}[[Category:API|IMPORT]][[Category:API:EPrints/DataObj|IMPORT]]<div><!-- Edit below this comment -->
<!-- Pod2Wiki=head_name -->=NAME=
+
 
 +
 
 +
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
 +
==NAME==
 
'''EPrints::DataObj::Import''' - bulk imports logging
 
'''EPrints::DataObj::Import''' - bulk imports logging
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=head_description -->=DESCRIPTION=
+
<span style='display:none'>User Comments</span>
Inherits from [[API:EPrints/DataObj|EPrints::DataObj]].
+
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_description -->
 +
==DESCRIPTION==
 +
This class represents a mass import of record's (i.e. eprint data  objects) into a repository.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=head_instance_variables -->=INSTANCE VARIABLES=
+
<span style='display:none'>User Comments</span>
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_$obj->{ -->==$obj->{==
 
  
  $obj-&gt;{ "data" }
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_$obj->{ -->==$obj->{==
+
</div>
 +
<!-- Pod2Wiki=head_core_metadata_fields -->
 +
==CORE METADATA FIELDS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  $obj-&gt;{ "dataset" }
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_$obj->{ -->==$obj->{==
+
</div>
 +
<!-- Pod2Wiki=item_importid -->
 +
===importid (counter)===
  
  $obj-&gt;{ "session" }
+
Unique ID for the import.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=head_core_fields -->=CORE FIELDS=
+
<span style='display:none'>User Comments</span>
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_importid -->==importid==
 
  
Unique id for the import.
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_datestamp -->==datestamp==
+
</div>
 +
<!-- Pod2Wiki=item_datestamp -->
 +
===datestamp (timestamp)===
  
Time of import.
+
Time import record was created.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_userid -->==userid==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Id of the user responsible for causing the import.
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_source_repository -->==source_repository==
+
</div>
 +
<!-- Pod2Wiki=item_source_repository -->
 +
===source_repository (text)===
  
 
Source entity from which this import came.
 
Source entity from which this import came.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_url -->==url==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_url -->
 +
===url (longtext)===
  
 
Location of the imported content (e.g. the file name).
 
Location of the imported content (e.g. the file name).
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_description -->==description==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_description -->
 +
===description (longtext)===
  
 
Human-readable description of the import.
 
Human-readable description of the import.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=head_methods -->=METHODS=
+
<span style='display:none'>User Comments</span>
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_get_system_field_info -->==get_system_field_info==
+
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_last_run -->
 +
===last_run (time)===
 +
 
 +
Time the import was last started.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_last_success -->
 +
===last_success (time)===
 +
 
 +
Time the import was last successfully completed.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_references_and_related_objects -->
 +
==REFERENCES AND RELATED OBJECTS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_userid -->
 +
===userid (itemref)===
 +
 
 +
ID of the user responsible for causing the import.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_instance_variables -->
 +
==INSTANCE VARIABLES==
 +
See [[API:EPrints/DataObj#INSTANCE_VARIABLES|EPrints::DataObj]].
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
  
  $thing = EPrints::DataObj::Import-&gt;get_system_field_info
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_methods -->
 +
==METHODS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Core fields contained in a Web import.
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_constructor_methods -->==Constructor Methods==
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=head_class_methods -->
<!-- Pod2Wiki=item_new -->===new===
+
===Class Methods===
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  $thing = EPrints::DataObj::Import-&gt;new( $session, $importid )
 
  
The data object identified by $importid.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_system_field_info -->
 +
====get_system_field_info====
  
<!-- End of Pod2Wiki -->
+
$fields = EPrints::DataObj::Import-&gt;get_system_field_info
<!-- Pod2Wiki=item_new_from_data -->===new_from_data===
+
Returns an array describing the system metadata of the import dataset.
  
  $thing = EPrints::DataObj::Import-&gt;new_from_data( $session, $known )
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
A new <tt>EPrints::DataObj::Import</tt> object containing data $known (a hash reference).
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_class_methods -->==Class Methods==
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_get_dataset_id -->
<!-- Pod2Wiki=item_remove_all -->===remove_all===
+
====get_dataset_id====
  
  EPrints::DataObj::Import::remove_all( $session )
+
$dataset = EPrints::DataObj::Import-&gt;get_dataset_id
 +
Returns the ID of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record  belongs.
  
Remove all records from the license dataset.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_defaults -->===get_defaults===
 
  
  $defaults = EPrints::DataObj::Import-&gt;get_defaults( $session, $data )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_object_methods -->
 +
===Object Methods===
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Return default values for this object based on the starting data.
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_object_methods -->==Object Methods==
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_run -->
<!-- Pod2Wiki=item_remove -->===remove===
+
====run====
  
  $foo = $thing-&gt;remove()
+
$list = $import-&gt;run( $processor )
 +
Run this bulk import. Returns a list of created eprint data objects.  <tt>$processor</tt> is used for reporting errors.
  
Remove this record from the data set (see [[API:EPrints/Database|EPrints::Database]]).
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_run -->===run===
 
  
  $list = $import-&gt;run( $processor )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_map -->
 +
====map====
  
Run this bulk import. Returns a list of EPrints created. $processor is used for reporting errors.
+
$import-&gt;map( $fn, $info )
 +
Maps the function <tt>$fn</tt> onto every eprint in this import.
  
<!-- End of Pod2Wiki -->
+
<tt>$info</tt> provides additonal information that may need to be processed by the function <tt>$fn</tt>.
<!-- Pod2Wiki=item_clear -->===clear===
 
  
  $import-&gt;clear()
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_clear -->
 +
====clear====
 +
 +
$import-&gt;clear
 
Clear the contents of this bulk import.
 
Clear the contents of this bulk import.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_get_from_source -->===get_from_source===
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_list -->
 +
====get_list====
 +
 
 +
$list = $import-&gt;get_list
 +
Returns a list of the items in this import.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_from_source -->
 +
====get_from_source====
 +
 
 +
$eprint = $import-&gt;get_from_source( $sourceid )
 +
Get the eprint that is from this import set and identified by  <tt>$sourceid</tt>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
  
  $eprint = $import-&gt;get_from_source( $sourceid )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_epdata_to_dataobj -->
 +
====epdata_to_dataobj====
  
Get the $eprint that is from this import set and identified by $sourceid.
+
$dataobj = $import-&gt;epdata_to_dataobj( $dataset, $epdata )
 +
Convert <tt>$epdata</tt> to an eprint data object. If an existing object  exists in this import that has the same identifier that object will be  used instead of creating a new object.
  
<!-- End of Pod2Wiki -->
+
Also calls <tt>set_eprint_import_automatic_fields</tt> on the object before  writing it to the database.
<!-- Pod2Wiki=head_see_also -->=SEE ALSO=
+
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_see_also -->
 +
==SEE ALSO==
 
[[API:EPrints/DataObj|EPrints::DataObj]] and [[API:EPrints/DataSet|EPrints::DataSet]].
 
[[API:EPrints/DataObj|EPrints::DataObj]] and [[API:EPrints/DataSet|EPrints::DataSet]].
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_copyright -->
 +
==COPYRIGHT==
 +
{{API:Copyright}}
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->

Latest revision as of 17:08, 10 January 2022

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::DataObj::Import - bulk imports logging

User Comments


DESCRIPTION

This class represents a mass import of record's (i.e. eprint data objects) into a repository.

User Comments


CORE METADATA FIELDS

User Comments


importid (counter)

Unique ID for the import.

User Comments


datestamp (timestamp)

Time import record was created.

User Comments


source_repository (text)

Source entity from which this import came.

User Comments


url (longtext)

Location of the imported content (e.g. the file name).

User Comments


description (longtext)

Human-readable description of the import.

User Comments


last_run (time)

Time the import was last started.

User Comments


last_success (time)

Time the import was last successfully completed.

User Comments


REFERENCES AND RELATED OBJECTS

User Comments


userid (itemref)

ID of the user responsible for causing the import.

User Comments


INSTANCE VARIABLES

See EPrints::DataObj.

User Comments


METHODS

User Comments


Class Methods

User Comments


get_system_field_info

$fields = EPrints::DataObj::Import->get_system_field_info

Returns an array describing the system metadata of the import dataset.

User Comments


get_dataset_id

$dataset = EPrints::DataObj::Import->get_dataset_id

Returns the ID of the EPrints::DataSet object to which this record belongs.

User Comments


Object Methods

User Comments


run

$list = $import->run( $processor )

Run this bulk import. Returns a list of created eprint data objects. $processor is used for reporting errors.

User Comments


map

$import->map( $fn, $info )

Maps the function $fn onto every eprint in this import.

$info provides additonal information that may need to be processed by the function $fn.

User Comments


clear

$import->clear

Clear the contents of this bulk import.

User Comments


get_list

$list = $import->get_list

Returns a list of the items in this import.

User Comments


get_from_source

$eprint = $import->get_from_source( $sourceid )

Get the eprint that is from this import set and identified by $sourceid.

User Comments


epdata_to_dataobj

$dataobj = $import->epdata_to_dataobj( $dataset, $epdata )

Convert $epdata to an eprint data object. If an existing object exists in this import that has the same identifier that object will be used instead of creating a new object.

Also calls set_eprint_import_automatic_fields on the object before writing it to the database.

User Comments


SEE ALSO

EPrints::DataObj and EPrints::DataSet.

User Comments


COPYRIGHT

© Copyright 2022 University of Southampton.

EPrints 3.4 is supplied by EPrints Services.

http://www.eprints.org/eprints-3.4/

LICENSE

This file is part of EPrints 3.4 http://www.eprints.org/.

EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.

EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.

User Comments