Data Object

From EPrints Documentation
Revision as of 17:54, 10 January 2007 by WikiSysop (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Data Objects: EPrint - User - Document - Subject - Saved Search - History - Access - Request

A data object is a single record which contains metadata. The metadata it contains is described by the fields of the data object.

API

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.