ibridges.meta.MetaData

class ibridges.meta.MetaData(item, blacklist='^org_[\\\\s\\\\S]+')

iRODS metadata operations.

This allows for adding and deleting of metadata entries for data objects and collections.

Parameters:
  • item (Union[iRODSDataObject, iRODSCollection]) – The data object or collection to attach the metadata object to.

  • blacklist (Optional[str]) – A regular expression for metadata names/keys that should be ignored. By default all metadata starting with org_ is ignored.

Examples

>>> meta = MetaData(coll)
>>> "Author" in meta
True
>>> for entry in meta:
>>>     print(entry.key, entry.value, entry.units)
Author Ben
Mass 10 kg
>>> len(meta)
2
>>> meta.add("Author", "Emma")
>>> meta.set("Author", "Alice")
>>> meta.delete("Author")
>>> print(meta)
{Mass, 10, kg}
__init__(item, blacklist='^org_[\\\\s\\\\S]+')

Initialize the metadata object.

Methods

__init__(item[, blacklist])

Initialize the metadata object.

add(key, value[, units])

Add metadata to an item.

clear()

Delete all metadata entries belonging to the item.

delete(key[, value, units])

Delete a metadata entry of an item.

find_all([key, value, units])

Find all metadata entries belonging to the data object/collection.

from_dict(meta_dict)

Fill the metadata based on a dictionary.

refresh()

Refresh the metadata of the item.

set(key, value[, units])

Set the metadata entry.

to_dict([keys])

Convert iRODS metadata (AVUs) and system information to a python dictionary.