Documentation

TemplateMetadata
in package
implements MetadataInterface

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

Required metadata format definitition properties:

  • templatePath - path to the template

Optional metadata format definition properties:

For the description of the XML attributes which can be used in the template please take a look on https://github.com/acdh-oeaw/arche-oaipmh/blob/master/doc/TemplateMetadata.md

Tags
author

zozlak

Table of Contents

Interfaces

MetadataInterface
Interface for different metadata providers.

Constants

IF_LOGICAL_REGEX  = '`^ *(OR|AND|NOT) *`'
IF_PART_REGEX  = '`^ *(any|every|none)[(](' . self::PREDICATE_REGEX . ')(?: +' . self::IF_VALUE_REGEX . ')?[)]`u'
IF_VALUE_REGEX  = '(==|!=|starts|ends|contains|>|<|>=|<=|regex) +(?:"([^"]*)"|\'([^\']*)\'|([0-9]+[.]?[0-9]*)|(' . self::PREDICATE_REGEX . '))'
PREDICATE_REGEX  = '[-_a-zA-Z0-9]+:[^ )]*'

Properties

$dataset  : Dataset
$format  : MetadataFormat
Metadata format descriptor
$headerData  : HeaderData
$loadedInverse  : array<string|int, SplObjectStorage>
$nodesStack  : array<string|int, TermInterface>
$res  : RepoResourceDb
Repository resource object
$seqNo  : int
$template  : string
Path to the XML template file
$valueMapper  : ValueMapper
$xml  : DOMDocument
$xmlLocation  : array<string|int, string>

Methods

__construct()  : mixed
Creates a metadata object for a given repository resource.
extendSearchDataQuery()  : QueryPart
Allows to extend a search query with additional clauses specific to the given metadata source.
extendSearchFilterQuery()  : QueryPart
Allows to extend a search query with additional clauses specific to the given metadata source.
getXml()  : DOMElement
Creates resource's XML metadata
evaluateIf()  : bool
expand()  : NamedNodeInterface
fetchValues()  : array<string|int, mixed>
loadDocument()  : void
loadMetadata()  : void
processElement()  : void
processValue()  : void
removePreservingChildren()  : void
removeUnneededNodes()  : void

Constants

IF_PART_REGEX

public mixed IF_PART_REGEX = '`^ *(any|every|none)[(](' . self::PREDICATE_REGEX . ')(?: +' . self::IF_VALUE_REGEX . ')?[)]`u'

IF_VALUE_REGEX

public mixed IF_VALUE_REGEX = '(==|!=|starts|ends|contains|>|<|>=|<=|regex) +(?:"([^"]*)"|\'([^\']*)\'|([0-9]+[.]?[0-9]*)|(' . self::PREDICATE_REGEX . '))'

Properties

$loadedInverse

private static array<string|int, SplObjectStorage> $loadedInverse = []

Methods

extendSearchDataQuery()

Allows to extend a search query with additional clauses specific to the given metadata source.

public static extendSearchDataQuery(MetadataFormat $format) : QueryPart

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
$format : MetadataFormat

metadata format descriptor

Return values
QueryPart

extendSearchFilterQuery()

Allows to extend a search query with additional clauses specific to the given metadata source.

public static extendSearchFilterQuery(MetadataFormat $format) : QueryPart

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
$format : MetadataFormat

metadata format descriptor

Return values
QueryPart

getXml()

Creates resource's XML metadata

public getXml() : DOMElement

If the template's root element has an val attribute a fake root element is introduced to the template to assure it will be a valid XML after the substitution (XML documents have to have a single root element).

Return values
DOMElement

evaluateIf()

private evaluateIf(string $if) : bool
Parameters
$if : string
Return values
bool

expand()

private expand(string $prefixed) : NamedNodeInterface
Parameters
$prefixed : string
Return values
NamedNodeInterface

fetchValues()

private fetchValues(Value $val) : array<string|int, mixed>
Parameters
$val : Value
Return values
array<string|int, mixed>

loadMetadata()

private loadMetadata(array<string|int, mixed> $resources, TermInterface|null $predicate, bool $inverse, bool $recursive) : void
Parameters
$resources : array<string|int, mixed>
$predicate : TermInterface|null
$inverse : bool
$recursive : bool

processElement()

private processElement(DOMDocument|DOMElement $el) : void
Parameters
$el : DOMDocument|DOMElement

processValue()

private processValue(DOMDocument|DOMElement $el) : void
Parameters
$el : DOMDocument|DOMElement

removePreservingChildren()

private removePreservingChildren(DOMElement $el) : void
Parameters
$el : DOMElement

removeUnneededNodes()

private removeUnneededNodes(DOMDocument|DOMElement $el) : void
Parameters
$el : DOMDocument|DOMElement

        
On this page

Search results