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

Use qualified rather than local names in generated model code #169

Open
5 tasks
MichaelClerx opened this issue Apr 26, 2020 · 7 comments
Open
5 tasks

Use qualified rather than local names in generated model code #169

MichaelClerx opened this issue Apr 26, 2020 · 7 comments

Comments

@MichaelClerx
Copy link
Contributor

MichaelClerx commented Apr 26, 2020

In generated code for:

  • Inputs
  • Outputs
  • Update code_generation.py to add an output for every rdf term in pvar.outputs

In the protocol language for

  • Lookups like sim:membrane_voltage would need some oxmeta bit in them

And then

  • Some fallback mechanism so that the old syntax still works, or else a deprecation warning and manually updating a whole bunch of protocols?
@jonc125
Copy link
Contributor

jonc125 commented Apr 27, 2020

We can't use the qualified names as-is (something like oxmeta:membrane_voltage isn't a valid Cython identifier!) but could use e.g. oxmeta__membrane_voltage - is that what you mean?

This would I think just mean tweaking the variable_name function in code_generation.py.

@MichaelClerx
Copy link
Contributor Author

@MichaelClerx
Copy link
Contributor Author

The model variable names are already unique, even if they're from different ontologies

@jonc125
Copy link
Contributor

jonc125 commented Apr 27, 2020

OK, I see. That would need changes in ModelWrapperEnvironment (and how it's set up) rather than in that dictionary, so that different prefixes map different subsets of the model variables. Currently as a hack (because pycml wasn't that clever) we have one environment pretending to be multiple ontologies. What you really want is one environment per ontology, then each has an independent set of local names.

@jonc125
Copy link
Contributor

jonc125 commented Apr 27, 2020

Not urgent though, because we don't have any protocols with conflicting local names yet!

@MichaelClerx
Copy link
Contributor Author

MichaelClerx commented Apr 27, 2020

I think it is urgent because I've updated the ModelInterface code to allow multiple rdf terms to annotate the same variable. I could hack in support so that it then extracts multiple local_name arguments from those rdf terms, but I'd much rather just do it right straight away?

@jonc125
Copy link
Contributor

jonc125 commented Apr 27, 2020

For now, just add a check that you don't get duplicate local names. That'll let #158 be merged, and we can address this separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants