MOLDY BREAD

This package allows users to interact with a Fedora 3.8 repository via the CLI.

The instructions here assume you are working with a compiled version of Moldy Bread. See installation instructions or package info if you are looking for something else.

Defining a config.yml

Make a copy of default_config.yml and set settings appropriately. Currently, this is the only way to pass authentication information for Fedora and Gsearch.

You can store this config file anywhere that you have read permissions. Use the full path to the file in commands like in the examples below.

Optionally, as of v0.1.2 you can avoid passing the -y flag on requests by including a directory called config with your yaml as config.yml in the path from where you are executing your command.

Command Line Parsing

When in doubt, use help:

moldybread -h

Populating Results

Result lists can be populated in several ways.

First, if you specify dublincore fields and matching strings with the -dc flag, results will be populated based on their metadata records. Each DublinCore field should be separated from its matching string with a colon (:). Each pair of fields and values should be separated with a semicolon (;). Do not include a namespace.

moldybread -dc "title:Pencil;contributor:Wiley"

Next, you can populate results based on a value in a PID or namespace with the -n flag. This value will normally be the namespace, but it doesn't have to be. It can specify any part of the pid.

moldybread -n test

Finally, you can populate results based on terms that appear anywhere in the metadata record with the -t flag.

moldybread -t Vancouver

Harvest Datastream (including metadata)

Datastreams can be harvested by supplying a datastream id (MODS by default) and a namespace. This can be used for metadata files or any other datastream.

moldybread -o harvest_datastream -d MODS -n test -y /full/path/to/my/yaml/file

Datastreams can also be harvested by supplying a datastream id (MODS by default) and a string of dc fields with associated strings.

moldybread -o harvest_datastream -d MODS -dc "title:Pencil;contributor:Wiley" -y /full/path/to/my/yaml/config/file

Finally, you can also harvest datastreams based on a keyword value.

moldybread -o harvest_datastream -d MODS -t Vancouver -y /full/path/to/my/yaml/config/file

Harvest Datastream Unless It's a part of a Page

Most of the time, we don't want the metadata record for a page from a book collection. If we want to make sure we don't get those, we need a slightly different operation. This can be used for any datastream.

moldybread -o harvest_datastream_no_pages -d MODS -n test -y /full/path/to/my/yaml/file

Download FOXML Record

FOXML records can be downloaded by supplying a namespace.

moldybread -o download_foxml -n test -y /full/path/to/my/yaml/file

Download Object XMl Record

Object XML records can be downloaded by supplying a namespace.

moldybread -o download_object_xml -n test -y /full/path/to/my/yaml/file

Update Metadata

You can update metadata from a directory. The files must end in .xml and be named according to a PID (i.e. test:1.xml).

Example layout:

|-- updates
    |-- test:1.xml
    |-- test:2.xml
    |-- test:3.xml

Example command:

moldybread -o update_metadata -p /home/mark/nim_projects/moldybread/updates -d MODS -y /full/path/to/my/yaml/file

If your request was successful, you should see a list of PIDS that were successfully updated.

NOTE: This operation automatically updates SOLR with Gsearch.

Update Metadata and Delete Old Versions

If you don't want to keep the old versions of the datstream you're updating, you can purge them.

Example command:

moldybread -o update_metadata_and_delete_old_versions -p /home/mark/nim_projects/moldybread/updates -d MODS -y /full/path/to/my/yaml/file

Version Datastream

Set whether a datastream should be versioned or not.

Note: parseBool is used on the value associated wit -v / --versionable. Because of this, these values are true: y, yes, true, 1, on. Similarly, these values are false: n, no, false, 0, off.

Example command:

moldybread -o version_datastream -n test -d MODS -v false -y /full/path/to/my/yaml/file

Change Object State

Change the state of all objects in a result set to [A]ctive, [I]nactive, or [D]eleted. Defaults to A.

Example command:

moldybread -o change_object_state -n test -s I -v false -y /full/path/to/my/yaml/file

Purge Old Versions of a Datastream

Purges all by the current version of a datastream.

Example command:

