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

From EPrints Documentation
Jump to: navigation, search
Line 10: Line 10:
 
'''EPrints::DataObj::EPrint''' - Class representing an actual EPrint
 
'''EPrints::DataObj::EPrint''' - Class representing an actual EPrint
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 21: Line 21:
 
EPrints::DataObj::EPrint is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in cfg.d/eprint_fields.pl):
 
EPrints::DataObj::EPrint is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in cfg.d/eprint_fields.pl):
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 70: Line 70:
 
    
 
    
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 77: Line 77:
 
<!-- Pod2Wiki=head_system_metadata --></div>
 
<!-- Pod2Wiki=head_system_metadata --></div>
 
==SYSTEM METADATA==
 
==SYSTEM METADATA==
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 87: Line 87:
 
The unique numerical ID of this eprint.  
 
The unique numerical ID of this eprint.  
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 97: Line 97:
 
The number of the current revision of this record.
 
The number of the current revision of this record.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 107: Line 107:
 
The id of the user who deposited this eprint (if any). Scripted importing could cause this not to be set.
 
The id of the user who deposited this eprint (if any). Scripted importing could cause this not to be set.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 117: Line 117:
 
The directory, relative to the documents directory for this repository, which this eprints data is stored in. Eg. disk0/00/00/03/34 for record 334.
 
The directory, relative to the documents directory for this repository, which this eprints data is stored in. Eg. disk0/00/00/03/34 for record 334.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 127: Line 127:
 
The date this record first appeared live in the repository.
 
The date this record first appeared live in the repository.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 137: Line 137:
 
The date this record was last modified.
 
The date this record was last modified.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 147: Line 147:
 
The date/time this record was moved between inbox, buffer, archive, etc.
 
The date/time this record was moved between inbox, buffer, archive, etc.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 157: Line 157:
 
The type of this record, one of the types of the "eprint" dataset.
 
The type of this record, one of the types of the "eprint" dataset.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 167: Line 167:
 
The ID of the eprint (if any) which this succeeds.  This field should have been an int and may be changed in a later upgrade.
 
The ID of the eprint (if any) which this succeeds.  This field should have been an int and may be changed in a later upgrade.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 177: Line 177:
 
The ID of the eprint (if any) which this eprint is a commentary on.  This  field should have been an int and may be changed in a later upgrade.
 
The ID of the eprint (if any) which this eprint is a commentary on.  This  field should have been an int and may be changed in a later upgrade.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 187: Line 187:
 
The ID of the eprint (if any) which has replaced this eprint. This is only set on records in the "deletion" dataset.  This field should have been an int and may be changed in a later upgrade.
 
The ID of the eprint (if any) which has replaced this eprint. This is only set on records in the "deletion" dataset.  This field should have been an int and may be changed in a later upgrade.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 194: Line 194:
 
<!-- Pod2Wiki=head_see_also --></div>
 
<!-- Pod2Wiki=head_see_also --></div>
 
==SEE ALSO==
 
==SEE ALSO==
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 201: Line 201:
 
<!-- Pod2Wiki=head_methods --></div>
 
<!-- Pod2Wiki=head_methods --></div>
 
==METHODS==
 
==METHODS==
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 213: Line 213:
 
nb. This will not return associated documents such as thumbnails.
 
nb. This will not return associated documents such as thumbnails.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 225: Line 225:
 
nb. This does not delete the eprint.
 
nb. This does not delete the eprint.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 237: Line 237:
 
This means moving it back to the user workarea.
 
This means moving it back to the user workarea.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 249: Line 249:
 
"buffer" is the internal code for the "review area".
 
"buffer" is the internal code for the "review area".
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 261: Line 261:
 
This causes the item to appear on the website.
 
This causes the item to appear on the website.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 271: Line 271:
 
Return the full path of the EPrint directory on the local filesystem. No trailing slash.
 
Return the full path of the EPrint directory on the local filesystem. No trailing slash.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 281: Line 281:
 
Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method.
 
Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 293: Line 293:
 
If called on inbox or buffer, remove the abstract page.
 
If called on inbox or buffer, remove the abstract page.
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 303: Line 303:
 
Return the EPrints::User to whom this eprint belongs (if any).
 
Return the EPrints::User to whom this eprint belongs (if any).
  
<div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<h4><span style='display:none'>User Comments</span></h4>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->

Revision as of 14:03, 24 August 2009


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::EPrint - Class representing an actual EPrint

