The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

 fedora_admin.pl - Fedora Commons Administrative client

SYNOPSIS

 ./fedora_admin.pl [options] [cmd]

 cmd:
    list
    doc ID [DSID]
    find query|terms STR
    update ID [active|inactive|deleted]
    purge ID
    list_datastreams ID
    list_methods ID
    list_relationships ID
    set_relationships ID FILE
    get_dissemination ID SDEFPID METHOD
    get_datastream ID DSID [DATE]
    set_datastream ID DSID url|file|xml FILE
    update_datastream ID DSID active|inactive|deleted|versionable|notversionable
    purge_datastream ID DSID
    validate ID
    history ID [DSID]
    xml ID
    export ID
    import ID|new file|xml FILE

 options:

  --database=<NAME>
  --exporter=<EXPORTER>
  --importer=<IMPORTER>
  --param foo=bar
  -y
  -d directory_containing_catmandu.yml

DESCRIPTION

fedora_admin.pl is a Fedora Commons-compatible client that execute HTTP Rest commands to a Fedora server.

fedora_admin.pl is intended to be conformat to Fedora Commons version up to Fedore 3.6.x.

CONFIGURATION

This script requires a catmandu.yml file containing the connection parameters to the Fedora repository. Here is an example 'catmandu.yml' file:

 ---
 store:
  fedora:
     package: FedoraCommons
     options:
       baseurl: http://localhost:8080/fedora
       username: fedoraAdmin
       password: fedoraAdmin

This file needs to be provided in the working directory or can be specified in the directory given by the -d option or specified in the environment by setting CATMANDU_CONF

  export CATMANDU_CONF=/etc/catamandu_conf_dir

OPTIONS

--database name

Name of a Fedora Commons server configured in catmandu.yml.

--exporter exporter

Name of a Catmandu::Exporter or a configuration in catmandu.yml.

--importer importer

Name of a Catmandu::Importer or a configuration in catmandu.yml.

--param FOO=BAR

Pass a parameter "FOO" with value "BAR" as optional parameter to a fedora_admin.pl command.

-y

Answer yes to all question.

-f directory_containing_catmandu.yml

Configuration directory

COMMANDS

list

Returns a list of all object identifiers (pid-s) that are store in the Fedora server.

doc ID

Returns a short description of the object with identifier ID (audit trail, dublin core, object properties, pid and version).

doc ID DSID

Return a short description about the latets version of datastream DSID in object ID.

find query|term QUERY

Execute a search query on the Fedora Commons server. One of 'query' or 'terms' is required.

update ID active|inactive|deleted

Updates the status of an object with identifier ID.

purge ID

Purges the object with identifier ID.

list_datastreams ID

Returns a listing of all datastreams for an object with identifier ID.

list_methods ID

Returns a listing of all methods for an object with identifier ID.

list_relations ID

Returns a RDF/Turtle expression of all relationships defined for an object with identifier ID. The turtle includes all relationships for all the datastreams.

set_relationships ID FILE

Updates all relationships of an object with identifier ID with RDF/Turtle expressions from FILE.

   $ cat /tmp/rel.ttl
   <info:fedora/demo:20> <info:fedora/fedora-system:def/model#hasModel>
                         <info:fedora/fedora-system:ServiceDeployment-3.0> ;
                         <info:fedora/fedora-system:def/model#isContractorOf>
                         <info:fedora/demo:FO_TO_PDFDOC>, <info:fedora/demo:TEI_TO_PDFDOC> ;
    <info:fedora/fedora-system:def/model#isDeploymentOf> <info:fedora/demo:19> .

   $ fedora_admin.pl set_relationships demo:20 /tmp/rel.ttl
get_dissemination ID SDEFPID METHOD

Returns the binary stream when executing a dissemination on an object with identifier ID, sDef definition SDEFPID and method identifier METHOD.

  $ fedora_admin.pl --param width=100 demo:29 demo:27 resizeImage
get_datastream ID DSID

Returns the binary stream for an object with identifier ID and data stream identifier DSID.

set_datastream ID DSID url|file|xml FILE

Updates a data stream DSID for an object with identifiet ID. Use the url, file or xml upload mechanism to import a file FILE.

  $ fedora_admin.pl demo:99 PDF file /tmp/my/pdf

  $ fedora_admin.pl --param controlGroep=E \
                    demo:99 PDF url http://inst.org/my.pdf
update_datastream ID DSID active|inactive|deleted|versionable|notversionable

Update the datastream status of an object with identifier ID and data stream identifier DSID.

purge_datastream ID DSID

Purges the data stream DSID from an object with identifier ID.

validate ID

Validate the content of an object with identifier ID.

history ID [DSID]

Returns the version history of an object with identifier ID. Optionally provide a data stream identifier DSID.

xml ID

Return an XML dump of an object with identifier ID.

export ID

Exports the object with identifier ID to standard ouput.

  $ fedora_admin.pl --param context=archive demo:999

See https://wiki.duraspace.org/display/FEDORA36/REST+API#RESTAPI-export for possible parameters.

import ID|new file|xml FILE

Imports an object into the Fedora store. Force an own identifier using or let the Fedora store mint a new one using 'new'.

  $ fedora_admin.pl --param format=info:fedora/fedora-system:ATOMZip-1.1 \
                      demo:999 file /tmp/demo_999.zip

  $ fedora_admin.pl --param format=info:fedora/fedora-system:ATOMZip-1.1 \
                    --param ownerId=admin \
                      new file /tmp/demo_999.zip

See https://wiki.duraspace.org/display/FEDORA36/REST+API#RESTAPI-ingest for possible parameters.

SEE ALSO

 L<Catmandu>, L<Catmandu::FedoraCommons>

AUTHORS

 Patrick Hochstenbach, "<patrick.hochstenbach at ugent.be>"

LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.