Constants

ADD

ADD

UPDATE

UPDATE

OVERWRITE

OVERWRITE

PARENT_PROP

PARENT_PROP

CONTAINS_PROP

CONTAINS_PROP

Properties

$uri

$uri : string

Resource's Fedora URI

Type

string

$metadata

$metadata : \EasyRdf\Resource

Resource metadata (local copy)

Type

\EasyRdf\Resource

$fedora

$fedora : \acdhOeaw\fedora\Fedora

Fedora connection object used by this resource

Type

\acdhOeaw\fedora\Fedora

$skipProp

$skipProp : array

List of metadata properties managed exclusively by the Fedora.

Type

array

$skipPropRegExp

$skipPropRegExp : string

Regular expression for filtering out metadata properties managed exclusively by the Fedora

Type

string

$updated

$updated : boolean

Are object's metadata synchronized with the Fedora

Type

boolean

$aclUrl

$aclUrl : string

URL of the ACL resource used by a given resource

Type

string

$param

$param : array

Parameters list

Type

array

Methods

__construct()

__construct(\acdhOeaw\fedora\Fedora  $fedora, string  $uri = '') 

Creates a dissemination service object.

Validity of the provided URI is not checked.

Parameters

\acdhOeaw\fedora\Fedora $fedora

repository connection object

string $uri

UTI of the repository resource representing the dissemination service

getUri()

getUri(boolean  $standardized = false) : string

Returns resource's Fedora URI

Parameters

boolean $standardized

should the Uri be standardized (in the form used in a triplestore) or current Fedora connection specific

Returns

string

getId()

getId() : string

Returns resource's ACDH UUID.

If there is no or are many ACDH UUIDs, an error is thrown.

Throws

\RuntimeException

Returns

string

getIds()

getIds() : array

Returns an array of resource's IDs.

If you want to get an ACDH ID, use the getId() method.

Returns

array

getFedora()

getFedora() : \acdhOeaw\fedora\Fedora

Returns the Fedora connection used by this object

Returns

\acdhOeaw\fedora\Fedora

delete()

delete(boolean  $deep = false, boolean  $children = false, boolean  $references = false) 

Removes the resource from the Fedora.

Please remember searching for children and references is done using a SPARQL query so any changes made since the beginning of the transaction won't be taken into account.

Parameters

boolean $deep

should tombstone resource will be deleted?

boolean $children

should children be removed?

boolean $references

should references to the resource be removed? (applies also for children when $children == true)

move()

move(string  $destination) 

Moves resource to another location.

Parameters

string $destination

new location

getFixity()

getFixity() 

Returns resource fixity.

Throws

\acdhOeaw\fedora\exceptions\Deleted
\acdhOeaw\fedora\exceptions\NotFound
\GuzzleHttp\Exception\RequestException

setMetadata()

setMetadata(\acdhOeaw\fedora\EasyRdf\Resource  $metadata, boolean  $fixReferences = false) 

Replaces resource metadata with a given RDF graph.

New metadata are not automatically written back to the Fedora. Use the updateMetadata() method to write them back.

Parameters

\acdhOeaw\fedora\EasyRdf\Resource $metadata
boolean $fixReferences

Should reference to other repository resources be switched into corresponding UUIDs?

updateMetadata()

updateMetadata(string  $mode = self::OVERWRITE) 

Writes resource metadata back to the Fedora and then fetches them by calling getMetadata().

Do not be surprised that the metadata read back from the Fedora can (and for sure will) differ from the one written by you. This is because Fedora (and/or doorkeeper) will add/modify some triples (e.g. fedora:lastModified).

Be aware that as Fedora generates errors when you try to set properties Fedora considers its private once, such properties will be ommited in the update (see getSparqlTriples() method documentation for details).

Parameters

string $mode

chooses the way the update is done: ADD simply adds current triples. All already existing triples (also old value of the triples you altered) are kept. UPDATE old values of already existing triples are updated with current values, new triples are added and all other triples are kept. OVERWRITE all existing triples are removed, then all current triples are added.

