COPASI API  4.40.278
CSEDMLExporter Class Reference

#include <CSEDMLExporter.h>


struct  KeyComparer
struct  PlotItemStyleComparer

Public Member Functions

void clearMaps ()
void createDataGenerators (std::string &taskId, CCopasiTask *task=NULL)
std::string createModel (const std::string &modelRef)
std::string createScanTask ()
LIBSEDML_CPP_NAMESPACE::SedDocument * createSEDMLDocument (CDataModel &dataModel, std::string modelRef)
std::string createSteadyStateTask ()
void createTasks ()
std::string createTimeCourseTask ()
 CSEDMLExporter ()
void exportAlgorithm (SedAlgorithm *alg, const CCopasiMethod *pMethod)
bool exportModelAndTasks (CDataModel &dataModel, const std::string &sedmlFilename, const std::string &sbmlDocument, unsigned int sedmlLevel=1, unsigned int sedmlVersion=1, bool overwrite=false)
std::string exportModelAndTasksToString (CDataModel &dataModel, const std::string &modelLocation, unsigned int sedmlLevel, unsigned int sedmlVersion)
void exportNthPlot (const CPlotSpecification *pPlot, size_t n)
bool exportNthScanItem (CScanProblem *pProblem, size_t n, SedRepeatedTask *task)
void exportPlotItem (const CPlotItem *pPlotItem, size_t i, size_t j)
void exportReport (const CReportDefinition *def)
std::string exportStyleForItem (const CPlotItem *pPlotItem)
void freeSedMLDocument ()
CDataModelgetDataModel ()
bool getExportActivePlotsOnly () const
bool getExportExecutableTasksOnly () const
bool getExportSpecificPlots () const
const std::string & getModelId () const
LIBSEDML_CPP_NAMESPACE::SedDocument * getSEDMLDocument ()
void setCurrentTime (std::string &taskId)
void setDataModel (CDataModel *pDataModel)
void setExportActivePlotsOnly (bool val)
void setExportExecutableTasksOnly (bool val)
void setExportSpecificPlots (bool val)
void setLevelAndVersion (unsigned int sedmlLevel, unsigned int sedmlVersion)
void setModelId (const std::string &val)
void setSBMLNamespaces (const LIBSBML_CPP_NAMESPACE::XMLNamespaces &sbmlns)
void setSBMLNamespaces (int level, int version, const std::string &prefix="sbml")
bool writeSedMLToFile (const std::string &filename) const
std::string writeSedMLToString () const
 ~CSEDMLExporter ()

Protected Types

typedef std::pair< std::string, VariableInfoTaskVarKey

Protected Member Functions

SedDataGenerator * createDataGenerator (const VariableInfo &info, const std::string &taskId, size_t i, size_t j)

Static Protected Member Functions

static std::string getParameterValueAsString (const CCopasiParameter *pParameter)

Protected Attributes

std::string mCurrentTaskId
std::map< TaskVarKey, SedDataGenerator *, KeyComparermDataGenerators
bool mExportActivePlotsOnly
bool mExportExecutableTasksOnly
bool mExportSpecificPlots
std::unordered_set< std::string > mGeneratedIds
std::string mModelId
SedPlot2D * mpCurrentPlot
SedPlot3D * mpCurrentPlot3D
const CPlotSpecificationmpCurrentSpec
SedDataGenerator * mpCurrentTime
SedDocument * mpSEDMLDocument
SedUniformTimeCourse * mpTimecourse
SedTask * mpTimecourseTask
unsigned int mSEDMLLevel
unsigned int mSEDMLVersion
std::map< const CPlotItem *, std::string, PlotItemStyleComparermStyleMap
CCommonName mTimeCN

Member Typedef Documentation

◆ TaskVarKey

typedef std::pair< std::string, VariableInfo > CSEDMLExporter::TaskVarKey

Constructor & Destructor Documentation

◆ CSEDMLExporter()

CSEDMLExporter::CSEDMLExporter ( )

constructs a new exporter element

◆ ~CSEDMLExporter()

CSEDMLExporter::~CSEDMLExporter ( )


References mpSBMLNamespaces, and pdelete.

