1. Go to this page and download the library: Download acdh-oeaw/repo-php-util library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
acdh-oeaw / repo-php-util example snippets
use acdhOeaw\util\RepoConfig as RC;
ew acdhOeaw\fedora\Fedora();
$graph = new EasyRdf\Graph();
$metadata = $graph->resource('.'); // the resource URI you provide here is irrelevant and can be any string (the EasyRdf library e');
$fedora->begin();
$resource1 = $fedora->createResource($metadata, 'pathToFile'); // with binary data from file, at the repository root
$resource2 = $fedora->createResource($metadata, 'myResourceData (...)'); // with binary data from string, at the repository root
$resource3 = $fedora->createResource($metadata); // without binary data, at the repository root
$resource4 = $fedora->createResource($metadata, '', '/my/collection'); // without binary data, as a child of a given Fedora collection (the collection has to exist)
$resource5 = $fedora->createResource($metadata, 'pathToFile', '/my/resource', 'PUT'); // with binary data from file, at a given location (the '/my' collection has to exist)
$fedora->commit();
$fedora->begin();
$resource = $fedora->getResourceById('https://id.acdh.oeaw.ac.at/myResource');
$resource->updateContent('pathToFile'); // with data in file
$resource->updateContent('new content of the resource'); // with data passed directly
$fedora->commit();
$fedora->begin();
$resource = $fedora->getResourceById('https://redmine.acdh.oeaw.ac.at/issues/5488');
$ind = new acdhOeaw\util\Indexer($resource);
$ind->setFilter('|[.]xml$|i');
$ind->setPaths(array('directoryToIndex')); // read next chapter
$ind->setUploadSizeLimit(100000000);
$ind->setDepth(1);
$ind->setFlatStructure(true);
$ind->index();
$fedora->commit();
// for the file path `/my/file/path.xml` search for metadata in files `/my/file/path.xml.ttl`, `/my/file/path/meta/path.xml.ttl` and `/some/dir/path.xml.ttl`
// locations are searched in the given order, first metadata file found is used
// such a file must contain only one resource being triples subject (if there are more, an exception is rised)
$metaLookup = new acdhOeaw\util\metaLookup\MetaLookupFile(array('.', './meta', '/some/dir'), '.ttl');
$ind = new Indexer($someResource);
$ind->setMetaLookup($metaLookup);
$ind->index();
$graph = new EasyRdf\Graph();
$graph->parseFile('pathToMetadataFile.ttl');
$metaLookup = new acdhOeaw\util\metaLookup\MetaLookupGraph($graph);
$ind = new Indexer($someResource);
$ind->setMetaLookup($metaLookup);
$ind->index();