Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot print a model with imports? #590

Closed
kerimoyle opened this issue May 5, 2020 · 7 comments
Closed

Cannot print a model with imports? #590

kerimoyle opened this issue May 5, 2020 · 7 comments
Labels

Comments

@kerimoyle
Copy link
Contributor

Say I have two models, one of which imports the other (see below). According to 2.15.1 and 3.4.2.2, I'm allowed to have a map_variables item that points to an imported component. How can I get this output using the API?

  • if I serialise the model without flattening, there can be no equivalences stored as the variables are not instantiated;
  • if I serialise the model after flattening, then it's no longer an import situation ... ?
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.cellml.org/cellml/2.0#" name="import_example">
  <import xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="importMe.cellml">
    <component component_ref="importedComponent" name="importMe"/>
  </import>
  <component name="localComponent">
    <variable name="x" units="dimensionless" interface="public_and_private"/>
  </component>
  <connection component_1="localComponent" component_2="importedComponent">
    <map_variables variable_1="x" variable_2="x"/> ///**** NOTE THIS BIT!!
  </connection>
</model>

Inside importMe.cellml:

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.cellml.org/cellml/2.0#" name="import_me">
  <component name="importMe">
    <variable name="x" units="dimensionless" interface="public_and_private"/>
  </component>
</model>
@kerimoyle kerimoyle added Bug New feature Additional feature Imports labels May 5, 2020
@nickerso
Copy link
Contributor

nickerso commented May 5, 2020

Maybe throw together a test which demonstrates this behaviour, that would be the easiest way to look at this. Cause as it stands this sounds like a huge bug.

@hsorby
Copy link
Contributor

hsorby commented May 5, 2020

small bug

@kerimoyle
Copy link
Contributor Author

kerimoyle commented May 5, 2020

I've written two small tests in #591 ... the second one (in variable tests) won't compile, but it shows what I'd expect to be able to do?

@nickerso
Copy link
Contributor

nickerso commented May 6, 2020

So as we remember how this was designed to work, there is actually no bug (see discussion on #591). But there could be new API to make the solution more convenient.

@kerimoyle
Copy link
Contributor Author

So as we remember how this was designed to work, there is actually no bug (see discussion on #591). But there could be new API to make the solution more convenient.

Nope, sorry @nickerso. There is a bug in that the variable equivalences are not being printed (see first test in PR) How the equivalence is established in the first place is a different thing ...

@nickerso
Copy link
Contributor

is this the issue reported in #594? or do you mean something else?

@kerimoyle
Copy link
Contributor Author

Something else - the original reason for this issue. The printer is not printing equivalences between variables when one (or more) of their components is imported. ie: the first test in #591

@hsorby hsorby closed this as completed in 84ebec3 Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants