Skip to content

Commit 40be311

Browse files
committed
Fix None vs "none" ontology version specification
No effects were observed on Make-managed files. Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent 86ed417 commit 40be311

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

case_utils/case_validate/__init__.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,26 @@ def get_ontology_graph(
9898
"""
9999
Get the ontology graph for the given case_version and any supplemental graphs.
100100
101-
:param case_version: the version of the CASE ontology to use. If None, the most recent version will be used.
101+
:param case_version: the version of the CASE ontology to use. If None (i.e. null), the most recent version will be used. If "none" (the string), no pre-built version of CASE will be used.
102102
:param supplemental_graphs: a list of supplemental graphs to use. If None, no supplemental graphs will be used.
103103
:return: the ontology graph against which to validate the data graph.
104104
"""
105-
if not case_version or case_version == "none":
106-
case_version = CURRENT_CASE_VERSION
107-
108105
ontology_graph = rdflib.Graph()
109-
ttl_filename = case_version + ".ttl"
110-
_logger.debug("ttl_filename = %r.", ttl_filename)
111-
ttl_data = importlib.resources.read_text(case_utils.ontology, ttl_filename)
112-
ontology_graph.parse(data=ttl_data, format="turtle")
106+
107+
if case_version != "none":
108+
# Load bundled CASE ontology at requested version.
109+
if case_version is None:
110+
case_version = CURRENT_CASE_VERSION
111+
ttl_filename = case_version + ".ttl"
112+
_logger.debug("ttl_filename = %r.", ttl_filename)
113+
ttl_data = importlib.resources.read_text(case_utils.ontology, ttl_filename)
114+
ontology_graph.parse(data=ttl_data, format="turtle")
115+
113116
if supplemental_graphs:
114117
for arg_ontology_graph in supplemental_graphs:
115118
_logger.debug("arg_ontology_graph = %r.", arg_ontology_graph)
116119
ontology_graph.parse(arg_ontology_graph)
120+
117121
return ontology_graph
118122

119123

0 commit comments

Comments
 (0)