...
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 , . The first relies on Camel and the second uses is a stand alone command line tool
utility. Both methods can export RDF and can be configured to also export binary resources.
Use of the
Exporting Resources Using the Camel Serialization Module
The Camel Serializer is documented here https://wiki.duraspace.org/display/FF/Export+Format . This method is considered a Module is currently a proof of concept but has documentation and code. It works by listening for events about newly created resources, or edits to existing resources. As such, the re-indexer Camel component must be invoked to export resources that were created before it started listening, unless they are edited while the camel serializer Camel Serializer is turned on.
Exporting Resources Using the Export Tool
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 for creating a complete backup of the content of a single Fedora container and all its descendant resources in a format that . From there, it can be imported back into the same Fedora repository, a different Fedora Repository, or into an another external system.
Installing the import-export
...
utility
Fedora 4
The import/export utility is designed to work against the Fedora 4 REST API. Therefore, you first must have a running Fedora repository.
...
The import/export utility maybe be installed in one of two ways:
- Download executable jar (TBD)
- Build from source
...
Preparing sample data
- Go to Fedora in a browser
...
- . If you're using the Quick Start method, this will located at: http://localhost:8080/rest
- Under the Create New Child Resource
...
- form on the right-hand side of the page,
...
- create a new resource called "albums"
- Navigate to
...
- the new resource at http://localhost:8080
...
- /rest/albums
- Under type on the right-hand side of the page, choose "binary" and select a file to upload from the resulting Choose File button
- Leave the identifier field blank and click Add
You will now have a Container with a binary file ready to export at 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 . For Vagrant installs, this will be under /opt/fcrepo-import-export for the vagrant install). ; otherwise, it will located in the directory where you cloned the GitHub repository when you build the tool from source. From there, you will need to locate the compiled jar file. If you build it from source, it will be in the GitHub repo at fcrepo-import-export/target/fcrepo-import-export-0.3.0-SNAPSHOT.jar.
To see all the available command line options:
Code Block | ||
---|---|---|
| ||
java -jar fcrepo-import-export-driver/target/fcrepo-import-export-driver-0.3.0.1-SNAPSHOT.jar -h |
Note: You will see "Error parsing args: Unrecognized option: -h" but this is bug and will be addressed in forthcoming releases.
To export all the RDF and binary resources in your sample container:
Code Block | ||
---|---|---|
| ||
java -jar fcrepo-import-export-driver/target/fcrepo-import-export-driver-0.3.0.1-SNAPSHOT.jar --mmode export --rresource http://localhost:8080/fcrepo/rest/albums -d-dir /tmp/descriptionstest --b /tmp/binaries |
You should now have RDF resources and binaries exported to /tmp/test.
Logging
To change the import-export logging level (default is INFO), set the fcrepo.log.importexport system property when running the command:
- Note, available logging levels are: TRACE, DEBUG, INFO, WARN, and ERROR
Code Block | ||
---|---|---|
| ||
java -Dfcrepo.log.importexport=WARN -jar fcrepo-import-export/target/fcrepo-import-export-0.3.0-SNAPSHOT.jar --mode export --resource http://localhost:8080/rest/albums --dir /tmp/test --binaries |
Options
Exporting only RDF
descriptions and binary resources in /tmp/binaries. If you do not want backups of the binaries, omit the --b flagbinaries option. You cannot export only binaries , you must include the -d flag.
There are other command line options available, e.g.,:
-u without the rdf metadata description.
Authentication
Pass the -u option to provide a username and password for Fedora basic authentication.
With the vagrant box, if you If you are using the Vagrant installation, it will have Fedora Auth turned on and are using the default settings, you would enabled and you will need to add the following to your command:
Code Block | ||
---|---|---|
| ||
-u fedoraAdmin:secret3 |
Format Options
Pass -x option to use a different file extension on the exported rdf.
, or -l to change the rdf language used
For . For example if you want json-ld instead of turtle, use:
...
Exported resources may be imported back into the repository from which they came, or into the same path in of another repository instance.
Installing the import tool
...
The following command will import the previous export into the same location of the same repository.
Code Block | ||
---|---|---|
| ||
java -jar fcrepo-import-export/target/fcrepo-import-export-0.3.0-SNAPSHOT.jar --mode import --resource http://localhost:8080/rest/albums --dir /tmp/test --binaries
|
To import into a different repository and/or path, use the map flag to ensure that the base URIs of the resources are properly translated in the new repository.
The following command will import the previous export into the same location of the same repository. In other words, the import would complete the migration of data from http://localhost:8080/rest/albums to http://localhost:8686/rest/albums.
Code Block | ||
---|---|---|
| ||
java -jar fcrepo-import-export/target/fcrepo-import-export-0.3.0-SNAPSHOT.jar --mode import --resource http://localhost:8686/rest/albums --dir /tmp/test --binaries --map http://localhost:8080/rest/albums,http://localhost:8686/rest/albums
|