SemBioProcess / SemGen

A tool for semantics-based annotation and composition of biosimulation models
18 stars 3 forks source link

Errors in CellML units when translating from a source JSim model description #271

Open nickerso opened 6 years ago

nickerso commented 6 years ago

These errors were discovered when using SemGen to translate a SemSim OWL model that had come from a JSim MML model description into CellML for this example: https://models.physiomeproject.org/workspace/4e3. Checking the git history for that workspace will show the changes made to correct the units - although that model still has issues with the generated math that cause OpenCOR to crash when loading the model (see opencor/opencor#1487).

A summary of the issues with units is given here:

  1. The names for units need to obey the same rules as other named entities (only alphanumeric characters plus the _) – e.g., mol^2/(J*s*cm^2) is an invalid CellML units name.
  2. Base units were redefined with non-CellML names (e.g., K was defined as a new base unit rather than use the existing kelvin, amp instead of using ampere, etc.). In the corrected version I removed the @base_unit’s and defined the units as a direct mapping to the standard base (from memory only, haven’t actually checked I got it all right!).
  3. The units weren’t actually defined, just a list of units with names and id’s but no definitions (compare https://models.physiomeproject.org/workspace/4e3/file/d1fc0e1c04b5cc2f563e10bf60f639154a5b94b9/Kapela_VSM.cellml to https://models.physiomeproject.org/workspace/4e3/file/05b3384ebffa15c5270486a6b9249a3360e34ebf/Kapela_VSM.cellml)
  4. There were some duplicate units (e.g., ms and msec) but that’s not really a problem, perhaps an optimisation when exporting the model.
maxneal commented 6 years ago

Currently we've got a fix in place for item 1. For items 2-4 we need to enhance the XMMLreader so that it reads in the unit factor information for each unit. Then we'll be able to identify unit synonymy better and not write out base units unnecessarily. We'll also be able to preserve all the unit factor info when going from MML to OWL to CellML.