User Comments


DESCRIPTION

This class represents a single eprint record and the metadata associated with it. This is associated with zero, one or many EPrint::Document objects.

EPrints::DataObj::EPrint is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in cfg.d/eprint_fields.pl):

User Comments


SYNOPSIS Inherrits all methods from EPrints::DataObj.

 # create a new eprint object (in the inbox):
 my $inbox_ds = $handle->get_dataset( "inbox" );
 my $epdata = { userid => $user->get_id, title => "Default title" };
 my $eprint = $inbox_ds->create_object( $handle, $epdata );
 
 # open the eprint with id '$eprintid':
 $eprint = EPrints::DataObj::EPrint->new( $handle, $eprintid );  
 
 # set some metadata:
 $eprint->set_value( "title", "The title of this eprint" );
 
 # un-set some metadata:
 $eprint->set_value( "abstract", undef );
 
 # retrieve some metatada:
 my $title = $eprint->get_value( "title" );
 
 # commit values to the database:
 $eprint->commit;
 
 # delete an eprint object *forever*:
 $eprint->remove;
 
 # render all the documents of an eprint:
 foreach my $doc ( $eprint->get_all_documents )
 {
   $page->appendChild( $doc->render_citation );
 }
 
 # move an eprint back to the owner's inbox:
 $eprint->move_to_inbox;
 
 # redirect to the eprint's abstract page:
 $handle->redirect( $eprint->get_url );
 
 # render some of the eprint's metadata
 $page->appendChild( $eprint->render_value( "title" ) );
 
 # render information about the owner of the eprint:
 my $xhtml = $eprint->get_user->render;
 

User Comments


SYSTEM METADATA

User Comments


eprintid (int)

The unique numerical ID of this eprint.

User Comments


rev_number (int)

The number of the current revision of this record.

User Comments


userid (itemref)

The id of the user who deposited this eprint (if any). Scripted importing could cause this not to be set.

User Comments


dir (text)

The directory, relative to the documents directory for this repository, which this eprints data is stored in. Eg. disk0/00/00/03/34 for record 334.

User Comments


datestamp (time)

The date this record first appeared live in the repository.

User Comments


lastmod (time)

The date this record was last modified.

User Comments


status_changes (time)

The date/time this record was moved between inbox, buffer, archive, etc.

User Comments


type (namedset)

The type of this record, one of the types of the "eprint" dataset.

User Comments


succeeds (itemref)

The ID of the eprint (if any) which this succeeds. This field should have been an int and may be changed in a later upgrade.

User Comments


commentary (itemref)

The ID of the eprint (if any) which this eprint is a commentary on. This field should have been an int and may be changed in a later upgrade.

User Comments


replacedby (itemref)

The ID of the eprint (if any) which has replaced this eprint. This is only set on records in the "deletion" dataset. This field should have been an int and may be changed in a later upgrade.

User Comments


SEE ALSO

User Comments


METHODS

User Comments


@documents = $eprint->get_all_documents

Return an array of all EPrint::Document objects associated with this eprint.

nb. This will not return associated documents such as thumbnails.

User Comments


$success = $eprint->move_to_deletion

Transfer the EPrint into the "deletion" dataset. Should only be called for eprints in the "archive" dataset. This is called "retiring" in the Web interface.

nb. This does not delete the eprint.

User Comments


$success = $eprint->move_to_inbox

Transfer the EPrint into the "inbox" dataset. Should only be called for eprints in the "buffer" dataset.

This means moving it back to the user workarea.

User Comments


$success = $eprint->move_to_buffer

Transfer the EPrint into the "buffer" dataset. Should only be called for eprints in the "inbox" or "archive" dataset.

"buffer" is the internal code for the "review area".

User Comments


$success = $eprint->move_to_archive

Move this eprint into the main "archive" dataset. Normally only called for eprints in "deletion" or "buffer" datasets.

This causes the item to appear on the website.

User Comments


$path = $eprint->local_path

Return the full path of the EPrint directory on the local filesystem. No trailing slash.

User Comments


$url = $eprint->url_stem

Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method.

User Comments


$eprint->generate_static

Generate the static version of the abstract web page. In a multi-language repository this will generate one version per language.

If called on inbox or buffer, remove the abstract page.

User Comments


$user = $eprint->get_user

Return the EPrints::User to whom this eprint belongs (if any).

User Comments