moldybread -o purge_old_versions -n test -d MODS -y /full/path/to/my/yaml/file

Find Objects Missing a Particular Datastream

Finds all objects in a results set that are missing a particular datastream.

Example command:

moldybread -o find_objs_missing_dsid -n test -d MODS -y /full/path/to/my/yaml/file

Download Datastream Histories as XML

Serializes to disk the history of a specific datatream as XML for all results in a result set.

Example command:

moldybread -o get_datastream_history -n test -d RELS-EXT -y /full/path/to/my/yaml/file.yml

Download Datastream at Date

Serializes to disk the a datatream at a specific date for all results in a result set.

Example command:

moldybread -o get_datastream_at_date -n test -d RELS-EXT -dt 2019-12-19 -y /full/path/to/my/yaml/file.yml

Download All Versions of a Datastream

You can download all versions of a datastream for a results set and have it serialized as pid-datestampe.extension (test:4-2020-01-07T16:18:28.742Z.xml).

moldybread -o download_all_versions -d MODS -t Vancouver -y /full/path/to/my/yaml/file.yml

Validate Checksums

You can check whether the current checksum of a datastream for an object matches the original checksum. If not, the objects with bad datastreams are listed:

Example command:

moldybread -o validate_checksums -n test -d OBJ -y /full/path/to/my/yaml/file.yml

Or, you can check whether the current checksum for all current versions of datastreams belonging to an object match the checksum of that datastream on ingest.

Example command:

moldybread -o validate_checksums -n test -y /full/path/to/my/yaml/file.yml

Find Unique Datastreams

You can get a list of unique datastreams from objects across a result set.

Example command:

moldybread -o find_distinct_datastreams -n test -y /full/path/to/my/yaml/file.yml

Audit Responsibility

Get a list of objects created or modified by a user.

Example command:

moldybread -o audit_responsibility -n test -x mark

Update Solr

In some situations, you may want to update Solr from gsearch without changing anything regarding a binary.

Example command:

moldybread -o update_solr -n test

Find Objects based on number of versions

Find all objects based on the number of versions and an operator by using extras (-x). Specify your version number then operator with a semicolon (;) as a separator.

For instance, you can find all matching objects with exactly 3 POLICY versions:

moldybread -o find_objects_by_versions -n test -d POLICY -x "3;=="

Or you can find all matching objects that don't have 3 POLICY versions:

moldybread -o find_objects_by_versions -n test -d POLICY -x "3;!="

Allowed operators are: ==, !=, >=, <=, >, and <.

Find XACML Rules and Exceptions for objects

Find all rules and any exceptions on that rule for a set of results

Example:

moldybread -o find_xacml_restrictions -n test

Check for Objects with no restrictions on management

Finds any objects that have no exceptions on deny-management-functions

Example:

moldybread -o check_management_restrictions -n test

Get Exceptions to a Specific XACML Rule or Action

Gets the exceptions to a specific rule or action for all objects in a set

Example:

moldybread -o get_xacml_exceptions -n test -x "deny-management-functions"

Download Pages from Books and Keep Semantic Filenaming

Download pages for all matching objects and name them as book/pageNumber.extension

Example:

moldybread -o download_book_pages -n test -d OBJ

Purge XACML Inheritance Relationship for Objects

Purge all http://islandora.ca/ontology/relsext#inheritXacmlFrom relationships between a set of objects and an inheritable object.

Example:

moldybread -o purge_xacml_inheritance -n test -x "islandora:test"

Change Content Model to Binary

Change content models for all objects in a set with a specific content model to binary.

Example:

moldybread -o change_model_to_binary -n test -x sp%5fbasic%5fimage

Add a New Relationship to all Digital Objects in a Set

Add a new relationshp to all objects in a set. Subject must be the digital object and you must supply the predicate, object, and whether the object is a literal as an extra separated by semicolons.

moldybread -o add_relationship_to_digital_object -n -x "info%3afedora%2ffedora%2dsystem%3adef%2fmodel%23hasModel;info%3afedora%2fislandora%3abinaryObjectCModel;false"