RepoResourceDb
in package
implements
RepoResourceInterface
Uses
RepoResourceTrait
Provides a read-only access to the repository resource's metadata.
Tags
Table of Contents
Interfaces
Properties
- $id : int
- $metadata : DatasetNodeInterface
- $metaSynced : bool
- $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.
- 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.
- getRepo() : RepoInterface
- Returns repository connection object associated with the given resource object.
- getUri() : TermInterface
- Returns the repository resource URL.
- isA() : bool
- Naivly checks if the resource is of a given class.
- loadMetadata() : void
- Loads current metadata from the repository.
- 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.
Properties
$id
private
int
$id
$metadata
private
DatasetNodeInterface
$metadata
$metaSynced
private
bool
$metaSynced
$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>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
PDOStatementgetRepo()
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
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()
Loads current metadata from the repository.
public
loadMetadata([bool $force = false ][, string $mode = self::META_RESOURCE ][, string|null $parentProperty = null ][, array<string|int, string> $resourceProperties = [] ][, array<string|int, string> $relativesProperties = [] ]) : void
Parameters
- $force : bool = false
-
enforce fetch from the repository (when you want to make sure metadata are in line with ones in the repository or e.g. reset them back to their current state in the repository)
- $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
- see the getMetadataQuery() method
- $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)
Tags
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