Difference between revisions of "Data Object"

From EPrints Documentation
Redirect page
Jump to: navigation, search
 
(Redirected page to Category:Data Objects)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{reference}}
+
#REDIRECT [[:Category: Data Objects]]
{{dataobj}}
+
 
+
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.
+

Latest revision as of 18:48, 13 March 2010