@@ -77,7 +77,7 @@ def concept_is_cdo_concept(n_concept: rdflib.URIRef) -> bool:
77
77
Determine if a concept is part of the CDO ontology.
78
78
79
79
:param n_concept: The concept to check.
80
- :return: whether the concept is part of the CDO ontology .
80
+ :return: whether the concept is part of the CDO ontologies .
81
81
"""
82
82
concept_iri = str (n_concept )
83
83
return concept_iri .startswith (
@@ -95,12 +95,14 @@ def get_ontology_graph(
95
95
:param supplemental_graphs: a list of supplemental graphs to use. If None, no supplemental graphs will be used.
96
96
:return: the ontology graph against which to validate the data graph.
97
97
"""
98
+ if not case_version or case_version == "none" :
99
+ case_version = CURRENT_CASE_VERSION
100
+
98
101
ontology_graph = rdflib .Graph ()
99
- if case_version and case_version != "none" :
100
- ttl_filename = case_version + ".ttl"
101
- _logger .debug ("ttl_filename = %r." , ttl_filename )
102
- ttl_data = importlib .resources .read_text (case_utils .ontology , ttl_filename )
103
- ontology_graph .parse (data = ttl_data , format = "turtle" )
102
+ ttl_filename = case_version + ".ttl"
103
+ _logger .debug ("ttl_filename = %r." , ttl_filename )
104
+ ttl_data = importlib .resources .read_text (case_utils .ontology , ttl_filename )
105
+ ontology_graph .parse (data = ttl_data , format = "turtle" )
104
106
if supplemental_graphs :
105
107
for arg_ontology_graph in supplemental_graphs :
106
108
_logger .debug ("arg_ontology_graph = %r." , arg_ontology_graph )
@@ -112,11 +114,11 @@ def get_invalid_cdo_concepts(
112
114
data_graph : Graph , ontology_graph : Graph
113
115
) -> Set [rdflib .URIRef ]:
114
116
"""
115
- Get the set of concepts in the data graph that are not part of the CDO ontology .
117
+ Get the set of concepts in the data graph that are not part of the CDO ontologies .
116
118
117
119
:param data_graph: The data graph to validate.
118
120
:param ontology_graph: The ontology graph to use for validation.
119
- :return: The list of concepts in the data graph that are not part of the CDO ontology .
121
+ :return: The set of concepts in the data graph that are not part of the CDO ontologies .
120
122
"""
121
123
# Construct set of CDO concepts for data graph concept-existence review.
122
124
cdo_concepts : Set [rdflib .URIRef ] = set ()
@@ -186,6 +188,7 @@ def validate(
186
188
case_version : Optional [str ] = None ,
187
189
supplemental_graphs : Optional [List [str ]] = None ,
188
190
abort_on_first : bool = False ,
191
+ inference : Optional [str ] = "none" ,
189
192
) -> ValidationResult :
190
193
"""
191
194
Validate the given data graph against the given CASE ontology version and supplemental graphs.
@@ -194,6 +197,7 @@ def validate(
194
197
:param case_version: The version of the CASE ontology to use. If None, the most recent version will be used.
195
198
:param supplemental_graphs: The supplemental graphs to use. If None, no supplemental graphs will be used.
196
199
:param abort_on_first: Whether to abort on the first validation error.
200
+ :param inference: The type of inference to use. If "none", no inference will be used.
197
201
:return: The validation result object containing the defined properties.
198
202
"""
199
203
# Convert the data graph string to a rdflib.Graph object.
@@ -213,7 +217,7 @@ def validate(
213
217
data_graph ,
214
218
shacl_graph = ontology_graph ,
215
219
ont_graph = ontology_graph ,
216
- inference = "none" ,
220
+ inference = inference ,
217
221
meta_shacl = False ,
218
222
abort_on_first = abort_on_first ,
219
223
allow_infos = False ,
0 commit comments