ServiceDb
extends RepoResourceDb
in package
implements
ServiceInterface
Uses
ServiceTrait
Description of ServiceDb
Tags
Table of Contents
Interfaces
Properties
- $id : int
- $loadParamFromMeta : bool
- $metadata : DatasetNodeInterface
- $metaSynced : bool
- $param : array<string|int, mixed>
- Parameters list
- $repo : RepoDb
- $repoInt : RepoInterface
Methods
- __construct() : mixed
- Creates an object representing a repository resource.
- 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.
- getFormats() : array<string|int, Format>
- Returns all return formats provided by the dissemination service.
- getGraph() : DatasetNodeInterface
- Returns resource metadata.
- getIds() : array<string|int, string>
- Returns an array with all repository resource identifiers.
- getLocation() : string
- Gets disseminations service's URL (before parameters subsitution)
- getMatchingResources() : Generator
- Returns repository resources which can be disseminated by a given service
- getMatchQuery() : QueryPart
- Returns an SQL query matching dissemination services and resources (in any direction).
- getMetadata() : DatasetNodeInterface
- Returns resource metadata.
- getMetadataStatement() : PDOStatement
- Returns a QueryPart object with an SQL query loading resource's metadata in a given mode.
- getParameters() : array<string|int, mixed>
- Get the parameters
- getRepo() : RepoInterface
- Returns repository connection object associated with the given resource object.
- getRequest() : Request
- Returns PSR-7 HTTP request disseminating a given resource.
- getRevProxy() : bool
- Should the dissemination service request be reverse-proxied?
- getUri() : TermInterface
- Returns the repository resource URL.
- isA() : bool
- Naivly checks if the resource is of a given class.
- loadMetadata() : mixed
- loadParametersFromMetadata() : void
- Tells the service it can load information on service parameters from its metadata.
- 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.
- getParameterClass() : string
- getParameterValues() : array<string, mixed>
- Evaluates parameter values for a given resource.
- getResNmspId() : string
- Fetches a resource id in a given namespace.
- getServiceClass() : string
- getUrlParameters() : array<string|int, string>
- Returns list of all parameters of a given dissemination service
- loadParameters() : void
Properties
$id
private
int
$id
$loadParamFromMeta
private
bool
$loadParamFromMeta
= false
$metadata
private
DatasetNodeInterface
$metadata
$metaSynced
private
bool
$metaSynced
$param
Parameters list
private
array<string|int, mixed>
$param
$repo
private
RepoDb
$repo
$repoInt
private
RepoInterface
$repoInt
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
getClasses()
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>getFormats()
Returns all return formats provided by the dissemination service.
public
getFormats() : array<string|int, Format>
Technically return formats are nothing more then strings. There is no requirement forcing them to be mime types, etc.
Return values
array<string|int, Format>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>getLocation()
Gets disseminations service's URL (before parameters subsitution)
public
getLocation() : string
Return values
stringgetMatchingResources()
Returns repository resources which can be disseminated by a given service
public
getMatchingResources([int|null $limit = null ][, int|null $offset = null ]) : Generator
Parameters
- $limit : int|null = null
- $offset : int|null = null
Return values
GeneratorgetMatchQuery()
Returns an SQL query matching dissemination services and resources (in any direction).
public
static getMatchQuery(int $id, int $mode, Schema $schema) : QueryPart
Parameters
- $id : int
-
resource or dissemination service id
- $mode : int
-
one of:
- ServiceInterface::QUERY_RES for querying resources for a given dissemination service
- ServiceInterface::QUERY_DISSERV for querying dissemination services for a given resource
- $schema : Schema
-
schema object providing RDF property mappings
Return values
QueryPartgetMetadata()
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
PDOStatementgetParameters()
Get the parameters
public
getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>getRepo()
Returns repository connection object associated with the given resource object.
public
getRepo() : RepoInterface
Return values
RepoInterfacegetRequest()
Returns PSR-7 HTTP request disseminating a given resource.
public
getRequest(RepoResourceInterface $res) : Request
Parameters
- $res : RepoResourceInterface
-
repository resource to be disseminated
Tags
Return values
RequestgetRevProxy()
Should the dissemination service request be reverse-proxied?
public
getRevProxy() : bool
If it's not set in the metadata, false is assumed.
Return values
boolgetUri()
Returns the repository resource URL.
public
getUri() : TermInterface
Return values
TermInterfaceisA()
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
loadParametersFromMetadata()
Tells the service it can load information on service parameters from its metadata.
public
loadParametersFromMetadata() : void
Information will be loaded in a lazy way (when it's needed).
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
getParameterClass()
private
getParameterClass() : string
Return values
stringgetParameterValues()
Evaluates parameter values for a given resource.
private
getParameterValues(array<string|int, string> $param, RepoResourceInterface $res) : array<string, mixed>
Parameters
- $param : array<string|int, string>
-
list of parameters
- $res : RepoResourceInterface
-
repository resource to be disseminated
Tags
Return values
array<string, mixed> —associative array with parameter values
getResNmspId()
Fetches a resource id in a given namespace.
private
getResNmspId(RepoResourceInterface $res, string $namespace, bool $force) : string
If namespaces overlap, tries to to avoid id in the overlapping ones.
Parameters
- $res : RepoResourceInterface
- $namespace : string
- $force : bool
Tags
Return values
stringgetServiceClass()
private
abstract getServiceClass() : string
Return values
stringgetUrlParameters()
Returns list of all parameters of a given dissemination service
private
getUrlParameters() : array<string|int, string>
Return values
array<string|int, string>loadParameters()
private
loadParameters() : void