Difference between revisions of "API:EPrints/DataSet"
Line 1: | Line 1: | ||
− | + | <!-- Pod2Wiki=_preamble_ | |
+ | This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. | ||
+ | --> | ||
+ | __NOTOC__ | ||
+ | {{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataSet.pm|package_name=EPrints::DataSet}}[[Category:API|DataSet]]<div><!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_name --></div> | ||
+ | ==NAME== | ||
+ | '''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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_synopsis --></div> | ||
+ | ==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 ); | ||
+ | |||
+ | <div style='background-color: #eef; 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> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_description --></div> | ||
+ | ==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 [[API:EPrints/Repository|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. | ||
+ | |||
+ | <div style='background-color: #eef; 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> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_cachemap_counter --></div> | ||
+ | ===cachemap, counter=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_archive_buffer_inbox_deletion --></div> | ||
+ | ===archive, buffer, inbox, deletion=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_methods --></div> | ||
+ | ==METHODS== | ||
+ | <div style='background-color: #eef; 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> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_field --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; 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> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_has_field --></div> | ||
+ | ===$bool = $ds->has_field( $fieldname )=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_confid --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; 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> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_id --></div> | ||
+ | ===$id = $ds->id=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_count --></div> | ||
+ | ===$n = $ds->count( $handle )=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_fields --></div> | ||
+ | ===@fields = $ds->get_fields=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_key_field --></div> | ||
+ | ===$field = $ds->get_key_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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_create_object --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; 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> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_render_name --></div> | ||
+ | ===$xhtml = $ds->render_name( $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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_map --></div> | ||
+ | ===$ds->map( $handle, $fn, $info )=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_repository --></div> | ||
+ | ===$repository = $ds->get_repository=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_item_ids --></div> | ||
+ | ===@ids = $dataset->get_item_ids( $handle )=== | ||
+ | |||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_see_also --></div> | ||
+ | ==SEE ALSO== | ||
+ | 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%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment --> |
Revision as of 14:02, 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
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.
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 );
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.
cachemap, counter
Don't have a package or metadata fields associated.
archive, buffer, inbox, deletion
All have the same package and metadata fields as eprints, but are filtered by eprint_status.
METHODS
$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.
$bool = $ds->has_field( $fieldname )
True if the dataset has a field of that name.
$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.
$id = $ds->id
Return the id of this dataset. Unlike confid the buffer dataset will return "buffer".
$n = $ds->count( $handle )
Return the number of records in this dataset.
@fields = $ds->get_fields
Returns a list of the EPrints::Metafields belonging to this dataset.
$field = $ds->get_key_field
Return the EPrints::MetaField representing the primary key field. Always the first field.
$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.
$xhtml = $ds->render_name( $handle )
Return a piece of XHTML describing this dataset, in the language of the given handle.
$ds->map( $handle, $fn, $info )
Maps the function $fn onto every record in this dataset. See EPrints::List for a full explanation.
$repository = $ds->get_repository
Returns the EPrints::Repository to which this dataset belongs.
@ids = $dataset->get_item_ids( $handle )
Return a list of the id's of all items in this set.
SEE ALSO
EPrints::MetaField, EPrints::DataObj