Difference between revisions of "API:EPrints/DataSet"

From EPrints Documentation
Jump to: navigation, search
Line 1: Line 1:
wer
+
<!-- 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-&gt;get_dataset( "inbox" );
 +
 
 +
  $confid = $ds-&gt;confid; # eprint
 +
  $id = $ds-&gt;id;        # inbox
 +
 
 +
  $metafield = $ds-&gt;get_field( $fieldname );
 +
  $metafield = $ds-&gt;get_key_field;
 +
  $bool = $ds-&gt;has_field( $fieldname );
 +
  @metafields = $ds-&gt;get_fields;
 +
 
 +
  $n = $ds-&gt;count( $handle );
 +
  $ds-&gt;map( $handle, $fn, $info );
 +
  @ids = $dataset-&gt;get_item_ids( $handle );
 +
 
 +
  $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%; '>
 +
<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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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


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