Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
MetadataDescription Class Reference
Inheritance diagram for MetadataDescription:
DataObject

Public Member Functions

 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 ()
 
 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)
 

Static Public Member Functions

static _allowedReplaceLevels ()
 

Public Attributes

 $_assocId
 
 $_assocType
 
 $_displayName
 
 $_metadataSchema
 
 $_metadataSchemaName
 
 $_seq
 
- Public Attributes inherited from DataObject
 $_data = array()
 
 $_extractionAdaptersLoaded = false
 
 $_hasLoadableAdapters = false
 
 $_injectionAdaptersLoaded = false
 
 $_metadataExtractionAdapters = array()
 
 $_metadataInjectionAdapters = 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

static MetadataDescription::_allowedReplaceLevels ( )
static

The allowed replace levels for the setStatements() method.

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

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 267 of file MetadataDescription.inc.php.

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

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 217 of file MetadataDescription.inc.php.

MetadataDescription::getAssocId ( )

Get the association id (described resource identifier)

Returns
int

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

References getAssocType().

MetadataDescription::getAssocType ( )

Get the association type (described resource type)

Returns
int

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

Referenced by getAssocId().

MetadataDescription::getDisplayName ( )

Get the (optional) display name

Returns
string

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

& MetadataDescription::getMetadataSchema ( )

Get the metadata schema

Returns
MetadataSchema

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

MetadataDescription::getMetadataSchemaName ( )

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

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

MetadataDescription::getNamespacedPropertyId (   $propertyName)

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

Parameters
$propertyNamestring
Returns
string

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

& MetadataDescription::getProperties ( )

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

Returns
array an array of MetadataProperties

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

& MetadataDescription::getProperty (   $propertyName)

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

Parameters
$propertyNamestring
Returns
MetadataProperty

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

Referenced by getStatements().

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 508 of file MetadataDescription.inc.php.

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 519 of file MetadataDescription.inc.php.

MetadataDescription::getSeq ( )

Get the sequence id

Returns
integer

Definition at line 252 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 529 of file MetadataDescription.inc.php.

& 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 355 of file MetadataDescription.inc.php.

& MetadataDescription::getStatements ( )

Get all statements

Returns
array statements

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

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

& 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 380 of file MetadataDescription.inc.php.

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 539 of file MetadataDescription.inc.php.

MetadataDescription::hasStatement (   $propertyName)

Check the existence of a statement for the given property.

Parameters
$propertyNamestring
Returns
boolean

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

MetadataDescription::isTranslatedProperty (   $propertyName)

Convenience method that checks whether a given property is translated.

Parameters
$propertyNamestring
Returns
boolean

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

MetadataDescription::MetadataDescription (   $metadataSchemaName,
  $assocType 
)

Constructor

Definition at line 155 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 323 of file MetadataDescription.inc.php.

MetadataDescription::setAssocId (   $assocId)

Set the association id (described resource identifier)

Parameters
$assocIdint

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

MetadataDescription::setDisplayName (   $displayName)

Set the (optional) display name

Parameters
$displayNamestring

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

MetadataDescription::setSeq (   $seq)

Set the sequence id

Parameters
$seqinteger

Definition at line 244 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 399 of file MetadataDescription.inc.php.

Member Data Documentation

int MetadataDescription::$_assocId

association id (the identifier of the described resource)

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

int MetadataDescription::$_assocType

association type (the type of the described resource)

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

string MetadataDescription::$_displayName

an (optional) display name that describes the contents of this meta-data description to the end user.

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

MetadataSchema MetadataDescription::$_metadataSchema

the schema this description complies to

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

string MetadataDescription::$_metadataSchemaName

fully qualified class name of the meta-data schema this description complies to

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

integer MetadataDescription::$_seq

sequence id used when saving several descriptions of the same subject.

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


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