Skip to content

Commit 406bae0

Browse files
authored
Update ontology submodule to latest available (#217)
- Updated to the latest version of the Web Lab Ontology. - Better error messages when working with transitively finding terms, and encountering subjects that don't point to an existing node in the model.
1 parent 93c356a commit 406bae0

File tree

6 files changed

+3742
-4
lines changed

6 files changed

+3742
-4
lines changed

RELEASE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Release 0.9.0
2+
- Updated to the latest version of the Web Lab Ontology.
3+
- Better error messages when working with transitively finding terms, and encountering subjects that don't point to an existing node in the model.
4+
15
# Release 0.8.0
26
- Added `--use-model-factory` flag to allow code to be added for models to self-register to the model factory of the ApPredict peoject.
37
- Renamed backward euler cells to be in line with others using `BackwardEulerOpt` / `BackwardEuler` instead of `BackwardEuler` and `BackwardEulerNoLot`.

chaste_codegen/_rdf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from cellmlmanip.model import Model
88
from cellmlmanip.rdf import create_rdf_node
99

10-
from chaste_codegen import MODULE_DIR
10+
from chaste_codegen import MODULE_DIR, CodegenError
1111

1212

1313
_ONTOLOGY = None # The 'oxmeta' ontology graph
@@ -62,6 +62,10 @@ class given by ``term``, i.e. are connected to it by a path of ``rdf:type`` pred
6262
cmeta_ids.update(model.rdf.subjects(PRED_IS_VERSION_OF, annotation))
6363
variables = []
6464
for cmeta_id in cmeta_ids:
65-
variables.append(model.get_variable_by_cmeta_id(cmeta_id))
65+
try:
66+
variables.append(model.get_variable_by_cmeta_id(cmeta_id))
67+
except KeyError as e:
68+
assert 'cmeta id' in str(e) and str(cmeta_id).replace('#', '', 1) in str(e), str(e)
69+
raise CodegenError('Rdf subject %s does not refer to any existing variable in the model.' % cmeta_id)
6670
variables.sort(key=lambda sym: sym.order_added)
6771
return variables

0 commit comments

Comments
 (0)