getMetadata()

getMetadata(boolean  $force = false) : \EasyRdf\Resource

Returns resource metadata.

Fetches them from the Fedora if they were not fetched already.

A deep copy of metadata is returned meaning adjusting the returned object does not automatically affect the resource metadata. Use the setMetadata() method to write back the changes you made.

Parameters

boolean $force

enforce fetch from Fedora (when you want to make sure metadata are in line with ones in the Fedora or e.g. reset them back to their current state in Fedora)

Returns

\EasyRdf\Resource

getContent()

getContent(boolean  $stream = false) : \GuzzleHttp\Psr7\Response

Returns resource's binary content.

Parameters

boolean $stream

should response body be streamed (true) or downloaded upfront (false)

Returns

\GuzzleHttp\Psr7\Response —

PSR-7 response containing resource's binary content

updateContent()

updateContent(mixed  $data, boolean  $convert = false) 

Updates resource binary content in the Fedora.

If the resource is not a binary resource (in Fedora terms), it can be converted. This means the existing Fedora resource will be deleted and the new one will be created. This means the resource will change its Fedora URI but the id property indicated by the "fedoraIdProp" config option (see init()) will be preserved. This means until you are using the id property values (and not Fedora URIs) to denote resources in your metadata, your metadata consistency will be preserved.

Parameters

mixed $data

resource data as a string, file name or an array: ['contentType' => 'foo', 'data' => 'bar', 'filename' => 'baz.txt']

boolean $convert

if metadata-only resource be automatically converted to a binary one

Throws

\DomainException

getClasses()

getClasses() : array

Returns all RDF types (classes) of a given resource.

Returns

array

isA()

isA(\acdhOeaw\fedora\type  $class) : boolean

Naivly checks if the resource is of a given class.

Naivly means that a given rdfs:type triple must exist in the resource metadata.

Parameters

\acdhOeaw\fedora\type $class

Returns

boolean

isBinary()

isBinary() : boolean

