\acdhOeaw\schema\disseminationService

ACDH dessimination service is modeled as a Fedora resource described by RDF properties:

  • cfg:fedoraTitleProp - a service name
  • cfg:fedoraServiceLocProp - a service location containing parameter bindings. A place where parameter is ingested is marked with the "{param_name}" syntax. Transformations can be applied to the parameter value using the "{param_name|part(path)|url}" syntax (transformations can be chained as on the example). Transformations shipped with the repo-php-util are provided in the acdhOeaw\fedora\dissemination\parameter namespace. You can register other using the acdhOeaw\fedora\dissemination\Parameter::registerTransformation(iTransformation $transformation) static method before calling acdhOeaw\fedora\dissmination\Service::getRequest(). There are two special parameters: RES_URI and RES_ID (latter one being resource's repository internal UUID)
  • cfg:fedoraServiceRetFormatProp - a MIME type provided by this service. It can contain a weight as used in the HTTP Accept header (e.g. "text/plain; q=0.5")

Dissemination service parameters are modeled as its child resources (cfg:fedoraRelProp) - see Parameter class description for details.

Matching between repository resources and dissemination services can be described in two ways:

  • using the cfg:fedoraHasServiceProp pointing directly from the resource's metadata to the dissemination service
  • by a matching rules defined with the Service::addMatch() method (see below)

Summary

Methods
Properties
Constants
__construct()
getMetadata()
getResource()
getId()
getIds()
updateRms()
getCreated()
setMetadata()
createNewVersion()
addParameter()
addMatch()
$debug
No constants found
findResource()
createResource()
getBinaryData()
mergeMetadata()
$created
$fedora
N/A
No private methods found
$res
$id
$metadata
$metadataPreserve
$location
$format
$revProxy
$params
$matches
N/A

Properties

$debug

$debug : boolean

Debug mode switch.

Type

boolean

$created

$created : boolean

Allows to keep track of the corresponding repository resource state: - null - unknown - true - recent call to updateRms() created the repository resource - false - repository resource already existed uppon last updateRms() call

Type

boolean

$id

$id : string

Entity id.

Type

string

$metadata

$metadata : \EasyRdf\Resource

External metadata to be merged with automatically generated one.

Type

\EasyRdf\Resource

$metadataPreserve

$metadataPreserve : array

List of automaticaly generated metadata properties to be preserved while merging with external metadata.

Type

array

$location

$location : string

Dissemination service location (URL).

It should contain references to all parameters passed by the query URL in form of {parameterName|transformation}. Remarks:

  • There is also a special RES_URI parameter available providing the URI of the resource being disseminated
  • For available transformations see the \acdhOeaw\fedora\dissemination\Parameter::transform().

An example value: `https://my.service?res={RES_URI|url}&myParam={myParam|}

Type

string

$format

$format : array

Return formats provided by the service

Type

array

$revProxy

$revProxy : boolean

Should calls to the diss service be reverse proxied?

Type

boolean

$params

$params : array

Parameters used by the service

Type

array

$matches

$matches : array

Resources matching rules for the service

Type

array

Methods

__construct()

__construct(\acdhOeaw\fedora\Fedora  $fedora, string  $id, string  $location, array  $format, boolean  $revProxy) 

Creates an object representing the dissemination service

Parameters

\acdhOeaw\fedora\Fedora $fedora

repository connection object

string $id

dissemination service id

string $location

dissemination service location (see the $location property description)

array $format

list of return types provided by the dissemination service

boolean $revProxy

should calls to the diss service be reverse proxied?

Throws

\InvalidArgumentException

getMetadata()

getMetadata() : Resource

Returns metadata describing the dissemination service.

Returns

Resource

getResource()

getResource(boolean  $create = true, boolean  $uploadBinary = true) : \acdhOeaw\fedora\FedoraResource

Returns repository resource representing given real-world entity.

If it does not exist, it can be created.

Parameters

boolean $create

should repository resource be created if it does not exist?

boolean $uploadBinary

should binary data of the real-world entity be uploaded uppon repository resource creation?

Returns

\acdhOeaw\fedora\FedoraResource

getId()

getId() : string

Returns primary id of the real-world entity stored in this object (as it was set up in the object contructor).

Please do not confuse this id with the random internal ACDH repo id.

Returns

string

getIds()

getIds() : array

Returns all known ids

Returns

array —

list of all ids

updateRms()

updateRms(boolean  $create = true, boolean  $uploadBinary = true, string  $path = '/') : \acdhOeaw\fedora\FedoraResource

Updates the dissemination service definition in the repository.

Parameters

boolean $create

should repository resource be created if it does not exist?

boolean $uploadBinary

should binary data of the real-world entity be uploaded uppon repository resource creation?

string $path

where to create a resource (if it does not exist). If it it ends with a "/", the resource will be created as a child of a given collection). All the parents in the Fedora resource tree have to exist (you can not create "/foo/bar" if "/foo" does not exist already).

Returns

\acdhOeaw\fedora\FedoraResource

getCreated()

getCreated() : boolean

Informs about the corresponding repository resource state uppon last call to the `updateRms()` method: - null - the updateRms() was not called yet - true - repository resource was created by last call to the updateRms() - false - repository resource already existed uppoin last call to the updateRms()

Returns

boolean

setMetadata()

setMetadata(Resource  $meta, array  $preserve = array()) 

Sets an external metadata to be appended to automatically generated ones.

If a given metatada property exists both in automatically generated and provided metadata, then the final result depends on the $preserve parameter:

  • if the property is listed in the $preserve array, both automatically generated and provided values will be kept
  • if not, only values from provided metadata will be kept and automatically generated ones will be skipped

Parameters

Resource $meta

external metadata

array $preserve

list of metadata properties to be kept - see above

createNewVersion()

createNewVersion(boolean  $uploadBinary = true, string  $path = '/', boolean  $pidPass = false) : \acdhOeaw\fedora\FedoraResource

Creates a new version of the resource. The new version inherits all IDs but the UUID and epic PIDs. The old version looses all IDs but the UUID and spic PIDs. It also looses all RC::relProp() connections with collections.

The old and the new resource are linked with cfg:fedoraIsNewVersionProp and cfg:fedoraIsOldVersionProp.

Parameters

boolean $uploadBinary

should binary data of the real-world entity be uploaded uppon repository resource creation?

string $path

where to create a resource (if it does not exist). If it it ends with a "/", the resource will be created as a child of a given collection). All the parents in the Fedora resource tree have to exist (you can not create "/foo/bar" if "/foo" does not exist already).

boolean $pidPass

should PIDs (epic handles) be migrated to the new version (true) or kept by the old one (false)

Returns

\acdhOeaw\fedora\FedoraResource

old version resource

addParameter()

addParameter(string  $name, string  $defaultValue = '', string  $rdfProperty = '_') 

Defines a dissemination service parameter.

Parameters

string $name

parameter name

string $defaultValue

default parameter value

string $rdfProperty

RDF property holding parameter value in resources' metadata

addMatch()

addMatch(string  $property, string  $value, boolean  $required) 

Defines a matching rule for the dissemination service

Parameters

string $property

RDF property to be checked in resource's metadata

string $value

expected RDF property value in resource's metadata

boolean $required

is this match rule compulsory?

findResource()

findResource(boolean  $create = true, boolean  $uploadBinary = true, string  $path = '') : boolean

Tries to find a repository resource representing a given object.

Parameters

boolean $create

should repository resource be created if it was not found?

boolean $uploadBinary

should binary data of the real-world entity be uploaded uppon repository resource creation?

string $path

where to create a resource (if it does not exist). If it it ends with a "/", the resource will be created as a child of a given collection). All the parents in the Fedora resource tree have to exist (you can not create "/foo/bar" if "/foo" does not exist already).

Returns

boolean —

if a repository resource was found

createResource()

createResource(Resource  $meta, boolean  $uploadBinary, string  $path) 

Creates a Fedora resource

Parameters

Resource $meta
boolean $uploadBinary
string $path

getBinaryData()

getBinaryData() : \acdhOeaw\schema\value

Provides entity binary data.

Returns

\acdhOeaw\schema\value —

accepted as the \acdhOeaw\fedora\Fedora::attachData() $body parameter

mergeMetadata()

mergeMetadata(Resource  $current, Resource  $new) : Resource

Merges metadata coming from the Fedora and generated by the class.

Parameters

Resource $current

current Fedora resource metadata

Resource $new

metadata generated by the class

Returns

Resource —

final metadata