fuzzy-dl-owl2 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. fuzzy_dl_owl2/__init__.py +2 -0
  2. fuzzy_dl_owl2/fuzzydl/__init__.py +23 -0
  3. fuzzy_dl_owl2/fuzzydl/assertion/__init__.py +2 -0
  4. fuzzy_dl_owl2/fuzzydl/assertion/assertion.py +72 -0
  5. fuzzy_dl_owl2/fuzzydl/assertion/atomic_assertion.py +19 -0
  6. fuzzy_dl_owl2/fuzzydl/concept/__init__.py +13 -0
  7. fuzzy_dl_owl2/fuzzydl/concept/all_some_concept.py +85 -0
  8. fuzzy_dl_owl2/fuzzydl/concept/approximation_concept.py +147 -0
  9. fuzzy_dl_owl2/fuzzydl/concept/atomic_concept.py +91 -0
  10. fuzzy_dl_owl2/fuzzydl/concept/choquet_integral.py +64 -0
  11. fuzzy_dl_owl2/fuzzydl/concept/concept.py +230 -0
  12. fuzzy_dl_owl2/fuzzydl/concept/concrete/__init__.py +10 -0
  13. fuzzy_dl_owl2/fuzzydl/concept/concrete/crisp_concrete_concept.py +60 -0
  14. fuzzy_dl_owl2/fuzzydl/concept/concrete/fuzzy_concrete_concept.py +63 -0
  15. fuzzy_dl_owl2/fuzzydl/concept/concrete/fuzzy_number/__init__.py +1 -0
  16. fuzzy_dl_owl2/fuzzydl/concept/concrete/fuzzy_number/triangular_fuzzy_number.py +127 -0
  17. fuzzy_dl_owl2/fuzzydl/concept/concrete/left_concrete_concept.py +70 -0
  18. fuzzy_dl_owl2/fuzzydl/concept/concrete/linear_concrete_concept.py +70 -0
  19. fuzzy_dl_owl2/fuzzydl/concept/concrete/modified_concrete_concept.py +66 -0
  20. fuzzy_dl_owl2/fuzzydl/concept/concrete/right_concrete_concept.py +70 -0
  21. fuzzy_dl_owl2/fuzzydl/concept/concrete/trapezoidal_concrete_concept.py +96 -0
  22. fuzzy_dl_owl2/fuzzydl/concept/concrete/triangular_concrete_concept.py +89 -0
  23. fuzzy_dl_owl2/fuzzydl/concept/ext_threshold_concept.py +77 -0
  24. fuzzy_dl_owl2/fuzzydl/concept/has_value_concept.py +51 -0
  25. fuzzy_dl_owl2/fuzzydl/concept/implies_concept.py +144 -0
  26. fuzzy_dl_owl2/fuzzydl/concept/interface/__init__.py +6 -0
  27. fuzzy_dl_owl2/fuzzydl/concept/interface/has_concept_interface.py +17 -0
  28. fuzzy_dl_owl2/fuzzydl/concept/interface/has_concepts_interface.py +18 -0
  29. fuzzy_dl_owl2/fuzzydl/concept/interface/has_role_concept_interface.py +14 -0
  30. fuzzy_dl_owl2/fuzzydl/concept/interface/has_role_interface.py +15 -0
  31. fuzzy_dl_owl2/fuzzydl/concept/interface/has_value_interface.py +21 -0
  32. fuzzy_dl_owl2/fuzzydl/concept/interface/has_weighted_concepts_interface.py +29 -0
  33. fuzzy_dl_owl2/fuzzydl/concept/modified/__init__.py +3 -0
  34. fuzzy_dl_owl2/fuzzydl/concept/modified/linearly_modified_concept.py +32 -0
  35. fuzzy_dl_owl2/fuzzydl/concept/modified/modified_concept.py +59 -0
  36. fuzzy_dl_owl2/fuzzydl/concept/modified/triangularly_modified_concept.py +33 -0
  37. fuzzy_dl_owl2/fuzzydl/concept/negated_nominal.py +42 -0
  38. fuzzy_dl_owl2/fuzzydl/concept/operator_concept.py +707 -0
  39. fuzzy_dl_owl2/fuzzydl/concept/owa_concept.py +57 -0
  40. fuzzy_dl_owl2/fuzzydl/concept/qowa_concept.py +62 -0
  41. fuzzy_dl_owl2/fuzzydl/concept/quasi_sugeno_integral.py +46 -0
  42. fuzzy_dl_owl2/fuzzydl/concept/self_concept.py +45 -0
  43. fuzzy_dl_owl2/fuzzydl/concept/string_concept.py +35 -0
  44. fuzzy_dl_owl2/fuzzydl/concept/sugeno_integral.py +83 -0
  45. fuzzy_dl_owl2/fuzzydl/concept/threshold_concept.py +81 -0
  46. fuzzy_dl_owl2/fuzzydl/concept/truth_concept.py +83 -0
  47. fuzzy_dl_owl2/fuzzydl/concept/value_concept.py +67 -0
  48. fuzzy_dl_owl2/fuzzydl/concept/weighted_concept.py +55 -0
  49. fuzzy_dl_owl2/fuzzydl/concept/weighted_max_concept.py +63 -0
  50. fuzzy_dl_owl2/fuzzydl/concept/weighted_min_concept.py +57 -0
  51. fuzzy_dl_owl2/fuzzydl/concept/weighted_sum_concept.py +62 -0
  52. fuzzy_dl_owl2/fuzzydl/concept/weighted_sum_zero_concept.py +62 -0
  53. fuzzy_dl_owl2/fuzzydl/concept_equivalence.py +20 -0
  54. fuzzy_dl_owl2/fuzzydl/concrete_feature.py +94 -0
  55. fuzzy_dl_owl2/fuzzydl/degree/__init__.py +4 -0
  56. fuzzy_dl_owl2/fuzzydl/degree/degree.py +79 -0
  57. fuzzy_dl_owl2/fuzzydl/degree/degree_expression.py +57 -0
  58. fuzzy_dl_owl2/fuzzydl/degree/degree_numeric.py +57 -0
  59. fuzzy_dl_owl2/fuzzydl/degree/degree_variable.py +54 -0
  60. fuzzy_dl_owl2/fuzzydl/domain_axiom.py +8 -0
  61. fuzzy_dl_owl2/fuzzydl/exception/__init__.py +2 -0
  62. fuzzy_dl_owl2/fuzzydl/exception/fuzzy_ontology_exception.py +4 -0
  63. fuzzy_dl_owl2/fuzzydl/exception/inconsistent_ontology_exception.py +4 -0
  64. fuzzy_dl_owl2/fuzzydl/feature_function.py +148 -0
  65. fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2.py +920 -0
  66. fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2_java.py +953 -0
  67. fuzzy_dl_owl2/fuzzydl/general_concept_inclusion.py +82 -0
  68. fuzzy_dl_owl2/fuzzydl/individual/__init__.py +3 -0
  69. fuzzy_dl_owl2/fuzzydl/individual/created_individual.py +219 -0
  70. fuzzy_dl_owl2/fuzzydl/individual/individual.py +113 -0
  71. fuzzy_dl_owl2/fuzzydl/individual/representative_individual.py +37 -0
  72. fuzzy_dl_owl2/fuzzydl/knowledge_base.py +9037 -0
  73. fuzzy_dl_owl2/fuzzydl/label.py +32 -0
  74. fuzzy_dl_owl2/fuzzydl/milp/__init__.py +7 -0
  75. fuzzy_dl_owl2/fuzzydl/milp/expression.py +186 -0
  76. fuzzy_dl_owl2/fuzzydl/milp/inequation.py +55 -0
  77. fuzzy_dl_owl2/fuzzydl/milp/milp_helper.py +787 -0
  78. fuzzy_dl_owl2/fuzzydl/milp/show_variables_helper.py +151 -0
  79. fuzzy_dl_owl2/fuzzydl/milp/solution.py +45 -0
  80. fuzzy_dl_owl2/fuzzydl/milp/term.py +76 -0
  81. fuzzy_dl_owl2/fuzzydl/milp/variable.py +89 -0
  82. fuzzy_dl_owl2/fuzzydl/modifier/__init__.py +3 -0
  83. fuzzy_dl_owl2/fuzzydl/modifier/linear_modifier.py +76 -0
  84. fuzzy_dl_owl2/fuzzydl/modifier/modifier.py +39 -0
  85. fuzzy_dl_owl2/fuzzydl/modifier/triangular_modifier.py +76 -0
  86. fuzzy_dl_owl2/fuzzydl/parser/ParserConstants.py +406 -0
  87. fuzzy_dl_owl2/fuzzydl/parser/__init__.py +1 -0
  88. fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py +2029 -0
  89. fuzzy_dl_owl2/fuzzydl/parser/ebnf.lark +290 -0
  90. fuzzy_dl_owl2/fuzzydl/parser/larkx.py +70 -0
  91. fuzzy_dl_owl2/fuzzydl/primitive_concept_definition.py +81 -0
  92. fuzzy_dl_owl2/fuzzydl/query/__init__.py +14 -0
  93. fuzzy_dl_owl2/fuzzydl/query/all_instances_query.py +50 -0
  94. fuzzy_dl_owl2/fuzzydl/query/bnp_query.py +22 -0
  95. fuzzy_dl_owl2/fuzzydl/query/defuzzify/__init__.py +4 -0
  96. fuzzy_dl_owl2/fuzzydl/query/defuzzify/defuzzify_query.py +76 -0
  97. fuzzy_dl_owl2/fuzzydl/query/defuzzify/lom_defuzzify_query.py +19 -0
  98. fuzzy_dl_owl2/fuzzydl/query/defuzzify/mom_defuzzify_query.py +88 -0
  99. fuzzy_dl_owl2/fuzzydl/query/defuzzify/som_defuzzify_query.py +20 -0
  100. fuzzy_dl_owl2/fuzzydl/query/instance_query.py +19 -0
  101. fuzzy_dl_owl2/fuzzydl/query/kb_satisfiable_query.py +32 -0
  102. fuzzy_dl_owl2/fuzzydl/query/max/__init__.py +5 -0
  103. fuzzy_dl_owl2/fuzzydl/query/max/max_instance_query.py +45 -0
  104. fuzzy_dl_owl2/fuzzydl/query/max/max_query.py +31 -0
  105. fuzzy_dl_owl2/fuzzydl/query/max/max_related_query.py +45 -0
  106. fuzzy_dl_owl2/fuzzydl/query/max/max_satisfiable_query.py +73 -0
  107. fuzzy_dl_owl2/fuzzydl/query/max/max_subsumes_query.py +64 -0
  108. fuzzy_dl_owl2/fuzzydl/query/min/__init__.py +5 -0
  109. fuzzy_dl_owl2/fuzzydl/query/min/min_instance_query.py +50 -0
  110. fuzzy_dl_owl2/fuzzydl/query/min/min_query.py +31 -0
  111. fuzzy_dl_owl2/fuzzydl/query/min/min_related_query.py +57 -0
  112. fuzzy_dl_owl2/fuzzydl/query/min/min_satisfiable_query.py +80 -0
  113. fuzzy_dl_owl2/fuzzydl/query/min/min_subsumes_query.py +65 -0
  114. fuzzy_dl_owl2/fuzzydl/query/query.py +38 -0
  115. fuzzy_dl_owl2/fuzzydl/query/related_query.py +15 -0
  116. fuzzy_dl_owl2/fuzzydl/query/satisfiable_query.py +37 -0
  117. fuzzy_dl_owl2/fuzzydl/query/subsumption_query.py +20 -0
  118. fuzzy_dl_owl2/fuzzydl/range_axiom.py +7 -0
  119. fuzzy_dl_owl2/fuzzydl/relation.py +47 -0
  120. fuzzy_dl_owl2/fuzzydl/restriction/__init__.py +2 -0
  121. fuzzy_dl_owl2/fuzzydl/restriction/has_value_restriction.py +16 -0
  122. fuzzy_dl_owl2/fuzzydl/restriction/restriction.py +34 -0
  123. fuzzy_dl_owl2/fuzzydl/role_parent_with_degree.py +10 -0
  124. fuzzy_dl_owl2/fuzzydl/util/__init__.py +3 -0
  125. fuzzy_dl_owl2/fuzzydl/util/config_reader.py +56 -0
  126. fuzzy_dl_owl2/fuzzydl/util/constants.py +424 -0
  127. fuzzy_dl_owl2/fuzzydl/util/util.py +73 -0
  128. fuzzy_dl_owl2/fuzzyowl2/__init__.py +5 -0
  129. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2.py +1513 -0
  130. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_java.py +1409 -0
  131. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl.py +917 -0
  132. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl_java.py +956 -0
  133. fuzzy_dl_owl2/fuzzyowl2/owl_types/__init__.py +0 -0
  134. fuzzy_dl_owl2/fuzzyowl2/owl_types/choquet_concept.py +19 -0
  135. fuzzy_dl_owl2/fuzzyowl2/owl_types/concept_definition.py +14 -0
  136. fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_datatype.py +22 -0
  137. fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_modifier.py +4 -0
  138. fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_nominal_concept.py +19 -0
  139. fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_property.py +5 -0
  140. fuzzy_dl_owl2/fuzzyowl2/owl_types/left_shoulder_function.py +17 -0
  141. fuzzy_dl_owl2/fuzzyowl2/owl_types/linear_function.py +17 -0
  142. fuzzy_dl_owl2/fuzzyowl2/owl_types/linear_modifier.py +13 -0
  143. fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_concept.py +19 -0
  144. fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_function.py +17 -0
  145. fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_property.py +15 -0
  146. fuzzy_dl_owl2/fuzzyowl2/owl_types/owa_concept.py +19 -0
  147. fuzzy_dl_owl2/fuzzyowl2/owl_types/property_definition.py +10 -0
  148. fuzzy_dl_owl2/fuzzyowl2/owl_types/qowa_concept.py +19 -0
  149. fuzzy_dl_owl2/fuzzyowl2/owl_types/quasi_sugeno_concept.py +21 -0
  150. fuzzy_dl_owl2/fuzzyowl2/owl_types/right_shoulder_function.py +17 -0
  151. fuzzy_dl_owl2/fuzzyowl2/owl_types/sugeno_concept.py +21 -0
  152. fuzzy_dl_owl2/fuzzyowl2/owl_types/trapezoidal_function.py +25 -0
  153. fuzzy_dl_owl2/fuzzyowl2/owl_types/triangular_function.py +21 -0
  154. fuzzy_dl_owl2/fuzzyowl2/owl_types/triangular_modifer.py +21 -0
  155. fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_concept.py +19 -0
  156. fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_max_concept.py +15 -0
  157. fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_min_concept.py +15 -0
  158. fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_concept.py +15 -0
  159. fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_zero_concept.py +15 -0
  160. fuzzy_dl_owl2/fuzzyowl2/parser/__init__.py +1 -0
  161. fuzzy_dl_owl2/fuzzyowl2/parser/owl2_parser.py +491 -0
  162. fuzzy_dl_owl2/fuzzyowl2/util/__init__.py +1 -0
  163. fuzzy_dl_owl2/fuzzyowl2/util/constants.py +112 -0
  164. fuzzy_dl_owl2-1.0.0.dist-info/LICENSE +427 -0
  165. fuzzy_dl_owl2-1.0.0.dist-info/METADATA +299 -0
  166. fuzzy_dl_owl2-1.0.0.dist-info/RECORD +167 -0
  167. fuzzy_dl_owl2-1.0.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,1409 @@
