Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
MetadataDescription Class Reference
Inheritance diagram for MetadataDescription:
DataObject

Public Member Functions

 _allowedReplaceLevels ()
 
 addStatement ($propertyName, &$value, $locale=null, $replace=false)
 
 getAssoc ()
 
 getAssocId ()
 
 getAssocType ()
 
 getDisplayName ()
 
getMetadataSchema ()
 
 getMetadataSchemaName ()
 
 getNamespacedPropertyId ($propertyName)
 
getProperties ()
 
getProperty ($propertyName)
 
 getPropertyNames ()
 
 getPropertyNamesByType ($propertyType)
 
 getSeq ()
 
 getSetPropertyNames ()
 
getStatement ($propertyName, $locale=null)
 
getStatements ()
 
getStatementTranslations ($propertyName)
 
 hasProperty ($propertyName)
 
 hasStatement ($propertyName)
 
 isTranslatedProperty ($propertyName)
 
 MetadataDescription ($metadataSchemaName, $assocType)
 
 removeStatement ($propertyName, $locale=null)
 
 setAssocId ($assocId)
 
 setDisplayName ($displayName)
 
 setSeq ($seq)
 
 setStatements (&$statements, $replace=METADATA_DESCRIPTION_REPLACE_PROPERTIES)
 
- Public Member Functions inherited from DataObject
 addSupportedMetadataAdapter (&$metadataAdapter)
 
 DataObject ($callHooks=true)
 
extractMetadata (&$metadataSchema)
 
 getAdditionalMetadataFieldNames ()
 
getAllData ()
 
getData ($key, $locale=null)
 
 getHasLoadableAdapters ()
 
 getId ()
 
 getLocaleMetadataFieldNames ()
 
getLocalizedData ($key)
 
 getMetadataFieldNames ($translated=true)
 
 getSetMetadataFieldNames ($translated=true)
 
getSupportedExtractionAdapters ()
 
getSupportedInjectionAdapters ()
 
getSupportedMetadataSchemas ()
 
 hasData ($key, $locale=null)
 
 injectMetadata (&$metadataDescription)
 
 removeSupportedMetadataAdapter ($metadataSchemaName)
 
 setAllData (&$data)
 
 setData ($key, $value, $locale=null)
 
 setHasLoadableAdapters ($hasLoadableAdapters)
 
 setId ($id)
 
upcastTo (&$targetObject)
 

Additional Inherited Members

- Public Attributes inherited from DataObject
 $_data = array()
 

Detailed Description

Class modeling a description (DCMI abstract model) or subject- predicate-object graph (RDF). This class and its children provide meta-data (DCMI abstract model: statements of property-value pairs, RDF: assertions of predicate-object pairs) about a given PKP application entity instance (DCMI abstract model: described resource, RDF: subject).

See Also
MetadataProperty
MetadataRecord
MetadataSchema

This class has primarily been designed to describe journals, journal issues, articles, conferences, conference proceedings (conference papers), monographs (books), monograph components (book chapters) or citations.

It is, however, flexible enough to be extended to describe any application entity in the future. Descriptions can be retrieved from any application object that implements the MetadataProvider interface.

Special attention has been paid to the compatibility of the class implementation with the implementation of several meta-data standards that we consider especially relevant to our use cases.

We distinguish two main use cases for meta-data: discovery and delivery of described resources. We have chosen the element-citation tag from the NLM standard http://dtd.nlm.nih.gov/publishing/tag-library/3.0/n-8xa0.html as our primary representation of delivery meta-data and dcterms http://dublincore.org/documents/dcmi-terms/ as our primary representation of discovery meta-data.

Our specific use of meta-data has important implications and determines our design goals:

  • Neither NLM-citation nor dcterms have been designed with an object oriented encoding in mind. NLM-citation is usually XML encoded while typical dcterms encodings are HTML meta-tags, RDF or XML.
  • We believe that trying to implement a super-set of meta-data standards ("least common denominator" or super-schema approach) is fundamentally flawed as meta-data standards are always developed with specific use-cases in mind that require potentially incompatible data properties or encodings.
  • Although we think that NLM-citation and dcterms are sensible default meta-data schemes our design should remain flexible enough for users to implement and use other schemes as an internal meta-data standard.
  • We have to make sure that we can easily extract/inject meta-data from/to PKP application objects.
  • We have to avoid code duplication to keep maintenance cost under control.
  • We have to minimize the "impedance mismatch" between our own object oriented encoding and fully standard compliant external encodings (i.e. XML, RDF, HTML meta-tags, ...) to allow for easy conversion between encodings.
  • We have to make sure that we can switch between internal and external encodings without any data loss.
  • We have to make sure that crosswalks to and from other important meta-data standards (e.g. OpenURL variants, MODS, MARC) can be performed in a well-defined and easy way while minimizing data loss.
  • We have to make sure that we can support qualified fields (e.g. qualified DC).
  • We have to make sure that we can support RDF triples.