Member Function Documentation

◆ clearMaps()

void CSEDMLExporter::clearMaps ( )

resets the internal map of created elements (will be called automatically by createSEDMLDocument())

References mCurrentTaskId, mDataGenerators, mGeneratedIds, mpCurrentPlot, mpCurrentTask, mpCurrentTime, and mStyleMap.

Referenced by createSEDMLDocument(), and freeSedMLDocument().

◆ createDataGenerator()

SedDataGenerator * CSEDMLExporter::createDataGenerator ( const VariableInfo info,
const std::string &  taskId,
size_t  i,
size_t  j 

Helper function for creating data generators. They will just reference the element with given SBML id, and target xpath expression.

References VariableInfo::addToDataGenerator(), VariableInfo::getName(), VariableInfo::getSbmlId(), mDataGenerators, mpSEDMLDocument, and SEDML_SET_ID.

Referenced by exportPlotItem(), and exportReport().

◆ createDataGenerators()

◆ createModel()

std::string CSEDMLExporter::createModel ( const std::string &  modelRef)

Creates a SED-ML model for the given model reference. This function is supposed to be executed before exporting tasks, as it will generate the model id that will be used for further exports.

the model id created

Creates the models for SEDML.

References CDirEntry::baseName(), mpSEDMLDocument, SEDML_SET_ID, and setModelId().

Referenced by createSEDMLDocument().

◆ createScanTask()

std::string CSEDMLExporter::createScanTask ( )

Creates a scan task if the dataModel contains a number of scan items and returns its id.

the id of the task, if created, otherwise an empty string.

Creates the simulations for SEDML.

References createSteadyStateTask(), exportNthScanItem(), CScanProblem::getContinueFromCurrentState(), SEDMLUtils::getNextId(), CScanProblem::getNumberOfScanItems(), CCopasiTask::getProblem(), CScanProblem::getSubtask(), CDataModel::getTaskList(), mpDataModel, mpSEDMLDocument, mpTimecourseTask, SEDML_SET_ID, CTaskEnum::steadyState, CTaskEnum::timeCourse, and CCopasiMessage::WARNING.

Referenced by createTasks().

◆ createSEDMLDocument()

LIBSEDML_CPP_NAMESPACE::SedDocument * CSEDMLExporter::createSEDMLDocument ( CDataModel dataModel,
std::string  modelRef 

Creates an SED-ML document from the given data model. It assumes that the SBML model has been exported to the given model location

dataModelthe data model to export
modelRefthe location of the SBML model
the created SED-ML document

References clearMaps(), createModel(), createTasks(), mpSBMLNamespaces, mpSEDMLDocument, mSEDMLLevel, mSEDMLVersion, and setDataModel().

Referenced by exportModelAndTasksToString().

◆ createSteadyStateTask()

std::string CSEDMLExporter::createSteadyStateTask ( )

Creates the steady state task and returns its id.

Creates the simulations for SEDML.

References SEDMLUtils::getNextId(), CCopasiTask::getProblem(), CDataModel::getTaskList(), mModelId, mpDataModel, mpSEDMLDocument, and SEDML_SET_ID.

Referenced by createScanTask().

◆ createTasks()

void CSEDMLExporter::createTasks ( )

Creates the SED-ML Tasks for the data model, assuming the model has already been created.

Before executing this method the model should have been created using createModel, or the model id should have been set with setModelId.

Creates the Tasks for SEDML. This will always create a task running a time course simulation. If the parameter scan has been specified, it will be exported as well.

References createDataGenerators(), createScanTask(), createTimeCourseTask(), CDataModel::getTaskList(), CCopasiTask::isScheduled(), mExportExecutableTasksOnly, and mpDataModel.

Referenced by createSEDMLDocument().

◆ createTimeCourseTask()

◆ exportAlgorithm()

◆ exportModelAndTasks()

bool CSEDMLExporter::exportModelAndTasks ( CDataModel dataModel,
const std::string &  filename,
const std::string &  sbmlDocument,
unsigned int  sedmlLevel = 1,
unsigned int  sedmlVersion = 1,
bool  overwrite = false 

Export the model and Task to SEDML. This legacy version requires that the SBML document is passed as string and is kept only for compatibility reasons.

dataModelthe copasi model to export
sedmlFilenamethe filename to write the SED-ML document to
sbmlDocumentthe sbml document as string
sedmlLevelthe the SED-ML level (defaults to 1)
sedmlVersionthe SED-ML version (defaults to 2)
overwriteboolean indicating whether the file should be overwritten (defaults to false)
success / failure. If the export fails, false is returned.

Export the model and Task to SEDML. The SEDML document is written to the file given by SEDMLFilename and reference SBML model is written to SBMLFilename . If the export fails, false is returned.

References createUniqueModelFileName(), CDirEntry::dirName(), CCopasiMessage::ERROR, exportModelAndTasksToString(), CLocaleString::fromUtf8(), MCDirEntry, and CDirEntry::Separator.

Referenced by CDataModel::exportSEDML().

◆ exportModelAndTasksToString()

std::string CSEDMLExporter::exportModelAndTasksToString ( CDataModel dataModel,
const std::string &  modelLocation,
unsigned int  sedmlLevel,
unsigned int  sedmlVersion 

Export the model and Task to SEDML. The SEDML document is returned as a string the model is not exported, instead the provided modelLocation will be referenced.

dataModelthe copasi model to export
modelLocationthe location where the SBML file was exported to
sedmlLevelthe SED-ML Level
sedmlVersionthe SED-ML version
the SED-ML document as string

References createSEDMLDocument(), setLevelAndVersion(), and writeSedMLToString().

Referenced by exportModelAndTasks(), and CDataModel::exportSEDMLToString().

◆ exportNthPlot()

◆ exportNthScanItem()

◆ exportPlotItem()

◆ exportReport()

◆ exportStyleForItem()

◆ freeSedMLDocument()

void CSEDMLExporter::freeSedMLDocument ( )

frees the SED-ML document, and resets maps

References clearMaps(), mpSEDMLDocument, and pdelete.

◆ getDataModel()

CDataModel * CSEDMLExporter::getDataModel ( )

References mpDataModel.

◆ getExportActivePlotsOnly()

bool CSEDMLExporter::getExportActivePlotsOnly ( ) const
whether only active plots should be exported

References mExportActivePlotsOnly.

◆ getExportExecutableTasksOnly()

bool CSEDMLExporter::getExportExecutableTasksOnly ( ) const
whether only executable tasks should be exported

References mExportExecutableTasksOnly.

◆ getExportSpecificPlots()

bool CSEDMLExporter::getExportSpecificPlots ( ) const
whether only plots should be exported that apply to the specific task

References mExportSpecificPlots.

◆ getModelId()

const std::string & CSEDMLExporter::getModelId ( ) const
the SBML model id used

References mModelId.

◆ getParameterValueAsString()

std::string CSEDMLExporter::getParameterValueAsString ( const CCopasiParameter pParameter)

◆ getSEDMLDocument()

LIBSEDML_CPP_NAMESPACE::SedDocument * CSEDMLExporter::getSEDMLDocument ( )
the currently constructed SED-ML document

References mpSEDMLDocument.

◆ setCurrentTime()

void CSEDMLExporter::setCurrentTime ( std::string &  taskId)

◆ setDataModel()

void CSEDMLExporter::setDataModel ( CDataModel pDataModel)

References mpDataModel.

Referenced by createSEDMLDocument().

◆ setExportActivePlotsOnly()

void CSEDMLExporter::setExportActivePlotsOnly ( bool  val)

Specify whether only active plots should be exported

References mExportActivePlotsOnly.

◆ setExportExecutableTasksOnly()

void CSEDMLExporter::setExportExecutableTasksOnly ( bool  val)

Specify whether only executable tasks should be exported

References mExportExecutableTasksOnly.

◆ setExportSpecificPlots()

void CSEDMLExporter::setExportSpecificPlots ( bool  val)

Specify whether plots should be exported only if they apply to the specific task

References mExportSpecificPlots.

◆ setLevelAndVersion()

void CSEDMLExporter::setLevelAndVersion ( unsigned int  sedmlLevel,
unsigned int  sedmlVersion 

Sets the SED-ML Level and Version used to export

References mSEDMLLevel, and mSEDMLVersion.

Referenced by exportModelAndTasksToString().

◆ setModelId()

void CSEDMLExporter::setModelId ( const std::string &  val)

specifies the SBML model id to be used by the task export.

References mModelId.

Referenced by createModel().

◆ setSBMLNamespaces() [1/2]

void CSEDMLExporter::setSBMLNamespaces ( const LIBSBML_CPP_NAMESPACE::XMLNamespaces &  sbmlns)

sets the sbml namespaces

If set, the sbml namespaces specified will be written into the declaration of the sedml document

thenamespace to write out

◆ setSBMLNamespaces() [2/2]

void CSEDMLExporter::setSBMLNamespaces ( int  level,
int  version,
const std::string &  prefix = "sbml" 

sets the sbml namespaces

If set, the sbml namespaces specified will be written into the declaration of the sedml document

levelthe level of the sbml document
versionthe version of the sbml document @prefix the prefix of the namespace to use (defaults to sbml)

References mpSBMLNamespaces, and pdelete.

Referenced by CDataModel::exportSEDML(), and CDataModel::exportSEDMLToString().

◆ writeSedMLToFile()

bool CSEDMLExporter::writeSedMLToFile ( const std::string &  filename) const

writes the current SED-ML document to the given filename

filenamethe file name to write to
boolean indicating success / failure

References mpSEDMLDocument, and CVersion::VERSION.

◆ writeSedMLToString()

std::string CSEDMLExporter::writeSedMLToString ( ) const
the current SED-ML document as string

References mpSEDMLDocument, and CVersion::VERSION.

Referenced by exportModelAndTasksToString().

Member Data Documentation

◆ mCurrentTaskId

std::string CSEDMLExporter::mCurrentTaskId

◆ mDataGenerators

std::map< TaskVarKey, SedDataGenerator *, KeyComparer > CSEDMLExporter::mDataGenerators

◆ mExportActivePlotsOnly

bool CSEDMLExporter::mExportActivePlotsOnly

◆ mExportExecutableTasksOnly

bool CSEDMLExporter::mExportExecutableTasksOnly

◆ mExportSpecificPlots

bool CSEDMLExporter::mExportSpecificPlots

◆ mGeneratedIds

std::unordered_set< std::string > CSEDMLExporter::mGeneratedIds

Referenced by clearMaps(), and exportPlotItem().

◆ mModelId

std::string CSEDMLExporter::mModelId

◆ mpCurrentPlot

SedPlot2D* CSEDMLExporter::mpCurrentPlot

◆ mpCurrentPlot3D

SedPlot3D* CSEDMLExporter::mpCurrentPlot3D

Referenced by exportNthPlot(), and exportPlotItem().

◆ mpCurrentSpec

const CPlotSpecification* CSEDMLExporter::mpCurrentSpec

Referenced by exportNthPlot(), and exportPlotItem().

◆ mpCurrentTask

CCopasiTask* CSEDMLExporter::mpCurrentTask

◆ mpCurrentTime

SedDataGenerator* CSEDMLExporter::mpCurrentTime

◆ mpDataModel

◆ mpSBMLNamespaces

LIBSBML_CPP_NAMESPACE::XMLNamespaces* CSEDMLExporter::mpSBMLNamespaces

◆ mpSEDMLDocument

◆ mpTimecourse

SedUniformTimeCourse* CSEDMLExporter::mpTimecourse

Referenced by createTimeCourseTask().

◆ mpTimecourseTask

SedTask* CSEDMLExporter::mpTimecourseTask

◆ mSEDMLLevel

unsigned int CSEDMLExporter::mSEDMLLevel

◆ mSEDMLVersion

unsigned int CSEDMLExporter::mSEDMLVersion

◆ mStyleMap

std::map< const CPlotItem*, std::string, PlotItemStyleComparer > CSEDMLExporter::mStyleMap

Referenced by clearMaps(), and exportStyleForItem().

◆ mTimeCN

CCommonName CSEDMLExporter::mTimeCN

Referenced by exportReport(), and setCurrentTime().

The documentation for this class was generated from the following files: