Difference between revisions of "Data Object"

From EPrints Documentation
Jump to: navigation, search
(API)
(Redirected page to Category:Data Objects)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{dataobj}}
+
#REDIRECT [[:Category: Data Objects]]
__NOTOC__
 
A data object is a single record which contains metadata. The metadata it contains is described by the fields of the data object.
 
 
 
== DataSet ==
 
 
 
A dataset is all the data objects of a certain type in a single repository. For example the "eprint" and "user" datasets. There are some "magic" datasets named "inbox", "buffer","archive","deletion" but these are subsets of the "eprint" dataset. An [[EPrint Object]] is always in the eprint dataset, but only in one of the sub-sets. For configuration values, always use "eprint".
 
 
 
== Database ==
 
 
 
Data objects are usually stored in the database. They are generally spread over a number of tables with the same prefix.
 
 
 
Non-multiple (single value) fields are stored in the table with the same name as the dataset. eg. "eprint".
 
 
 
Mutilple fields (lists of values) are stored in their own table named after the dataset, then an underscore then the fieldname. For example "eprint_subjects". These tables also contain a "pos" value to indicate the order of the list. This is always present, even if it's a bit meaningless for some fields.
 
 
 
== XML ==
 
 
 
Each data object may be represented as XML. See [[XML Export Format]].
 
 
 
== API ==
 
 
 
All dataobjects are represented as instances of subclasses of [[API:EPrints/DataObj|EPrints::DataObj]]. This is just and overview of the sort of things you can do. For full API documentation go [[API:EPrints/DataObj|here]].
 
 
 
All dataobjects support some basic methods:
 
 
 
$value = $dataobj->get_value( $fieldname );
 
 
 
The $value should be utf-8 encoded, but EPrints won't check, so be careful.
 
 
 
$dataobj->set_value( $fieldname, $value );
 
$dataobj->commit;
 
 
 
The database is not actually updated until commit is called. Any modified fields will be queued for re-indexing by the [[indexer]], if needed.
 
 
 
$boolean = $dataobj->is_set( $fieldname );
 
 
 
True if the named field has a value set in this data object. Gives a warning if the field does not exist.
 
 
 
$boolean = $dataobj->exists_and_set( $fieldname );
 
 
 
Returns true if this dataobj has a field named $fieldname AND that field is set. This is useful for plugins which do not wish to fail, just because a field does not exist in the current repository.
 
 
 
$xhtml = $dataobj->render_value( $fieldname );
 
 
 
Returns an [[XHTML DOM]] object describing the value of the field in the dataobject. How it is rendered into HTML depends on the type of the field, what properties are set on that field and the language of the current session.
 
 
 
$output = $dataobj->export( $pluginid, %params );
 
 
 
Returns the results of applying the export plugin named $pluginid to this object.
 

Latest revision as of 18:48, 13 March 2010