Of Hats and Islandora
T h e T u q u e S t o r y
1
Of Hats and Islandora T h e T u q u e S t o r y 1 Who is this - - PowerPoint PPT Presentation
Of Hats and Islandora T h e T u q u e S t o r y 1 Who is this guy? Jonathan Green Chief Technology Officer at jonathan@discoverygarden.ca twitter: @jonawesomegreen slides: http://bit.ly/1atrzte 2 3 Overview 4 Links
T h e T u q u e S t o r y
1
Jonathan Green Chief Technology Officer at jonathan@discoverygarden.ca twitter: @jonawesomegreen slides: http://bit.ly/1atrzte
2
3
4
5
6
7
// Get the Tuque object $tuque = islandora_get_tuque_connection(); // Construct a new Fedora Object (but don't ingest it) $object = $tuque->repository->constructObject("jons:amazingobject"); // Set some properties $object->label = "An amazing demo object."; $object->owner = "Jonathan Green"; // Create a new datastream. DSID: AWESOME $datastream = $object->constructDatastream("AWESOME", "M"); $datastream->label = 'Cool demo datastream'; $datastream->mimetype = 'image/jpeg'; $datastream->setContentFromUrl('http://bit.ly/15walXA'); // Ingest the datastream $object->ingestDatastream($datastream); // Ingest the Object $tuque->repository->ingestObject($object);
8
// Load an existing object $object = islandora_object_load('jons:amazingobject'); // Change some properties $object->label = 'This is a new label'; // Test is a datastream exists if (isset($object['DSID'])) { // the datastream exists } // Access datastreams using array notation $object['AWESOME']->label = 'Change datastream label'; // Iterate over datastreams foreach ($object as $datastream) { echo $datastream->id; } // Add and remove relationships $object->relationships->remove(FEDORA_MODEL_URI, 'hasModel', 'islandora:collectionCModel'); $object->relationships->add(FEDORA_MODEL_URI, 'hasModel', 'islandora:imageCModel');
9
10
11
12
13
14
15
http://fcrepo.org/
16
17
18
19
abstract class AbstractRepository extends MagicProperty {} class RepositoryDecorator extends AbstractRepository {} class IslandoraRepositoryDecorator extends RepositoryDecorator {} $general_repo = Tuque::GetRepository('fedora4'); $repository = new IslandoraRepositoryDecorator($general_repo); $repository = new CachingRepositoryDecorator($repository); class IslandoraFedoraRepository extends FedoraRepository {} class IslandoraFedoraObject extends FedoraObject {} $repository = new IslandoraFedoraRepository(...)
20
21
slides: http://bit.ly/1atrzte
22