Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
MetadataProperty Class Reference

Public Member Functions

 getAllowedTypes ()
 
getAssocTypes ()
 
 getCardinality ()
 
 getDisplayName ()
 
 getId ()
 
 getMandatory ()
 
 getName ()
 
 getTranslated ()
 
 getValidationMessage ()
 
 isValid ($value, $locale=null)
 
 MetadataProperty ($name, $assocTypes=array(), $allowedTypes=METADATA_PROPERTY_TYPE_STRING, $translated=false, $cardinality=METADATA_PROPERTY_CARDINALITY_ONE, $displayName=null, $validationMessage=null, $mandatory=false)
 

Static Public Member Functions

static getSupportedCardinalities ()
 
static getSupportedTypes ()
 

Public Attributes

 $_allowedTypes
 
 $_assocTypes
 
 $_cardinality
 
 $_displayName
 
 $_name
 
 $_translated
 
 $_validationMessage
 

Detailed Description

Class representing metadata properties. It specifies type and cardinality of a meta-data property (=term, field, ...) and whether the property can be internationalized. It also provides a validator to test whether input conforms to the property specification.

See Also
MetadataSchema
MetadataRecord

In the DCMI abstract model, this class specifies a property together with its allowed range and cardinality.

We also define the resource types (application entities, association types) that can be described with the property. This allows us to check that only valid resource associations are made. It also allows us to prepare property entry forms or displays for a given resource type and integrate these in the work-flow of the resource. By dynamically adding or removing assoc types, end users will be able to configure the meta-data fields that they wish to make available, persist or enter in their application.

Definition at line 53 of file MetadataProperty.inc.php.

Member Function Documentation

MetadataProperty::getAllowedTypes ( )

Get the allowed type

Returns
integer

Definition at line 250 of file MetadataProperty.inc.php.

References $_validationMessage.

& MetadataProperty::getAssocTypes ( )

Get the allowed association types (resources that can be described with this property)

Returns
array a list of integers representing association types.

Definition at line 242 of file MetadataProperty.inc.php.

References $_cardinality.

MetadataProperty::getCardinality ( )

Get the cardinality

Returns
integer

Definition at line 266 of file MetadataProperty.inc.php.

MetadataProperty::getDisplayName ( )

Get the translation id representing the display name of the property.

Returns
string

Definition at line 231 of file MetadataProperty.inc.php.

MetadataProperty::getId ( )

Returns a canonical form of the property name ready to be used as a property id in an external context (e.g. Forms or Templates).

Returns
string

Definition at line 212 of file MetadataProperty.inc.php.

MetadataProperty::getMandatory ( )

Is this property mandatory?

Returns
boolean

Definition at line 282 of file MetadataProperty.inc.php.

MetadataProperty::getName ( )

Get the name

Returns
string

Definition at line 202 of file MetadataProperty.inc.php.

static MetadataProperty::getSupportedCardinalities ( )
static

Return supported cardinalities

Returns
array supported cardinalities

Definition at line 470 of file MetadataProperty.inc.php.

static MetadataProperty::getSupportedTypes ( )
static

Return supported meta-data property types

NB: These types are sorted from most specific to most general and will be validated in this order so that we'll always identify more specific types as such (see MetadataProperty::isValid() for more details).

Returns
array supported meta-data property types

Definition at line 454 of file MetadataProperty.inc.php.

MetadataProperty::getTranslated ( )

Is this property translated?

Returns
boolean

Definition at line 258 of file MetadataProperty.inc.php.

MetadataProperty::getValidationMessage ( )

Get the validation message

Returns
string

Definition at line 274 of file MetadataProperty.inc.php.

MetadataProperty::isValid (   $value,
  $locale = null 
)

Validate a given input against the property specification

The given value must validate against at least one of the allowed types. The first allowed type id will be returned as validation result. If the given value fits none of the allowed types, then we'll return 'false'.

Parameters
$valuemixed the input to be validated
$localestring the locale to be used for validation
Returns
array|boolean an array with a single entry of the format "type => additional type parameter" against which the value validated or boolean false if not validated at all.

Definition at line 304 of file MetadataProperty.inc.php.

MetadataProperty::MetadataProperty (   $name,
  $assocTypes = array(),
  $allowedTypes = METADATA_PROPERTY_TYPE_STRING,
  $translated = false,
  $cardinality = METADATA_PROPERTY_CARDINALITY_ONE,
  $displayName = null,
  $validationMessage = null,
  $mandatory = false 
)

Constructor

Parameters
$namestring the unique name of the property within a meta-data schema (can be a property URI)
$assocTypesarray an array of integers that define the application entities that can be described with this property.
$allowedTypesmixed must be a scalar or an array with the supported types, default: METADATA_PROPERTY_TYPE_STRING
$translatedboolean whether the property may have various language versions, default: false
$cardinalityinteger must be on of the supported cardinalities, default: METADATA_PROPERTY_CARDINALITY_ONE
$displayNamestring
$validationMessagestring A string that can be displayed in case a user tries to set an invalid value for this property.
$mandatoryboolean Is this a mandatory property within the schema?

Definition at line 114 of file MetadataProperty.inc.php.

Member Data Documentation

array MetadataProperty::$_allowedTypes

allowed property types

Definition at line 76 of file MetadataProperty.inc.php.

int MetadataProperty::$_assocTypes

the resource types that can be described with this property

Definition at line 70 of file MetadataProperty.inc.php.

integer MetadataProperty::$_cardinality

property cardinality

Definition at line 88 of file MetadataProperty.inc.php.

Referenced by getAssocTypes().

string MetadataProperty::$_displayName

a translation id

Definition at line 64 of file MetadataProperty.inc.php.

string MetadataProperty::$_name

property name

Definition at line 58 of file MetadataProperty.inc.php.

boolean MetadataProperty::$_translated

flag that defines whether the property can be translated

Definition at line 82 of file MetadataProperty.inc.php.

string MetadataProperty::$_validationMessage

validation message

Definition at line 94 of file MetadataProperty.inc.php.

Referenced by getAllowedTypes().


The documentation for this class was generated from the following file: