Documentation

RepoResourceTrait

A common boilet plate code to be reused by all RepoResourceInterface implementations.

Tags
author

zozlak

Table of Contents

Properties

$metadata  : DatasetNodeInterface
$metaSynced  : bool
$repoInt  : RepoInterface

Methods

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.
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()  : mixed
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

Methods

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
see
setGraph()
see
getMetadata()
Return values
DatasetNodeInterface

getIds()

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
see
setMetadata()
see
setGraph()
see
getGraph()
Return values
DatasetNodeInterface

getUri()

Returns the repository resource URL.

public getUri() : TermInterface
Return values
TermInterface

isA()

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
bool

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
see
updateMetadata()
see
setMetadata()

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
see
updateMetadata()
see
setGraph()

        
On this page

Search results