Skip to content

The master attribute in an OMEX archive is an optional hint yet OpenCOR requires it. #557

Description

@dbrnz

From the specification of an OMEX manifest:

The `master` is an optional attribute of type `boolean`. It represents a hint, 
that a certain file is to be used first when processing the content of an archive. 
Are top model description in a composed model, calling the various submodels; 
simulation description, calling the different model descriptions and 
data sources used in the experiment.

At most one content element per archive may have its master attribute set to `true`.

However while OpenCOR will open an OMEX archive with just a CellML file that has the master attribute set true, it complains if there is no master attribute and reports:

Image

Does OpenCOR expect a SED-ML file when the CellML isn't flagged as master? The above messages are recent, as earlier code simply crashed when there was no SED-ML. I would expect CellML to be used if there's no SED-ML, regardless of the master attribute, as it's meant to be an optional hint.

Activity

  1. agarny commented on Sep 28, 2026

    @agarny
    Contributor

    It is true that the master attribute is optional. However, when it comes to our use of COMBINE archives (i.e. contain one or several CellML files and, sometimes, one or several SED-ML files) then a tool like Web OpenCOR needs to know which file it should open. Failing that, what is Web OpenCOR supposed to be doing? I guess it could let the user know which files are present in the COMBINE archive and ask the user to select the one that ought to be opened or just select the first SED-ML file, if there is one, or the first CellML file.

    Anyway, until this gets done (if ever), I thought I would just enforce the need for the master attribute to avoid ambiguity.

  2. dbrnz commented on Sep 28, 2026

    @dbrnz
    ContributorAuthor

    Certainly master is necessary if there are several CellML and/or SED-ML files in an archive. However, when an archive only contains a single CellML file and no SED-ML and there's no master attribute on any of the archive's files, shouldn't the CellML be treated as if it were master? Similarly, if there is only the one SED-ML file and no master file, then shouldn't the SED-ML be treated as the master??

  3. agarny commented on Sep 28, 2026

    @agarny
    Contributor

    Certainly master is necessary if there are several CellML and/or SED-ML files in an archive.

    Well, I would like it to be necessary, but as you have seen: master is optional, so...

    However, when an archive only contains a single CellML file and no SED-ML and there's no master attribute on any of the archive's files, shouldn't the CellML be treated as if it were master? Similarly, if there is only the one SED-ML file and no master file, then shouldn't the SED-ML be treated as the master??

    Yes, it could be done, I agree.

  4. dbrnz commented on Sep 28, 2026

    @dbrnz
    ContributorAuthor

    This is something I stumbled into after creating a simple OMEX archive and trying to open it with OpenCOR. Having realised that master is mandatory so far as OpenCOR goes, I got things to work by specifying the CellML file to be the master. This is fine so far as I go, although someone else in the future, following the OMEX spec, may well be tripped up by this "feature" -- if nothing else, should the requirement not be noted in some README?

  5. agarny commented on Sep 28, 2026

    @agarny
    Contributor

    Note that this is actually a libOpenCOR requirement, not a Web OpenCOR requirement. Still, I am not sure it's worth worrying too much about it? @nickerso?

  6. dbrnz commented on Oct 7, 2026

    @dbrnz
    ContributorAuthor

    And indeed, opening the OMEX archive of the GLUT2 model on PMR fails with no master...

    Image
  7. agarny commented on Oct 7, 2026

    @agarny
    Contributor

    Ok, I am going to look into it and have libOpenCOR support an OMEX file with no master file. But what should be the exact behaviour if there is no master file?

    1. if the OMEX file contains one SED-ML file, then it will consider that SED-ML file as the master file.
    2. if the OMEX file contains several SED-ML files, then... what should we do? Use the first SED-ML file or warn the user that there are several SED-ML files?
    3. if the OMEX file doesn't contain any SED-ML file but one CellML file, then it will consider that CellML file as the master file.
    4. if the OMEX file doesn't contain any SED-ML file but several CellML files, then... what should we do? Use the first CellML file or warn the user that there are several CellML files?

    For points 2 and 4, I am in favour of just warning the user since I don't think libOpenCOR should decide on the user's behaviour. If anything, it should be a tool like Web OpenCOR that should ask the user which CellML / SED-ML file should be opened. This is particular important for CellML files since there might indeed be a "main" CellML file that imports other CellML files.

    Does this sound reasonable?

  8. agarny commented on Oct 7, 2026

    @agarny
    Contributor

    Otherwise, why not just generate an OMEX file which specifies a master file?...

  9. dbrnz commented on Oct 7, 2026

    @dbrnz
    ContributorAuthor

    Does this sound reasonable?

    Yes it does. If there's only one thing to choose from there's no need to explicitly specify it (options 1 and 3), otherwise have libOpenCOR fail and have a UI (e.g. Web OpenCOR) ask the user what they want.

    Otherwise, why not just generate an OMEX file which specifies a master file?...

    Because PMR has exposures with OMEX files that have no master -- @nickerso is one culprit...

  10. agarny commented on Oct 7, 2026

    @agarny
    Contributor

    Does this sound reasonable?
    Yes it does. If there's only one thing to choose from there's no need to explicitly specify it (options 1 and 3), otherwise have libOpenCOR fail and have a UI (e.g. Web OpenCOR) ask the user what they want.

    Otherwise, why not just generate an OMEX file which specifies a master file?...

    Because PMR has exposures with OMEX files that have no master -- @nickerso is one culprit...

    Ok, I will look into it tomorrow then (see opencor/libopencor#603).

  11. agarny commented on Oct 8, 2026

    @agarny
    Contributor

    Closing as a result of PR #606 for issue for opencor/libopencor#603.

  12. agarny commented on Oct 8, 2026

    @agarny
    Contributor

    @dbrnz, just to confirm that this is now working... although the GLUT2 model on PMR has a lot of issues...

    Image
  13. dbrnz commented on Oct 8, 2026

    @dbrnz
    ContributorAuthor

    Thanks!

    The OMEX opens just fine in legacy OpenCOR, and the archive does contain './units/units.cellml`, so is there an issue with libOpenCOR reading OMEX archives that have files in sub-directories?

  14. agarny commented on Oct 8, 2026

    @agarny
    Contributor

    https://models.physiomeproject.org/e/cae/GLUT2_BG.cellml/view seems to be dead at the moment, but if the model uses imports, then it won't work. Indeed, [lib]OpenCOR doesn't currently support imports, only flattened models... :/

  15. dbrnz commented on Oct 8, 2026

    @dbrnz
    ContributorAuthor

    The OMEX opens just fine in legacy OpenCOR

    Hmm, I tell a lie -- it does not...

    With legacy OpenCOR:

    • If the OMEX is unzipped then OpenCOR happily opens and runs the SEDML in the archive.
    • Directly opening the OMEX as downloaded from PMR reports: Information: only COMBINE archives with one master file are supported.
    • Tweaking the manifest to specify the SEDML file to be master and directly opening the recreated OMEX gives: Error: 'units/units.cellml' could not be found.

    PMR appears to have been offline -- the link is now back up for me.

  16. agarny commented on Oct 8, 2026

    @agarny
    Contributor

    With legacy OpenCOR:

    • If the OMEX is unzipped then OpenCOR happily opens and runs the SEDML in the archive.

    Makes sense.

    • Directly opening the OMEX as downloaded from PMR reports: Information: only COMBINE archives with one master file are supported.

    Makes sense indeed and I should have been surprised the first time you sad that it was working fine in legacy OpenCOR since, like in Web OpenCOR (before the fix), a COMBINE archive is expected to have master file.

    • Tweaking the manifest to specify the SEDML file to be master and directly opening the recreated OMEX gives: Error: 'units/units.cellml' could not be found.

    ?! Here is the OMEX file that I have just tweaked to have a master file and it all works fine in legacy OpenCOR (make sure to rename the extension to .omex or libSBML will trip over it).

    GLUT2 - The Physics of Physiology.zip

  17. dbrnz commented on Oct 8, 2026

    @dbrnz
    ContributorAuthor

    ?! Here is the OMEX file that I have just tweaked to have a master file and it all works fine in legacy OpenCOR (make sure to rename the extension to .omex or libSBML will trip over it).

    Aargh, my mistake -- I used -j when zipping so as not to have paths included and this of course flattened things...

    Anyway I can run the model using legacy OpenCOR, which is all I need. I've recreated it using CellDL and am now trying to get the resulting CellML running in both legacy and web OpenCOR -- the issues so far have been to do with CellML generation, not OpenCOR.

  18. agarny commented on Oct 8, 2026

    @agarny
    Contributor

    21. > ?! Here is the OMEX file that I have just tweaked to have a master file and it all works fine in legacy OpenCOR (make sure to rename the extension to .omex or libSBML will trip over it).

     Aargh, my mistake -- I used `-j` when zipping so as not to have paths included and this of course flattened things...
    

    🤯🤣

     Anyway I can run the model using legacy OpenCOR, which is all I need. I've recreated it using CellDL and am now trying to get the resulting CellML running in both legacy and web OpenCOR -- the issues so far have been to do with CellML generation, not OpenCOR.
    

    With CellML generation?

  19. dbrnz commented on Oct 8, 2026

    @dbrnz
    ContributorAuthor

    Anyway I can run the model using legacy OpenCOR, which is all I need. I've recreated it using CellDL and am now trying to get the resulting CellML running in both legacy and web OpenCOR -- the issues so far have been to do with CellML generation, not OpenCOR.

    With CellML generation?

    Issues with how I'm generating CellML from CellDL, outside of OpenCOR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions