Difference between revisions of "API:EPrints/DataSet"
Line 18: | Line 18: | ||
==SYNOPSIS== | ==SYNOPSIS== | ||
my $ds = $handle->get_dataset( "inbox" ); | my $ds = $handle->get_dataset( "inbox" ); | ||
+ | my $ds = $repository->get_dataset( "inbox" ); | ||
$confid = $ds->confid; # eprint | $confid = $ds->confid; # eprint |
Revision as of 19:13, 25 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" ); my $ds = $repository->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