Checks if a given resource is a binary one (if not, it's a purely metadata one).

Returns

boolean

getChildrenQuery()

getChildrenQuery() : \acdhOeaw\fedora\metadataQuery\Query

Returns the SPARQL query object returning resource's children.

It is assumed that child-parent relations are denoted by: child -> config::relProp -> id <- config::idProp <- parent metadata properties scheme.

Returns

\acdhOeaw\fedora\metadataQuery\Query

getChildrenQueryParameter()

getChildrenQueryParameter() : \acdhOeaw\fedora\metadataQuery\QueryParameter

Return the SPARQL query triple object denoting relation of being this resource's child

Returns

\acdhOeaw\fedora\metadataQuery\QueryParameter

getFedoraChildren()

getFedoraChildren() : array

Returns all resource's Fedora children.

A Fedora child is a resource pointed by the ldp:contains triple. All Fedora children URIs are nested in the parent's URI path but the deepness of such nesting can vary (e.g. both http://a/b and http://a/b/c/d can be Fedora children of the http://a depenging on how they were created).

Fedora's parent-child relation is automatically maintained by the Fedora and depends on the way Fedora resources are created.

Returns

array

getChildren()

getChildren() : array

Returns all resource's children.

It is assumed that child-parent relations are denoted by: child -> config::relProp -> id <- config::idProp <- parent metadata properties scheme.

Returns

array

getChildrenByProperty()

getChildrenByProperty(string  $property, string  $value = '') : array

Returns all resource's children having a given property or a given value of a given property.

It is assumed that child-parent relations are denoted by: child -> config::relProp -> id <- config::idProp <- parent metadata properties scheme.

Parameters

string $property

fully qualified URI of the property

string $value

property value (optional)

Returns

array

getChildrenByPropertyRegEx()

getChildrenByPropertyRegEx(string  $property, string  $regEx, string  $flags = 'i') : array

Returns all resource's children with a given property matching a given regular expression

It is assumed that child-parent relations are denoted by: child -> config::relProp -> id <- config::idProp <- parent metadata properties scheme.

Parameters

string $property

fully qualified URI of the property

string $regEx

regular expression to match

string $flags

regular expression flags

Returns

array

getAclUrl()

getAclUrl(boolean  $refresh = false) : string

Returns URL of the resources' ACL collection

Parameters

boolean $refresh

should ACL URL be reread

Returns

string

getAcl()

getAcl(boolean  $refresh = true) : \acdhOeaw\fedora\acl\WebAcl

Returns a WebAcl object for access rules manipulation.

Parameters

boolean $refresh

should the ACL collection and rules be refreshed or read from cache (there are many scenarios when reading requiring ACL data to be outdated so the default behaviour is to refresh)

Returns

\acdhOeaw\fedora\acl\WebAcl

getDissServices()

getDissServices(boolean  $lazy = false) : array

Returns list of dissemination services available for a resource.

Parameters

boolean $lazy

when false returned array contains instances of \acdhOeaw\fedora\dissemination\Service, when true it contains dissemination service URIs

Returns

array

__metaToString()

__metaToString() : string

Returns serialized metadata (primarly for debugging)

Returns

string

__toString()

__toString() : \acdhOeaw\fedora\type

Provides short string representation of the object

Returns

\acdhOeaw\fedora\type

getFormats()

getFormats() : array

Returns all return formats provided by the dissemination service.

Technically return formats are nothing more then strings. There is no requirement forcing them to be mime types, etc.

Returns

array

getRequest()

getRequest(\acdhOeaw\fedora\FedoraResource  $res) : \GuzzleHttp\Psr7\Request

Returns PSR-7 HTTP request disseminating a given resource.

Parameters

\acdhOeaw\fedora\FedoraResource $res

repository resource to be disseminated

Throws

\RuntimeException

Returns

\GuzzleHttp\Psr7\Request

getLocation()

getLocation() : string

Gets disseminations service's URL (before parameters subsitution)

Returns

string

getRevProxy()

getRevProxy() : boolean

Should the dissemination service request be reverse-proxied?

If it's not set in the metadata, false is assumed.

Returns

boolean

loadMetadata()

loadMetadata(boolean  $force = false) 

Loads current metadata from the Fedora.

Parameters

boolean $force

enforce fetch from Fedora (when you want to make sure metadata are in line with ones in the Fedora or e.g. reset them back to their current state in Fedora)

getMetadataFromFedora()

getMetadataFromFedora() : Resource

Fetches metadata from Fedora.

Throws

\GuzzleHttp\Exception\RequestException
\acdhOeaw\fedora\exceptions\Deleted

Returns

Resource

getSparqlTriples()

getSparqlTriples(\EasyRdf\Resource  $metadata) : string

Serializes metadata to a form suitable for Fedora's SPARQL-update query.

This means the "ntriples" format with subject URIs compliant with current Fedora connection and excluding properties Fedora reserves for itself (and rises errors when they are provided from the outside).

Parameters

\EasyRdf\Resource $metadata

metadata to serialize

Returns

string

extractAcl()

extractAcl(\GuzzleHttp\Psr7\Response  $resp) 

Fetches ACL URL from Fedora response headers and updates the `$aclUrl` property.

If new and old URLs differ, clears the $acl property.

If no appropriate header is found clears the $aclUrl and $acl properties.

Parameters

\GuzzleHttp\Psr7\Response $resp

Fedora response

extractAclFromMetadata()

extractAclFromMetadata() 

Tries to extract ACL URL from the metadata and update the `$aclUrl` property.

getUrlParameters()

getUrlParameters() : array

Returns list of all parameters of a given dissemination service

Returns

array

getParameterValues()

getParameterValues(array  $param, \acdhOeaw\fedora\FedoraResource  $res) : array

Evaluates parameter values for a given resource.

Parameters

array $param

list of parameters

\acdhOeaw\fedora\FedoraResource $res

repository resource to be disseminated

Throws

\RuntimeException

Returns

array —

associative array with parameter values

getParameters()

getParameters()