Documentation

RepoTrait

A common (mostly boiler plate) code for classes implementing the RepoInterface.

Tags
author

zozlak

Table of Contents

Properties

$baseUrl  : string
Repository REST API base URL
$headers  : object
An object providing mappings of repository REST API parameters to HTTP headers used by a given repository instance.
$queryLog  : AbstractLogger|null
$schema  : Schema
An object providing mappings of repository concepts to RDF properties used to denote them by a given repository instance.

Methods

getBaseUrl()  : string
Returns the repository REST API base URL.
getHeaderName()  : string
Returns an HTTP header name to be used to pass a given information in the repository request.
getResourceById()  : RepoResourceInterface
Tries to find a repository resource with a given id.
getSchema()  : Schema
Returns the `Schema` object defining repository entities to RDF property mappings.
setQueryLog()  : void
Sets a search queries logger
extractResourcesFromGraph()  : Generator<string|int, RepoResourceInterface>
Extracts collection of RepoResource objects from the EasyRdf graph being parsed from a search response.
sortMatchingResources()  : void

Properties

$baseUrl

Repository REST API base URL

private string $baseUrl

$headers

An object providing mappings of repository REST API parameters to HTTP headers used by a given repository instance.

private object $headers

$queryLog

private AbstractLogger|null $queryLog

$schema

An object providing mappings of repository concepts to RDF properties used to denote them by a given repository instance.

private Schema $schema

Methods

getBaseUrl()

Returns the repository REST API base URL.

public getBaseUrl() : string
Return values
string

getHeaderName()

Returns an HTTP header name to be used to pass a given information in the repository request.

public getHeaderName(string $purpose) : string
Parameters
$purpose : string
Return values
string

getResourceById()

Tries to find a repository resource with a given id.

public getResourceById(string $id[, string $class = null ]) : RepoResourceInterface

Throws an error on failure.

Parameters
$id : string
$class : string = null

an optional class of the resulting object representing the resource (to be used by extension libraries)

Return values
RepoResourceInterface

getSchema()

Returns the `Schema` object defining repository entities to RDF property mappings.

public getSchema() : Schema
Return values
Schema

setQueryLog()

Sets a search queries logger

public setQueryLog(AbstractLogger $log) : void
Parameters
$log : AbstractLogger

extractResourcesFromGraph()

Extracts collection of RepoResource objects from the EasyRdf graph being parsed from a search response.

private extractResourcesFromGraph(Dataset $graph, SearchConfig $config) : Generator<string|int, RepoResourceInterface>
Parameters
$graph : Dataset

graph returned by the parseSearchResponse() method

$config : SearchConfig

search configuration object

Return values
Generator<string|int, RepoResourceInterface>

sortMatchingResources()

private sortMatchingResources(array<string|int, DatasetNodeInterface&$resources, NamedNode $searchOrderProp) : void
Parameters
$resources : array<string|int, DatasetNodeInterface>
$searchOrderProp : NamedNode

        
On this page

Search results