$debug
$debug : boolean
Should debug messages be generated when searching for resources
Represents a Fedora connection.
Provides transaction managment and methods for convinient search and creation of Fedora resources.
$sparqlClient : \acdhOeaw\fedora\SparqlClient
SPARQL client object
$cache : \acdhOeaw\fedora\FedoraCache
Resources cache
$txProc : \acdhOeaw\util\KeepTransactionAlive
KeepTransactionAlive object (used when pcntl_fork() is not available, e.g.
on Windows).
attachData(\GuzzleHttp\Psr7\Request $request, $body) : \GuzzleHttp\Psr7\Request
Attaches binary content to a given Guzzle HTTP request
\GuzzleHttp\Psr7\Request | $request | HTTP request |
$body | binary content to be attached It can be a file name, an URL, an array or a normal string. If it is an URL, a "redirecting Fedora resource" will be created. If it is an array, it should contain fields: contentType, filename, data |
getCache() : \acdhOeaw\fedora\FedoraCache
Returns a FedoraResource objects cache
createResource(\acdhOeaw\fedora\EasyRdf\Resource $metadata, mixed $data = '', string $path = '', string $method = 'POST') : \acdhOeaw\rms\FedoraResource
Creates a resource in the Fedora and returns corresponding Resource object
\acdhOeaw\fedora\EasyRdf\Resource | $metadata | resource metadata |
mixed | $data | optional resource data as a string, file name or an array: ['contentType' => 'foo', 'data' => 'bar', 'filename' => 'foo.bar'] |
string | $path | optional Fedora resource path (see also the |
string | $method | creation method to use - POST or PUT, by default POST |
sendRequest(\GuzzleHttp\Psr7\Request $request, array $options = array()) : \GuzzleHttp\Psr7\Response
Sends a given HTTP request to the Fedora.
Switches most important errors into specific error classes.
\GuzzleHttp\Psr7\Request | $request | request to be send |
array | $options | Guzzle request options (see http://docs.guzzlephp.org/en/stable/request-options.html) |
getResourceByUri(string $uri) : \acdhOeaw\fedora\FedoraResource
Returns a FedoraResource based on a given URI.
Request URI is imported into the current connection meaning base Fedora API URL will and the current transaction URI (if there is an active transaction) will replace ones in passed URI.
It is not checked if a resource with a given URI exists.
string | $uri |
getResourceById(string $id, boolean $checkIfExist = true) : \acdhOeaw\fedora\FedoraResource
Finds Fedora resources with a given id property value (as it is defined by the "fedoraIdProp" configuration option - see the init() method).
If there is no or are many such resources, an error is thrown.
string | $id | |
boolean | $checkIfExist | should we make sure resource was not deleted during the current transaction |
getResourceByMetadata(Resource $metadata, boolean $checkIfExist = true) : \acdhOeaw\fedora\type
Extracts id properties form metadata based on the "fedoraIdProp" configuration property and calls `getResourceByIds()`
Resource | $metadata | |
boolean | $checkIfExist | should we make sure resource was not deleted during the current transaction |
getResourceByIds(array $ids, boolean $checkIfExist = true) : \acdhOeaw\fedora\FedoraResource
Finds Fedora resources matching any of provided ids.
array | $ids | |
boolean | $checkIfExist | should we make sure resource was not deleted during the current transaction |
getResourcesByProperty(string $property, string $value = '', boolean $checkIfExist = true) : array
Finds all Fedora resources having a given RDF property value.
If the value is not provided, all resources with a given property set (to any value) are returned.
Be aware that all property values introduced during the transaction are not taken into account (see documentation of the begin() method)
string | $property | fully qualified property URI |
string | $value | optional property value |
boolean | $checkIfExist | should we make sure resource was not deleted during the current transaction |
getResourcesByPropertyRegEx(string $property, string $regEx, string $flags = 'i', boolean $checkIfExist = true) : array
Finds all Fedora resources with a given RDF property matching given regular expression.
Be aware that all property values introduced during the transaction are not taken into account (see documentation of the begin() method)
string | $property | fully qualified property URI |
string | $regEx | regular expression to match against |
string | $flags | regular expression flags (by default "i" - case insensitive) |
boolean | $checkIfExist | should we make sure resource was not deleted during the current transaction |
getResourcesByQuery(\acdhOeaw\fedora\metadataQuery\Query $query, string $resVar = '?res', boolean $checkIfExist = true) : array
Finds all Fedora resources satisfying a given SPARQL query.
Be aware that the triplestore state is not affected by all actions performed during the active transaction.
\acdhOeaw\fedora\metadataQuery\Query | $query | SPARQL query fetching resources from the triplestore |
string | $resVar | name of the SPARQL variable containing resource URIs |
boolean | $checkIfExist | should we make sure resource was not deleted during the current transaction |
runQuery(\acdhOeaw\fedora\metadataQuery\Query $query) : \EasyRdf\Sparql\Result
Runs a SPARQL query defined by a Query object against repository triplestore.
\acdhOeaw\fedora\metadataQuery\Query | $query | query to run |
begin(integer $keepAliveTimeout = 30)
Starts new Fedora transaction.
Only one transaction can be opened at the same time, so make sure you committed previous transactions before starting a new one.
Be aware that all metadata modified during the transaction will be not visible in the triplestore coupled with the Fedora until the transaction is committed.
integer | $keepAliveTimeout | Automatic transaction prolongment timeout
(see the |
prolong(string $txUrl = null)
Fedora transactions automatically expire after 3 minutes. If you want a transaction to be kept longer it must be manually prolonged. This method does it for you.
string | $txUrl | optional transaction URL. If not provided, current transaction URL is used. |
fixMetadataReferences(Resource $meta, array $skipProperties = array()) : Resource
Tries to switch references to all repository resources into their UUIDs.
Changes are done in-place!
Resource | $meta | metadata to apply changes to |
array | $skipProperties | list of properties which should not be processed (other than IDs which are always excluded) |
verifyResources(array $resources, boolean $force = false) : array
Removes from an array resources which do not exist anymore.
array | $resources | |
boolean | $force | should resource be always checked (true) or maybe it is enough if metadata were already fetched during this session (false) |