Skip to content

Commit

Permalink
check if at least one axiom generator is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
muddymudskipper committed Jun 25, 2024
1 parent 1f01291 commit b9971e5
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions cmem_plugin_robotreason/plugin_robotreason.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,26 @@ def __init__( # noqa: PLR0913
if result_iri == ontology_graph_iri:
raise ValueError("Result graph IRI cannot be the same as the ontology graph IRI.")
if not validators.url(result_iri):
raise ValueError("Result graph IRI is invalid")
raise ValueError("Result graph IRI is invalid.")

self.axioms_dict = {
"sub_class": "SubClass",
"equivalent_class": "EquivalentClass",
"disjoint_classes": "DisjointClasses",
"data_property_characteristic": "DataPropertyCharacteristic",
"equivalent_data_properties": "EquivalentDataProperties",
"sub_data_property": "SubDataProperty",
"class_assertion": "ClassAssertion",
"property_assertion": "PropertyAssertion",
"equivalent_object_property": "EquivalentObjectProperty",
"inverse_object_properties": "InverseObjectProperties",
"object_property_characteristic": "ObjectPropertyCharacteristic",
"sub_object_property": "SubObjectProperty",
"object_property_range": "ObjectPropertyRange",
"object_property_domain": "ObjectPropertyDomain",
}
if True not in [self.__dict__[k] for k in self.axioms_dict]:
raise ValueError("No axiom generator selected.")

def create_xml_catalog_file(self, graphs: dict) -> None:
"""Create XML catalog file"""
Expand Down Expand Up @@ -305,23 +324,7 @@ def get_graphs_tree(self) -> dict:

def set_axioms(self) -> str:
"""Set asserted axioms"""
axioms_dict = {
"sub_class": "SubClass",
"equivalent_class": "EquivalentClass",
"disjoint_classes": "DisjointClasses",
"data_property_characteristic": "DataPropertyCharacteristic",
"equivalent_data_properties": "EquivalentDataProperties",
"sub_data_property": "SubDataProperty",
"class_assertion": "ClassAssertion",
"property_assertion": "PropertyAssertion",
"equivalent_object_property": "EquivalentObjectProperty",
"inverse_object_properties": "InverseObjectProperties",
"object_property_characteristic": "ObjectPropertyCharacteristic",
"sub_object_property": "SubObjectProperty",
"object_property_range": "ObjectPropertyRange",
"object_property_domain": "ObjectPropertyDomain",
}
axioms = " ".join(v for k, v in axioms_dict.items() if self.__dict__[k])
axioms = " ".join(v for k, v in self.axioms_dict.items() if self.__dict__[k])
if not axioms:
raise ValueError("No axioms selected.")
return axioms
Expand Down

0 comments on commit b9971e5

Please sign in to comment.