ParameterDb
extends RepoResourceDb
in package
implements
ParameterInterface
Uses
ParameterTrait
Description of ParameterDb
Tags
Table of Contents
Interfaces
Properties
- $default : string
- $id : int
- $metadata : DatasetNodeInterface
- $metaSynced : bool
- $namespaces : Schema
- $repo : RepoDb
- $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
- getClasses() : array<string|int, string>
- Returns all RDF types (classes) of a given repository resource.
- 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.
- getMetadataStatement() : PDOStatement
- Returns a QueryPart object with an SQL query loading resource's metadata in a given mode.
- 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
- isA() : bool
- Naivly checks if the resource is of a given class.
- loadMetadata() : mixed
- 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.
- findValue() : string
- getServiceClass() : string
- init() : void
Properties
$default
private
string
$default
= ''
$id
private
int
$id
$metadata
private
DatasetNodeInterface
$metadata
$metaSynced
private
bool
$metaSynced
$namespaces
private
Schema
$namespaces
$repo
private
RepoDb
$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 $urlOrId, RepoInterface $repo) : mixed
Parameters
- $urlOrId : string
-
either a resource URL or just the numeric id
- $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
stringgetClasses()
Returns all RDF types (classes) of a given repository resource.
public
getClasses() : array<string|int, string>
Return values
array<string|int, string>getDissServices()
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
DatasetNodeInterfacegetMetadataStatement()
Returns a QueryPart object with an SQL query loading resource's metadata in a given mode.
public
getMetadataStatement([string $mode = self::META_RESOURCE ][, string|null $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : PDOStatement
Parameters
- $mode : string = self::META_RESOURCE
-
scope of the metadata returned by the repository - see the
RepoDb()::getPdoStatementBySqlQuery()
method - $parentProperty : string|null = null
-
RDF property name used to find related resources
- $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)
Return values
PDOStatementgetName()
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
stringisA()
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
registerTransformation()
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
findValue()
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