Open Journal Systems  3.3.0
MetadataSchema Class Reference
Inheritance diagram for MetadataSchema:
PKPDc11Schema TestSchema Dc11Schema

Public Member Functions

 __construct ($name, $namespace, $classname, $assocTypes)
 
 addProperty ($name, $allowedTypes=METADATA_PROPERTY_TYPE_STRING, $translated=false, $cardinality=METADATA_PROPERTY_CARDINALITY_ONE, $displayName=null, $validationMessage=null, $mandatory=false)
 
 getAssocTypes ()
 
 getClassName ()
 
 getName ()
 
 getNamespace ()
 
 getNamespacedPropertyId ($propertyName)
 
getProperties ()
 
getProperty ($propertyName)
 
 getPropertyNames ()
 
 getPropertyNamesByType ($propertyType)
 
 hasProperty ($propertyName)
 
 setProperties (&$properties)
 

Data Fields

 $_assocTypes
 
 $_classname
 
 $_name
 
 $_namespace
 
 $_properties = array()
 

Detailed Description

Class that represents a meta-data schema (e.g. NLM element-citation, OpenURL, dc(terms), MODS) or a subset of it.

See also
MetadataProperty
MetadataRecord

We only implement such subsets of meta-data schemas that contain elements which can be mapped to PKP application objects. Meta-data schemas are not meant to represent any meta-data in the given schema just PKP application meta-data. The constructor argument uniquely identifies the application objects this meta-data schema can be mapped to. There should never be two MetadataSchemas with the same namespace that map to the same application object type. This also means that we implement composite elements if and only if the composite complies with our internal class composition schema and not only because the schema allows a composite in a certain position. See MetadataDescription and MetadataProperty for further information about composite meta-data properties.

Example: We implement a composite to represent authors that correspond to the PKPAuthor class. We do not implement composites for title meta-data even if the chosen schema allows this (e.g. abbreviated title, alternative title) as this data is implemented as fields of the Submission object. This doesn't mean that such data cannot be mapped to composites in external bindings, e.g. in an XML binding of the meta-data schema. We can always map a flat list of key/value pairs to a hierarchical representation in an external binding.

This coupling allows us to flexibly configure meta-data entry for application objects. We can identify appropriate meta-data fields for application objects when displaying or entering object meta-data in application forms. Thereby users can dynamically add meta-data fields for input/output if they require these for their local meta-data partners (e.g. libraries, repositories, harvesters, indexers).

We assume that all properties defined within a schema can potentially be assigned to the objects represented by the given association types. Users should, however, be able to enable / disable properties on a per-assoc-type basis so that only a sub-set of properties will actually be available in the user interface as well as exported or imported for these objects.

New schemas can be dynamically added to the mix at any time if they provide fields not provided by already existing schemas.

NB: We currently provide meta-data schemas as classes for better performance and code readability. It might, however, be necessary to maintain meta-data schemas in the database for higher flexibility and easier run-time configuration/ installation of new schemas.

Definition at line 68 of file MetadataSchema.inc.php.

Constructor & Destructor Documentation

◆ __construct()

MetadataSchema::__construct (   $name,
  $namespace,
  $classname,
  $assocTypes 
)

Constructor

Parameters
$namestring the meta-data schema name
$namespacestring a globally unique namespace for the schema. Property names must be unique within this namespace.
$classnamethe fully qualified class name of this schema
$assocTypesarray|integer the association types of PKP application objects that can be described using this schema. A single association type can be given as a scalar.

Definition at line 115 of file MetadataSchema.inc.php.

Member Function Documentation

◆ addProperty()

MetadataSchema::addProperty (   $name,
  $allowedTypes = METADATA_PROPERTY_TYPE_STRING,
  $translated = false,
  $cardinality = METADATA_PROPERTY_CARDINALITY_ONE,
  $displayName = null,
  $validationMessage = null,
  $mandatory = false 
)

Add a property to this meta-data schema.

Parameters
$namestring the unique name of the property within a meta-data schema (can be a property URI)
$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 227 of file MetadataSchema.inc.php.

Referenced by TestSchema\__construct(), PKPDc11Schema\__construct(), and setProperties().

◆ getAssocTypes()

MetadataSchema::getAssocTypes ( )

Get the association types for PKP application objects that can be described with this schema.

Returns
array

Definition at line 164 of file MetadataSchema.inc.php.

References $_assocTypes.

◆ getClassName()

MetadataSchema::getClassName ( )

Get the fully qualified class name of this schema.

Returns
string

Definition at line 155 of file MetadataSchema.inc.php.

References $_classname.

◆ getName()

MetadataSchema::getName ( )

Get the name of the schema

Returns
string

Definition at line 139 of file MetadataSchema.inc.php.

References $_name.

◆ getNamespace()

MetadataSchema::getNamespace ( )

Get the internal namespace qualifier of the schema

Returns
string

Definition at line 147 of file MetadataSchema.inc.php.

References $_namespace.

Referenced by getNamespacedPropertyId().

◆ getNamespacedPropertyId()

MetadataSchema::getNamespacedPropertyId (   $propertyName)

Returns the property id with prefixed name space for use in an external context (e.g. Forms, Templates).

Parameters
$propertyNamestring
Returns
string

Definition at line 197 of file MetadataSchema.inc.php.

References getNamespace(), and getProperty().

◆ getProperties()

& MetadataSchema::getProperties ( )

Get the properties of the meta-data schema.

Returns
array an array of MetadataProperties

Definition at line 172 of file MetadataSchema.inc.php.

References $_properties.

◆ getProperty()

& MetadataSchema::getProperty (   $propertyName)

Get a property. Returns null if the property doesn't exist.

Returns
MetadataProperty

Definition at line 181 of file MetadataSchema.inc.php.

References hasProperty().

Referenced by getNamespacedPropertyId().

◆ getPropertyNames()

MetadataSchema::getPropertyNames ( )

Get the property names defined for this meta-data schema

Returns
array an array of string values representing valid property names

Definition at line 243 of file MetadataSchema.inc.php.

◆ getPropertyNamesByType()

MetadataSchema::getPropertyNamesByType (   $propertyType)

Get the names of properties with a given data type.

Parameters
$propertyTypemixed a valid property type description
Returns
array an array of string values representing valid property names

Definition at line 252 of file MetadataSchema.inc.php.

References MetadataProperty\getSupportedTypes().

◆ hasProperty()

MetadataSchema::hasProperty (   $propertyName)

Checks whether a property exists in the meta-data schema

Parameters
$propertyNamestring
Returns
boolean

Definition at line 271 of file MetadataSchema.inc.php.

Referenced by getProperty().

◆ setProperties()

MetadataSchema::setProperties ( $properties)

(Re-)set all properties of this meta-data schema.

Parameters
$propertiesarray an array of MetadataProperties

Definition at line 207 of file MetadataSchema.inc.php.

References addProperty().

Field Documentation

◆ $_assocTypes

array MetadataSchema::$_assocTypes

Definition at line 73 of file MetadataSchema.inc.php.

Referenced by getAssocTypes().

◆ $_classname

string MetadataSchema::$_classname

Definition at line 91 of file MetadataSchema.inc.php.

Referenced by getClassName().

◆ $_name

string MetadataSchema::$_name

Definition at line 79 of file MetadataSchema.inc.php.

Referenced by getName().

◆ $_namespace

string MetadataSchema::$_namespace

Definition at line 85 of file MetadataSchema.inc.php.

Referenced by getNamespace().

◆ $_properties

array MetadataSchema::$_properties = array()

meta-data properties (predicates) supported for this meta-data schema.

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

Referenced by getProperties().


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