caoscrawler.converters.rocrate module#

Converters take structure elements and create Records and new structure elements from them.

This converter converts ro-crate files which may also be .eln-files.

class caoscrawler.converters.rocrate.ELNFileConverter(definition: dict, name: str, converter_registry: dict)#

Bases: ROCrateConverter

Convert .eln-Files See: TheELNConsortium/TheELNFileFormat

These files are basically RO-Crates with some minor differences: - The ro-crate metadata file is not on top-level within the .eln-zip-container,

but in a top-level subdirectory.

create_children(generalStore: GeneralStore, element: StructureElement)#

Loads an ROCrate from an .eln-file or directory.

This involves unzipping the .eln-file to a temporary folder and creating an ROCrate object from its contents.

Arguments:#

element must be a File or Directory (structure element).

Returns:#

A list with an ROCrateElement representing the contents of the .eln-file or None in case of errors.

class caoscrawler.converters.rocrate.ROCrateConverter(definition: dict, name: str, converter_registry: dict)#

Bases: SimpleFileConverter

Convert ro-crate files / directories.

cleanup()#

This function is called when the converter runs out of scope and can be used to clean up objects that were needed in the converter or its children.

create_children(generalStore: GeneralStore, element: StructureElement)#

Loads an ROCrate from an rocrate file or directory.

Arguments:#

element must be a File or Directory (structure element).

Returns:#

A list with an ROCrateElement representing the contents of the .eln-file or None in case of errors.

match(element: StructureElement) dict | None#

This method is used to implement detailed checks for matching compatibility of the current structure element with this converter.

The return value is a dictionary providing possible matched variables from the structure elements information.

setup()#

Analogous to cleanup. Can be used to set up variables that are permanently stored in this converter.

typecheck(element: StructureElement)#

Check whether the current structure element can be converted using this converter.

class caoscrawler.converters.rocrate.ROCrateEntityConverter(definition: dict, name: str, converter_registry: dict)#

Bases: Converter

create_children(generalStore: GeneralStore, element: StructureElement)#
match(element: StructureElement) dict | None#

This method is used to implement detailed checks for matching compatibility of the current structure element with this converter.

The return value is a dictionary providing possible matched variables from the structure elements information.

typecheck(element: StructureElement)#

Check whether the current structure element can be converted using this converter.