Open Journal Systems  3.3.0
MetadataProperty Class Reference

Public Member Functions

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

Static Public Member Functions

static getSupportedCardinalities ()
 
static getSupportedTypes ()
 

Data Fields

 $_allowedTypes
 
 $_assocTypes
 
 $_cardinality
 
 $_displayName
 
 $_mandatory
 
 $_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.

Constructor & Destructor Documentation

◆ __construct()

MetadataProperty::__construct (   $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.

References getSupportedCardinalities(), and getSupportedTypes().

Member Function Documentation

◆ getAllowedTypes()

MetadataProperty::getAllowedTypes ( )

Get the allowed type

Returns
integer

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

References $_allowedTypes.

Referenced by isValid().

◆ getAssocTypes()

& 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 $_assocTypes.

◆ getCardinality()

MetadataProperty::getCardinality ( )

Get the cardinality

Returns
integer

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

References $_cardinality.

◆ getDisplayName()

MetadataProperty::getDisplayName ( )

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

Returns
string

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

References $_displayName.

◆ getId()

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.

References PKPString\camelize(), and getName().

◆ getMandatory()

MetadataProperty::getMandatory ( )

Is this property mandatory?

Returns
boolean

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

References $_mandatory.

◆ getName()

MetadataProperty::getName ( )

Get the name

Returns
string

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

References $_name.

Referenced by getId().

◆ getSupportedCardinalities()

static MetadataProperty::getSupportedCardinalities ( )
static

Return supported cardinalities

Returns
array supported cardinalities

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

Referenced by __construct().

◆ getSupportedTypes()

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 458 of file MetadataProperty.inc.php.

Referenced by __construct(), MetadataSchema\getPropertyNamesByType(), and isValid().

◆ getTranslated()

MetadataProperty::getTranslated ( )

Is this property translated?

Returns
boolean

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

References $_translated.

◆ getValidationMessage()

MetadataProperty::getValidationMessage ( )

Get the validation message

Returns
string

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

References $_validationMessage.

◆ isValid()

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.

References getAllowedTypes(), DAORegistry\getDAO(), getSupportedTypes(), and ValidatorFactory\make().

Field Documentation

◆ $_allowedTypes

array MetadataProperty::$_allowedTypes

allowed property types

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

Referenced by getAllowedTypes().

◆ $_assocTypes

int MetadataProperty::$_assocTypes

the resource types that can be described with this property

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

Referenced by getAssocTypes().

◆ $_cardinality

integer MetadataProperty::$_cardinality

property cardinality

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

Referenced by getCardinality().

◆ $_displayName

string MetadataProperty::$_displayName

a translation id

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

Referenced by getDisplayName().

◆ $_mandatory

boolean MetadataProperty::$_mandatory

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

Referenced by getMandatory().

◆ $_name

string MetadataProperty::$_name

property name

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

Referenced by getName().

◆ $_translated

boolean MetadataProperty::$_translated

flag that defines whether the property can be translated

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

Referenced by getTranslated().

◆ $_validationMessage

string MetadataProperty::$_validationMessage

validation message

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

Referenced by getValidationMessage().


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