fuzzy-dl-owl2 1.0.9__py3-none-any.whl → 1.0.10__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/fuzzydl/fuzzydl_to_owl2.py +24 -10
- fuzzy_dl_owl2/fuzzydl/knowledge_base.py +58 -72
- fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py +1 -3
- fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2.py +75 -45
- fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl.py +73 -6
- fuzzy_dl_owl2/fuzzyowl2/owl_types/crisp_function.py +17 -0
- fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_nominal_concept.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_concept.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_function.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_property.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_max_concept.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_min_concept.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_concept.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_zero_concept.py +1 -1
- fuzzy_dl_owl2/fuzzyowl2/parser/owl2_xml_parser.py +8 -2
- {fuzzy_dl_owl2-1.0.9.dist-info → fuzzy_dl_owl2-1.0.10.dist-info}/METADATA +7 -5
- {fuzzy_dl_owl2-1.0.9.dist-info → fuzzy_dl_owl2-1.0.10.dist-info}/RECORD +19 -18
- {fuzzy_dl_owl2-1.0.9.dist-info → fuzzy_dl_owl2-1.0.10.dist-info}/WHEEL +1 -1
- {fuzzy_dl_owl2-1.0.9.dist-info → fuzzy_dl_owl2-1.0.10.dist-info/licenses}/LICENSE +0 -0
|
@@ -3,8 +3,9 @@ from __future__ import annotations
|
|
|
3
3
|
import os
|
|
4
4
|
import sys
|
|
5
5
|
import typing
|
|
6
|
-
|
|
6
|
+
import urllib
|
|
7
7
|
import urllib.parse
|
|
8
|
+
from functools import partial
|
|
8
9
|
|
|
9
10
|
from rdflib import RDF, RDFS, XSD, Literal, Namespace, URIRef
|
|
10
11
|
|
|
@@ -130,7 +131,6 @@ from pyowl2.expressions.object_property import OWLObjectProperty
|
|
|
130
131
|
from pyowl2.individual.named_individual import OWLNamedIndividual
|
|
131
132
|
from pyowl2.literal.literal import OWLLiteral
|
|
132
133
|
from pyowl2.ontology import OWLOntology
|
|
133
|
-
import urllib
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
# @utils.timer_decorator
|
|
@@ -145,7 +145,7 @@ class FuzzydlToOwl2:
|
|
|
145
145
|
base_iri: str = "http://www.semanticweb.org/ontologies/fuzzydl_ontology#",
|
|
146
146
|
) -> None:
|
|
147
147
|
base_iri = urllib.parse.urlparse(base_iri).geturl().rstrip("/").rstrip("#")
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
self.num_classes: int = 0
|
|
150
150
|
self.kb, _ = DLParser.get_kb(input_file)
|
|
151
151
|
self.ontology_path: str = f"{base_iri}#"
|
|
@@ -349,17 +349,16 @@ class FuzzydlToOwl2:
|
|
|
349
349
|
if str(c) in self.concepts:
|
|
350
350
|
return self.concepts.get(str(c))
|
|
351
351
|
c4: OWLClassExpression = self.get_new_atomic_class(str(c))
|
|
352
|
-
c3: OWLClassExpression = self.get_base(c.
|
|
352
|
+
c3: OWLClassExpression = self.get_base(c.curr_concept)
|
|
353
353
|
self.concepts[str(c)] = c3
|
|
354
|
-
|
|
355
354
|
main_xml = FuzzyXML.build_main_xml(FuzzyOWL2Keyword.CONCEPT.get_str_value())
|
|
356
355
|
concept_xml = FuzzyXML.build_concept_xml(
|
|
357
356
|
FuzzyOWL2Keyword.MODIFIED.get_str_value(),
|
|
358
357
|
{
|
|
359
358
|
FuzzyOWL2Keyword.MODIFIER.get_str_value(): str(
|
|
360
|
-
self.modifiers[str(c)]
|
|
359
|
+
self.modifiers[str(c.modifier)].iri.value
|
|
361
360
|
),
|
|
362
|
-
FuzzyOWL2Keyword.BASE.get_str_value(): str(c3),
|
|
361
|
+
FuzzyOWL2Keyword.BASE.get_str_value(): str(c3.iri.value),
|
|
363
362
|
},
|
|
364
363
|
)
|
|
365
364
|
main_xml.append(concept_xml)
|
|
@@ -418,14 +417,14 @@ class FuzzydlToOwl2:
|
|
|
418
417
|
elif c_type == ConceptType.WEIGHTED:
|
|
419
418
|
c: WeightedConcept = typing.cast(WeightedConcept, c)
|
|
420
419
|
c4: OWLClassExpression = self.get_new_atomic_class(str(c))
|
|
421
|
-
c3: OWLClassExpression = self.get_base(c.
|
|
420
|
+
c3: OWLClassExpression = self.get_base(c.curr_concept)
|
|
422
421
|
|
|
423
422
|
main_xml = FuzzyXML.build_main_xml(FuzzyOWL2Keyword.CONCEPT.get_str_value())
|
|
424
423
|
concept_xml = FuzzyXML.build_concept_xml(
|
|
425
424
|
FuzzyOWL2Keyword.WEIGHTED.get_str_value(),
|
|
426
425
|
{
|
|
427
426
|
FuzzyOWL2Keyword.DEGREE_VALUE.get_str_value(): str(c.weight),
|
|
428
|
-
FuzzyOWL2Keyword.BASE.get_str_value(): str(c3),
|
|
427
|
+
FuzzyOWL2Keyword.BASE.get_str_value(): str(c3.iri.value),
|
|
429
428
|
},
|
|
430
429
|
)
|
|
431
430
|
main_xml.append(concept_xml)
|
|
@@ -497,7 +496,7 @@ class FuzzydlToOwl2:
|
|
|
497
496
|
FuzzyOWL2Keyword.DEGREE_VALUE.get_str_value(): str(
|
|
498
497
|
curr_concept.weights[i]
|
|
499
498
|
),
|
|
500
|
-
FuzzyOWL2Keyword.BASE.get_str_value(): str(c5),
|
|
499
|
+
FuzzyOWL2Keyword.BASE.get_str_value(): str(c5.iri.value),
|
|
501
500
|
},
|
|
502
501
|
)
|
|
503
502
|
concept_xml.append(sub_concept_xml)
|
|
@@ -799,6 +798,21 @@ class FuzzydlToOwl2:
|
|
|
799
798
|
# )
|
|
800
799
|
self.add_ontology_annotation(annotation)
|
|
801
800
|
|
|
801
|
+
# Process atomic concepts
|
|
802
|
+
# TODO
|
|
803
|
+
for c in self.kb.atomic_concepts.values():
|
|
804
|
+
self.ontology.add_axiom(
|
|
805
|
+
OWLDeclaration(
|
|
806
|
+
self.get_class(str(c)),
|
|
807
|
+
[
|
|
808
|
+
OWLAnnotation(
|
|
809
|
+
OWLAnnotationProperty(URIRef(RDFS.label)),
|
|
810
|
+
OWLLiteral(Literal(str(c), lang="en")),
|
|
811
|
+
)
|
|
812
|
+
],
|
|
813
|
+
)
|
|
814
|
+
)
|
|
815
|
+
|
|
802
816
|
# Process concrete concepts
|
|
803
817
|
for c in self.kb.concrete_concepts.values():
|
|
804
818
|
self._process_concrete_concept(c)
|
|
@@ -12,51 +12,43 @@ from sortedcontainers import SortedSet
|
|
|
12
12
|
from fuzzy_dl_owl2.fuzzydl.assertion.assertion import Assertion
|
|
13
13
|
from fuzzy_dl_owl2.fuzzydl.classification_node import ClassificationNode
|
|
14
14
|
from fuzzy_dl_owl2.fuzzydl.concept.all_some_concept import AllSomeConcept
|
|
15
|
-
from fuzzy_dl_owl2.fuzzydl.concept.approximation_concept import
|
|
15
|
+
from fuzzy_dl_owl2.fuzzydl.concept.approximation_concept import \
|
|
16
|
+
ApproximationConcept
|
|
16
17
|
from fuzzy_dl_owl2.fuzzydl.concept.atomic_concept import AtomicConcept
|
|
17
18
|
from fuzzy_dl_owl2.fuzzydl.concept.choquet_integral import ChoquetIntegral
|
|
18
19
|
from fuzzy_dl_owl2.fuzzydl.concept.concept import Concept
|
|
19
|
-
from fuzzy_dl_owl2.fuzzydl.concept.concrete.crisp_concrete_concept import
|
|
20
|
-
CrispConcreteConcept
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
from fuzzy_dl_owl2.fuzzydl.concept.concrete.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
from fuzzy_dl_owl2.fuzzydl.concept.concrete.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
from fuzzy_dl_owl2.fuzzydl.concept.
|
|
38
|
-
|
|
39
|
-
)
|
|
40
|
-
from fuzzy_dl_owl2.fuzzydl.concept.concrete.trapezoidal_concrete_concept import (
|
|
41
|
-
TrapezoidalConcreteConcept,
|
|
42
|
-
)
|
|
43
|
-
from fuzzy_dl_owl2.fuzzydl.concept.concrete.triangular_concrete_concept import (
|
|
44
|
-
TriangularConcreteConcept,
|
|
45
|
-
)
|
|
46
|
-
from fuzzy_dl_owl2.fuzzydl.concept.ext_threshold_concept import ExtThresholdConcept
|
|
20
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.crisp_concrete_concept import \
|
|
21
|
+
CrispConcreteConcept
|
|
22
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept import \
|
|
23
|
+
FuzzyConcreteConcept
|
|
24
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_number.triangular_fuzzy_number import \
|
|
25
|
+
TriangularFuzzyNumber
|
|
26
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.left_concrete_concept import \
|
|
27
|
+
LeftConcreteConcept
|
|
28
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.linear_concrete_concept import \
|
|
29
|
+
LinearConcreteConcept
|
|
30
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.modified_concrete_concept import \
|
|
31
|
+
ModifiedConcreteConcept
|
|
32
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.right_concrete_concept import \
|
|
33
|
+
RightConcreteConcept
|
|
34
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.trapezoidal_concrete_concept import \
|
|
35
|
+
TrapezoidalConcreteConcept
|
|
36
|
+
from fuzzy_dl_owl2.fuzzydl.concept.concrete.triangular_concrete_concept import \
|
|
37
|
+
TriangularConcreteConcept
|
|
38
|
+
from fuzzy_dl_owl2.fuzzydl.concept.ext_threshold_concept import \
|
|
39
|
+
ExtThresholdConcept
|
|
47
40
|
from fuzzy_dl_owl2.fuzzydl.concept.has_value_concept import HasValueConcept
|
|
48
41
|
from fuzzy_dl_owl2.fuzzydl.concept.implies_concept import ImpliesConcept
|
|
49
|
-
from fuzzy_dl_owl2.fuzzydl.concept.interface.has_concepts_interface import
|
|
50
|
-
HasConceptsInterface
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
from fuzzy_dl_owl2.fuzzydl.concept.interface.has_value_interface import
|
|
54
|
-
HasValueInterface
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
from fuzzy_dl_owl2.fuzzydl.concept.modified.triangularly_modified_concept import
|
|
58
|
-
TriangularlyModifiedConcept
|
|
59
|
-
)
|
|
42
|
+
from fuzzy_dl_owl2.fuzzydl.concept.interface.has_concepts_interface import \
|
|
43
|
+
HasConceptsInterface
|
|
44
|
+
from fuzzy_dl_owl2.fuzzydl.concept.interface.has_role_interface import \
|
|
45
|
+
HasRoleInterface
|
|
46
|
+
from fuzzy_dl_owl2.fuzzydl.concept.interface.has_value_interface import \
|
|
47
|
+
HasValueInterface
|
|
48
|
+
from fuzzy_dl_owl2.fuzzydl.concept.modified.modified_concept import \
|
|
49
|
+
ModifiedConcept
|
|
50
|
+
from fuzzy_dl_owl2.fuzzydl.concept.modified.triangularly_modified_concept import \
|
|
51
|
+
TriangularlyModifiedConcept
|
|
60
52
|
from fuzzy_dl_owl2.fuzzydl.concept.negated_nominal import NegatedNominal
|
|
61
53
|
from fuzzy_dl_owl2.fuzzydl.concept.operator_concept import OperatorConcept
|
|
62
54
|
from fuzzy_dl_owl2.fuzzydl.concept.owa_concept import OwaConcept
|
|
@@ -70,28 +62,30 @@ from fuzzy_dl_owl2.fuzzydl.concept.threshold_concept import ThresholdConcept
|
|
|
70
62
|
from fuzzy_dl_owl2.fuzzydl.concept.truth_concept import TruthConcept
|
|
71
63
|
from fuzzy_dl_owl2.fuzzydl.concept.value_concept import ValueConcept
|
|
72
64
|
from fuzzy_dl_owl2.fuzzydl.concept.weighted_concept import WeightedConcept
|
|
73
|
-
from fuzzy_dl_owl2.fuzzydl.concept.weighted_max_concept import
|
|
74
|
-
|
|
75
|
-
from fuzzy_dl_owl2.fuzzydl.concept.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
from fuzzy_dl_owl2.fuzzydl.concept.weighted_max_concept import \
|
|
66
|
+
WeightedMaxConcept
|
|
67
|
+
from fuzzy_dl_owl2.fuzzydl.concept.weighted_min_concept import \
|
|
68
|
+
WeightedMinConcept
|
|
69
|
+
from fuzzy_dl_owl2.fuzzydl.concept.weighted_sum_concept import \
|
|
70
|
+
WeightedSumConcept
|
|
71
|
+
from fuzzy_dl_owl2.fuzzydl.concept.weighted_sum_zero_concept import \
|
|
72
|
+
WeightedSumZeroConcept
|
|
79
73
|
from fuzzy_dl_owl2.fuzzydl.concept_equivalence import ConceptEquivalence
|
|
80
74
|
from fuzzy_dl_owl2.fuzzydl.concrete_feature import ConcreteFeature
|
|
81
75
|
from fuzzy_dl_owl2.fuzzydl.degree.degree import Degree
|
|
82
76
|
from fuzzy_dl_owl2.fuzzydl.degree.degree_expression import DegreeExpression
|
|
83
77
|
from fuzzy_dl_owl2.fuzzydl.degree.degree_numeric import DegreeNumeric
|
|
84
78
|
from fuzzy_dl_owl2.fuzzydl.degree.degree_variable import DegreeVariable
|
|
85
|
-
from fuzzy_dl_owl2.fuzzydl.exception.inconsistent_ontology_exception import
|
|
86
|
-
InconsistentOntologyException
|
|
87
|
-
)
|
|
79
|
+
from fuzzy_dl_owl2.fuzzydl.exception.inconsistent_ontology_exception import \
|
|
80
|
+
InconsistentOntologyException
|
|
88
81
|
from fuzzy_dl_owl2.fuzzydl.feature_function import FeatureFunction
|
|
89
|
-
from fuzzy_dl_owl2.fuzzydl.general_concept_inclusion import
|
|
90
|
-
|
|
82
|
+
from fuzzy_dl_owl2.fuzzydl.general_concept_inclusion import \
|
|
83
|
+
GeneralConceptInclusion
|
|
84
|
+
from fuzzy_dl_owl2.fuzzydl.individual.created_individual import \
|
|
85
|
+
CreatedIndividual
|
|
91
86
|
from fuzzy_dl_owl2.fuzzydl.individual.individual import Individual
|
|
92
|
-
from fuzzy_dl_owl2.fuzzydl.individual.representative_individual import
|
|
93
|
-
RepresentativeIndividual
|
|
94
|
-
)
|
|
87
|
+
from fuzzy_dl_owl2.fuzzydl.individual.representative_individual import \
|
|
88
|
+
RepresentativeIndividual
|
|
95
89
|
from fuzzy_dl_owl2.fuzzydl.milp.expression import Expression
|
|
96
90
|
from fuzzy_dl_owl2.fuzzydl.milp.milp_helper import MILPHelper
|
|
97
91
|
from fuzzy_dl_owl2.fuzzydl.milp.solution import Solution
|
|
@@ -99,29 +93,21 @@ from fuzzy_dl_owl2.fuzzydl.milp.term import Term
|
|
|
99
93
|
from fuzzy_dl_owl2.fuzzydl.milp.variable import Variable
|
|
100
94
|
from fuzzy_dl_owl2.fuzzydl.modifier.linear_modifier import LinearModifier
|
|
101
95
|
from fuzzy_dl_owl2.fuzzydl.modifier.modifier import Modifier
|
|
102
|
-
from fuzzy_dl_owl2.fuzzydl.modifier.triangular_modifier import
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
from fuzzy_dl_owl2.fuzzydl.modifier.triangular_modifier import \
|
|
97
|
+
TriangularModifier
|
|
98
|
+
from fuzzy_dl_owl2.fuzzydl.primitive_concept_definition import \
|
|
99
|
+
PrimitiveConceptDefinition
|
|
106
100
|
from fuzzy_dl_owl2.fuzzydl.relation import Relation
|
|
107
|
-
from fuzzy_dl_owl2.fuzzydl.restriction.has_value_restriction import
|
|
101
|
+
from fuzzy_dl_owl2.fuzzydl.restriction.has_value_restriction import \
|
|
102
|
+
HasValueRestriction
|
|
108
103
|
from fuzzy_dl_owl2.fuzzydl.restriction.restriction import Restriction
|
|
109
104
|
from fuzzy_dl_owl2.fuzzydl.util import constants
|
|
110
105
|
from fuzzy_dl_owl2.fuzzydl.util.config_reader import ConfigReader
|
|
111
106
|
from fuzzy_dl_owl2.fuzzydl.util.constants import (
|
|
112
|
-
BlockingDynamicType,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
FeatureFunctionType,
|
|
117
|
-
FuzzyLogic,
|
|
118
|
-
InequalityType,
|
|
119
|
-
KnowledgeBaseRules,
|
|
120
|
-
LogicOperatorType,
|
|
121
|
-
RepresentativeIndividualType,
|
|
122
|
-
RestrictionType,
|
|
123
|
-
VariableType,
|
|
124
|
-
)
|
|
107
|
+
BlockingDynamicType, ConceptType, ConcreteFeatureType,
|
|
108
|
+
CreatedIndividualBlockingType, FeatureFunctionType, FuzzyLogic,
|
|
109
|
+
InequalityType, KnowledgeBaseRules, LogicOperatorType,
|
|
110
|
+
RepresentativeIndividualType, RestrictionType, VariableType)
|
|
125
111
|
from fuzzy_dl_owl2.fuzzydl.util.util import Util
|
|
126
112
|
from fuzzy_dl_owl2.fuzzydl.util.utils import class_debugging
|
|
127
113
|
|
|
@@ -525,9 +525,7 @@ class DLParser(object):
|
|
|
525
525
|
if f is None:
|
|
526
526
|
Util.error(f"Error: Fuzzy concept {f} has to be defined before being used.")
|
|
527
527
|
if not isinstance(f, (RightConcreteConcept, LeftConcreteConcept)):
|
|
528
|
-
Util.error(
|
|
529
|
-
f"Error: Fuzzy concept {f} has to be a right or a linear function."
|
|
530
|
-
)
|
|
528
|
+
Util.error(f"Error: Fuzzy concept {f} has to be a right or left functions.")
|
|
531
529
|
concepts: list[Concept] = [
|
|
532
530
|
DLParser._to_concept(concept) for concept in list_tokens[1:]
|
|
533
531
|
]
|
|
@@ -4,9 +4,11 @@ import typing
|
|
|
4
4
|
from rdflib import Namespace
|
|
5
5
|
|
|
6
6
|
from fuzzy_dl_owl2.fuzzydl.util import constants
|
|
7
|
+
from fuzzy_dl_owl2.fuzzydl.util.config_reader import ConfigReader
|
|
7
8
|
from fuzzy_dl_owl2.fuzzydl.util.util import Util
|
|
8
9
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.choquet_concept import ChoquetConcept
|
|
9
10
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.concept_definition import ConceptDefinition
|
|
11
|
+
from fuzzy_dl_owl2.fuzzyowl2.owl_types.crisp_function import CrispFunction
|
|
10
12
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_datatype import FuzzyDatatype
|
|
11
13
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_modifier import FuzzyModifier
|
|
12
14
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_nominal_concept import FuzzyNominalConcept
|
|
@@ -146,8 +148,6 @@ from pyowl2.individual.anonymous_individual import OWLAnonymousIndividual
|
|
|
146
148
|
from pyowl2.literal.literal import OWLLiteral
|
|
147
149
|
from pyowl2.ontology import OWLOntology
|
|
148
150
|
|
|
149
|
-
from fuzzy_dl_owl2.fuzzydl.util.config_reader import ConfigReader
|
|
150
|
-
|
|
151
151
|
|
|
152
152
|
class FuzzyOwl2(object):
|
|
153
153
|
POS_INFINITY: float = 10000.0
|
|
@@ -219,12 +219,16 @@ class FuzzyOwl2(object):
|
|
|
219
219
|
if datatype_def_axioms is None:
|
|
220
220
|
continue
|
|
221
221
|
for axiom in datatype_def_axioms:
|
|
222
|
+
Util.debug(f"Getting facets for axiom {axiom}...")
|
|
222
223
|
assert isinstance(axiom, OWLDatatypeDefinition)
|
|
223
224
|
datatype_name: str = self.get_short_name(axiom.datatype).replace(
|
|
224
225
|
":", ""
|
|
225
226
|
)
|
|
226
227
|
if datatype_name != name:
|
|
227
228
|
continue
|
|
229
|
+
f1: typing.Optional[OWLFacet] = None
|
|
230
|
+
f2: typing.Optional[OWLFacet] = None
|
|
231
|
+
Util.debug(f"Getting facets for data range {axiom.data_range}...")
|
|
228
232
|
if isinstance(axiom.data_range, OWLDatatypeRestriction):
|
|
229
233
|
facets: list[OWLFacet] = list(axiom.data_range.restrictions)
|
|
230
234
|
f1: OWLFacet = facets[0]
|
|
@@ -260,14 +264,27 @@ class FuzzyOwl2(object):
|
|
|
260
264
|
continue
|
|
261
265
|
f1: OWLFacet = facets1[0]
|
|
262
266
|
f2: OWLFacet = facets2[0]
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
|
|
268
|
+
Util.debug(f"Facets 1 {f1}.")
|
|
269
|
+
Util.debug(f"Facets 2 {f2}.")
|
|
270
|
+
if f1:
|
|
271
|
+
if f1.constraint_to_uriref() == OWLFacet.MIN_INCLUSIVE:
|
|
272
|
+
facets[0] = float(str(f1.value.value))
|
|
273
|
+
elif f1.constraint_to_uriref() == OWLFacet.MIN_EXCLUSIVE:
|
|
274
|
+
facets[0] = float(str(f1.value.value)) + ConfigReader.EPSILON
|
|
275
|
+
elif f1.constraint_to_uriref() == OWLFacet.MAX_INCLUSIVE:
|
|
276
|
+
facets[1] = float(str(f1.value.value))
|
|
277
|
+
elif f1.constraint_to_uriref() == OWLFacet.MAX_EXCLUSIVE:
|
|
278
|
+
facets[1] = float(str(f1.value.value)) - ConfigReader.EPSILON
|
|
279
|
+
if f2:
|
|
280
|
+
if f2.constraint_to_uriref() == OWLFacet.MIN_INCLUSIVE:
|
|
281
|
+
facets[0] = float(str(f2.value.value))
|
|
282
|
+
elif f2.constraint_to_uriref() == OWLFacet.MIN_EXCLUSIVE:
|
|
283
|
+
facets[0] = float(str(f2.value.value)) + ConfigReader.EPSILON
|
|
284
|
+
elif f2.constraint_to_uriref() == OWLFacet.MAX_INCLUSIVE:
|
|
285
|
+
facets[1] = float(str(f2.value.value))
|
|
286
|
+
elif f2.constraint_to_uriref() == OWLFacet.MAX_INCLUSIVE:
|
|
287
|
+
facets[1] = float(str(f2.value.value)) - ConfigReader.EPSILON
|
|
271
288
|
return facets
|
|
272
289
|
return facets
|
|
273
290
|
|
|
@@ -301,7 +318,9 @@ class FuzzyOwl2(object):
|
|
|
301
318
|
c.set_max_value(facets[1])
|
|
302
319
|
Util.debug(f"Concept for {datatype} -> {c}")
|
|
303
320
|
self.fuzzy_datatypes[datatype_name] = c
|
|
304
|
-
if isinstance(c,
|
|
321
|
+
if isinstance(c, CrispFunction):
|
|
322
|
+
self.write_crisp_function_definition(datatype_name, c)
|
|
323
|
+
elif isinstance(c, LeftShoulderFunction):
|
|
305
324
|
self.write_left_shoulder_function_definition(datatype_name, c)
|
|
306
325
|
elif isinstance(c, RightShoulderFunction):
|
|
307
326
|
self.write_right_shoulder_function_definition(datatype_name, c)
|
|
@@ -913,6 +932,7 @@ class FuzzyOwl2(object):
|
|
|
913
932
|
)
|
|
914
933
|
|
|
915
934
|
def get_class_name(self, c: OWLClassExpression) -> str:
|
|
935
|
+
Util.debug(f"Getting class name for expression: {c}")
|
|
916
936
|
if isinstance(c, OWLClass):
|
|
917
937
|
d: OWLClass = typing.cast(OWLClass, c)
|
|
918
938
|
if d.is_thing():
|
|
@@ -1053,6 +1073,7 @@ class FuzzyOwl2(object):
|
|
|
1053
1073
|
raise ValueError
|
|
1054
1074
|
|
|
1055
1075
|
def get_object_property_name(self, p: OWLObjectPropertyExpression) -> str:
|
|
1076
|
+
Util.debug(f"Getting object property name for expression: {p}")
|
|
1056
1077
|
if p.is_top_object_property():
|
|
1057
1078
|
return self.get_top_object_property_name()
|
|
1058
1079
|
elif p.is_bottom_object_property():
|
|
@@ -1061,6 +1082,7 @@ class FuzzyOwl2(object):
|
|
|
1061
1082
|
return self.get_atomic_object_property_name(p)
|
|
1062
1083
|
|
|
1063
1084
|
def get_data_property_name(self, p: OWLDataPropertyExpression) -> str:
|
|
1085
|
+
Util.debug(f"Getting data property name for expression: {p}")
|
|
1064
1086
|
if p.is_top_data_property():
|
|
1065
1087
|
return self.get_top_data_property_name()
|
|
1066
1088
|
elif p.is_bottom_data_property():
|
|
@@ -1069,6 +1091,7 @@ class FuzzyOwl2(object):
|
|
|
1069
1091
|
return self.get_atomic_data_property_name(p)
|
|
1070
1092
|
|
|
1071
1093
|
def get_individual_name(self, i: OWLIndividual) -> typing.Optional[str]:
|
|
1094
|
+
Util.debug(f"Getting individual name for expression: {i}")
|
|
1072
1095
|
if isinstance(i, OWLAnonymousIndividual):
|
|
1073
1096
|
Util.info(f"Anonymous individual not supported")
|
|
1074
1097
|
return None
|
|
@@ -1221,7 +1244,7 @@ class FuzzyOwl2(object):
|
|
|
1221
1244
|
|
|
1222
1245
|
def get_atomic_object_property_name(self, p: OWLObjectProperty) -> str:
|
|
1223
1246
|
name: str = self.get_short_name(p)
|
|
1224
|
-
Util.info(f"Write object property {name}")
|
|
1247
|
+
Util.info(f"Write atomic object property {name}")
|
|
1225
1248
|
return ""
|
|
1226
1249
|
|
|
1227
1250
|
def get_top_data_property_name(self) -> str:
|
|
@@ -1234,27 +1257,27 @@ class FuzzyOwl2(object):
|
|
|
1234
1257
|
|
|
1235
1258
|
def get_atomic_data_property_name(self, p: OWLDataProperty) -> str:
|
|
1236
1259
|
name: str = self.get_short_name(p)
|
|
1237
|
-
Util.info(f"Write data property {name}")
|
|
1260
|
+
Util.info(f"Write atomic data property {name}")
|
|
1238
1261
|
return ""
|
|
1239
1262
|
|
|
1240
1263
|
def write_fuzzy_logic(self, logic: str) -> None:
|
|
1241
1264
|
Util.info(f"Write fuzzy logic {logic}")
|
|
1242
1265
|
|
|
1243
1266
|
def write_concept_declaration(self, c: OWLClassExpression) -> None:
|
|
1244
|
-
Util.info(f"Write declaration {c}")
|
|
1267
|
+
Util.info(f"Write concept declaration {c}")
|
|
1245
1268
|
|
|
1246
1269
|
def write_data_property_declaration(self, dp: OWLDataPropertyExpression) -> None:
|
|
1247
|
-
Util.info(f"Write declaration {dp}")
|
|
1270
|
+
Util.info(f"Write data property declaration {dp}")
|
|
1248
1271
|
|
|
1249
1272
|
def write_object_property_declaration(
|
|
1250
1273
|
self, op: OWLObjectPropertyExpression
|
|
1251
1274
|
) -> None:
|
|
1252
|
-
Util.info(f"Write declaration {op}")
|
|
1275
|
+
Util.info(f"Write object property declaration {op}")
|
|
1253
1276
|
|
|
1254
1277
|
def write_concept_assertion_axiom(
|
|
1255
1278
|
self, i: OWLIndividual, c: OWLClassExpression, d: float
|
|
1256
1279
|
) -> None:
|
|
1257
|
-
Util.info(f"Write axiom {i}: {c} >= {d}")
|
|
1280
|
+
Util.info(f"Write concept assertion axiom {i}: {c} >= {d}")
|
|
1258
1281
|
|
|
1259
1282
|
def write_object_property_assertion_axiom(
|
|
1260
1283
|
self,
|
|
@@ -1263,7 +1286,7 @@ class FuzzyOwl2(object):
|
|
|
1263
1286
|
p: OWLObjectPropertyExpression,
|
|
1264
1287
|
d: float,
|
|
1265
1288
|
) -> None:
|
|
1266
|
-
Util.info(f"Write axiom ({i1}, {i2}): {p} >= {d}")
|
|
1289
|
+
Util.info(f"Write object property assertion axiom ({i1}, {i2}): {p} >= {d}")
|
|
1267
1290
|
|
|
1268
1291
|
def write_data_property_assertion_axiom(
|
|
1269
1292
|
self,
|
|
@@ -1272,7 +1295,7 @@ class FuzzyOwl2(object):
|
|
|
1272
1295
|
p: OWLDataPropertyExpression,
|
|
1273
1296
|
d: float,
|
|
1274
1297
|
) -> None:
|
|
1275
|
-
Util.info(f"Write axiom ({i}, {lit}): {p} >= {d}")
|
|
1298
|
+
Util.info(f"Write data property assertion axiom ({i}, {lit}): {p} >= {d}")
|
|
1276
1299
|
|
|
1277
1300
|
def write_negative_object_property_assertion_axiom(
|
|
1278
1301
|
self,
|
|
@@ -1281,7 +1304,9 @@ class FuzzyOwl2(object):
|
|
|
1281
1304
|
p: OWLObjectPropertyExpression,
|
|
1282
1305
|
d: float,
|
|
1283
1306
|
) -> None:
|
|
1284
|
-
Util.info(
|
|
1307
|
+
Util.info(
|
|
1308
|
+
f"Write negative object property assertion axiom ({i1}, {i2}): not {p} >= {d}"
|
|
1309
|
+
)
|
|
1285
1310
|
|
|
1286
1311
|
def write_negative_data_property_assertion_axiom(
|
|
1287
1312
|
self,
|
|
@@ -1290,7 +1315,9 @@ class FuzzyOwl2(object):
|
|
|
1290
1315
|
p: OWLDataPropertyExpression,
|
|
1291
1316
|
d: float,
|
|
1292
1317
|
) -> None:
|
|
1293
|
-
Util.info(
|
|
1318
|
+
Util.info(
|
|
1319
|
+
f"Write negative data property assertion axiom ({i}, {lit}): not {p} >= {d}"
|
|
1320
|
+
)
|
|
1294
1321
|
|
|
1295
1322
|
def write_same_individual_axiom(self, ind_set: set[OWLIndividual]) -> None:
|
|
1296
1323
|
Util.info(f"Write axiom SameIndividual({ind_set})")
|
|
@@ -1394,7 +1421,7 @@ class FuzzyOwl2(object):
|
|
|
1394
1421
|
def write_inverse_object_property_axiom(
|
|
1395
1422
|
self, p1: OWLObjectPropertyExpression, p2: OWLObjectPropertyExpression
|
|
1396
1423
|
) -> None:
|
|
1397
|
-
Util.info(f"Write axiom ({p1} inverse of {p2})")
|
|
1424
|
+
Util.info(f"Write inverse object property axiom - axiom ({p1} inverse of {p2})")
|
|
1398
1425
|
|
|
1399
1426
|
def write_inverse_functional_object_property_axiom(
|
|
1400
1427
|
self, p: OWLObjectPropertyExpression
|
|
@@ -1424,100 +1451,103 @@ class FuzzyOwl2(object):
|
|
|
1424
1451
|
def write_disjoint_object_properties_axiom(
|
|
1425
1452
|
self, class_set: set[OWLObjectPropertyExpression]
|
|
1426
1453
|
) -> None:
|
|
1427
|
-
Util.info(f"Write axiom ({class_set})")
|
|
1454
|
+
Util.info(f"Write disjoint object properties axiom ({class_set})")
|
|
1428
1455
|
|
|
1429
1456
|
def write_disjoint_data_properties_axiom(
|
|
1430
1457
|
self, class_set: set[OWLDataPropertyExpression]
|
|
1431
1458
|
) -> None:
|
|
1432
|
-
Util.info(f"Write axiom ({class_set})")
|
|
1459
|
+
Util.info(f"Write disjoint data properties axiom ({class_set})")
|
|
1433
1460
|
|
|
1434
1461
|
def write_triangular_modifier_definition(
|
|
1435
1462
|
self, name: str, mod: TriangularModifier
|
|
1436
1463
|
) -> None:
|
|
1437
|
-
Util.info(f"Write definition {name} = {mod}")
|
|
1464
|
+
Util.info(f"Write triangular modifier definition {name} = {mod}")
|
|
1438
1465
|
|
|
1439
1466
|
def write_linear_modifier_definition(self, name: str, mod: LinearModifier) -> None:
|
|
1440
|
-
Util.info(f"Write definition {name} = {mod}")
|
|
1467
|
+
Util.info(f"Write linear modifier definition {name} = {mod}")
|
|
1468
|
+
|
|
1469
|
+
def write_crisp_function_definition(self, name: str, dat: CrispFunction) -> None:
|
|
1470
|
+
Util.info(f"Write crisp function definition {name} = {dat}")
|
|
1441
1471
|
|
|
1442
1472
|
def write_left_shoulder_function_definition(
|
|
1443
1473
|
self, name: str, dat: LeftShoulderFunction
|
|
1444
1474
|
) -> None:
|
|
1445
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1475
|
+
Util.info(f"Write left shoulder function definition {name} = {dat}")
|
|
1446
1476
|
|
|
1447
1477
|
def write_right_shoulder_function_definition(
|
|
1448
1478
|
self, name: str, dat: RightShoulderFunction
|
|
1449
1479
|
) -> None:
|
|
1450
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1480
|
+
Util.info(f"Write right shoulder function definition {name} = {dat}")
|
|
1451
1481
|
|
|
1452
1482
|
def write_linear_function_definition(self, name: str, dat: LinearFunction) -> None:
|
|
1453
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1483
|
+
Util.info(f"Write linear function definition {name} = {dat}")
|
|
1454
1484
|
|
|
1455
1485
|
def write_triangular_function_definition(
|
|
1456
1486
|
self, name: str, dat: TriangularFunction
|
|
1457
1487
|
) -> None:
|
|
1458
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1488
|
+
Util.info(f"Write triangular function definition {name} = {dat}")
|
|
1459
1489
|
|
|
1460
1490
|
def write_trapezoidal_function_definition(
|
|
1461
1491
|
self, name: str, dat: TrapezoidalFunction
|
|
1462
1492
|
) -> None:
|
|
1463
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1493
|
+
Util.info(f"Write trapezoidal function definition {name} = {dat}")
|
|
1464
1494
|
|
|
1465
1495
|
def write_modified_function_definition(
|
|
1466
1496
|
self, name: str, dat: ModifiedFunction
|
|
1467
1497
|
) -> None:
|
|
1468
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1498
|
+
Util.info(f"Write modified function definition {name} = {dat}")
|
|
1469
1499
|
|
|
1470
1500
|
def write_modified_property_definition(
|
|
1471
1501
|
self, name: str, dat: ModifiedProperty
|
|
1472
1502
|
) -> None:
|
|
1473
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1503
|
+
Util.info(f"Write modified property definition {name} = {dat}")
|
|
1474
1504
|
|
|
1475
1505
|
def write_modified_concept_definition(
|
|
1476
1506
|
self, name: str, dat: ModifiedConcept
|
|
1477
1507
|
) -> None:
|
|
1478
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1508
|
+
Util.info(f"Write modified concept definition {name} = {dat}")
|
|
1479
1509
|
|
|
1480
1510
|
def write_fuzzy_nominal_concept_definition(
|
|
1481
1511
|
self, name: str, dat: FuzzyNominalConcept
|
|
1482
1512
|
) -> None:
|
|
1483
|
-
Util.info(f"Write definition {name} = {dat}")
|
|
1513
|
+
Util.info(f"Write fuzzy nominal concept definition {name} = {dat}")
|
|
1484
1514
|
|
|
1485
1515
|
def write_weighted_concept_definition(self, name: str, c: WeightedConcept) -> None:
|
|
1486
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1516
|
+
Util.info(f"Write weighted concept definition {name} = {c}")
|
|
1487
1517
|
|
|
1488
1518
|
def write_weighted_max_concept_definition(
|
|
1489
1519
|
self, name: str, c: WeightedMaxConcept
|
|
1490
1520
|
) -> None:
|
|
1491
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1521
|
+
Util.info(f"Write weighted max concept definition {name} = {c}")
|
|
1492
1522
|
|
|
1493
1523
|
def write_weighted_min_concept_definition(
|
|
1494
1524
|
self, name: str, c: WeightedMinConcept
|
|
1495
1525
|
) -> None:
|
|
1496
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1526
|
+
Util.info(f"Write weighted min concept definition {name} = {c}")
|
|
1497
1527
|
|
|
1498
1528
|
def write_weighted_sum_concept_definition(
|
|
1499
1529
|
self, name: str, c: WeightedSumConcept
|
|
1500
1530
|
) -> None:
|
|
1501
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1531
|
+
Util.info(f"Write weighted sum concept definition {name} = {c}")
|
|
1502
1532
|
|
|
1503
1533
|
def write_weighted_sum_zero_concept_definition(
|
|
1504
1534
|
self, name: str, c: WeightedSumZeroConcept
|
|
1505
1535
|
) -> None:
|
|
1506
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1536
|
+
Util.info(f"Write weighted sum zero concept definition {name} = {c}")
|
|
1507
1537
|
|
|
1508
1538
|
def write_owa_concept_definition(self, name: str, c: OwaConcept) -> None:
|
|
1509
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1539
|
+
Util.info(f"Write owa concept definition {name} = {c}")
|
|
1510
1540
|
|
|
1511
1541
|
def write_choquet_concept_definition(self, name: str, c: ChoquetConcept) -> None:
|
|
1512
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1542
|
+
Util.info(f"Write choquet concept definition {name} = {c}")
|
|
1513
1543
|
|
|
1514
1544
|
def write_sugeno_concept_definition(self, name: str, c: SugenoConcept) -> None:
|
|
1515
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1545
|
+
Util.info(f"Write sugeno concept definition {name} = {c}")
|
|
1516
1546
|
|
|
1517
1547
|
def write_quasi_sugeno_concept_definition(
|
|
1518
1548
|
self, name: str, c: QsugenoConcept
|
|
1519
1549
|
) -> None:
|
|
1520
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1550
|
+
Util.info(f"Write quasi sugeno concept definition {name} = {c}")
|
|
1521
1551
|
|
|
1522
1552
|
def write_qowa_concept_definition(self, name: str, c: QowaConcept) -> None:
|
|
1523
|
-
Util.info(f"Write definition {name} = {c}")
|
|
1553
|
+
Util.info(f"Write quasi owa concept definition {name} = {c}")
|
|
@@ -7,6 +7,7 @@ from fuzzy_dl_owl2.fuzzydl.util.constants import FuzzyDLKeyword
|
|
|
7
7
|
from fuzzy_dl_owl2.fuzzydl.util.util import Util
|
|
8
8
|
from fuzzy_dl_owl2.fuzzyowl2.fuzzyowl2 import FuzzyOwl2
|
|
9
9
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.choquet_concept import ChoquetConcept
|
|
10
|
+
from fuzzy_dl_owl2.fuzzyowl2.owl_types.crisp_function import CrispFunction
|
|
10
11
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_nominal_concept import FuzzyNominalConcept
|
|
11
12
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.left_shoulder_function import (
|
|
12
13
|
LeftShoulderFunction,
|
|
@@ -102,6 +103,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
102
103
|
return False
|
|
103
104
|
|
|
104
105
|
def __write(self, line: str) -> None:
|
|
106
|
+
Util.debug(f"Writing line to FuzzyDL file: {line}")
|
|
105
107
|
with open(self.output_dl, "a") as file:
|
|
106
108
|
file.write(f"{line}\n")
|
|
107
109
|
|
|
@@ -208,7 +210,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
208
210
|
if len(literat_set) > 0:
|
|
209
211
|
return f"(= {self.get_data_property_name(p)} {literat_set})"
|
|
210
212
|
Util.error(
|
|
211
|
-
f"Data some values restriction with range {range} and type {type} not supported -- DataSomeValuesFrom({p} {range})"
|
|
213
|
+
f"Data some values restriction with range {range} and type {type(range)} not supported -- DataSomeValuesFrom({p} {range})"
|
|
212
214
|
)
|
|
213
215
|
return None
|
|
214
216
|
|
|
@@ -220,7 +222,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
220
222
|
if datatype_name in self.fuzzy_datatypes:
|
|
221
223
|
return f"(all {self.get_data_property_name(p)} {datatype_name})"
|
|
222
224
|
Util.error(
|
|
223
|
-
f"Data all values restriction with range {range} and type {type} not supported -- DataAllValuesFrom({p} {range})"
|
|
225
|
+
f"Data all values restriction with range {range} and type {type(range)} not supported -- DataAllValuesFrom({p} {range})"
|
|
224
226
|
)
|
|
225
227
|
return None
|
|
226
228
|
|
|
@@ -418,25 +420,29 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
418
420
|
return name
|
|
419
421
|
|
|
420
422
|
def write_fuzzy_logic(self, logic: str) -> None:
|
|
423
|
+
super().write_fuzzy_logic(logic)
|
|
421
424
|
self.__write(f"(define-fuzzy-logic {logic})")
|
|
422
425
|
|
|
423
426
|
def write_concept_declaration(self, c: OWLClassExpression) -> None:
|
|
427
|
+
super().write_concept_declaration(c)
|
|
424
428
|
self.__write(
|
|
425
429
|
f"(define-primitive-concept {self.get_class_name(c)} {self.get_top_concept_name()})"
|
|
426
430
|
)
|
|
427
431
|
|
|
428
432
|
def write_data_property_declaration(self, dp: OWLDataPropertyExpression) -> None:
|
|
433
|
+
super().write_data_property_declaration(dp)
|
|
429
434
|
self.write_functional_data_property_axiom(dp)
|
|
430
435
|
self.__write(f"(range {self.get_data_property_name(dp)} *string*)")
|
|
431
436
|
|
|
432
437
|
def write_object_property_declaration(
|
|
433
438
|
self, op: OWLObjectPropertyExpression
|
|
434
439
|
) -> None:
|
|
435
|
-
|
|
440
|
+
super().write_object_property_declaration(op)
|
|
436
441
|
|
|
437
442
|
def write_concept_assertion_axiom(
|
|
438
443
|
self, i: OWLIndividual, c: OWLClassExpression, d: float
|
|
439
444
|
) -> None:
|
|
445
|
+
super().write_concept_assertion_axiom(i, c, d)
|
|
440
446
|
self.__write(
|
|
441
447
|
f"(instance {self.get_individual_name(i)} {self.get_class_name(c)} {d})"
|
|
442
448
|
)
|
|
@@ -448,6 +454,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
448
454
|
p: OWLObjectPropertyExpression,
|
|
449
455
|
d: float,
|
|
450
456
|
) -> None:
|
|
457
|
+
super().write_object_property_assertion_axiom(i1, i2, p, d)
|
|
451
458
|
self.__write(
|
|
452
459
|
f"(related {self.get_individual_name(i1)} {self.get_individual_name(i2)} {self.get_object_property_name(p)} {d})"
|
|
453
460
|
)
|
|
@@ -459,6 +466,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
459
466
|
p: OWLDataPropertyExpression,
|
|
460
467
|
d: float,
|
|
461
468
|
) -> None:
|
|
469
|
+
super().write_data_property_assertion_axiom(i, lit, p, d)
|
|
462
470
|
datatype: OWLDatatype = lit.datatype
|
|
463
471
|
dp_name: str = self.get_data_property_name(p)
|
|
464
472
|
if datatype is None:
|
|
@@ -490,7 +498,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
490
498
|
else:
|
|
491
499
|
value = int(str(lit.value))
|
|
492
500
|
self.__write(
|
|
493
|
-
f"(instance {self.get_individual_name(i)} (
|
|
501
|
+
f"(instance {self.get_individual_name(i)} (= {dp_name} {value}) {d})"
|
|
494
502
|
)
|
|
495
503
|
else:
|
|
496
504
|
if dp_name not in self.string_datatypes:
|
|
@@ -513,6 +521,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
513
521
|
p: OWLObjectPropertyExpression,
|
|
514
522
|
d: float,
|
|
515
523
|
) -> None:
|
|
524
|
+
super().write_negative_object_property_assertion_axiom(i1, i2, p, d)
|
|
516
525
|
Util.error(
|
|
517
526
|
f"Negative object property assertion not supported -- NegativeObjectPropertyAssertion({p} {i1} {i2} {d})"
|
|
518
527
|
)
|
|
@@ -525,24 +534,28 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
525
534
|
p: OWLDataPropertyExpression,
|
|
526
535
|
d: float,
|
|
527
536
|
) -> None:
|
|
537
|
+
super().write_negative_data_property_assertion_axiom(i, lit, p, d)
|
|
528
538
|
Util.error(
|
|
529
539
|
f"Negative data property assertion not supported -- NegativeDataPropertyAssertion({p} {i} {lit} {d})"
|
|
530
540
|
)
|
|
531
541
|
return None
|
|
532
542
|
|
|
533
543
|
def write_same_individual_axiom(self, ind_set: set[OWLIndividual]) -> None:
|
|
544
|
+
super().write_same_individual_axiom(ind_set)
|
|
534
545
|
Util.error(
|
|
535
|
-
f"Same individual axiom not supported --
|
|
546
|
+
f"Same individual axiom not supported -- SameIndividuals({self.__get_set_name(ind_set)})"
|
|
536
547
|
)
|
|
537
548
|
return None
|
|
538
549
|
|
|
539
550
|
def write_different_individuals_axiom(self, ind_set: set[OWLIndividual]) -> None:
|
|
551
|
+
super().write_different_individuals_axiom(ind_set)
|
|
540
552
|
Util.error(
|
|
541
553
|
f"Different individual axiom not supported -- DifferentIndividuals({self.__get_set_name(ind_set)})"
|
|
542
554
|
)
|
|
543
555
|
return None
|
|
544
556
|
|
|
545
557
|
def write_disjoint_classes_axiom(self, class_set: set[OWLClassExpression]) -> None:
|
|
558
|
+
super().write_disjoint_classes_axiom(class_set)
|
|
546
559
|
if len(class_set) <= 1:
|
|
547
560
|
return
|
|
548
561
|
self.__write(
|
|
@@ -550,6 +563,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
550
563
|
)
|
|
551
564
|
|
|
552
565
|
def write_disjoint_union_axiom(self, class_set: set[OWLClassExpression]) -> None:
|
|
566
|
+
super().write_disjoint_union_axiom(class_set)
|
|
553
567
|
if len(class_set) <= 1:
|
|
554
568
|
return
|
|
555
569
|
for c in class_set:
|
|
@@ -562,6 +576,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
562
576
|
def write_subclass_of_axiom(
|
|
563
577
|
self, subclass: OWLClassExpression, superclass: OWLClassExpression, d: float
|
|
564
578
|
) -> None:
|
|
579
|
+
super().write_subclass_of_axiom(subclass, superclass, d)
|
|
565
580
|
if isinstance(subclass, OWLClass) and d == 1:
|
|
566
581
|
self.__write(
|
|
567
582
|
f"(define-primitive-concept {self.get_short_name(subclass)} {self.get_class_name(superclass)})"
|
|
@@ -574,6 +589,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
574
589
|
def write_equivalent_classes_axiom(
|
|
575
590
|
self, class_set: set[OWLClassExpression]
|
|
576
591
|
) -> None:
|
|
592
|
+
super().write_equivalent_classes_axiom(class_set)
|
|
577
593
|
name: str = None
|
|
578
594
|
left_class: OWLClassExpression = None
|
|
579
595
|
for c in class_set:
|
|
@@ -596,6 +612,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
596
612
|
superproperty: OWLObjectPropertyExpression,
|
|
597
613
|
d: float,
|
|
598
614
|
) -> None:
|
|
615
|
+
super().write_sub_object_property_of_axiom(subproperty, superproperty, d)
|
|
599
616
|
self.__write(
|
|
600
617
|
f"(implies-role {self.get_object_property_name(subproperty)} {self.get_object_property_name(superproperty)} {d})"
|
|
601
618
|
)
|
|
@@ -606,6 +623,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
606
623
|
superproperty: OWLDataPropertyExpression,
|
|
607
624
|
d: float,
|
|
608
625
|
) -> None:
|
|
626
|
+
super().write_sub_data_property_of_axiom(subproperty, superproperty, d)
|
|
609
627
|
self.__write(
|
|
610
628
|
f"(implies-role {self.get_data_property_name(subproperty)} {self.get_data_property_name(superproperty)} {d})"
|
|
611
629
|
)
|
|
@@ -616,13 +634,16 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
616
634
|
superproperty: OWLObjectPropertyExpression,
|
|
617
635
|
d: float,
|
|
618
636
|
) -> None:
|
|
637
|
+
super().write_sub_property_chain_of_axiom(chain, superproperty, d)
|
|
619
638
|
Util.error(
|
|
620
639
|
f"Subproperty chain axiom not supported -- SubObjectPropertyOf(ObjectPropertyChain({self.__get_set_name(chain)}) {superproperty} {d})"
|
|
621
640
|
)
|
|
641
|
+
return None
|
|
622
642
|
|
|
623
643
|
def write_equivalent_object_properties_axiom(
|
|
624
644
|
self, class_set: set[OWLObjectPropertyExpression]
|
|
625
645
|
) -> None:
|
|
646
|
+
super().write_equivalent_object_properties_axiom(class_set)
|
|
626
647
|
first: OWLObjectPropertyExpression = next(class_set)
|
|
627
648
|
first_name: str = self.get_object_property_name(first)
|
|
628
649
|
for property in class_set - set([first]):
|
|
@@ -633,6 +654,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
633
654
|
def write_equivalent_data_properties_axiom(
|
|
634
655
|
self, class_set: set[OWLDataPropertyExpression]
|
|
635
656
|
) -> None:
|
|
657
|
+
super().write_equivalent_data_properties_axiom(class_set)
|
|
636
658
|
first: OWLDataPropertyExpression = next(class_set)
|
|
637
659
|
first_name: str = self.get_data_property_name(first)
|
|
638
660
|
for property in class_set - set([first]):
|
|
@@ -643,28 +665,34 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
643
665
|
def write_transitive_object_property_axiom(
|
|
644
666
|
self, p: OWLObjectPropertyExpression
|
|
645
667
|
) -> None:
|
|
668
|
+
super().write_transitive_object_property_axiom(p)
|
|
646
669
|
self.__write(f"(transitive {self.get_object_property_name(p)})")
|
|
647
670
|
|
|
648
671
|
def write_symmetric_object_property_axiom(
|
|
649
672
|
self, p: OWLObjectPropertyExpression
|
|
650
673
|
) -> None:
|
|
674
|
+
super().write_symmetric_object_property_axiom(p)
|
|
651
675
|
self.__write(f"(symmetric {self.get_object_property_name(p)})")
|
|
652
676
|
|
|
653
677
|
def write_asymmetric_object_property_axiom(
|
|
654
678
|
self, p: OWLObjectPropertyExpression
|
|
655
679
|
) -> None:
|
|
680
|
+
super().write_asymmetric_object_property_axiom(p)
|
|
656
681
|
Util.error(
|
|
657
682
|
f"Asymmetric object property axiom not supported -- AsymmetricObjectProperty({p})"
|
|
658
683
|
)
|
|
684
|
+
return None
|
|
659
685
|
|
|
660
686
|
def write_reflexive_object_property_axiom(
|
|
661
687
|
self, p: OWLObjectPropertyExpression
|
|
662
688
|
) -> None:
|
|
689
|
+
super().write_reflexive_object_property_axiom(p)
|
|
663
690
|
self.__write(f"(reflexive {self.get_object_property_name(p)})")
|
|
664
691
|
|
|
665
692
|
def write_irreflexive_object_property_axiom(
|
|
666
693
|
self, p: OWLObjectPropertyExpression
|
|
667
694
|
) -> None:
|
|
695
|
+
super().write_irreflexive_object_property_axiom(p)
|
|
668
696
|
Util.error(
|
|
669
697
|
f"Irreflexive object property axiom not supported -- IrreflexiveObjectProperty({p})"
|
|
670
698
|
)
|
|
@@ -672,14 +700,16 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
672
700
|
def write_functional_object_property_axiom(
|
|
673
701
|
self, p: OWLObjectPropertyExpression
|
|
674
702
|
) -> None:
|
|
703
|
+
super().write_functional_object_property_axiom(p)
|
|
675
704
|
name: str = self.get_object_property_name(p)
|
|
676
705
|
if name not in self.processed_functional_object_properties:
|
|
677
706
|
self.processed_functional_object_properties.add(name)
|
|
678
707
|
self.__write(f"(functional {name})")
|
|
679
708
|
|
|
680
709
|
def write_functional_data_property_axiom(
|
|
681
|
-
self, p:
|
|
710
|
+
self, p: OWLDataPropertyExpression
|
|
682
711
|
) -> None:
|
|
712
|
+
super().write_functional_data_property_axiom(p)
|
|
683
713
|
name: str = self.get_data_property_name(p)
|
|
684
714
|
if name not in self.processed_functional_data_properties:
|
|
685
715
|
self.processed_functional_data_properties.add(name)
|
|
@@ -688,6 +718,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
688
718
|
def write_inverse_object_property_axiom(
|
|
689
719
|
self, p1: OWLObjectPropertyExpression, p2: OWLObjectPropertyExpression
|
|
690
720
|
) -> None:
|
|
721
|
+
super().write_inverse_object_property_axiom(p1, p2)
|
|
691
722
|
self.__write(
|
|
692
723
|
f"(inverse {self.get_object_property_name(p1)} {self.get_object_property_name(p2)})"
|
|
693
724
|
)
|
|
@@ -695,11 +726,13 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
695
726
|
def write_inverse_functional_object_property_axiom(
|
|
696
727
|
self, p: OWLObjectPropertyExpression
|
|
697
728
|
) -> None:
|
|
729
|
+
super().write_inverse_functional_object_property_axiom(p)
|
|
698
730
|
self.__write(f"(inverse-functional {self.get_object_property_name(p)})")
|
|
699
731
|
|
|
700
732
|
def write_object_property_domain_axiom(
|
|
701
733
|
self, p: OWLObjectPropertyExpression, c: OWLClassExpression
|
|
702
734
|
) -> None:
|
|
735
|
+
super().write_object_property_domain_axiom(p, c)
|
|
703
736
|
self.__write(
|
|
704
737
|
f"(domain {self.get_object_property_name(p)} {self.get_class_name(c)})"
|
|
705
738
|
)
|
|
@@ -707,6 +740,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
707
740
|
def write_object_property_range_axiom(
|
|
708
741
|
self, p: OWLObjectPropertyExpression, c: OWLClassExpression
|
|
709
742
|
) -> None:
|
|
743
|
+
super().write_object_property_range_axiom(p, c)
|
|
710
744
|
self.__write(
|
|
711
745
|
f"(range {self.get_object_property_name(p)} {self.get_class_name(c)})"
|
|
712
746
|
)
|
|
@@ -714,6 +748,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
714
748
|
def write_data_property_domain_axiom(
|
|
715
749
|
self, p: OWLDataPropertyExpression, c: OWLClassExpression
|
|
716
750
|
) -> None:
|
|
751
|
+
super().write_data_property_domain_axiom(p, c)
|
|
717
752
|
self.__write(
|
|
718
753
|
f"(domain {self.get_data_property_name(p)} {self.get_class_name(c)})"
|
|
719
754
|
)
|
|
@@ -721,6 +756,7 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
721
756
|
def write_data_property_range_axiom(
|
|
722
757
|
self, p: OWLDataPropertyExpression, range: OWLDataRange
|
|
723
758
|
) -> None:
|
|
759
|
+
super().write_data_property_range_axiom(p, range)
|
|
724
760
|
range_str: str = None
|
|
725
761
|
dp_name: str = self.get_data_property_name(p)
|
|
726
762
|
if isinstance(range, OWLDatatype):
|
|
@@ -809,108 +845,139 @@ class FuzzyOwl2ToFuzzyDL(FuzzyOwl2):
|
|
|
809
845
|
def write_disjoint_object_properties_axiom(
|
|
810
846
|
self, class_set: set[OWLObjectPropertyExpression]
|
|
811
847
|
) -> None:
|
|
848
|
+
super().write_disjoint_object_properties_axiom(class_set)
|
|
812
849
|
Util.error(
|
|
813
850
|
f"Disjoint object properties axiom not supported -- DisjointObjectProperties({self.__get_set_name(class_set)})"
|
|
814
851
|
)
|
|
852
|
+
return None
|
|
815
853
|
|
|
816
854
|
def write_disjoint_data_properties_axiom(
|
|
817
855
|
self, class_set: set[OWLDataPropertyExpression]
|
|
818
856
|
) -> None:
|
|
857
|
+
super().write_disjoint_data_properties_axiom(class_set)
|
|
819
858
|
Util.error(
|
|
820
859
|
f"Disjoint data properties axiom not supported -- DisjointDataProperties({self.__get_set_name(class_set)})"
|
|
821
860
|
)
|
|
861
|
+
return None
|
|
822
862
|
|
|
823
863
|
def write_triangular_modifier_definition(
|
|
824
864
|
self, name: str, mod: TriangularModifier
|
|
825
865
|
) -> None:
|
|
866
|
+
super().write_triangular_modifier_definition(name, mod)
|
|
826
867
|
self.__write(f"(define-modifier {name} {mod})")
|
|
827
868
|
|
|
828
869
|
def write_linear_modifier_definition(self, name: str, mod: LinearModifier) -> None:
|
|
870
|
+
super().write_linear_modifier_definition(name, mod)
|
|
829
871
|
self.__write(f"(define-modifier {name} {mod})")
|
|
830
872
|
|
|
873
|
+
def write_crisp_function_definition(self, name: str, dat: CrispFunction) -> None:
|
|
874
|
+
super().write_crisp_function_definition(name, dat)
|
|
875
|
+
self.__write(f"(define-fuzzy-concept {name} {dat})")
|
|
876
|
+
|
|
831
877
|
def write_left_shoulder_function_definition(
|
|
832
878
|
self, name: str, dat: LeftShoulderFunction
|
|
833
879
|
) -> None:
|
|
880
|
+
super().write_left_shoulder_function_definition(name, dat)
|
|
834
881
|
self.__write(f"(define-fuzzy-concept {name} {dat})")
|
|
835
882
|
|
|
836
883
|
def write_right_shoulder_function_definition(
|
|
837
884
|
self, name: str, dat: RightShoulderFunction
|
|
838
885
|
) -> None:
|
|
886
|
+
super().write_right_shoulder_function_definition(name, dat)
|
|
839
887
|
self.__write(f"(define-fuzzy-concept {name} {dat})")
|
|
840
888
|
|
|
841
889
|
def write_linear_function_definition(self, name: str, dat: LinearFunction) -> None:
|
|
890
|
+
super().write_linear_function_definition(name, dat)
|
|
842
891
|
self.__write(f"(define-fuzzy-concept {name} {dat})")
|
|
843
892
|
|
|
844
893
|
def write_triangular_function_definition(
|
|
845
894
|
self, name: str, dat: TriangularFunction
|
|
846
895
|
) -> None:
|
|
896
|
+
super().write_triangular_function_definition(name, dat)
|
|
847
897
|
self.__write(f"(define-fuzzy-concept {name} {dat})")
|
|
848
898
|
|
|
849
899
|
def write_trapezoidal_function_definition(
|
|
850
900
|
self, name: str, dat: TrapezoidalFunction
|
|
851
901
|
) -> None:
|
|
902
|
+
super().write_trapezoidal_function_definition(name, dat)
|
|
852
903
|
self.__write(f"(define-fuzzy-concept {name} {dat})")
|
|
853
904
|
|
|
854
905
|
def write_modified_function_definition(
|
|
855
906
|
self, name: str, dat: ModifiedFunction
|
|
856
907
|
) -> None:
|
|
908
|
+
super().write_modified_function_definition(name, dat)
|
|
857
909
|
self.__write(f"(define-concept {name} {dat})")
|
|
858
910
|
|
|
859
911
|
def write_modified_property_definition(
|
|
860
912
|
self, name: str, dat: ModifiedProperty
|
|
861
913
|
) -> None:
|
|
914
|
+
super().write_modified_property_definition(name, dat)
|
|
862
915
|
Util.error(
|
|
863
916
|
f"Modified property not supported -- EquivalentObjectProperties({name} <{dat.get_fuzzy_modifier()} {dat.get_property()}>)"
|
|
864
917
|
)
|
|
918
|
+
return None
|
|
865
919
|
|
|
866
920
|
def write_modified_concept_definition(
|
|
867
921
|
self, name: str, dat: ModifiedConcept
|
|
868
922
|
) -> None:
|
|
923
|
+
super().write_modified_concept_definition(name, dat)
|
|
869
924
|
self.__write(f"(define-concept {name} {dat})")
|
|
870
925
|
|
|
871
926
|
def write_fuzzy_nominal_concept_definition(
|
|
872
927
|
self, name: str, dat: FuzzyNominalConcept
|
|
873
928
|
) -> None:
|
|
929
|
+
super().write_fuzzy_nominal_concept_definition(name, dat)
|
|
874
930
|
Util.error(
|
|
875
931
|
f"Fuzzy nominal not supported -- EquivalentConcepts({name} OneOf({dat}))"
|
|
876
932
|
)
|
|
933
|
+
return None
|
|
877
934
|
|
|
878
935
|
def write_weighted_concept_definition(self, name: str, c: WeightedConcept) -> None:
|
|
936
|
+
super().write_weighted_concept_definition(name, c)
|
|
879
937
|
self.__write(f"(define-concept {name} {c})")
|
|
880
938
|
|
|
881
939
|
def write_weighted_max_concept_definition(
|
|
882
940
|
self, name: str, c: WeightedMaxConcept
|
|
883
941
|
) -> None:
|
|
942
|
+
super().write_weighted_max_concept_definition(name, c)
|
|
884
943
|
self.__write(f"(define-concept {name} {c})")
|
|
885
944
|
|
|
886
945
|
def write_weighted_min_concept_definition(
|
|
887
946
|
self, name: str, c: WeightedMinConcept
|
|
888
947
|
) -> None:
|
|
948
|
+
super().write_weighted_min_concept_definition(name, c)
|
|
889
949
|
self.__write(f"(define-concept {name} {c})")
|
|
890
950
|
|
|
891
951
|
def write_weighted_sum_concept_definition(
|
|
892
952
|
self, name: str, c: WeightedSumConcept
|
|
893
953
|
) -> None:
|
|
954
|
+
super().write_weighted_sum_concept_definition(name, c)
|
|
894
955
|
self.__write(f"(define-concept {name} {c})")
|
|
895
956
|
|
|
896
957
|
def write_weighted_sum_zero_concept_definition(
|
|
897
958
|
self, name: str, c: WeightedSumZeroConcept
|
|
898
959
|
) -> None:
|
|
960
|
+
super().write_weighted_sum_zero_concept_definition(name, c)
|
|
899
961
|
self.__write(f"(define-concept {name} {c})")
|
|
900
962
|
|
|
901
963
|
def write_owa_concept_definition(self, name: str, c: OwaConcept) -> None:
|
|
964
|
+
super().write_owa_concept_definition(name, c)
|
|
902
965
|
self.__write(f"(define-concept {name} {c})")
|
|
903
966
|
|
|
904
967
|
def write_choquet_concept_definition(self, name: str, c: ChoquetConcept) -> None:
|
|
968
|
+
super().write_choquet_concept_definition(name, c)
|
|
905
969
|
self.__write(f"(define-concept {name} {c})")
|
|
906
970
|
|
|
907
971
|
def write_sugeno_concept_definition(self, name: str, c: SugenoConcept) -> None:
|
|
972
|
+
super().write_sugeno_concept_definition(name, c)
|
|
908
973
|
self.__write(f"(define-concept {name} {c})")
|
|
909
974
|
|
|
910
975
|
def write_quasi_sugeno_concept_definition(
|
|
911
976
|
self, name: str, c: QsugenoConcept
|
|
912
977
|
) -> None:
|
|
978
|
+
super().write_quasi_sugeno_concept_definition(name, c)
|
|
913
979
|
self.__write(f"(define-concept {name} {c})")
|
|
914
980
|
|
|
915
981
|
def write_qowa_concept_definition(self, name: str, c: QowaConcept) -> None:
|
|
982
|
+
super().write_qowa_concept_definition(name, c)
|
|
916
983
|
self.__write(f"(define-concept {name} {c})")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_datatype import FuzzyDatatype
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class CrispFunction(FuzzyDatatype):
|
|
5
|
+
def __init__(self, a: float, b: float) -> None:
|
|
6
|
+
super().__init__()
|
|
7
|
+
self._a: float = a
|
|
8
|
+
self._b: float = b
|
|
9
|
+
|
|
10
|
+
def get_a(self) -> float:
|
|
11
|
+
return self._a
|
|
12
|
+
|
|
13
|
+
def get_b(self) -> float:
|
|
14
|
+
return self._b
|
|
15
|
+
|
|
16
|
+
def __str__(self) -> str:
|
|
17
|
+
return f"crisp({self._k1}, {self._k2}, {self._a}, {self._b})"
|
|
@@ -10,6 +10,7 @@ import pyparsing as pp
|
|
|
10
10
|
from fuzzy_dl_owl2.fuzzydl.util.config_reader import ConfigReader
|
|
11
11
|
from fuzzy_dl_owl2.fuzzydl.util.util import Util
|
|
12
12
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.choquet_concept import ChoquetConcept
|
|
13
|
+
from fuzzy_dl_owl2.fuzzyowl2.owl_types.crisp_function import CrispFunction
|
|
13
14
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.fuzzy_nominal_concept import FuzzyNominalConcept
|
|
14
15
|
from fuzzy_dl_owl2.fuzzyowl2.owl_types.left_shoulder_function import (
|
|
15
16
|
LeftShoulderFunction,
|
|
@@ -140,7 +141,7 @@ class FuzzyOwl2XMLParser(object):
|
|
|
140
141
|
elif concept_type == FuzzyOWL2Keyword.NOMINAL:
|
|
141
142
|
return FuzzyNominalConcept(
|
|
142
143
|
float(
|
|
143
|
-
child.attrib.get(FuzzyOWL2Keyword.
|
|
144
|
+
child.attrib.get(FuzzyOWL2Keyword.DEGREE_VALUE.get_str_value())
|
|
144
145
|
),
|
|
145
146
|
child.attrib.get(FuzzyOWL2Keyword.INDIVIDUAL.get_str_value()),
|
|
146
147
|
)
|
|
@@ -148,7 +149,12 @@ class FuzzyOwl2XMLParser(object):
|
|
|
148
149
|
child = root.find(FuzzyOWL2Keyword.DATATYPE.get_tag_name())
|
|
149
150
|
datatype_type = child.attrib.get(FuzzyOWL2Keyword.TYPE.get_str_value())
|
|
150
151
|
|
|
151
|
-
if datatype_type == FuzzyOWL2Keyword.
|
|
152
|
+
if datatype_type == FuzzyOWL2Keyword.CRISP:
|
|
153
|
+
return CrispFunction(
|
|
154
|
+
float(child.attrib.get(FuzzyOWL2Keyword.A.get_str_value())),
|
|
155
|
+
float(child.attrib.get(FuzzyOWL2Keyword.B.get_str_value())),
|
|
156
|
+
)
|
|
157
|
+
elif datatype_type == FuzzyOWL2Keyword.LEFT_SHOULDER:
|
|
152
158
|
return LeftShoulderFunction(
|
|
153
159
|
float(child.attrib.get(FuzzyOWL2Keyword.A.get_str_value())),
|
|
154
160
|
float(child.attrib.get(FuzzyOWL2Keyword.B.get_str_value())),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: fuzzy-dl-owl2
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.10
|
|
4
4
|
Summary: A python porting of the Fuzzy Description Language (see https://www.umbertostraccia.it/cs/software/fuzzyDL/fuzzyDL.html) and the Fuzzy OWL 2 framework (see https://www.umbertostraccia.it/cs/software/FuzzyOWL/index.html).
|
|
5
5
|
License: CC-BY-SA-4.0
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Giuseppe Filippone
|
|
7
8
|
Author-email: filipponegiuseppe94@gmail.com
|
|
8
9
|
Requires-Python: >=3.11,<4.0
|
|
@@ -11,6 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
16
|
Requires-Dist: networkx (>=3.3,<4.0)
|
|
15
17
|
Requires-Dist: owlready2 (>=0.47,<0.48)
|
|
16
18
|
Requires-Dist: pyowl2 (>=1.0.3,<2.0.0)
|
|
@@ -290,9 +292,9 @@ restriction := '(' ('>=' | '<=', '=') name (name | restriction_funct
|
|
|
290
292
|
|$(\mathrm{>=}\ F\ \text{variable})$| ${\mathrm{sup}}_{b \in {\Delta}_D} \[F^\mathcal{I} (x, b) \otimes (b \geq \text{variable})\]$|
|
|
291
293
|
|$(\mathrm{<=}\ F\ \text{variable})$| $\mathrm{sup}_{b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b \leq \text{variable})\]$|
|
|
292
294
|
|$(=\ F\ \text{variable}) $| $\mathrm{sup}_{b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b = \text{variable})\]$|
|
|
293
|
-
|$(\mathrm{>=}\ F\ \text{fuzzy
|
|
294
|
-
|$(\mathrm{<=}\ F\ \text{fuzzy
|
|
295
|
-
|$(=\ F\ \text{fuzzy
|
|
295
|
+
|$(\mathrm{>=}\ F\ \text{fuzzy\\_number})$|$\mathrm{sup}_{b^\prime, b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b \geq b^\prime) \otimes {\text{fuzzy\\_number}(b^\prime)}^\mathcal{I}\]$|
|
|
296
|
+
|$(\mathrm{<=}\ F\ \text{fuzzy\\_number})$|$\mathrm{sup}_{b^\prime, b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b \leq b^\prime) \otimes {\text{fuzzy\\_number}(b^\prime)}^\mathcal{I}\]$|
|
|
297
|
+
|$(=\ F\ \text{fuzzy\\_number})$|$\mathrm{sup}_{b^\prime, b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b = b^\prime) \otimes {\text{fuzzy\\_number}(b^\prime)}^\mathcal{I}\]$|
|
|
296
298
|
|$(\mathrm{>=}\ F\ \mathrm{function}(F_1, \ldots, F_n))$|$\mathrm{sup}_{b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b \geq {\mathrm{function}(F_1, \ldots, F_n)}^{\mathcal{I}})\]$|
|
|
297
299
|
|$(\mathrm{<=}\ F\ \mathrm{function}(F_1, \ldots, F_n))$|$\mathrm{sup}_{b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b \leq {\mathrm{function}(F_1, \ldots, F_n)}^{\mathcal{I}})\]$|
|
|
298
300
|
|$(=\ F\ \mathrm{function}(F_1, \ldots, F_n))$|$\mathrm{sup}_{b \in \Delta_D} \[F^\mathcal{I} (x, b) \otimes (b = {\mathrm{function}(F_1, \ldots, F_n)}^{\mathcal{I}})\]$|
|
|
@@ -65,13 +65,13 @@ fuzzy_dl_owl2/fuzzydl/exception/__init__.py,sha256=IoYY5IQoU4UYyoB-dFOVLZyDvJN20
|
|
|
65
65
|
fuzzy_dl_owl2/fuzzydl/exception/fuzzy_ontology_exception.py,sha256=eH1ybBCx1QoZaf8PLCq1rC_3tiBRA-gKCwECTcUUuro,122
|
|
66
66
|
fuzzy_dl_owl2/fuzzydl/exception/inconsistent_ontology_exception.py,sha256=ez0RQN4KGlNRcfB7IXfPz3bM86CFLl6zo-RRTBRpa_o,129
|
|
67
67
|
fuzzy_dl_owl2/fuzzydl/feature_function.py,sha256=DXc2ZgjSqAIK5TauJzhcXgifQOB2ZkPxfElRAhJsGVw,6716
|
|
68
|
-
fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2.py,sha256=
|
|
68
|
+
fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2.py,sha256=1EPRTpvtnEzfmXB1ktDfJT9cOxIdOCSQxjhK7sDlqzc,58440
|
|
69
69
|
fuzzy_dl_owl2/fuzzydl/general_concept_inclusion.py,sha256=X2gIpmKs0RsU7VoKILxpQdBs2yyLAIqWd5UWOAuk22M,2557
|
|
70
70
|
fuzzy_dl_owl2/fuzzydl/individual/__init__.py,sha256=zBCa24kE2nv08VgtphjLshpbGNEARUJgCdtyv9r6JGc,110
|
|
71
71
|
fuzzy_dl_owl2/fuzzydl/individual/created_individual.py,sha256=lERkUgXkhYJgLJjuEbqLHimd5O2ABuMkMDnNipliJtY,9293
|
|
72
72
|
fuzzy_dl_owl2/fuzzydl/individual/individual.py,sha256=iQIqQvbrQ9XOQABVQTt9UF-3MTc2zrcZgBprNYWJfgA,4408
|
|
73
73
|
fuzzy_dl_owl2/fuzzydl/individual/representative_individual.py,sha256=nayeaoV0B-9xO_I8mttHZTi1CWHs7X7ezhiIjQP7ZBs,1538
|
|
74
|
-
fuzzy_dl_owl2/fuzzydl/knowledge_base.py,sha256=
|
|
74
|
+
fuzzy_dl_owl2/fuzzydl/knowledge_base.py,sha256=mcRwGq6bPZK9mthGoX5CENulpq9NKiZwQcKlqpu8JGg,449470
|
|
75
75
|
fuzzy_dl_owl2/fuzzydl/label.py,sha256=gh4V0LTwzucaOWoV2n4JIATjs5EbxIIdtppOZttaiw0,1187
|
|
76
76
|
fuzzy_dl_owl2/fuzzydl/milp/__init__.py,sha256=g2oFT2Ge8W5Li2kP2CJjpjJ1a0PRI2vDoDdzYDsEtDY,246
|
|
77
77
|
fuzzy_dl_owl2/fuzzydl/milp/expression.py,sha256=KBGIBid5kZhOT5l4buWmAtPAvm_8JfK3lUNg10GhANg,7160
|
|
@@ -86,7 +86,7 @@ fuzzy_dl_owl2/fuzzydl/modifier/linear_modifier.py,sha256=2g3wR-UNqJhLMvyroapu_mb
|
|
|
86
86
|
fuzzy_dl_owl2/fuzzydl/modifier/modifier.py,sha256=rjNND_cOeGZXNSHlP_eO2RloSlkR6MfvrJgFqUa8Ars,1365
|
|
87
87
|
fuzzy_dl_owl2/fuzzydl/modifier/triangular_modifier.py,sha256=9z_oVC0QidpNCEk0FsN2EDzy7lDWTXl5dNGr3sc04j4,2131
|
|
88
88
|
fuzzy_dl_owl2/fuzzydl/parser/__init__.py,sha256=vs0cN8a1ATeFx1J4evw6k7mWe4zOvba_xMO2eBXZ_gc,32
|
|
89
|
-
fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py,sha256=
|
|
89
|
+
fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py,sha256=1AqO_7U9xuIRvir-CQNGfSuSDmC13hEhEFLH6W3x-Hs,97242
|
|
90
90
|
fuzzy_dl_owl2/fuzzydl/primitive_concept_definition.py,sha256=xe-pqIDJw64bej2PFQXXApisgK0gHAnhxKJ1ruuyvDk,2523
|
|
91
91
|
fuzzy_dl_owl2/fuzzydl/query/__init__.py,sha256=hWPTep2e_-q4rLitvqiMhA3dWp0VqrFxxv6ZphljMaQ,459
|
|
92
92
|
fuzzy_dl_owl2/fuzzydl/query/all_instances_query.py,sha256=W12qjt6qyPyioR7H3730PiJOq0PbNoTGHfepbG66C24,4946
|
|
@@ -127,21 +127,22 @@ fuzzy_dl_owl2/fuzzydl/util/constants.py,sha256=He8y8tmhgku9ZB2IbZP-OUaZYLQN_6dkd
|
|
|
127
127
|
fuzzy_dl_owl2/fuzzydl/util/util.py,sha256=5COC79TAJz8fNrRzXLbNpAT9rLd_0KrRI1OU-hob3oU,1903
|
|
128
128
|
fuzzy_dl_owl2/fuzzydl/util/utils.py,sha256=TPVLEL9NJXgReuxEIOTEOVYqojSymg_-kyrLETXnYdo,2344
|
|
129
129
|
fuzzy_dl_owl2/fuzzyowl2/__init__.py,sha256=C44P0-Sn35FQdVMqYLzeDWa5qPmokbcs8GPiD_zQaSg,153
|
|
130
|
-
fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2.py,sha256=
|
|
131
|
-
fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl.py,sha256=
|
|
130
|
+
fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2.py,sha256=BzUdv4W4TOXUGMLY1frEi4UPw6a5WEruROGOU8-fE70,74128
|
|
131
|
+
fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl.py,sha256=dvMq7y8fPm5WZaPnESw4C7r7ZwQfewqSDJ01S7WD5YE,40876
|
|
132
132
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
133
133
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/choquet_concept.py,sha256=ymnyNfvkvWA3y2UMXyPviD0U98vJ6jrX6zddj09SUoI,671
|
|
134
134
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/concept_definition.py,sha256=d5ZsEX8NN-aYJohXGzeJFhrnufCJ6AZ1YLGiclwysDc,324
|
|
135
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/crisp_function.py,sha256=YmXcbFfnqFR7YONl4jNJjG8b2ErpzCH-vUuNNGGrAkY,455
|
|
135
136
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_datatype.py,sha256=hgwLDROjJjevl8IUxRMSw1s_HX0Ooww3MaXYrwvF7n4,464
|
|
136
137
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_modifier.py,sha256=LOqjKDz6_Gi0vXzz9oKagSBnlHqUS_PDwIFYFbb6ne0,50
|
|
137
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_nominal_concept.py,sha256=
|
|
138
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_nominal_concept.py,sha256=0M-YtytiiHCip_YfAJHX1OHd2GHfdesKmnA40ubol9g,564
|
|
138
139
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/fuzzy_property.py,sha256=AK_L-JtEwTN_gjmDRnY5i4i3w7lGDVtT4Ba7ryVPz38,52
|
|
139
140
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/left_shoulder_function.py,sha256=xeiJGisZSwWbHp4a9indXmu-IOJsR-qMDYLBzw2c1UI,470
|
|
140
141
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/linear_function.py,sha256=3MZR09E0AhUTEHQZY_RUpucYqIBZPiP84rBj4EMQOyo,457
|
|
141
142
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/linear_modifier.py,sha256=CIm4rlSuvcI9dqLscASFHexjHKcJ06Wg3fZy__tw7H4,340
|
|
142
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_concept.py,sha256=
|
|
143
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_function.py,sha256=
|
|
144
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_property.py,sha256=
|
|
143
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_concept.py,sha256=U-E7RfIfbYvqm_08p7kcIAfuwXNYC5lkfKne4MHjPFg,554
|
|
144
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_function.py,sha256=liebxiX_dHmbPTdpSVmdrnOdR6lBALYBD_bOB_MnUHE,427
|
|
145
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/modified_property.py,sha256=CFdaZJyozJZB-g69YZfBw0gN-aFSi-LJSMvibVXo4Mk,544
|
|
145
146
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/owa_concept.py,sha256=rQNp8zSQ-tQYwcJsc3sCVhG1chtZ7Ev1MumSBOPbOwI,659
|
|
146
147
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/property_definition.py,sha256=5NZd22GcaPQKCrIZwCGzPgx1M5h41A3tH9qKI_m2WVc,268
|
|
147
148
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/qowa_concept.py,sha256=yfErtkNIWWW-QUgA4T6F7tL-sCPC0GXYYkR2xT8LHKk,598
|
|
@@ -152,17 +153,17 @@ fuzzy_dl_owl2/fuzzyowl2/owl_types/trapezoidal_function.py,sha256=l3KRs7ACesW9MM8
|
|
|
152
153
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/triangular_function.py,sha256=gteNPNUnUheMpNEKnr6t88Lxe5p_ust-oeDrLU51Au4,567
|
|
153
154
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/triangular_modifer.py,sha256=Z7Tc3bDbU9U_LXUGnrdugGHa2PQ81qN91NbQAdaWbXo,552
|
|
154
155
|
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_concept.py,sha256=sd_KYs0__df_Zv1P6KGU1oTvz4zi5Y2UyyfF57vYru0,542
|
|
155
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_max_concept.py,sha256=
|
|
156
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_min_concept.py,sha256=
|
|
157
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_concept.py,sha256=
|
|
158
|
-
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_zero_concept.py,sha256=
|
|
156
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_max_concept.py,sha256=kAfNUtxq-SmVA9WCyJpwHkj57znpg_c28MioQJ89myM,530
|
|
157
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_min_concept.py,sha256=zJY2v58sPhmFcUAWKPuyT0rJXoU82Prqg4aCT62MtRQ,530
|
|
158
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_concept.py,sha256=wlVYizlgvMlD6GGTX20a8mTMBJqFSYn9CV-tKL76jeE,530
|
|
159
|
+
fuzzy_dl_owl2/fuzzyowl2/owl_types/weighted_sum_zero_concept.py,sha256=SD1xHZaEDeOkGHp0kceyoXRH44g8tbRjEKvFm1dpdXI,544
|
|
159
160
|
fuzzy_dl_owl2/fuzzyowl2/parser/__init__.py,sha256=HjRhpobpAAB569symjAAoN98RVIqo0P6KtsVLDxC3Ok,60
|
|
160
161
|
fuzzy_dl_owl2/fuzzyowl2/parser/owl2_parser.py,sha256=6rwMT_dGaaaKZQRotGiidbwqCOpLuPkyXaHXGQ5CV1k,20068
|
|
161
|
-
fuzzy_dl_owl2/fuzzyowl2/parser/owl2_xml_parser.py,sha256
|
|
162
|
+
fuzzy_dl_owl2/fuzzyowl2/parser/owl2_xml_parser.py,sha256=-no2LqMt8xqx5o_I4BRzk6q3c2tmot3EhXbMN8OglYE,11587
|
|
162
163
|
fuzzy_dl_owl2/fuzzyowl2/util/__init__.py,sha256=4qG4CwkdYoT0vh3uX9N8DlmXh4QfKimVUqR4h2DR8Gg,50
|
|
163
164
|
fuzzy_dl_owl2/fuzzyowl2/util/constants.py,sha256=Oev5Q-H4mhmdvV3nrp0fZKZx8jpo9beXjJwm0dfDUSc,6970
|
|
164
165
|
fuzzy_dl_owl2/fuzzyowl2/util/fuzzy_xml.py,sha256=iYAodtBkZYt3cOvMBA0VEMOU87ljb-06_aUfH14gvwE,3416
|
|
165
|
-
fuzzy_dl_owl2-1.0.
|
|
166
|
-
fuzzy_dl_owl2-1.0.
|
|
167
|
-
fuzzy_dl_owl2-1.0.
|
|
168
|
-
fuzzy_dl_owl2-1.0.
|
|
166
|
+
fuzzy_dl_owl2-1.0.10.dist-info/METADATA,sha256=-exBj5DbR3tU5en64ZVyhxjGMIZzR2Yx4l8jx1AaIoo,43843
|
|
167
|
+
fuzzy_dl_owl2-1.0.10.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
168
|
+
fuzzy_dl_owl2-1.0.10.dist-info/licenses/LICENSE,sha256=er4Z7Ju3OzYUG5mbhh0krYVegIuv4PgehMzihVb2wpc,20131
|
|
169
|
+
fuzzy_dl_owl2-1.0.10.dist-info/RECORD,,
|
|
File without changes
|