1
+ import os
2
+ import typing
3
+
4
+ import jpype
5
+ import jpype.types
6
+ import jpype.imports
7
+
8
+ if jpype.isJVMStarted():
9
+ jpype.shutdownJVM()
10
+
11
+ jpype.startJVM(classpath=["./jars/*"])
12
+
13
+ from java.io import File
14
+ from org.semanticweb.owlapi.apibinding import OWLManager
15
+ from org.semanticweb.owlapi.model import (
16
+ IRI,
17
+ AxiomType,
18
+ ClassExpressionType,
19
+ DataRangeType,
20
+ OWLAnnotation,
21
+ OWLAnnotationValue,
22
+ OWLAxiom,
23
+ OWLClass,
24
+ OWLClassExpression,
25
+ OWLDataAllValuesFrom,
26
+ OWLDataExactCardinality,
27
+ OWLDataFactory,
28
+ OWLDataHasValue,
29
+ OWLDataIntersectionOf,
30
+ OWLDataMaxCardinality,
31
+ OWLDataMinCardinality,
32
+ OWLDataProperty,
33
+ OWLDataPropertyExpression,
34
+ OWLDataRange,
35
+ OWLDataSomeValuesFrom,
36
+ OWLDatatype,
37
+ OWLDatatypeDefinitionAxiom,
38
+ OWLDatatypeRestriction,
39
+ OWLEntity,
40
+ OWLFacetRestriction,
41
+ OWLIndividual,
42
+ OWLLiteral,
43
+ OWLObjectAllValuesFrom,
44
+ OWLObjectComplementOf,
45
+ OWLObjectExactCardinality,
46
+ OWLObjectHasSelf,
47
+ OWLObjectHasValue,
48
+ OWLObjectIntersectionOf,
49
+ OWLObjectMaxCardinality,
50
+ OWLObjectMinCardinality,
51
+ OWLObjectOneOf,
52
+ OWLObjectProperty,
53
+ OWLObjectPropertyExpression,
54
+ OWLObjectSomeValuesFrom,
55
+ OWLObjectUnionOf,
56
+ OWLOntology,
57
+ OWLOntologyManager,
58
+ OWLProperty,
59
+ )
60
+ from org.semanticweb.owlapi.util import QNameShortFormProvider
61
+ from org.semanticweb.owlapi.vocab import OWLFacet
62
+
63
+ from fuzzy_dl_owl2.fuzzydl.util import constants
64
+ from fuzzy_dl_owl2.fuzzydl.util.util import Util
65
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.choquet_concept import ChoquetConcept
66
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.concept_definition import ConceptDefinition
67
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_datatype import FuzzyDatatype
68
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_modifier import FuzzyModifier
69
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_nominal_concept import FuzzyNominalConcept
70
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.left_shoulder_function import (
71
+ LeftShoulderFunction,
72
+ )
73
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.linear_function import LinearFunction
74
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.linear_modifier import LinearModifier
75
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.modified_concept import ModifiedConcept
76
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.modified_function import ModifiedFunction
77
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.modified_property import ModifiedProperty
78
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.owa_concept import OwaConcept
79
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.qowa_concept import QowaConcept
80
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.quasi_sugeno_concept import QsugenoConcept
81
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.right_shoulder_function import (
82
+ RightShoulderFunction,
83
+ )
84
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.sugeno_concept import SugenoConcept
85
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.trapezoidal_function import TrapezoidalFunction
86
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.triangular_function import TriangularFunction
87
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.triangular_modifer import TriangularModifier
88
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.weighted_concept import WeightedConcept
89
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.weighted_max_concept import WeightedMaxConcept
90
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.weighted_min_concept import WeightedMinConcept
91
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.weighted_sum_concept import WeightedSumConcept
92
+ from fuzzy_dl_owl2.fuzzyowl2.owl_types.weighted_sum_zero_concept import (
93
+ WeightedSumZeroConcept,
94
+ )
95
+ from fuzzy_dl_owl2.fuzzyowl2.parser.owl2_parser import FuzzyOwl2Parser
96
+
97
+
98
+ class FuzzyOwl2(object):
99
+ POS_INFINITY: float = 10000.0
100
+ NEG_INFINITY: float = -POS_INFINITY
101
+
102
+ def __init__(
103
+ self,
104
+ input_file: str,
105
+ output_file: str,
106
+ base_iri: str = "http://www.semanticweb.org/ontologies/fuzzydl_ontology.owl",
107
+ ) -> None:
108
+ self.output_dl: str = os.path.join(constants.RESULTS_PATH, output_file)
109
+
110
+ self.defined_concepts: dict[str, ConceptDefinition] = dict()
111
+ self.defined_properties: dict[str, ConceptDefinition] = dict()
112
+ self.fuzzy_datatypes: dict[str, ConceptDefinition] = dict()
113
+ self.fuzzy_modifiers: dict[str, ConceptDefinition] = dict()
114
+ self.processed_axioms: set[str] = set()
115
+ self.ontologies: set[OWLOntology] = set()
116
+
117
+ FuzzyOwl2Parser.load_config()
118
+
119
+ self.ontology_path = base_iri
120
+ self.ontology_iri = IRI.create(base_iri)
121
+ self.manager: OWLOntologyManager = OWLManager.createOWLOntologyManager()
122
+ self.data_factory: OWLDataFactory = self.manager.getOWLDataFactory()
123
+ self.ontology: OWLOntology = self.manager.loadOntologyFromOntologyDocument(
124
+ IRI.create(File(input_file))
125
+ )
126
+ self.fuzzy_label = self.data_factory.getOWLAnnotationProperty(
127
+ IRI.create(f"{self.ontology_iri}#fuzzyLabel")
128
+ )
129
+ # self.pm: SimpleShortFormProvider = SimpleShortFormProvider()
130
+ self.pm: QNameShortFormProvider = QNameShortFormProvider()
131
+
132
+ # self.ontology.set_base_iri(self.ontology_path + "#", rename_entities=True)
133
+
134
+ self.ontologies.add(self.ontology)
135
+ self.ontologies.update(self.manager.getImportsClosure(self.ontology))
136
+
137
+ def get_short_name(self, e: OWLEntity) -> str:
138
+ return self.pm.getShortForm(e)
139
+
140
+ def translate_owl2ontology(self) -> None:
141
+ self.process_ontology_annotations()
142
+ self.process_datatype_annotations()
143
+ self.process_concept_annotations()
144
+ self.process_property_annotations()
145
+ self.process_ontology_axioms()
146
+
147
+ def process_ontology_annotations(self) -> None:
148
+ for ontology in self.ontologies:
149
+ annotations: set[OWLAnnotation] = ontology.getAnnotations()
150
+ for annotation in annotations:
151
+ if annotation.getProperty() != self.fuzzy_label:
152
+ continue
153
+ value: OWLAnnotationValue = annotation.getValue()
154
+ annotation_str: str = str(value.getLiteral().replace('"', ""))
155
+ Util.debug(f"Annotation for ontology -> {annotation_str}")
156
+ self.write_fuzzy_logic(FuzzyOwl2Parser.parse_string(annotation_str)[0])
157
+
158
+ def __get_facets(self, name: str) -> list[float]:
159
+ facets: list[float] = [float("-inf"), float("inf")]
160
+ for ontology in self.ontologies:
161
+ datatype_def_axioms: set[OWLDatatypeDefinitionAxiom] = ontology.getAxioms(
162
+ AxiomType.DATATYPE_DEFINITION
163
+ )
164
+ if datatype_def_axioms is None:
165
+ continue
166
+ for axiom in datatype_def_axioms:
167
+ datatype_name: str = self.get_short_name(axiom.getDatatype()).replace(
168
+ ":", ""
169
+ )
170
+ if datatype_name != name:
171
+ continue
172
+ if (
173
+ axiom.getDataRange().getDataRangeType()
174
+ == DataRangeType.DATATYPE_RESTRICTION
175
+ ):
176
+ facets: list[OWLFacetRestriction] = list(
177
+ axiom.getDataRange().getFacetRestrictions()
178
+ )
179
+ f1: OWLFacetRestriction = facets[0]
180
+ f2: OWLFacetRestriction = facets[1]
181
+ elif (
182
+ axiom.getDataRange().getDataRangeType()
183
+ == DataRangeType.DATA_INTERSECTION_OF
184
+ ):
185
+ data_range: OWLDataIntersectionOf = typing.cast(
186
+ OWLDataIntersectionOf, axiom.getDataRange()
187
+ )
188
+ operands: list[OWLDataRange] = list(data_range.getOperands())
189
+ if operands is None or len(operands) != 2:
190
+ continue
191
+ r1: OWLDataRange = operands[0]
192
+ r2: OWLDataRange = operands[1]
193
+ if not (
194
+ r1.getDataRangeType() == DataRangeType.DATATYPE_RESTRICTION
195
+ and r2.getDataRangeType() == DataRangeType.DATATYPE_RESTRICTION
196
+ ):
197
+ continue
198
+ restriction1: OWLDatatypeRestriction = typing.cast(
199
+ OWLDatatypeRestriction, r1
200
+ )
201
+ restriction2: OWLDatatypeRestriction = typing.cast(
202
+ OWLDatatypeRestriction, r2
203
+ )
204
+ facets1: set[OWLFacetRestriction] = (
205
+ restriction1.getFacetRestrictions()
206
+ )
207
+ facets2: set[OWLFacetRestriction] = (
208
+ restriction2.getFacetRestrictions()
209
+ )
210
+ if (
211
+ facets1 is None
212
+ or len(facets1) != 1
213
+ or facets2 is None
214
+ or len(facets2) != 1
215
+ ):
216
+ continue
217
+ f1: OWLFacetRestriction = list(facets1)[0]
218
+ f2: OWLFacetRestriction = list(facets2)[0]
219
+ if f1.getFacet() == OWLFacet.MIN_INCLUSIVE:
220
+ facets[0] = float(str(f1.getFacetValue().getLiteral()))
221
+ elif f1.getFacet() == OWLFacet.MAX_INCLUSIVE:
222
+ facets[1] = float(str(f1.getFacetValue().getLiteral()))
223
+ if f2.getFacet() == OWLFacet.MIN_INCLUSIVE:
224
+ facets[0] = float(str(f2.getFacetValue().getLiteral()))
225
+ elif f2.getFacet() == OWLFacet.MAX_INCLUSIVE:
226
+ facets[1] = float(str(f2.getFacetValue().getLiteral()))
227
+ return facets
228
+ return facets
229
+
230
+ def __get_annotation_for_class(
231
+ self, ontology: OWLOntology, cls: OWLClass
232
+ ) -> typing.Generator[typing.Optional[OWLAnnotation], None, None]:
233
+ for axiom in ontology.getAxioms(AxiomType.ANNOTATION_ASSERTION):
234
+ if axiom.getProperty() != self.fuzzy_label:
235
+ continue
236
+ subject = axiom.getSubject()
237
+ try:
238
+ if subject.isIRI() and str(subject.asIRI().get()) == str(cls.getIRI()):
239
+ yield axiom.getAnnotation()
240
+ except:
241
+ if subject == cls:
242
+ yield axiom.getAnnotation()
243
+ return None
244
+
245
+ def process_datatype_annotations(self) -> None:
246
+ for ontology in self.ontologies:
247
+ for axiom in ontology.getAxioms(AxiomType.DECLARATION):
248
+ entity: OWLEntity = axiom.getEntity()
249
+ if not entity.isOWLDatatype():
250
+ continue
251
+ Util.debug(f"Datatype for ontology -> {entity}")
252
+ datatype: OWLDatatype = entity.asOWLDatatype()
253
+ annotations: set[OWLAnnotation] = set(
254
+ self.__get_annotation_for_class(ontology, datatype)
255
+ )
256
+ if annotations is None or len(annotations) == 0:
257
+ continue
258
+ if len(annotations) > 1:
259
+ Util.error(
260
+ f"Error: There are {len(annotations)} datatype annotations for {datatype}"
261
+ )
262
+ annotation: OWLAnnotation = list(annotations)[0].getValue()
263
+ annotation_str: str = str(annotation.getLiteral().replace('"', ""))
264
+ Util.debug(f"Annotation for {datatype} -> {annotation_str}")
265
+ datatype_name: str = self.get_short_name(datatype)
266
+ facets: list[float] = self.__get_facets(datatype_name)
267
+ c: typing.Union[ConceptDefinition, FuzzyModifier] = (
268
+ FuzzyOwl2Parser.parse_string(annotation_str)[0]
269
+ )
270
+ if isinstance(c, FuzzyDatatype):
271
+ c.set_min_value(facets[0])
272
+ c.set_max_value(facets[1])
273
+ Util.debug(f"Concept for {datatype} -> {c}")
274
+ self.fuzzy_datatypes[datatype_name] = c
275
+ if isinstance(c, LeftShoulderFunction):
276
+ self.write_left_shoulder_function_definition(datatype_name, c)
277
+ elif isinstance(c, RightShoulderFunction):
278
+ self.write_right_shoulder_function_definition(datatype_name, c)
279
+ elif isinstance(c, LinearFunction):
280
+ self.write_linear_function_definition(datatype_name, c)
281
+ elif isinstance(c, TriangularFunction):
282
+ self.write_triangular_function_definition(datatype_name, c)
283
+ elif isinstance(c, TrapezoidalFunction):
284
+ self.write_trapezoidal_function_definition(datatype_name, c)
285
+ elif isinstance(c, LinearModifier):
286
+ self.fuzzy_modifiers[datatype_name] = c
287
+ self.write_linear_modifier_definition(datatype_name, c)
288
+ elif isinstance(c, TriangularModifier):
289
+ self.fuzzy_modifiers[datatype_name] = c
290
+ self.write_triangular_modifier_definition(datatype_name, c)
291
+ else:
292
+ raise ValueError
293
+
294
+ def process_concept_annotations(self) -> None:
295
+ for ontology in self.ontologies:
296
+ for axiom in ontology.getAxioms(AxiomType.DECLARATION):
297
+ entity: OWLEntity = axiom.getEntity()
298
+ if not entity.isOWLClass():
299
+ continue
300
+ cls: OWLClass = entity.asOWLClass()
301
+ Util.debug(f"Concept for ontology -> {cls}")
302
+ annotations: set[OWLAnnotation] = set(
303
+ self.__get_annotation_for_class(ontology, cls)
304
+ )
305
+ if annotations is None or len(annotations) == 0:
306
+ continue
307
+ if len(annotations) > 1:
308
+ Util.error(
309
+ f"Error: There are {len(annotations)} class annotations for {cls}"
310
+ )
311
+ annotation: OWLAnnotation = list(annotations)[0].getValue()
312
+ annotation_str: str = str(annotation.getLiteral().replace('"', ""))
313
+ Util.debug(f"Annotation for concept {cls} -> {annotation_str}")
314
+ concept: ConceptDefinition = FuzzyOwl2Parser.parse_string(
315
+ annotation_str
316
+ )[0]
317
+ Util.debug(f"Concept -> {concept}")
318
+ name: str = self.get_short_name(cls)
319
+ if isinstance(concept, ModifiedConcept):
320
+ mod_name: str = concept.get_fuzzy_modifier()
321
+ if mod_name not in self.fuzzy_modifiers:
322
+ Util.error(f"Error: Fuzzy modifier {mod_name} not defined.")
323
+ self.defined_concepts[name] = concept
324
+ self.write_modified_concept_definition(name, concept)
325
+ elif isinstance(concept, FuzzyNominalConcept):
326
+ self.defined_concepts[name] = concept
327
+ self.write_fuzzy_nominal_concept_definition(name, concept)
328
+ elif isinstance(concept, WeightedConcept):
329
+ self.defined_concepts[name] = concept
330
+ self.write_weighted_concept_definition(name, concept)
331
+ elif isinstance(concept, WeightedMaxConcept):
332
+ self.defined_concepts[name] = concept
333
+ self.write_weighted_max_concept_definition(name, concept)
334
+ elif isinstance(concept, WeightedMinConcept):
335
+ self.defined_concepts[name] = concept
336
+ self.write_weighted_min_concept_definition(name, concept)
337
+ elif isinstance(concept, WeightedSumConcept):
338
+ self.defined_concepts[name] = concept
339
+ self.write_weighted_sum_concept_definition(name, concept)
340
+ elif isinstance(concept, WeightedSumZeroConcept):
341
+ self.defined_concepts[name] = concept
342
+ self.write_weighted_sum_zero_concept_definition(name, concept)
343
+ elif isinstance(concept, OwaConcept):
344
+ self.defined_concepts[name] = concept
345
+ self.write_owa_concept_definition(name, concept)
346
+ elif isinstance(concept, QowaConcept):
347
+ self.defined_concepts[name] = concept
348
+ self.write_qowa_concept_definition(name, concept)
349
+ elif isinstance(concept, ChoquetConcept):
350
+ self.defined_concepts[name] = concept
351
+ self.write_choquet_concept_definition(name, concept)
352
+ elif isinstance(concept, SugenoConcept):
353
+ self.defined_concepts[name] = concept
354
+ self.write_sugeno_concept_definition(name, concept)
355
+ elif isinstance(concept, QsugenoConcept):
356
+ self.defined_concepts[name] = concept
357
+ self.write_quasi_sugeno_concept_definition(name, concept)
358
+ else:
359
+ raise ValueError
360
+
361
+ def process_property_annotations(self) -> None:
362
+ for ontology in self.ontologies:
363
+ for axiom in ontology.getAxioms(AxiomType.DECLARATION):
364
+ entity: OWLEntity = axiom.getEntity()
365
+ if not (entity.isOWLDataProperty() or entity.isOWLObjectProperty()):
366
+ continue
367
+ property: OWLProperty = (
368
+ entity.asOWLObjectProperty()
369
+ if entity.isOWLObjectProperty()
370
+ else entity.asOWLDataProperty()
371
+ )
372
+ annotations: set[OWLAnnotation] = set(
373
+ self.__get_annotation_for_class(ontology, property)
374
+ )
375
+ if annotations is None or len(annotations) == 0:
376
+ continue
377
+ if len(annotations) > 1:
378
+ Util.error(
379
+ f"Error: There are {len(annotations)} property annotations for {property}"
380
+ )
381
+ annotation: OWLAnnotation = list(annotations)[0].getValue()
382
+ annotation_str: str = str(annotation.getLiteral().replace('"', ""))
383
+ Util.debug(f"Annotation for property {property} -> {annotation_str}")
384
+ prop: typing.Optional[ModifiedProperty] = (
385
+ FuzzyOwl2Parser.parse_string(annotation_str)
386
+ )[0]
387
+ if prop is None:
388
+ return
389
+ if not isinstance(prop, ModifiedProperty):
390
+ raise ValueError
391
+ name: str = self.get_short_name(property)
392
+ mod_name: str = prop.get_fuzzy_modifier()
393
+ if mod_name not in self.fuzzy_modifiers:
394
+ Util.error(f"Error: Fuzzy modifier {mod_name} not defined.")
395
+ self.defined_properties[name] = prop
396
+ self.write_modified_property_definition(name, prop)
397
+
398
+ def __get_degree(self, axiom: OWLAxiom) -> float:
399
+ annotations: set[OWLAnnotation] = set(axiom.getAnnotations())
400
+ if annotations is None or len(annotations) == 0:
401
+ return 1.0
402
+ if len(annotations) > 1:
403
+ Util.error(
404
+ f"Error: There are {len(annotations)} annotations for axiom {axiom}."
405
+ )
406
+ annotation: OWLAnnotation = list(annotations)[0].getValue()
407
+ annotation_str: str = str(annotation.getLiteral().replace('"', ""))
408
+ Util.debug(f"Annotation for degree -> {annotation_str}")
409
+ deg: float = FuzzyOwl2Parser.parse_string(annotation_str)[0]
410
+ Util.debug(f"Degree for axiom -> {deg}")
411
+ if not isinstance(deg, float):
412
+ raise ValueError
413
+ return deg
414
+
415
+ def __write_subclass_of_axiom(
416
+ self, ontology: OWLOntology, annotated: bool = True
417
+ ) -> None:
418
+ for axiom in ontology.getAxioms(AxiomType.SUBCLASS_OF):
419
+ subclass: OWLClassExpression = axiom.getSubClass()
420
+ superclass: OWLClassExpression = axiom.getSuperClass()
421
+ degree: float = self.__get_degree(axiom)
422
+ if annotated:
423
+ if degree == 1.0:
424
+ continue
425
+ Util.debug(f"Subjclass of axiom -> {axiom}")
426
+ self.write_subclass_of_axiom(subclass, superclass, degree)
427
+ self.processed_axioms.add(f"{subclass} => {superclass}")
428
+ else:
429
+ if (
430
+ degree == 1.0
431
+ and f"{subclass} => {superclass}" not in self.processed_axioms
432
+ ):
433
+ Util.debug(f"Not annotated subclass of axiom -> {axiom}")
434
+ self.processed_axioms.add(f"{subclass} => {superclass}")
435
+ self.write_subclass_of_axiom(subclass, superclass, degree)
436
+
437
+ def __write_subobject_property_axiom(
438
+ self, ontology: OWLOntology, annotated: bool = True
439
+ ) -> None:
440
+ for axiom in ontology.getAxioms(AxiomType.SUB_OBJECT_PROPERTY):
441
+ sub_property: OWLObjectPropertyExpression = axiom.getSubProperty()
442
+ super_property: OWLObjectPropertyExpression = axiom.getSuperProperty()
443
+ degree: float = self.__get_degree(axiom)
444
+ if annotated:
445
+ if degree != 1.0:
446
+ Util.debug(f"Sub-object property axiom -> {axiom}")
447
+ self.write_sub_object_property_of_axiom(
448
+ sub_property, super_property, degree
449
+ )
450
+ self.processed_axioms.add(f"{sub_property} => {super_property}")
451
+ else:
452
+ if (
453
+ degree == 1.0
454
+ and f"{sub_property} => {super_property}"
455
+ not in self.processed_axioms
456
+ ):
457
+ Util.debug(f"Not annotated sub-object property axiom -> {axiom}")
458
+ self.processed_axioms.add(f"{sub_property} => {super_property}")
459
+ self.write_sub_object_property_of_axiom(
460
+ sub_property, super_property, degree
461
+ )
462
+
463
+ def __write_subdata_property_axiom(
464
+ self, ontology: OWLOntology, annotated: bool = True
465
+ ) -> None:
466
+ for axiom in ontology.getAxioms(AxiomType.SUB_DATA_PROPERTY):
467
+ sub_property: OWLDataPropertyExpression = axiom.getSubProperty()
468
+ super_property: OWLDataPropertyExpression = axiom.getSuperProperty()
469
+ degree: float = self.__get_degree(axiom)
470
+ if annotated:
471
+ if degree != 1.0:
472
+ Util.debug(f"Sub-data property axiom -> {axiom}")
473
+ self.write_sub_data_property_of_axiom(
474
+ sub_property, super_property, degree
475
+ )
476
+ self.processed_axioms.add(f"{sub_property} => {super_property}")
477
+ else:
478
+ if (
479
+ degree == 1.0
480
+ and f"{sub_property} => {super_property}"
481
+ not in self.processed_axioms
482
+ ):
483
+ Util.debug(f"Not annotated sub-data property axiom -> {axiom}")
484
+ self.processed_axioms.add(f"{sub_property} => {super_property}")
485
+ self.write_sub_data_property_of_axiom(
486
+ sub_property, super_property, degree
487
+ )
488
+
489
+ def __write_subproperty_chain_of_axiom(
490
+ self, ontology: OWLOntology, annotated: bool = True
491
+ ) -> None:
492
+ for axiom in ontology.getAxioms(AxiomType.SUB_PROPERTY_CHAIN_OF):
493
+ chain: list[OWLObjectPropertyExpression] = axiom.getPropertyChain()
494
+ super_property: OWLDataPropertyExpression = axiom.getSuperProperty()
495
+ degree: float = self.__get_degree(axiom)
496
+ if annotated:
497
+ if degree != 1.0:
498
+ Util.debug(f"Sub property chain of axiom -> {axiom}")
499
+ self.write_sub_property_chain_of_axiom(
500
+ chain, super_property, degree
501
+ )
502
+ self.processed_axioms.add(f"{chain} => {super_property}")
503
+ else:
504
+ if (
505
+ degree == 1.0
506
+ and f"{chain} => {super_property}" not in self.processed_axioms
507
+ ):
508
+ Util.debug(f"Not annotated sub property chain of axiom -> {axiom}")
509
+ self.processed_axioms.add(f"{chain} => {super_property}")
510
+ self.write_sub_property_chain_of_axiom(
511
+ chain, super_property, degree
512
+ )
513
+
514
+ def __write_class_assertion_axiom(
515
+ self, ontology: OWLOntology, annotated: bool = True
516
+ ) -> None:
517
+ for axiom in ontology.getAxioms(AxiomType.CLASS_ASSERTION):
518
+ cls: OWLClassExpression = axiom.getClassExpression()
519
+ ind: OWLIndividual = axiom.getIndividual()
520
+ degree: float = self.__get_degree(axiom)
521
+ if annotated:
522
+ if degree != 1.0:
523
+ Util.debug(f"Class assertion axiom -> {axiom}")
524
+ self.write_concept_assertion_axiom(ind, cls, degree)
525
+ self.processed_axioms.add(f"{ind}:{cls}")
526
+ else:
527
+ if degree == 1.0 and f"{ind}:{cls}" not in self.processed_axioms:
528
+ Util.debug(f"Not annotated class assertion axiom -> {axiom}")
529
+ self.processed_axioms.add(f"{ind}:{cls}")
530
+ self.write_concept_assertion_axiom(ind, cls, degree)
531
+
532
+ def __write_object_property_assertion_axiom(
533
+ self, ontology: OWLOntology, annotated: bool = True
534
+ ) -> None:
535
+ for axiom in ontology.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION):
536
+ ind1: OWLIndividual = axiom.getSubject()
537
+ ind2: OWLIndividual = axiom.getObject()
538
+ prop: OWLObjectPropertyExpression = axiom.getProperty()
539
+ degree: float = self.__get_degree(axiom)
540
+ if annotated:
541
+ if degree != 1.0:
542
+ Util.debug(f"Object property assertion axiom -> {axiom}")
543
+ self.write_object_property_assertion_axiom(ind1, ind2, prop, degree)
544
+ self.processed_axioms.add(f"({ind1}, {ind2}):{prop}")
545
+ else:
546
+ if (
547
+ degree == 1.0
548
+ and f"({ind1}, {ind2}):{prop}" not in self.processed_axioms
549
+ ):
550
+ Util.debug(
551
+ f"Not annotated object property assertion axiom -> {axiom}"
552
+ )
553
+ self.processed_axioms.add(f"({ind1}, {ind2}):{prop}")
554
+ self.write_object_property_assertion_axiom(ind1, ind2, prop, degree)
555
+
556
+ def __write_data_property_assertion_axiom(
557
+ self, ontology: OWLOntology, annotated: bool = True
558
+ ) -> None:
559
+ for axiom in ontology.getAxioms(AxiomType.DATA_PROPERTY_ASSERTION):
560
+ ind1: OWLIndividual = axiom.getSubject()
561
+ ind2: OWLIndividual = axiom.getObject()
562
+ prop: OWLDataPropertyExpression = axiom.getProperty()
563
+ degree: float = self.__get_degree(axiom)
564
+ if annotated:
565
+ if degree != 1.0:
566
+ Util.debug(f"Data property assertion axiom -> {axiom}")
567
+ self.write_data_property_assertion_axiom(ind1, ind2, prop, degree)
568
+ self.processed_axioms.add(f"({ind1}, {ind2}):{prop}")
569
+ else:
570
+ if (
571
+ degree == 1.0
572
+ and f"({ind1}, {ind2}):{prop}" not in self.processed_axioms
573
+ ):
574
+ Util.debug(
575
+ f"Not annotated data property assertion axiom -> {axiom}"
576
+ )
577
+ self.processed_axioms.add(f"({ind1}, {ind2}):{prop}")
578
+ self.write_data_property_assertion_axiom(ind1, ind2, prop, degree)
579
+
580
+ def __write_negative_object_property_assertion_axiom(
581
+ self, ontology: OWLOntology, annotated: bool = True
582
+ ) -> None:
583
+ for axiom in ontology.getAxioms(AxiomType.NEGATIVE_OBJECT_PROPERTY_ASSERTION):
584
+ ind1: OWLIndividual = axiom.getSubject()
585
+ ind2: OWLIndividual = axiom.getObject()
586
+ prop: OWLObjectPropertyExpression = axiom.getProperty()
587
+ degree: float = self.__get_degree(axiom)
588
+ if annotated:
589
+ if degree != 1.0:
590
+ Util.debug(f"Negative object property assertion axiom -> {axiom}")
591
+ self.write_negative_object_property_assertion_axiom(
592
+ ind1, ind2, prop, degree
593
+ )
594
+ self.processed_axioms.add(f"({ind1}, {ind2}):not {prop}")
595
+ else:
596
+ if (
597
+ degree == 1.0
598
+ and f"({ind1}, {ind2}):not {prop}" not in self.processed_axioms
599
+ ):
600
+ Util.debug(
601
+ f"Not annotated negative object property assertion axiom -> {axiom}"
602
+ )
603
+ self.processed_axioms.add(f"({ind1}, {ind2}):not {prop}")
604
+ self.write_negative_object_property_assertion_axiom(
605
+ ind1, ind2, prop, degree
606
+ )
607
+
608
+ def __write_negative_data_property_assertion_axiom(
609
+ self, ontology: OWLOntology, annotated: bool = True
610
+ ) -> None:
611
+ for axiom in ontology.getAxioms(AxiomType.NEGATIVE_DATA_PROPERTY_ASSERTION):
612
+ ind1: OWLIndividual = axiom.getSubject()
613
+ ind2: OWLIndividual = axiom.getObject()
614
+ prop: OWLDataPropertyExpression = axiom.getProperty()
615
+ degree: float = self.__get_degree(axiom)
616
+ if annotated:
617
+ if degree != 1.0:
618
+ Util.debug(f"Negative data property assertion axiom -> {axiom}")
619
+ self.write_negative_data_property_assertion_axiom(
620
+ ind1, ind2, prop, degree
621
+ )
622
+ self.processed_axioms.add(f"({ind1}, {ind2}):not {prop}")
623
+ else:
624
+ if (
625
+ degree == 1.0
626
+ and f"({ind1}, {ind2}):not {prop}" not in self.processed_axioms
627
+ ):
628
+ Util.debug(
629
+ f"Not annotated negative data property assertion axiom -> {axiom}"
630
+ )
631
+ self.processed_axioms.add(f"({ind1}, {ind2}):not {prop}")
632
+ self.write_negative_data_property_assertion_axiom(
633
+ ind1, ind2, prop, degree
634
+ )
635
+
636
+ def process_ontology_axioms(self) -> None:
637
+ for ontology in self.ontologies:
638
+ # ########
639
+ # TBox
640
+ # ########
641
+ for axiom in ontology.getAxioms(AxiomType.DISJOINT_CLASSES):
642
+ if str(axiom) not in self.processed_axioms:
643
+ Util.debug(f"Disjoint axiom -> {axiom}")
644
+ self.processed_axioms.add(str(axiom))
645
+ self.write_disjoint_classes_axiom(axiom.getClassExpressions())
646
+ for axiom in ontology.getAxioms(AxiomType.DISJOINT_UNION):
647
+ if str(axiom) not in self.processed_axioms:
648
+ Util.debug(f"Disjoint union axiom -> {axiom}")
649
+ self.processed_axioms.add(str(axiom))
650
+ self.write_disjoint_union_axiom(axiom.getClassExpressions())
651
+ self.__write_subclass_of_axiom(ontology, annotated=True)
652
+ for axiom in ontology.getAxioms(AxiomType.EQUIVALENT_CLASSES):
653
+ if str(axiom) not in self.processed_axioms:
654
+ Util.debug(f"Equivalent classes axiom -> {axiom}")
655
+ self.processed_axioms.add(str(axiom))
656
+ self.write_equivalent_classes_axiom(axiom.getClassExpressions())
657
+ for cls in ontology.getClassesInSignature():
658
+ if not cls.isTopEntity() and str(cls) not in self.processed_axioms:
659
+ Util.debug(f"Concept declaration axiom -> {cls}")
660
+ self.processed_axioms.add(str(cls))
661
+ self.write_concept_declaration(cls)
662
+ # ########
663
+ # RBox
664
+ # ########
665
+ self.__write_subobject_property_axiom(ontology, annotated=True)
666
+ self.__write_subdata_property_axiom(ontology, annotated=True)
667
+ self.__write_subproperty_chain_of_axiom(ontology, annotated=True)
668
+ for axiom in ontology.getAxioms(AxiomType.EQUIVALENT_OBJECT_PROPERTIES):
669
+ Util.debug(f"Equivalent object properties axiom -> {axiom}")
670
+ if str(axiom) not in self.processed_axioms:
671
+ self.processed_axioms.add(str(axiom))
672
+ self.write_equivalent_object_properties_axiom(axiom.getProperties())
673
+ for axiom in ontology.getAxioms(AxiomType.EQUIVALENT_DATA_PROPERTIES):
674
+ if str(axiom) not in self.processed_axioms:
675
+ Util.debug(f"Equivalent data properties axiom -> {axiom}")
676
+ self.processed_axioms.add(str(axiom))
677
+ self.write_equivalent_data_properties_axiom(axiom.getProperties())
678
+ for axiom in ontology.getAxioms(AxiomType.TRANSITIVE_OBJECT_PROPERTY):
679
+ if str(axiom) not in self.processed_axioms:
680
+ Util.debug(f"Transitive object property axiom -> {axiom}")
681
+ self.processed_axioms.add(str(axiom))
682
+ self.write_transitive_object_property_axiom(axiom.getProperty())
683
+ for axiom in ontology.getAxioms(AxiomType.SYMMETRIC_OBJECT_PROPERTY):
684
+ if str(axiom) not in self.processed_axioms:
685
+ Util.debug(f"Symmetric object property axiom -> {axiom}")
686
+ self.processed_axioms.add(str(axiom))
687
+ self.write_symmetric_object_property_axiom(axiom.getProperty())
688
+ for axiom in ontology.getAxioms(AxiomType.ASYMMETRIC_OBJECT_PROPERTY):
689
+ if str(axiom) not in self.processed_axioms:
690
+ Util.debug(f"Asymmetric object property axiom -> {axiom}")
691
+ self.processed_axioms.add(str(axiom))
692
+ self.write_asymmetric_object_property_axiom(axiom.getProperty())
693
+ for axiom in ontology.getAxioms(AxiomType.REFLEXIVE_OBJECT_PROPERTY):
694
+ if str(axiom) not in self.processed_axioms:
695
+ Util.debug(f"Reflexive object property axiom -> {axiom}")
696
+ self.processed_axioms.add(str(axiom))
697
+ self.write_reflexive_object_property_axiom(axiom.getProperty())
698
+ for axiom in ontology.getAxioms(AxiomType.IRREFLEXIVE_OBJECT_PROPERTY):
699
+ if str(axiom) not in self.processed_axioms:
700
+ Util.debug(f"Irreflexive object property axiom -> {axiom}")
701
+ self.processed_axioms.add(str(axiom))
702
+ self.write_irreflexive_object_property_axiom(axiom.getProperty())
703
+ for axiom in ontology.getAxioms(AxiomType.FUNCTIONAL_OBJECT_PROPERTY):
704
+ if str(axiom) not in self.processed_axioms:
705
+ Util.debug(f"Functional object property axiom -> {axiom}")
706
+ self.processed_axioms.add(str(axiom))
707
+ self.write_functional_object_property_axiom(axiom.getProperty())
708
+ for axiom in ontology.getAxioms(AxiomType.FUNCTIONAL_DATA_PROPERTY):
709
+ if str(axiom) not in self.processed_axioms:
710
+ Util.debug(f"Functional data property axiom -> {axiom}")
711
+ self.processed_axioms.add(str(axiom))
712
+ self.write_functional_data_property_axiom(axiom.getProperty())
713
+ for axiom in ontology.getAxioms(AxiomType.INVERSE_OBJECT_PROPERTIES):
714
+ if str(axiom) not in self.processed_axioms:
715
+ Util.debug(f"Inverse object properties axiom -> {axiom}")
716
+ self.processed_axioms.add(str(axiom))
717
+ self.write_inverse_object_property_axiom(
718
+ axiom.getFirstProperty(), axiom.getSecondProperty()
719
+ )
720
+ for axiom in ontology.getAxioms(
721
+ AxiomType.INVERSE_FUNCTIONAL_OBJECT_PROPERTY
722
+ ):
723
+ if str(axiom) not in self.processed_axioms:
724
+ Util.debug(f"Inverse functional object property axiom -> {axiom}")
725
+ self.processed_axioms.add(str(axiom))
726
+ self.write_inverse_functional_object_property_axiom(
727
+ axiom.getProperty()
728
+ )
729
+ for axiom in ontology.getAxioms(AxiomType.OBJECT_PROPERTY_DOMAIN):
730
+ if str(axiom) not in self.processed_axioms:
731
+ Util.debug(f"Object property domain axiom -> {axiom}")
732
+ self.processed_axioms.add(str(axiom))
733
+ self.write_object_property_domain_axiom(
734
+ axiom.getProperty(), axiom.getDomain()
735
+ )
736
+ for axiom in ontology.getAxioms(AxiomType.OBJECT_PROPERTY_RANGE):
737
+ if str(axiom) not in self.processed_axioms:
738
+ Util.debug(f"Object property range axiom -> {axiom}")
739
+ self.processed_axioms.add(str(axiom))
740
+ self.write_object_property_range_axiom(
741
+ axiom.getProperty(), axiom.getRange()
742
+ )
743
+ for axiom in ontology.getAxioms(AxiomType.DATA_PROPERTY_DOMAIN):
744
+ if str(axiom) not in self.processed_axioms:
745
+ Util.debug(f"Data property domain axiom -> {axiom}")
746
+ self.processed_axioms.add(str(axiom))
747
+ self.write_data_property_domain_axiom(
748
+ axiom.getProperty(), axiom.getDomain()
749
+ )
750
+ for axiom in ontology.getAxioms(AxiomType.DATA_PROPERTY_RANGE):
751
+ if str(axiom) not in self.processed_axioms:
752
+ Util.debug(f"Data property range axiom -> {axiom}")
753
+ self.processed_axioms.add(str(axiom))
754
+ self.write_data_property_range_axiom(
755
+ axiom.getProperty(), axiom.getRange()
756
+ )
757
+ for axiom in ontology.getAxioms(AxiomType.DISJOINT_OBJECT_PROPERTIES):
758
+ if str(axiom) not in self.processed_axioms:
759
+ Util.debug(f"Disjoint object properties axiom -> {axiom}")
760
+ self.processed_axioms.add(str(axiom))
761
+ self.write_disjoint_object_properties_axiom(axiom.getProperties())
762
+ for axiom in ontology.getAxioms(AxiomType.DISJOINT_DATA_PROPERTIES):
763
+ if str(axiom) not in self.processed_axioms:
764
+ Util.debug(f"Disjoint data properties axiom -> {axiom}")
765
+ self.processed_axioms.add(str(axiom))
766
+ self.write_disjoint_data_properties_axiom(axiom.getProperties())
767
+ # ########
768
+ # ABox
769
+ # ########
770
+ self.__write_class_assertion_axiom(ontology, annotated=True)
771
+ self.__write_object_property_assertion_axiom(ontology, annotated=True)
772
+ self.__write_data_property_assertion_axiom(ontology, annotated=True)
773
+ self.__write_negative_object_property_assertion_axiom(
774
+ ontology, annotated=True
775
+ )
776
+ self.__write_negative_data_property_assertion_axiom(
777
+ ontology, annotated=True
778
+ )
779
+ for axiom in ontology.getAxioms(AxiomType.SAME_INDIVIDUAL):
780
+ if str(axiom) not in self.processed_axioms:
781
+ Util.debug(f"Same individual axiom -> {axiom}")
782
+ self.processed_axioms.add(str(axiom))
783
+ self.write_same_individual_axiom(axiom.getIndividuals())
784
+ for axiom in ontology.getAxioms(AxiomType.DIFFERENT_INDIVIDUALS):
785
+ if str(axiom) not in self.processed_axioms:
786
+ Util.debug(f"Different individuals axiom -> {axiom}")
787
+ self.processed_axioms.add(str(axiom))
788
+ self.write_different_individuals_axiom(axiom.getIndividuals())
789
+ # ########
790
+ # Not annotated sublcass axioms
791
+ # ########
792
+ self.__write_subclass_of_axiom(ontology, annotated=False)
793
+ self.__write_subobject_property_axiom(ontology, annotated=False)
794
+ self.__write_subdata_property_axiom(ontology, annotated=False)
795
+ self.__write_subproperty_chain_of_axiom(ontology, annotated=False)
796
+ self.__write_class_assertion_axiom(ontology, annotated=False)
797
+ self.__write_object_property_assertion_axiom(ontology, annotated=False)
798
+ self.__write_data_property_assertion_axiom(ontology, annotated=False)
799
+ self.__write_negative_object_property_assertion_axiom(
800
+ ontology, annotated=False
801
+ )
802
+ self.__write_negative_data_property_assertion_axiom(
803
+ ontology, annotated=False
804
+ )
805
+
806
+ def get_class_name(self, c: OWLClassExpression) -> str:
807
+ c_type: ClassExpressionType = c.getClassExpressionType()
808
+ if c_type == ClassExpressionType.OWL_CLASS:
809
+ d: OWLClass = typing.cast(OWLClass, c)
810
+ if d.isOWLThing():
811
+ return self.get_top_concept_name()
812
+ if d.isOWLNothing():
813
+ return self.get_bottom_concept_name()
814
+ return self.get_atomic_concept_name(d)
815
+ elif c_type == ClassExpressionType.OBJECT_INTERSECTION_OF:
816
+ operands: OWLObjectIntersectionOf = typing.cast(
817
+ OWLObjectIntersectionOf, c
818
+ ).getOperands()
819
+ return self.get_object_intersection_of_name(operands)
820
+ elif c_type == ClassExpressionType.OBJECT_UNION_OF:
821
+ operands: OWLObjectUnionOf = typing.cast(OWLObjectUnionOf, c).getOperands()
822
+ return self.get_object_union_of_name(operands)
823
+ elif c_type == ClassExpressionType.OBJECT_SOME_VALUES_FROM:
824
+ some: OWLObjectSomeValuesFrom = typing.cast(OWLObjectSomeValuesFrom, c)
825
+ return self.get_object_some_values_from_name(
826
+ some.getProperty(), some.getFiller()
827
+ )
828
+ elif c_type == ClassExpressionType.OBJECT_ALL_VALUES_FROM:
829
+ all: OWLObjectAllValuesFrom = typing.cast(OWLObjectAllValuesFrom, c)
830
+ return self.get_object_all_values_from_name(
831
+ all.getProperty(), all.getFiller()
832
+ )
833
+ elif c_type == ClassExpressionType.DATA_SOME_VALUES_FROM:
834
+ some: OWLDataSomeValuesFrom = typing.cast(OWLDataSomeValuesFrom, c)
835
+ return self.get_data_some_values_from_name(
836
+ some.getProperty(), some.getFiller()
837
+ )
838
+ elif c_type == ClassExpressionType.DATA_ALL_VALUES_FROM:
839
+ all: OWLDataAllValuesFrom = typing.cast(OWLDataAllValuesFrom, c)
840
+ return self.get_data_all_values_from_name(
841
+ all.getProperty(), all.getFiller()
842
+ )
843
+ elif c_type == ClassExpressionType.OBJECT_COMPLEMENT_OF:
844
+ complement: OWLObjectComplementOf = typing.cast(OWLObjectComplementOf, c)
845
+ return self.get_object_complement_of_name(complement.getOperand())
846
+ elif c_type == ClassExpressionType.OBJECT_HAS_SELF:
847
+ has_self: OWLObjectHasSelf = typing.cast(OWLObjectHasSelf, c)
848
+ return self.get_object_has_self_name(has_self.getProperty())
849
+ elif c_type == ClassExpressionType.OBJECT_ONE_OF:
850
+ one_of: OWLObjectOneOf = typing.cast(OWLObjectOneOf, c)
851
+ return self.get_object_one_of_name(one_of.getIndividuals())
852
+ elif c_type == ClassExpressionType.OBJECT_HAS_VALUE:
853
+ has_value: OWLObjectHasValue = typing.cast(OWLObjectHasValue, c)
854
+ return self.get_object_has_value_name(
855
+ has_value.getProperty(), has_value.getValue()
856
+ )
857
+ elif c_type == ClassExpressionType.DATA_HAS_VALUE:
858
+ has_value: OWLDataHasValue = typing.cast(OWLDataHasValue, c)
859
+ return self.get_data_has_value_name(
860
+ has_value.getProperty(), has_value.getValue()
861
+ )
862
+ elif c_type == ClassExpressionType.OBJECT_MIN_CARDINALITY:
863
+ min_card: OWLObjectMinCardinality = typing.cast(OWLObjectMinCardinality, c)
864
+ if min_card.isQualified():
865
+ return self.get_object_min_cardinality_restriction(
866
+ min_card.getCardinality(),
867
+ min_card.getProperty(),
868
+ min_card.getFiller(),
869
+ )
870
+ else:
871
+ return self.get_object_min_cardinality_restriction(
872
+ min_card.getCardinality(), min_card.getProperty()
873
+ )
874
+ elif c_type == ClassExpressionType.OBJECT_MAX_CARDINALITY:
875
+ max_card: OWLObjectMaxCardinality = typing.cast(OWLObjectMaxCardinality, c)
876
+ if max_card.isQualified():
877
+ return self.get_object_max_cardinality_restriction(
878
+ max_card.getCardinality(),
879
+ max_card.getProperty(),
880
+ max_card.getFiller(),
881
+ )
882
+ else:
883
+ return self.get_object_max_cardinality_restriction(
884
+ max_card.getCardinality(), max_card.getProperty()
885
+ )
886
+ elif c_type == ClassExpressionType.OBJECT_EXACT_CARDINALITY:
887
+ exact_card: OWLObjectExactCardinality = typing.cast(
888
+ OWLObjectExactCardinality, c
889
+ )
890
+ if exact_card.isQualified():
891
+ return self.get_object_exact_cardinality_restriction(
892
+ exact_card.getCardinality(),
893
+ exact_card.getProperty(),
894
+ exact_card.getFiller(),
895
+ )
896
+ else:
897
+ return self.get_object_exact_cardinality_restriction(
898
+ exact_card.getCardinality(), exact_card.getProperty()
899
+ )
900
+ elif c_type == ClassExpressionType.DATA_MIN_CARDINALITY:
901
+ min_card: OWLDataMinCardinality = typing.cast(OWLDataMinCardinality, c)
902
+ if min_card.isQualified():
903
+ return self.get_data_min_cardinality_restriction(
904
+ min_card.getCardinality(),
905
+ min_card.getProperty(),
906
+ min_card.getFiller(),
907
+ )
908
+ else:
909
+ return self.get_data_min_cardinality_restriction(
910
+ min_card.getCardinality(), min_card.getProperty()
911
+ )
912
+ elif c_type == ClassExpressionType.DATA_MAX_CARDINALITY:
913
+ max_card: OWLDataMaxCardinality = typing.cast(OWLDataMaxCardinality, c)
914
+ if max_card.isQualified():
915
+ return self.get_data_max_cardinality_restriction(
916
+ max_card.getCardinality(),
917
+ max_card.getProperty(),
918
+ max_card.getFiller(),
919
+ )
920
+ else:
921
+ return self.get_data_max_cardinality_restriction(
922
+ max_card.getCardinality(), max_card.getProperty()
923
+ )
924
+ elif c_type == ClassExpressionType.DATA_EXACT_CARDINALITY:
925
+ exact_card: OWLDataExactCardinality = typing.cast(
926
+ OWLDataExactCardinality, c
927
+ )
928
+ if exact_card.isQualified():
929
+ return self.get_data_exact_cardinality_restriction(
930
+ exact_card.getCardinality(),
931
+ exact_card.getProperty(),
932
+ exact_card.getFiller(),
933
+ )
934
+ else:
935
+ return self.get_data_exact_cardinality_restriction(
936
+ exact_card.getCardinality(), exact_card.getProperty()
937
+ )
938
+ else:
939
+ raise ValueError
940
+
941
+ def get_object_property_name(self, p: OWLObjectPropertyExpression) -> str:
942
+ if p.isOWLTopObjectProperty():
943
+ return self.get_top_object_property_name()
944
+ elif p.isOWLBottomObjectProperty():
945
+ return self.get_bottom_object_property_name()
946
+ else:
947
+ return self.get_atomic_object_property_name(p.asOWLObjectProperty())
948
+
949
+ def get_data_property_name(self, p: OWLDataPropertyExpression) -> str:
950
+ if p.isOWLTopDataProperty():
951
+ return self.get_top_data_property_name()
952
+ elif p.isOWLBottomDataProperty():
953
+ return self.get_bottom_data_property_name()
954
+ else:
955
+ return self.get_atomic_data_property_name(p.asOWLDataProperty())
956
+
957
+ def get_individual_name(self, i: OWLIndividual) -> typing.Optional[str]:
958
+ if i.isAnonymous():
959
+ Util.info(f"Anonymous individual not supported")
960
+ return None
961
+ else:
962
+ name: str = self.get_short_name(i.asOWLNamedIndividual())
963
+ Util.info(f"Individual {name}")
964
+ return ""
965
+
966
+ def get_top_concept_name(self) -> str:
967
+ Util.info(f"Print Top concept")
968
+ return ""
969
+
970
+ def get_bottom_concept_name(self) -> str:
971
+ Util.info(f"Print Bottom concept")
972
+ return ""
973
+
974
+ def get_atomic_concept_name(self, c: OWLClass) -> str:
975
+ name: str = self.get_short_name(c)
976
+ Util.info(f"Print Atomic concept {name}")
977
+ return ""
978
+
979
+ def get_object_intersection_of_name(self, operands: set[OWLClassExpression]) -> str:
980
+ Util.info(f"Print ObjectIntersectionOf {operands}")
981
+ return ""
982
+
983
+ def get_object_union_of_name(self, operands: set[OWLClassExpression]) -> str:
984
+ Util.info(f"Print ObjectUnionOf {operands}")
985
+ return ""
986
+
987
+ def get_object_some_values_from_name(
988
+ self, p: OWLObjectPropertyExpression, c: OWLClassExpression
989
+ ) -> str:
990
+ Util.info(f"Print ObjectSomeValuesFrom({p} {c})")
991
+ return ""
992
+
993
+ def get_object_all_values_from_name(
994
+ self, p: OWLObjectPropertyExpression, c: OWLClassExpression
995
+ ) -> str:
996
+ Util.info(f"Print ObjectAllValuesFrom({p} {c})")
997
+ return ""
998
+
999
+ def get_data_some_values_from_name(
1000
+ self, p: OWLDataPropertyExpression, range: OWLDataRange
1001
+ ) -> str:
1002
+ Util.info(f"Print DataSomeValuesFrom({p} {range})")
1003
+ return ""
1004
+
1005
+ def get_data_all_values_from_name(
1006
+ self, p: OWLDataPropertyExpression, range: OWLDataRange
1007
+ ) -> str:
1008
+ Util.info(f"Print DataAllValuesFrom({p} {range})")
1009
+ return ""
1010
+
1011
+ def get_object_complement_of_name(self, c: OWLClassExpression) -> str:
1012
+ Util.info(f"Print ObjectComplement({c})")
1013
+ return ""
1014
+
1015
+ def get_object_has_self_name(self, p: OWLObjectPropertyExpression) -> str:
1016
+ Util.info(f"Print ObjectHasSelf({p})")
1017
+ return ""
1018
+
1019
+ def get_object_one_of_name(self, ind_set: set[OWLIndividual]) -> str:
1020
+ Util.info(f"Print ObjectOneOf({ind_set})")
1021
+ return ""
1022
+
1023
+ def get_object_has_value_name(
1024
+ self, p: OWLObjectPropertyExpression, i: OWLIndividual
1025
+ ) -> str:
1026
+ Util.info(f"Print ObjectHasValue({p} {i})")
1027
+ return ""
1028
+
1029
+ def get_data_has_value_name(
1030
+ self, p: OWLDataPropertyExpression, literal: OWLLiteral
1031
+ ) -> str:
1032
+ Util.info(f"Print DataHasValue({p} {literal})")
1033
+ return ""
1034
+
1035
+ def get_object_min_cardinality_restriction(
1036
+ self,
1037
+ cardinality: int,
1038
+ p: OWLObjectPropertyExpression,
1039
+ c: OWLClassExpression = None,
1040
+ ) -> str:
1041
+ if c is not None:
1042
+ Util.info(f"Print ObjectMinCardinalityRestriction({cardinality} {p} {c})")
1043
+ else:
1044
+ Util.info(f"Print ObjectMinCardinalityRestriction({cardinality} {p})")
1045
+ return ""
1046
+
1047
+ def get_object_max_cardinality_restriction(
1048
+ self,
1049
+ cardinality: int,
1050
+ p: OWLObjectPropertyExpression,
1051
+ c: OWLClassExpression = None,
1052
+ ) -> str:
1053
+ if c is not None:
1054
+ Util.info(f"Print ObjectMaxCardinalityRestriction({cardinality} {p} {c})")
1055
+ else:
1056
+ Util.info(f"Print ObjectMaxCardinalityRestriction({cardinality} {p})")
1057
+ return ""
1058
+
1059
+ def get_object_exact_cardinality_restriction(
1060
+ self,
1061
+ cardinality: int,
1062
+ p: OWLObjectPropertyExpression,
1063
+ c: OWLClassExpression = None,
1064
+ ) -> str:
1065
+ if c is not None:
1066
+ Util.info(f"Print ObjectExactCardinalityRestriction({cardinality} {p} {c})")
1067
+ else:
1068
+ Util.info(f"Print ObjectExactCardinalityRestriction({cardinality} {p})")
1069
+ return ""
1070
+
1071
+ def get_data_min_cardinality_restriction(
1072
+ self, cardinality: int, p: OWLDataPropertyExpression, range: OWLDataRange = None
1073
+ ) -> str:
1074
+ if range is not None:
1075
+ Util.info(f"Print DataMinCardinalityRestriction({cardinality} {p} {range})")
1076
+ else:
1077
+ Util.info(f"Print DataMinCardinalityRestriction({cardinality} {p})")
1078
+ return ""
1079
+
1080
+ def get_data_max_cardinality_restriction(
1081
+ self, cardinality: int, p: OWLDataPropertyExpression, range: OWLDataRange = None
1082
+ ) -> str:
1083
+ if range is not None:
1084
+ Util.info(f"Print DataMaxCardinalityRestriction({cardinality} {p} {range})")
1085
+ else:
1086
+ Util.info(f"Print DataMaxCardinalityRestriction({cardinality} {p})")
1087
+ return ""
1088
+
1089
+ def get_data_exact_cardinality_restriction(
1090
+ self, cardinality: int, p: OWLDataPropertyExpression, range: OWLDataRange = None
1091
+ ) -> str:
1092
+ if range is not None:
1093
+ Util.info(
1094
+ f"Print DataExactCardinalityRestriction({cardinality} {p} {range})"
1095
+ )
1096
+ else:
1097
+ Util.info(f"Print DataExactCardinalityRestriction({cardinality} {p})")
1098
+ return ""
1099
+
1100
+ def get_top_object_property_name(self) -> str:
1101
+ Util.info("Write top object property")
1102
+ return ""
1103
+
1104
+ def get_bottom_object_property_name(self) -> str:
1105
+ Util.info("Write bottom object property")
1106
+ return ""
1107
+
1108
+ def get_atomic_object_property_name(self, p: OWLObjectProperty) -> str:
1109
+ name: str = self.get_short_name(p)
1110
+ Util.info(f"Write object property {name}")
1111
+ return ""
1112
+
1113
+ def get_top_data_property_name(self) -> str:
1114
+ Util.info("Write top data property")
1115
+ return ""
1116
+
1117
+ def get_bottom_data_property_name(self) -> str:
1118
+ Util.info("Write bottom data property")
1119
+ return ""
1120
+
1121
+ def get_atomic_data_property_name(self, p: OWLDataProperty) -> str:
1122
+ name: str = self.get_short_name(p)
1123
+ Util.info(f"Write data property {name}")
1124
+ return ""
1125
+
1126
+ def write_fuzzy_logic(self, logic: str) -> None:
1127
+ Util.info(f"Write fuzzy logic {logic}")
1128
+
1129
+ def write_concept_declaration(self, c: OWLClassExpression) -> None:
1130
+ Util.info(f"Write declaration {c}")
1131
+
1132
+ def write_data_property_declaration(self, dp: OWLDataPropertyExpression) -> None:
1133
+ Util.info(f"Write declaration {dp}")
1134
+
1135
+ def write_object_property_declaration(
1136
+ self, op: OWLObjectPropertyExpression
1137
+ ) -> None:
1138
+ Util.info(f"Write declaration {op}")
1139
+
1140
+ def write_concept_assertion_axiom(
1141
+ self, i: OWLIndividual, c: OWLClassExpression, d: float
1142
+ ) -> None:
1143
+ Util.info(f"Write axiom {i}: {c} >= {d}")
1144
+
1145
+ def write_object_property_assertion_axiom(
1146
+ self,
1147
+ i1: OWLIndividual,
1148
+ i2: OWLIndividual,
1149
+ p: OWLObjectPropertyExpression,
1150
+ d: float,
1151
+ ) -> None:
1152
+ Util.info(f"Write axiom ({i1}, {i2}): {p} >= {d}")
1153
+
1154
+ def write_data_property_assertion_axiom(
1155
+ self,
1156
+ i1: OWLIndividual,
1157
+ i2: OWLIndividual,
1158
+ p: OWLDataPropertyExpression,
1159
+ d: float,
1160
+ ) -> None:
1161
+ Util.info(f"Write axiom ({i1}, {i2}): {p} >= {d}")
1162
+
1163
+ def write_negative_object_property_assertion_axiom(
1164
+ self,
1165
+ i1: OWLIndividual,
1166
+ i2: OWLIndividual,
1167
+ p: OWLObjectPropertyExpression,
1168
+ d: float,
1169
+ ) -> None:
1170
+ Util.info(f"Write axiom ({i1}, {i2}): not {p} >= {d}")
1171
+
1172
+ def write_negative_data_property_assertion_axiom(
1173
+ self,
1174
+ i1: OWLIndividual,
1175
+ i2: OWLIndividual,
1176
+ p: OWLDataPropertyExpression,
1177
+ d: float,
1178
+ ) -> None:
1179
+ Util.info(f"Write axiom ({i1}, {i2}): not {p} >= {d}")
1180
+
1181
+ def write_same_individual_axiom(self, ind_set: set[OWLIndividual]) -> None:
1182
+ Util.info(f"Write axiom SameIndividual({ind_set})")
1183
+
1184
+ def write_different_individuals_axiom(self, ind_set: set[OWLIndividual]) -> None:
1185
+ Util.info(f"Write axiom DifferentIndividuals({ind_set})")
1186
+
1187
+ def write_disjoint_classes_axiom(self, class_set: set[OWLClassExpression]) -> None:
1188
+ Util.info(f"Write axiom DisjointClasses({class_set})")
1189
+
1190
+ def write_disjoint_union_axiom(self, class_set: set[OWLClassExpression]) -> None:
1191
+ Util.info(f"Write axiom DisjointUnion({class_set})")
1192
+
1193
+ def write_subclass_of_axiom(
1194
+ self, subclass: OWLClassExpression, superclass: OWLClassExpression, d: float
1195
+ ) -> None:
1196
+ Util.info(
1197
+ f"Write axiom SubClassOf({subclass} is subclass of {superclass} >= {d})"
1198
+ )
1199
+
1200
+ def write_equivalent_classes_axiom(
1201
+ self, class_set: set[OWLClassExpression]
1202
+ ) -> None:
1203
+ Util.info(f"Write axiom EquivalentClasses({class_set})")
1204
+
1205
+ def write_sub_object_property_of_axiom(
1206
+ self,
1207
+ subproperty: OWLObjectPropertyExpression,
1208
+ superproperty: OWLObjectPropertyExpression,
1209
+ d: float,
1210
+ ) -> None:
1211
+ Util.info(
1212
+ f"Write axiom SubObjectPropertyOf({subproperty} is subclass of {superproperty} >= {d})"
1213
+ )
1214
+
1215
+ def write_sub_data_property_of_axiom(
1216
+ self,
1217
+ subproperty: OWLDataPropertyExpression,
1218
+ superproperty: OWLDataPropertyExpression,
1219
+ d: float,
1220
+ ) -> None:
1221
+ Util.info(
1222
+ f"Write axiom SubDataPropertyOf({subproperty} is subclass of {superproperty} >= {d})"
1223
+ )
1224
+
1225
+ def write_sub_property_chain_of_axiom(
1226
+ self,
1227
+ chain: list[OWLObjectPropertyExpression],
1228
+ superproperty: OWLObjectPropertyExpression,
1229
+ d: float,
1230
+ ) -> None:
1231
+ Util.info(
1232
+ f"Write axiom SubPropertyChainOf({chain} is subclass of {superproperty} >= {d})"
1233
+ )
1234
+
1235
+ def write_equivalent_object_properties_axiom(
1236
+ self, class_set: set[OWLObjectPropertyExpression]
1237
+ ) -> None:
1238
+ Util.info(f"Write axiom EquivalentObjectProperties({class_set})")
1239
+
1240
+ def write_equivalent_data_properties_axiom(
1241
+ self, class_set: set[OWLDataPropertyExpression]
1242
+ ) -> None:
1243
+ Util.info(f"Write axiom EquivalentDataProperties({class_set})")
1244
+
1245
+ def write_transitive_object_property_axiom(
1246
+ self, p: OWLObjectPropertyExpression
1247
+ ) -> None:
1248
+ Util.info(f"Write axiom TransitiveObjectProperty({p})")
1249
+
1250
+ def write_symmetric_object_property_axiom(
1251
+ self, p: OWLObjectPropertyExpression
1252
+ ) -> None:
1253
+ Util.info(f"Write axiom SymmetricObjectProperty({p})")
1254
+
1255
+ def write_asymmetric_object_property_axiom(
1256
+ self, p: OWLObjectPropertyExpression
1257
+ ) -> None:
1258
+ Util.info(f"Write axiom AsymmetricObjectProperty({p})")
1259
+
1260
+ def write_reflexive_object_property_axiom(
1261
+ self, p: OWLObjectPropertyExpression
1262
+ ) -> None:
1263
+ Util.info(f"Write axiom ReflexiveObjectProperty({p})")
1264
+
1265
+ def write_irreflexive_object_property_axiom(
1266
+ self, p: OWLObjectPropertyExpression
1267
+ ) -> None:
1268
+ Util.info(f"Write axiom IrreflexiveObjectProperty({p})")
1269
+
1270
+ def write_functional_object_property_axiom(
1271
+ self, p: OWLObjectPropertyExpression
1272
+ ) -> None:
1273
+ Util.info(f"Write axiom FunctionalObjectProperty({p})")
1274
+
1275
+ def write_functional_data_property_axiom(
1276
+ self, p: OWLObjectPropertyExpression
1277
+ ) -> None:
1278
+ Util.info(f"Write axiom FunctionalDataProperty({p})")
1279
+
1280
+ def write_inverse_object_property_axiom(
1281
+ self, p1: OWLObjectPropertyExpression, p2: OWLObjectPropertyExpression
1282
+ ) -> None:
1283
+ Util.info(f"Write axiom ({p1} inverse of {p2})")
1284
+
1285
+ def write_inverse_functional_object_property_axiom(
1286
+ self, p: OWLObjectPropertyExpression
1287
+ ) -> None:
1288
+ Util.info(f"Write axiom InverseFunctionalObjectProperty({p})")
1289
+
1290
+ def write_object_property_domain_axiom(
1291
+ self, p: OWLObjectPropertyExpression, c: OWLClassExpression
1292
+ ) -> None:
1293
+ Util.info(f"Write axiom domain ({c} of object property {p})")
1294
+
1295
+ def write_object_property_range_axiom(
1296
+ self, p: OWLObjectPropertyExpression, c: OWLClassExpression
1297
+ ) -> None:
1298
+ Util.info(f"Write axiom range ({c} of object property {p})")
1299
+
1300
+ def write_data_property_domain_axiom(
1301
+ self, p: OWLDataPropertyExpression, c: OWLClassExpression
1302
+ ) -> None:
1303
+ Util.info(f"Write axiom domain ({c} of data property {p})")
1304
+
1305
+ def write_data_property_range_axiom(
1306
+ self, p: OWLDataPropertyExpression, range: OWLDataRange
1307
+ ) -> None:
1308
+ Util.info(f"Write axiom range ({range} of data property {p})")
1309
+
1310
+ def write_disjoint_object_properties_axiom(
1311
+ self, class_set: set[OWLObjectPropertyExpression]
1312
+ ) -> None:
1313
+ Util.info(f"Write axiom ({class_set})")
1314
+
1315
+ def write_disjoint_data_properties_axiom(
1316
+ self, class_set: set[OWLDataPropertyExpression]
1317
+ ) -> None:
1318
+ Util.info(f"Write axiom ({class_set})")
1319
+
1320
+ def write_triangular_modifier_definition(
1321
+ self, name: str, mod: TriangularModifier
1322
+ ) -> None:
1323
+ Util.info(f"Write definition {name} = {mod}")
1324
+
1325
+ def write_linear_modifier_definition(self, name: str, mod: LinearModifier) -> None:
1326
+ Util.info(f"Write definition {name} = {mod}")
1327
+
1328
+ def write_left_shoulder_function_definition(
1329
+ self, name: str, dat: LeftShoulderFunction
1330
+ ) -> None:
1331
+ Util.info(f"Write definition {name} = {dat}")
1332
+
1333
+ def write_right_shoulder_function_definition(
1334
+ self, name: str, dat: RightShoulderFunction
1335
+ ) -> None:
1336
+ Util.info(f"Write definition {name} = {dat}")
1337
+
1338
+ def write_linear_function_definition(self, name: str, dat: LinearFunction) -> None:
1339
+ Util.info(f"Write definition {name} = {dat}")
1340
+
1341
+ def write_triangular_function_definition(
1342
+ self, name: str, dat: TriangularFunction
1343
+ ) -> None:
1344
+ Util.info(f"Write definition {name} = {dat}")
1345
+
1346
+ def write_trapezoidal_function_definition(
1347
+ self, name: str, dat: TrapezoidalFunction
1348
+ ) -> None:
1349
+ Util.info(f"Write definition {name} = {dat}")
1350
+
1351
+ def write_modified_function_definition(
1352
+ self, name: str, dat: ModifiedFunction
1353
+ ) -> None:
1354
+ Util.info(f"Write definition {name} = {dat}")
1355
+
1356
+ def write_modified_property_definition(
1357
+ self, name: str, dat: ModifiedProperty
1358
+ ) -> None:
1359
+ Util.info(f"Write definition {name} = {dat}")
1360
+
1361
+ def write_modified_concept_definition(
1362
+ self, name: str, dat: ModifiedConcept
1363
+ ) -> None:
1364
+ Util.info(f"Write definition {name} = {dat}")
1365
+
1366
+ def write_fuzzy_nominal_concept_definition(
1367
+ self, name: str, dat: FuzzyNominalConcept
1368
+ ) -> None:
1369
+ Util.info(f"Write definition {name} = {dat}")
1370
+
1371
+ def write_weighted_concept_definition(self, name: str, c: WeightedConcept) -> None:
1372
+ Util.info(f"Write definition {name} = {c}")
1373
+
1374
+ def write_weighted_max_concept_definition(
1375
+ self, name: str, c: WeightedMaxConcept
1376
+ ) -> None:
1377
+ Util.info(f"Write definition {name} = {c}")
1378
+
1379
+ def write_weighted_min_concept_definition(
1380
+ self, name: str, c: WeightedMinConcept
1381
+ ) -> None:
1382
+ Util.info(f"Write definition {name} = {c}")
1383
+
1384
+ def write_weighted_sum_concept_definition(
1385
+ self, name: str, c: WeightedSumConcept
1386
+ ) -> None:
1387
+ Util.info(f"Write definition {name} = {c}")
1388
+
1389
+ def write_weighted_sum_zero_concept_definition(
1390
+ self, name: str, c: WeightedSumZeroConcept
1391
+ ) -> None:
1392
+ Util.info(f"Write definition {name} = {c}")
1393
+
1394
+ def write_owa_concept_definition(self, name: str, c: OwaConcept) -> None:
1395
+ Util.info(f"Write definition {name} = {c}")
1396
+
1397
+ def write_choquet_concept_definition(self, name: str, c: ChoquetConcept) -> None:
1398
+ Util.info(f"Write definition {name} = {c}")
1399
+
1400
+ def write_sugeno_concept_definition(self, name: str, c: SugenoConcept) -> None:
1401
+ Util.info(f"Write definition {name} = {c}")
1402
+
1403
+ def write_quasi_sugeno_concept_definition(
1404
+ self, name: str, c: QsugenoConcept
1405
+ ) -> None:
1406
+ Util.info(f"Write definition {name} = {c}")
1407
+
1408
+ def write_qowa_concept_definition(self, name: str, c: QowaConcept) -> None:
1409
+ Util.info(f"Write definition {name} = {c}")