Difference between revisions of "API:EPrints/DataSet"

From EPrints Documentation
Jump to: navigation, search
Line 10: Line 10:
 
'''EPrints::DataSet''' - a dataset is a set of records in the eprints system with the same metadata.
 
'''EPrints::DataSet''' - a dataset is a set of records in the eprints system with the same 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 33: Line 33:
 
   $obj = $ds-&gt;create_object( $handle, $data );
 
   $obj = $ds-&gt;create_object( $handle, $data );
 
    
 
    
<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 48: Line 48:
 
The fields contained in a dataset are defined by the data object and by any additional fields defined in cfg.d. Some datasets don't have any fields while others may just be "virtual" datasets made from others.
 
The fields contained in a dataset are defined by the data object and by any additional fields defined in cfg.d. Some datasets don't have any fields while others may just be "virtual" datasets made from others.
  
<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 58: Line 58:
 
Don't have a package or metadata fields associated.
 
Don't have a package or metadata fields associated.
  
<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 68: Line 68:
 
All have the same package and metadata fields as '''eprints''', but are filtered by '''eprint_status'''.
 
All have the same package and metadata fields as '''eprints''', but are filtered by '''eprint_status'''.
  
<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 75: Line 75:
 
<!-- 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 85: Line 85:
 
Return a MetaField object describing the asked for field in this dataset, or undef if there is no such field.
 
Return a MetaField object describing the asked for field in this dataset, or undef if there is no such field.
  
<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 95: Line 95:
 
True if the dataset has a field of that name.
 
True if the dataset has a field of that name.
  
<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:
 
archive, buffer, inbox and deletion all return "eprint" as they must have the same configuration.
 
archive, buffer, inbox and deletion all return "eprint" as they must have the same configuration.
  
<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:
 
Return the id of this dataset. Unlike confid the buffer dataset will  return "buffer".  
 
Return the id of this dataset. Unlike confid the buffer dataset will  return "buffer".  
  
<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:
 
Return the number of records in this dataset.
 
Return the number of records in this 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 137: Line 137:
 
Returns a list of the EPrints::Metafields belonging to this dataset.
 
Returns a list of the EPrints::Metafields belonging to this 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 147: Line 147:
 
Return the EPrints::MetaField representing the primary key field. Always the first field.
 
Return the EPrints::MetaField representing the primary key field. Always the first field.
  
<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 161: Line 161:
 
If $data describes sub-objects too then those will also be created.
 
If $data describes sub-objects too then those will also be created.
  
<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 171: Line 171:
 
Return a piece of XHTML describing this dataset, in the language of the given handle.
 
Return a piece of XHTML describing this dataset, in the language of the given handle.
  
<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 181: Line 181:
 
Maps the function $fn onto every record in this dataset. See  EPrints::List for a full explanation.
 
Maps the function $fn onto every record in this dataset. See  EPrints::List for a full explanation.
  
<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 191: Line 191:
 
Returns the EPrints::Repository to which this dataset belongs.
 
Returns the EPrints::Repository to which this dataset belongs.
  
<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:
 
Return a list of the id's of all items in this set.
 
Return a list of the id's of all items in this 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 210: Line 210:
 
EPrints::MetaField, EPrints::DataObj
 
EPrints::MetaField, EPrints::DataObj
  
<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::DataSet - a dataset is a set of records in the eprints system with the same metadata.

User Comments


SYNOPSIS

 my $ds = $handle->get_dataset( "inbox" );
 
 $confid = $ds->confid; # eprint
 $id = $ds->id;         # inbox
 
 $metafield = $ds->get_field( $fieldname );
 $metafield = $ds->get_key_field;
 $bool = $ds->has_field( $fieldname );
 @metafields = $ds->get_fields;
 
 $n = $ds->count( $handle );
 $ds->map( $handle, $fn, $info );
 @ids = $dataset->get_item_ids( $handle );
 
 $obj = $ds->create_object( $handle, $data );
 

User Comments


DESCRIPTION

This module describes an EPrint dataset.

A repository has several datasets that make up the repository's database. The list of dataset ids can be obtained from the repository object (see EPrints::Repository).

A normal dataset (eg. "user") has a package associated with it (eg. EPrints::DataObj::User) which must be a subclass of EPrints::DataObj and a number of SQL tables which are prefixed with the dataset name. Most datasets also have a set of associated EPrints::MetaField's which may be optional or compulsary depending on the type eg. books have editors but posters don't but they are both EPrints.

The fields contained in a dataset are defined by the data object and by any additional fields defined in cfg.d. Some datasets don't have any fields while others may just be "virtual" datasets made from others.

User Comments


cachemap, counter

Don't have a package or metadata fields associated.

User Comments


archive, buffer, inbox, deletion

All have the same package and metadata fields as eprints, but are filtered by eprint_status.

User Comments


METHODS

User Comments


$metafield = $ds->get_field( $fieldname )

Return a MetaField object describing the asked for field in this dataset, or undef if there is no such field.

User Comments


$bool = $ds->has_field( $fieldname )

True if the dataset has a field of that name.

User Comments


$confid = $ds->confid

Return the string to use when getting configuration for this dataset.

archive, buffer, inbox and deletion all return "eprint" as they must have the same configuration.

User Comments


$id = $ds->id

Return the id of this dataset. Unlike confid the buffer dataset will return "buffer".

User Comments


$n = $ds->count( $handle )

Return the number of records in this dataset.

User Comments


@fields = $ds->get_fields

Returns a list of the EPrints::Metafields belonging to this dataset.

User Comments


$field = $ds->get_key_field

Return the EPrints::MetaField representing the primary key field. Always the first field.

User Comments


$obj = $ds->create_object( $handle, $data )

Create a new object in the given dataset. Return the new object.

Return undef if the object could not be created.

If $data describes sub-objects too then those will also be created.

User Comments


$xhtml = $ds->render_name( $handle )

Return a piece of XHTML describing this dataset, in the language of the given handle.

User Comments


$ds->map( $handle, $fn, $info )

Maps the function $fn onto every record in this dataset. See EPrints::List for a full explanation.

User Comments


$repository = $ds->get_repository

Returns the EPrints::Repository to which this dataset belongs.

User Comments


@ids = $dataset->get_item_ids( $handle )

Return a list of the id's of all items in this set.

User Comments


SEE ALSO

EPrints::MetaField, EPrints::DataObj

User Comments