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