Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  •     Install Vagrant and VirtualBox
  •     run the following commands:
       

    Code Block
    languagebash
    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 file

        vagrant

    Code Block
    languagebash
    vagrant 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

  • Code Block
    languagebash
    vagrant ssh
    sudo su -
    cd /opt
    git clone 
        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
Maven 3Mave
Git

Code Block
languagebash
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

Code Block
languagebash
java -jar fcrepo-import-export-driver/target/fcrepo-import-export-driver-0.0.1-SNAPSHOT.jar -h


    to To export all the RDF and binary resources in your sample container:
    java

Code Block
languagebash
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:

Code Block
languagebash
-u fedoraAdmin:secret3 


secret3    
to your command.
-x to use a different rdf serialization.
For example if you want json-ld instead of turtle, use:

Code Block
languagebash
-x .json

...



Importing resources

Exported resources may be imported back into the repository from which they came or into the same path in another repository instance.

...