We took the following design decisions to achieve these goals:

  • We only implement properties that are justified by strong real-world use-cases. We recognize that the limiting factor is not the data that we could represent but the data we actually have. This is not determined by the chosen standard but by the PKP application objects we want to represent. Additional meta-data properties/predicates can be added as required.
  • We do adapt data structures as long as we can make sure that a fully standard compliant encoding can always be re-constructed. This is especially true for NLM-citation which is designed with XML in mind and therefore uses hierarchical constructs that are difficult to represent in an OO class model. This means that our meta-data framework only supports (nested) key/ value-based schemas which can however be converted to hierarchical representations.
  • We borrow class and property names from the DCMI abstract model as the terms used there provide better readability for developers less acquainted with formal model theory. We'll, however, make sure that data can easily be RDF encoded within our data model.
  • Data validation must ensure that meta-data always complies with a specific meta-data standard. As we are speaking about an object oriented encoding that is not defined in the original standard, we define compliance as "roundtripability". This means we must be able to convert our object oriented data encoding to a fully standard compliant encoding and back without any data loss.

Definition at line 109 of file MetadataDescription.inc.php.

Member Function Documentation

MetadataDescription::_allowedReplaceLevels ( )

The allowed replace levels for the setStatements() method. NB: Workaround for PHP4 which doesn't allow static class members.

Definition at line 558 of file MetadataDescription.inc.php.

Referenced by setStatements().

MetadataDescription::addStatement (   $propertyName,
$value,
  $locale = null,
  $replace = false 
)

Add a meta-data statement. Statements can only be added for properties that are part of the meta-data schema. This method will also check the validity of the value for the given property before adding the statement.

Parameters
$propertyNamestring The name of the property
$valuemixed The value to be assigned to the property
$localestring
$replaceboolean whether to replace an existing statement
Returns
boolean true if a valid statement was added, otherwise false

Definition at line 249 of file MetadataDescription.inc.php.

References AppLocale\getLocale(), getProperty(), getStatement(), and DataObject\setData().

Referenced by Nlm30CitationSchemaOpenurl10CrosswalkFilter\process(), Openurl10Nlm30CitationSchemaCrosswalkFilter\process(), and setStatements().

MetadataDescription::getAssoc ( )

Construct a meta-data application entity id (described resource id / subject id) for this meta-data description object.

Returns
string

Definition at line 199 of file MetadataDescription.inc.php.

References getAssocId(), and getAssocType().

MetadataDescription::getAssocId ( )

Get the association id (described resource identifier)

Returns
int

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

Referenced by getAssoc().

MetadataDescription::getAssocType ( )

Get the association type (described resource type)

Returns
int

Definition at line 173 of file MetadataDescription.inc.php.

Referenced by getAssoc().

MetadataDescription::getDisplayName ( )

Get the (optional) display name

Returns
string

Definition at line 218 of file MetadataDescription.inc.php.

& MetadataDescription::getMetadataSchema ( )
MetadataDescription::getMetadataSchemaName ( )

Get the fully qualified class name of the supported meta-data schema.

Definition at line 151 of file MetadataDescription.inc.php.

Referenced by getMetadataSchema().

MetadataDescription::getNamespacedPropertyId (   $propertyName)

Convenience method that returns a property id the underlying meta-data schema.

Parameters
$propertyNamestring
Returns
string

Definition at line 480 of file MetadataDescription.inc.php.

References getMetadataSchema().

Referenced by CitationForm\validate().

& MetadataDescription::getProperties ( )

Convenience method that returns the properties of the underlying meta-data schema.

Returns
array an array of MetadataProperties

Definition at line 458 of file MetadataDescription.inc.php.

References getMetadataSchema().

& MetadataDescription::getProperty (   $propertyName)

Convenience method that returns a property from the underlying meta-data schema.

Parameters
$propertyNamestring
Returns
MetadataProperty

Definition at line 469 of file MetadataDescription.inc.php.

References getMetadataSchema().

Referenced by addStatement(), getStatement(), and isTranslatedProperty().

MetadataDescription::getPropertyNames ( )

Convenience method that returns the valid property names of the underlying meta-data schema.

