Parameter
extends RepoResource
in package
Uses
ParameterTrait
Represents a dissemination service parameter.
Tags
Table of Contents
Constants
- UPDATE_ADD = 'add'
- UPDATE_MERGE = 'merge'
- UPDATE_OVERWRITE = 'overwrite'
Properties
- $default : string
- $metadata : DatasetNodeInterface
- $metaSynced : bool
- $namespaces : Schema
- $repo : Repo
- $repoInt : RepoInterface
- $transformations : array<string, string>
- Stores list of registered transformations
- $valueProp : NamedNodeInterface
Methods
- __construct() : mixed
- Creates an object representing a repository resource.
- applyTransformations() : string
- Applies given transformations to a value
- delete() : array<string|int, string>
- Deletes the repository resource.
- deleteAsync() : PromiseInterface
- Asynchronous version of delete()
- factory() : RepoResource
- Creates a repository resource object from the PSR-7 response object returning the metadata.
- getClasses() : array<string|int, string>
- Returns all RDF types (classes) of a given repository resource.
- getContent() : ResponseInterface
- Returns repository resource binary content.
- getContentAsync() : ResponsePromise
- synchronous version of getContent()
- getDissServices() : array<string, Service>
- Returns list of dissemination services available for a resource.
- getGraph() : DatasetNodeInterface
- Returns resource metadata.
- getIds() : array<string|int, string>
- Returns an array with all repository resource identifiers.
- getMetadata() : DatasetNodeInterface
- Returns resource metadata.
- getName() : string
- Returns parameter name
- getRepo() : RepoInterface
- Returns repository connection object associated with the given resource object.
- getUri() : TermInterface
- Returns the repository resource URL.
- getValue() : string
- Return parameter value for a given repository resource
- hasBinaryContent() : bool
- Checks if the resource has the binary content.
- isA() : bool
- Naivly checks if the resource is of a given class.
- loadMetadata() : mixed
- loadMetadataAsync() : PromiseInterface|null
- Asynchronous version of loadMetadata()
- merge() : void
- Merges the current resource with the given one. See the corresponding [REST endpoint description](https://app.swaggerhub.com/apis/zozlak/arche/3.0#/default/put_merge__srcResourceId___targetResourceId_)
- mergeAsync() : PromiseInterface
- Asynchronous version of merge()
- registerTransformation() : void
- Registers a new transformation
- setGraph() : void
- Replaces resource metadata with a given RDF graph. A reference to the provided metadata is stored meaning future modifications of the $metadata object automatically affect the resource metadata.
- setMetadata() : void
- Replaces resource metadata with a given RDF resource graph. A deep copy of the provided metadata is stored meaning future modifications of the $metadata object don't affect the resource metadata.
- updateContent() : void
- Updates repository resource binary content with a given payload.
- updateContentAsync() : PromiseInterface
- Asynchronous version of updateContent()
- updateMetadata() : void
- Saves the object metadata to the repository.
- updateMetadataAsync() : PromiseInterface|null
- Asynchronous version of updateMetadata()
- getId() : int
- Returns an internal repository resource identifier.
- findValue() : string
- getServiceClass() : string
- init() : void
- parseMetadata() : void
- Parses metadata fetched from the repository.
- withReadHeaders() : Request
Constants
UPDATE_ADD
public
mixed
UPDATE_ADD
= 'add'
UPDATE_MERGE
public
mixed
UPDATE_MERGE
= 'merge'
UPDATE_OVERWRITE
public
mixed
UPDATE_OVERWRITE
= 'overwrite'
Properties
$default
private
string
$default
= ''
$metadata
private
DatasetNodeInterface
$metadata
$metaSynced
private
bool
$metaSynced
$namespaces
private
Schema
$namespaces
$repo
private
Repo
$repo
$repoInt
private
RepoInterface
$repoInt
$transformations
Stores list of registered transformations
private
static array<string, string>
$transformations
= ['add' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\AddParam::class, 'base64' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\Base64Encode::class, 'part' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\UriPart::class, 'set' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\SetParam::class, 'substr' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\Substr::class, 'url' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\UrlEncode::class, 'rawurlencode' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\RawUrlEncode::class, 'removeprotocol' => \acdhOeaw\arche\lib\disserv\dissemination\transformation\RemoveProtocol::class]
$valueProp
private
NamedNodeInterface
$valueProp
Methods
__construct()
Creates an object representing a repository resource.
public
__construct(string $url, RepoInterface $repo) : mixed
Parameters
- $url : string
-
URL of the resource
- $repo : RepoInterface
-
repository connection object
applyTransformations()
Applies given transformations to a value
public
static applyTransformations(string $value[, array<string|int, string> $transformations = [] ]) : string
Parameters
- $value : string
-
value
- $transformations : array<string|int, string> = []
-
transformations to be applied to the value
Return values
stringdelete()
Deletes the repository resource.
public
delete([bool $tombstone = false ][, bool $references = false ][, string $recursiveProperty = '' ]) : array<string|int, string>
Returns an array of deleted resources' URIs.
Parameters
- $tombstone : bool = false
-
should tombstones be removed for deleted resources?
- $references : bool = false
-
should references to deleted resources be removed from other resources?
- $recursiveProperty : string = ''
-
is present, deletion continues recursively to all resources pointing to the deleted one with this RDF property
Return values
array<string|int, string>deleteAsync()
Asynchronous version of delete()
public
deleteAsync([bool $tombstone = false ][, bool $references = false ][, string $recursiveProperty = '' ]) : PromiseInterface
Parameters
- $tombstone : bool = false
- $references : bool = false
- $recursiveProperty : string = ''
Tags
Return values
PromiseInterfacefactory()
Creates a repository resource object from the PSR-7 response object returning the metadata.
public
static factory(Repo $repo, ResponseInterface $response[, string|null $uri = null ]) : RepoResource
Parameters
- $repo : Repo
-
connection object
- $response : ResponseInterface
-
PSR-7 repository response object
- $uri : string|null = null
-
resource URI (if not provided, a Location HTTP header from the response will be used)
Return values
RepoResourcegetClasses()
Returns all RDF types (classes) of a given repository resource.
public
getClasses() : array<string|int, string>
Return values
array<string|int, string>getContent()
Returns repository resource binary content.
public
getContent() : ResponseInterface
Return values
ResponseInterface —PSR-7 response containing resource's binary content
getContentAsync()
synchronous version of getContent()
public
getContentAsync() : ResponsePromise
Tags
Return values
ResponsePromisegetDissServices()
Returns list of dissemination services available for a resource.
public
getDissServices() : array<string, Service>
Return values
array<string, Service>getGraph()
Returns resource metadata.
public
getGraph() : DatasetNodeInterface
Fetches them from the repository with the loadMetadata()
if they were
not fetched already.
A reference to the metadata is returned meaning adjusting the returned object automatically affects the resource metadata.
Tags
Return values
DatasetNodeInterfacegetIds()
Returns an array with all repository resource identifiers.
public
getIds() : array<string|int, string>
Return values
array<string|int, string>getMetadata()
Returns resource metadata.
public
getMetadata() : DatasetNodeInterface
Fetches them from the repository with the loadMetadata()
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.
Tags
Return values
DatasetNodeInterfacegetName()
Returns parameter name
public
getName() : string
Return values
stringgetRepo()
Returns repository connection object associated with the given resource object.
public
getRepo() : RepoInterface
Return values
RepoInterfacegetUri()
Returns the repository resource URL.
public
getUri() : TermInterface
Return values
TermInterfacegetValue()
Return parameter value for a given repository resource
public
getValue(RepoResourceInterface $res[, array<string|int, string> $transformations = [] ][, string|null $prefix = null ][, bool $forcePrefix = false ]) : string
Parameters
- $res : RepoResourceInterface
-
repository resource to get the value for
- $transformations : array<string|int, string> = []
-
transformations to be applied to the value
- $prefix : string|null = null
-
preferred value prefix
- $forcePrefix : bool = false
-
should error be thrown if $prefix is defined and no value with a given prefix can be found
Tags
Return values
stringhasBinaryContent()
Checks if the resource has the binary content.
public
hasBinaryContent() : bool
Return values
boolisA()
Naivly checks if the resource is of a given class.
public
isA(string $class) : bool
Naivly means that a given rdfs:type triple must exist in the resource metadata.
Parameters
- $class : string
Return values
boolloadMetadata()
public
abstract loadMetadata() : mixed
loadMetadataAsync()
Asynchronous version of loadMetadata()
public
loadMetadataAsync([bool $force = false ][, string $mode = self::META_RESOURCE ][, string|null $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : PromiseInterface|null
Parameters
- $force : bool = false
- $mode : string = self::META_RESOURCE
- $parentProperty : string|null = null
- $resourceProperties : array<string|int, string> = []
- $relativesProperties : array<string|int, string> = []
Tags
Return values
PromiseInterface|nullmerge()
Merges the current resource with the given one. See the corresponding [REST endpoint description](https://app.swaggerhub.com/apis/zozlak/arche/3.0#/default/put_merge__srcResourceId___targetResourceId_)
public
merge(string $targetResId[, string $readMode = self::META_RESOURCE ][, string $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : void
If this action succeeds, resource's URI changes to the targetResource's one.
Parameters
- $targetResId : string
- $readMode : string = self::META_RESOURCE
-
scope of the metadata returned by the repository
- see the META_* constants defined by the RepoResourceInterface
- $parentProperty : string = null
-
RDF property to be used by the metadata read mode denoted by the $readMode parameter
- $resourceProperties : array<string|int, string> = []
-
list of RDF properties to be includes for a resource (if the list is empty, all exsiting RDF properties are included)
- $relativesProperties : array<string|int, string> = []
-
list of RDF properties to be includes for resources being relatives (if the list is empty, all exsiting RDF properties are included)
mergeAsync()
Asynchronous version of merge()
public
mergeAsync(string $targetResId[, string $readMode = self::META_RESOURCE ][, string|null $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : PromiseInterface
Parameters
- $targetResId : string
- $readMode : string = self::META_RESOURCE
- $parentProperty : string|null = null
- $resourceProperties : array<string|int, string> = []
- $relativesProperties : array<string|int, string> = []
Tags
Return values
PromiseInterfaceregisterTransformation()
Registers a new transformation
public
static registerTransformation(iTransformation $transformation) : void
Parameters
- $transformation : iTransformation
-
transformation to be registered
setGraph()
Replaces resource metadata with a given RDF graph. A reference to the provided metadata is stored meaning future modifications of the $metadata object automatically affect the resource metadata.
public
setGraph(DatasetInterface $metadata) : void
New metadata are not automatically written back to the repository. Use the updateMetadata() method to write them back.
Parameters
- $metadata : DatasetInterface
Tags
setMetadata()
Replaces resource metadata with a given RDF resource graph. A deep copy of the provided metadata is stored meaning future modifications of the $metadata object don't affect the resource metadata.
public
setMetadata(DatasetNodeInterface $metadata) : void
New metadata is not automatically written back to the repository.
Use the updateMetadata()
method to write them back.
Parameters
- $metadata : DatasetNodeInterface
Tags
updateContent()
Updates repository resource binary content with a given payload.
public
updateContent(BinaryPayload $content[, string $readMode = self::META_RESOURCE ][, string $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : void
Parameters
- $content : BinaryPayload
-
new content
- $readMode : string = self::META_RESOURCE
-
scope of the metadata returned by the repository
- see the META_* constants defined by the RepoResourceInterface
- $parentProperty : string = null
-
RDF property to be used by the metadata read mode denoted by the $readMode parameter
- $resourceProperties : array<string|int, string> = []
-
list of RDF properties to be includes for a resource (if the list is empty, all exsiting RDF properties are included)
- $relativesProperties : array<string|int, string> = []
-
list of RDF properties to be includes for resources being relatives (if the list is empty, all exsiting RDF properties are included)
updateContentAsync()
Asynchronous version of updateContent()
public
updateContentAsync(BinaryPayload $content[, string $readMode = self::META_RESOURCE ][, string|null $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : PromiseInterface
Parameters
- $content : BinaryPayload
- $readMode : string = self::META_RESOURCE
- $parentProperty : string|null = null
- $resourceProperties : array<string|int, string> = []
- $relativesProperties : array<string|int, string> = []
Tags
Return values
PromiseInterfaceupdateMetadata()
Saves the object metadata to the repository.
public
updateMetadata([string $updateMode = self::UPDATE_MERGE ][, string $readMode = self::META_RESOURCE ][, string $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : void
Local metadata are automatically updated with the metadata resulting from the update.
Parameters
- $updateMode : string = self::UPDATE_MERGE
-
metadata update mode - one of
RepoResource::UPDATE_MERGE
,RepoResource::UPDATE_ADD
andRepoResource::UPDATE_OVERWRITE
- $readMode : string = self::META_RESOURCE
-
scope of the metadata returned by the repository
- see the META_* constants defined by the RepoResourceInterface
- $parentProperty : string = null
-
RDF property to be used by the metadata read mode denoted by the $readMode parameter
- $resourceProperties : array<string|int, string> = []
-
list of RDF properties to be includes for a resource (if the list is empty, all exsiting RDF properties are included)
- $relativesProperties : array<string|int, string> = []
-
list of RDF properties to be includes for resources being relatives (if the list is empty, all exsiting RDF properties are included)
updateMetadataAsync()
Asynchronous version of updateMetadata()
public
updateMetadataAsync([string $updateMode = self::UPDATE_MERGE ][, string $readMode = self::META_RESOURCE ][, string|null $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : PromiseInterface|null
Parameters
- $updateMode : string = self::UPDATE_MERGE
- $readMode : string = self::META_RESOURCE
- $parentProperty : string|null = null
- $resourceProperties : array<string|int, string> = []
- $relativesProperties : array<string|int, string> = []
Tags
Return values
PromiseInterface|nullgetId()
Returns an internal repository resource identifier.
protected
getId() : int
Return values
intfindValue()
private
findValue(DatasetNodeInterface $meta, string|null $prefix, bool $force) : string
Parameters
- $meta : DatasetNodeInterface
- $prefix : string|null
- $force : bool
Return values
stringgetServiceClass()
private
abstract getServiceClass() : string
Return values
stringinit()
private
init() : void
parseMetadata()
Parses metadata fetched from the repository.
private
parseMetadata(ResponseInterface $resp) : void
Parameters
- $resp : ResponseInterface
-
response to the metadata fetch HTTP request.
withReadHeaders()
private
withReadHeaders(Request $request, string $mode, string|null $parentProperty, array<string|int, string> $resourceProperties, array<string|int, string> $relativesProperties) : Request
Parameters
- $request : Request
- $mode : string
- $parentProperty : string|null
- $resourceProperties : array<string|int, string>
- $relativesProperties : array<string|int, string>