Note
This documentation relates to a work in progress during three focused sprints starting on August 29, 2016 and as such, the features and procedures described here may not be finalized and released.
Exporting resources
There are two different methods available for exporting metadata and digital objects from a Fedora 4 repository, the first uses the Camel Serialization Module https://github.com/fcrepo4-exts/fcrepo-camel-toolbox/tree/master/fcrepo-serialization , and the second uses a stand alone command line tool
Both methods can export RDF and can be configured to also export binary resources.
Use of the Camel Serializer is documented here https://wiki.duraspace.org/display/FF/Export+Format . This method is considered a proof of concept. It works by listening for events about newly created resources, or edits to existing resources, and as such it cannot export resources that were created before it started listening, unless they are edited while the camel serializer is turned on.
The command line tool is part of the Import Export Utility. https://github.com/fcrepo4-labs/fcrepo-import-export . This tool can export an entire repository, or a subset, and is intended as a method of creating a complete backup of the content of a single Fedora container and all its descendant resources, in a format that can be imported, back into the same Fedora repository, a different Fedora Repository or into an external system.
Installing the export tool
With fcrepo4-vagrant
This example uses a Fedora 4 Vagrant https://github.com/fcrepo4-exts/fcrepo4-vagrant instance as a test environment. By following these instructions, you should be able to duplicate these exact results.
Pre-requisites
Vagrant
Virtualbox
Git
Installation
- Install Vagrant and VirtualBox
run the following commands:
git clone https://github.com/fcrepo4-exts/fcrepo4-vagrant.git cd fcrepo4-vagrant
(optional step to turn off user authentication) edit the file at install_scripts/config and change
FEDORA_AUTH=true to FEDORA_AUTH=false and save the filevagrant up
At this point there should be a working Fedora 4 repository (currently version 4.6.0), which you should be able to reach in a web browser at http://localhost:8080/fcrepo/rest. You will not need to enter a username and password, assuming you turned off the FEDORA_AUTH flag in your vagrant install script.
vagrant ssh sudo su - cd /opt git clone https://github.com/fcrepo4-labs/fcrepo-import-export cd fcrepo-import-export mvn clean install
Without vagrant
The export tool can be run on any computer that has access to the Fedora repository.
Pre-requisites
Java 8
Mave
Git
git clone https://github.com/fcrepo4-labs/fcrepo-import-export cd fcrepo-import-export mvn clean install
Preparing a sample
Go to Fedora in a browser, and in the 'Create New Child Resource' form on the right hand side of the page, type a name (I used 'albums') into the Identifier box and click 'add'. This will create a sample Resource.
Navigate to that new resource at http://localhost:8080/fcrepo/rest/albums and create a new child resource there. This time, change the type to binary and upload a sample binary file. I used a jpg image for this example. The identifier will get filled in by Fedora if you don't choose one yourself.
You now have a Container to export (http://localhost:8080/fcrepo/rest/albums).
Using the export tool
Move to the directory where you downloaded the code (cd /opt/fcrepo-import-export for the vagrant install).
To see all the available command line options:
java -jar fcrepo-import-export-driver/target/fcrepo-import-export-driver-0.0.1-SNAPSHOT.jar -h
To export all the RDF and binary resources in your sample container:
java -jar fcrepo-import-export-driver/target/fcrepo-import-export-driver-0.0.1-SNAPSHOT.jar -m export -r http://localhost:8080/fcrepo/rest/albums -d /tmp/descriptions -b /tmp/binaries
You should now have RDF resources exported to /tmp/descriptions and binary resources in /tmp/binaries. If you do not want backups of the binaries, omit the -b flag. You cannot export only binaries, you must include the -d flag.
There are other command line options available, e.g.,:
-u to provide a username and password for Fedora basic authentication.
With the vagrant box, if you have Fedora Auth turned on and are using the default settings, you would add the following to your command:
-u fedoraAdmin:secret3
-x to use a different file extension on the exported rdf.
-l to change the rdf language used
For example if you want json-ld instead of turtle, use:
-x .json -l application/ld+json
The full list of available serializations is:
- application/ld+json
- application/n-triples
- application/rdf+xml
- text/n3 (or text/rdf+n3)
- text/plain
- text/turtle (or application/x-turtle)
(from RESTful HTTP API)
Importing resources
Exported resources may be imported back into the repository from which they came or into the same path in another repository instance.
Installing the import tool
The export tool is installed at the same time as the import tool, you can follow the instructions about for installing the export tool, if you have not done so already.
Preparing a sample
Follow the instructions above to create a sample export. After
Export Package Format
(TBD) a