Returns
array an array of string values representing valid property names

Definition at line 490 of file MetadataDescription.inc.php.

References getMetadataSchema().

MetadataDescription::getPropertyNamesByType (   $propertyType)

Convenience method that returns the names of properties with a given data type of the underlying meta-data schema.

Parameters
$propertyTypestring
Returns
array an array of string values representing valid property names

Definition at line 501 of file MetadataDescription.inc.php.

References getMetadataSchema().

MetadataDescription::getSeq ( )

Get the sequence id

Returns
integer

Definition at line 234 of file MetadataDescription.inc.php.

MetadataDescription::getSetPropertyNames ( )

Returns an array of property names for which statements exist.

Returns
array an array of string values representing valid property names

Definition at line 511 of file MetadataDescription.inc.php.

References getStatements().

& MetadataDescription::getStatement (   $propertyName,
  $locale = null 
)

Get a specific statement

Parameters
$propertyNamestring
$localestring
Returns
mixed a scalar property value or an array of property values if the cardinality of the property is 'many'.

Definition at line 337 of file MetadataDescription.inc.php.

References DataObject\getData(), AppLocale\getLocale(), and getProperty().

Referenced by addStatement().

& MetadataDescription::getStatements ( )

Get all statements

Returns
array statements

Definition at line 319 of file MetadataDescription.inc.php.

References DataObject\getAllData().

Referenced by getSetPropertyNames(), and hasStatement().

& MetadataDescription::getStatementTranslations (   $propertyName)

Returns all translations of a translated property

Parameters
$propertyNamestring
Returns
array all translations of a given property; if the property has cardinality "many" then this returns a two-dimensional array whereby the first key represents the locale and the second the translated values.

Definition at line 362 of file MetadataDescription.inc.php.

References DataObject\getData(), and isTranslatedProperty().

MetadataDescription::hasProperty (   $propertyName)

Convenience method that checks the existence of a property in the underlying meta-data schema.

Parameters
$propertyNamestring
Returns
boolean

Definition at line 521 of file MetadataDescription.inc.php.

References getMetadataSchema().

MetadataDescription::hasStatement (   $propertyName)

Check the existence of a statement for the given property.

Parameters
$propertyNamestring
Returns
boolean

Definition at line 531 of file MetadataDescription.inc.php.

References getStatements().

MetadataDescription::isTranslatedProperty (   $propertyName)

Convenience method that checks whether a given property is translated.

Parameters
$propertyNamestring
Returns
boolean

Definition at line 542 of file MetadataDescription.inc.php.

References getProperty().

Referenced by getStatementTranslations().

MetadataDescription::MetadataDescription (   $metadataSchemaName,
  $assocType 
)

Constructor

Definition at line 137 of file MetadataDescription.inc.php.

MetadataDescription::removeStatement (   $propertyName,
  $locale = null 
)

Remove statement. If the property has cardinality 'many' then all statements for the property will be removed at once. If the property is translated and the locale is null then the statements for all locales will be removed.

Parameters
$propertyNamestring
$localestring
Returns
boolean true if the statement was found and removed, otherwise false

Definition at line 305 of file MetadataDescription.inc.php.

References DataObject\hasData(), and DataObject\setData().

MetadataDescription::setAssocId (   $assocId)

Set the association id (described resource identifier)

Parameters
$assocIdint

Definition at line 189 of file MetadataDescription.inc.php.

MetadataDescription::setDisplayName (   $displayName)

Set the (optional) display name

Parameters
$displayNamestring

Definition at line 210 of file MetadataDescription.inc.php.

MetadataDescription::setSeq (   $seq)

Set the sequence id

Parameters
$seqinteger

Definition at line 226 of file MetadataDescription.inc.php.

MetadataDescription::setStatements ( $statements,
  $replace = METADATA_DESCRIPTION_REPLACE_PROPERTIES 
)

Add several statements at once. If one of the statements is invalid then the meta-data description will remain in its initial state.

  • Properties with a cardinality of 'many' must be passed in as sub-arrays.
  • Translated properties with a cardinality of 'one' must be passed in as sub-arrays with the locale as a key.
  • Translated properties with a cardinality of 'many' must be passed in as sub-sub-arrays with the locale as the first key.
    Parameters
    $statementsarray statements
    $replaceinteger one of the allowed replace levels.
    Returns
    boolean true if all statements could be added, false otherwise

Definition at line 381 of file MetadataDescription.inc.php.

References _allowedReplaceLevels(), addStatement(), DataObject\getAllData(), and DataObject\setAllData().


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