openminds

export.openminds

OpenMINDS JSON-LD conversion utilities for TVBO.

This module provides bidirectional conversion between TVBO datamodel objects and openMINDS-compatible JSON-LD format.

This module is the single source of truth for all openMINDS type mappings. Both runtime conversion and schema generation import from here.

Functions

Name Description
experiment_from_openminds Convert openMINDS JSON-LD to a dict suitable for SimulationExperiment.
experiment_to_openminds Convert a SimulationExperiment to openMINDS JSON-LD format.
load_openminds Load an openMINDS JSON-LD file and return conversion-ready dict.
save_openminds Save a TVBO object as openMINDS JSON-LD file.
study_from_openminds Convert openMINDS JSON-LD to a dict suitable for SimulationStudy.
study_to_openminds Convert a SimulationStudy to openMINDS JSON-LD format.

experiment_from_openminds

export.openminds.experiment_from_openminds(data)

Convert openMINDS JSON-LD to a dict suitable for SimulationExperiment.

Parameters

data : dict OpenMINDS JSON-LD dictionary.

Returns

dict Dictionary that can be passed to SimulationExperiment(**dict).

experiment_to_openminds

export.openminds.experiment_to_openminds(
    experiment,
    base_id=None,
    include_context=True,
)

Convert a SimulationExperiment to openMINDS JSON-LD format.

Parameters

experiment : SimulationExperiment The experiment to convert. base_id : str, optional Base URI for generating @id values. If not provided, uses a default. include_context : bool Whether to include the @context in the output.

Returns

dict OpenMINDS-compatible JSON-LD dictionary.

load_openminds

export.openminds.load_openminds(filepath)

Load an openMINDS JSON-LD file and return conversion-ready dict.

Parameters

filepath : str Path to JSON-LD file.

Returns

dict Dictionary suitable for constructing TVBO objects.

save_openminds

export.openminds.save_openminds(obj, filepath, base_id=None, indent=2)

Save a TVBO object as openMINDS JSON-LD file.

Parameters

obj : SimulationExperiment or SimulationStudy The object to save. filepath : str Output file path (should end in .jsonld or .json). base_id : str, optional Base URI for @id values. indent : int JSON indentation level.

study_from_openminds

export.openminds.study_from_openminds(data)

Convert openMINDS JSON-LD to a dict suitable for SimulationStudy.

Parameters

data : dict OpenMINDS JSON-LD dictionary.

Returns

dict Dictionary that can be passed to SimulationStudy(**dict).

study_to_openminds

export.openminds.study_to_openminds(study, base_id=None, include_context=True)

Convert a SimulationStudy to openMINDS JSON-LD format.

Parameters

study : SimulationStudy The study to convert. base_id : str, optional Base URI for generating @id values. include_context : bool Whether to include the @context in the output.

Returns

dict OpenMINDS-compatible JSON-LD dictionary.