\acdhOeaw\oai\metadataLiveCmdiMetadata

Creates <metadata> element by filling in an XML template with values read from the repository resource's metadata.

Required metadata format definitition properties:

  • uriProp - metadata property storing resource's OAI-PMH id
  • idProp - metadata property identifying a repository resource
  • labelProp - metadata property storing repository resource label
  • schemaProp - metadata property storing resource's CMDI profile URI
  • templateDir - path to a directory storing XML templates; each template should have exactly same name as the CMDI profile id, e.g. clarin.eu:cr1:p_1290431694580.xml
  • defaultLang - default language to be used when the template doesn't explicitly specify one

Optional metadata format definition properties:

  • propNmsp[prefix] - an array of property URIs namespaces used in the template
  • schemaDefault provides a default CMDI profile (e.g. clarin.eu:cr1:p_1290431694580.xml) to be used when a resource's metadata don't contain the schemaProp or none of its values correspond to an existing CMDI template. If schemaDefault isn't provided, resources which don't contain the schemaProp in their metadata are automatically excluded from the OAI-PMH search.
  • schemaEnforce if provided, only resources with a given value of the schemaProp are processed.

XML tags in the template can be annotated with following attributes:

  • val="valuePath" specifies how to get the value. Possible valuePath variants are:
    • /propUri - get a value from a given metadata property value
    • /propUri[key] - parse given metadata property value as YAML and take the value at the key key
    • @propUri1/propUri2 - get another resource URI from the propUri1 metadata property value, then use the propUri2 metadata property value of this resource
    • NOW - get the current time
    • URI - get the resource's repository URI
    • OAIURI - get the resource's OAI-PMH ID
  • count="N" (default 1)
    • when "*" and metadata contain no property specified by the val attribute the tag is removed from the template;
    • when "*" or "+" and metadata contain many properties specified by the val attribute the tag is repeated for each metadata property value
    • when "1" or "+" and metadata contain no property specified by the val attribute the tag is left empty in the template;
    • when "1" and metadata contain many properties specified by the val attribute first metadata property value is used
  • lang="true" if present and a metadata property value contains information about the language, the xml:lang attribute is added to the template tag
  • asXML="true" if present, value specified with the val attribute is parsed and added as XML

Summary

Methods
Properties
Constants
__construct()
getXml()
extendSearchQuery()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
processElement()
insertValue()
insertMetaValues()
collectMetaValue()
replacePropNmsp()
$res
$format
$template
N/A

Properties

$res

$res : \acdhOeaw\fedora\FedoraResource

Repository resource object

Type

\acdhOeaw\fedora\FedoraResource

$template

$template : string

Path to the XML template file

Type

string

Methods

__construct()

__construct(\acdhOeaw\fedora\FedoraResource  $resource, \stdClass  $sparqlResultRow, \acdhOeaw\oai\data\MetadataFormat  $format) 

Creates a metadata object for a given repository resource.

Parameters

\acdhOeaw\fedora\FedoraResource $resource

repository resource object

\stdClass $sparqlResultRow

SPARQL search query result row

\acdhOeaw\oai\data\MetadataFormat $format

metadata format descriptor describing this resource

getXml()

getXml() : \DOMElement

Creates resource's XML metadata

Returns

\DOMElement

extendSearchQuery()

extendSearchQuery(\acdhOeaw\oai\data\MetadataFormat  $format, string  $resVar) : string

Applies metadata format restrictions.

Returned string must be a valid SPARQL query part one can insert as ... in a query like SELECT * WHERE { ... LIMIT (someRule)}. It means if you need your own LIMIT clause or other advanced constructs, you must return a subquery.

Remark! PHP doesn't consider static methods as an interface part therefore existance of this method in classes implementing this interface is not enforced.

Parameters

\acdhOeaw\oai\data\MetadataFormat $format

metadata format descriptor

string $resVar

variable used in the search query to denote the repository resource

Returns

string

processElement()

processElement(\DOMElement  $el) 

Recursively processes all XML elements

Parameters

\DOMElement $el

DOM element to be processed

insertValue()

insertValue(\DOMElement  $el) : boolean

Injects metadata values into a given DOM element of the CMDI template.

Parameters

\DOMElement $el

DOM element to be processes

Returns

boolean —

should $el DOMElement be removed from the document

insertMetaValues()

insertMetaValues(\DOMElement  $el, string  $val) 

Fetches values from repository resource's metadata and creates corresponding CMDI parts.

Parameters

\DOMElement $el
string $val

DOMElement's val attribute value

collectMetaValue()

collectMetaValue(array  $values, \EasyRdf\Literal  $metaVal, \acdhOeaw\oai\metadata\type  $subprop) 

Extracts metadata value from a given EasyRdf node

Parameters

array $values
\EasyRdf\Literal $metaVal
\acdhOeaw\oai\metadata\type $subprop

replacePropNmsp()

replacePropNmsp(string  $prop) : string

Parameters

string $prop

Returns

string