Difference between revisions of "API:EPrints/DataSet"

From EPrints Documentation
Jump to: navigation, search
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


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" );
 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 );
 

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