fuzzy-dl-owl2 1.0.7__py3-none-any.whl → 1.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. fuzzy_dl_owl2/fuzzydl/__init__.py +2 -1
  2. fuzzy_dl_owl2/fuzzydl/assertion/assertion.py +1 -0
  3. fuzzy_dl_owl2/fuzzydl/assertion/atomic_assertion.py +2 -0
  4. fuzzy_dl_owl2/fuzzydl/classification_node.py +64 -0
  5. fuzzy_dl_owl2/fuzzydl/concept/__init__.py +2 -0
  6. fuzzy_dl_owl2/fuzzydl/concept/atomic_concept.py +1 -1
  7. fuzzy_dl_owl2/fuzzydl/concept/choquet_integral.py +6 -0
  8. fuzzy_dl_owl2/fuzzydl/concept/concept.py +8 -0
  9. fuzzy_dl_owl2/fuzzydl/concept/concrete/crisp_concrete_concept.py +1 -0
  10. fuzzy_dl_owl2/fuzzydl/concept/concrete/fuzzy_concrete_concept.py +1 -0
  11. fuzzy_dl_owl2/fuzzydl/concept/concrete/fuzzy_number/triangular_fuzzy_number.py +12 -0
  12. fuzzy_dl_owl2/fuzzydl/concept/concrete/left_concrete_concept.py +3 -0
  13. fuzzy_dl_owl2/fuzzydl/concept/concrete/linear_concrete_concept.py +3 -0
  14. fuzzy_dl_owl2/fuzzydl/concept/concrete/modified_concrete_concept.py +4 -0
  15. fuzzy_dl_owl2/fuzzydl/concept/concrete/right_concrete_concept.py +2 -0
  16. fuzzy_dl_owl2/fuzzydl/concept/concrete/trapezoidal_concrete_concept.py +1 -0
  17. fuzzy_dl_owl2/fuzzydl/concept/concrete/triangular_concrete_concept.py +2 -0
  18. fuzzy_dl_owl2/fuzzydl/concept/modified/linearly_modified_concept.py +3 -0
  19. fuzzy_dl_owl2/fuzzydl/concept/modified/modified_concept.py +3 -0
  20. fuzzy_dl_owl2/fuzzydl/concept/modified/triangularly_modified_concept.py +3 -0
  21. fuzzy_dl_owl2/fuzzydl/concept/negated_nominal.py +3 -0
  22. fuzzy_dl_owl2/fuzzydl/concept/operator_concept.py +8 -0
  23. fuzzy_dl_owl2/fuzzydl/concept/qowa_concept.py +4 -0
  24. fuzzy_dl_owl2/fuzzydl/concept/quasi_sugeno_integral.py +3 -0
  25. fuzzy_dl_owl2/fuzzydl/concept/sigma_concept.py +71 -0
  26. fuzzy_dl_owl2/fuzzydl/concept/sigma_count.py +56 -0
  27. fuzzy_dl_owl2/fuzzydl/concept/sugeno_integral.py +4 -0
  28. fuzzy_dl_owl2/fuzzydl/concept_equivalence.py +5 -0
  29. fuzzy_dl_owl2/fuzzydl/concrete_feature.py +6 -0
  30. fuzzy_dl_owl2/fuzzydl/domain_axiom.py +3 -0
  31. fuzzy_dl_owl2/fuzzydl/feature_function.py +3 -0
  32. fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2.py +169 -27
  33. fuzzy_dl_owl2/fuzzydl/general_concept_inclusion.py +6 -0
  34. fuzzy_dl_owl2/fuzzydl/individual/created_individual.py +41 -2
  35. fuzzy_dl_owl2/fuzzydl/individual/individual.py +14 -0
  36. fuzzy_dl_owl2/fuzzydl/individual/representative_individual.py +9 -0
  37. fuzzy_dl_owl2/fuzzydl/knowledge_base.py +2033 -249
  38. fuzzy_dl_owl2/fuzzydl/label.py +18 -10
  39. fuzzy_dl_owl2/fuzzydl/milp/expression.py +33 -23
  40. fuzzy_dl_owl2/fuzzydl/milp/inequation.py +8 -0
  41. fuzzy_dl_owl2/fuzzydl/milp/milp_helper.py +720 -22
  42. fuzzy_dl_owl2/fuzzydl/milp/show_variables_helper.py +82 -0
  43. fuzzy_dl_owl2/fuzzydl/milp/solution.py +23 -0
  44. fuzzy_dl_owl2/fuzzydl/milp/variable.py +7 -0
  45. fuzzy_dl_owl2/fuzzydl/modifier/linear_modifier.py +3 -0
  46. fuzzy_dl_owl2/fuzzydl/modifier/modifier.py +21 -0
  47. fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py +48 -7
  48. fuzzy_dl_owl2/fuzzydl/primitive_concept_definition.py +7 -0
  49. fuzzy_dl_owl2/fuzzydl/query/__init__.py +1 -0
  50. fuzzy_dl_owl2/fuzzydl/query/all_instances_query.py +80 -1
  51. fuzzy_dl_owl2/fuzzydl/query/bnp_query.py +2 -0
  52. fuzzy_dl_owl2/fuzzydl/query/classification_query.py +26 -0
  53. fuzzy_dl_owl2/fuzzydl/query/defuzzify/defuzzify_query.py +2 -1
  54. fuzzy_dl_owl2/fuzzydl/query/defuzzify/lom_defuzzify_query.py +4 -0
  55. fuzzy_dl_owl2/fuzzydl/query/defuzzify/mom_defuzzify_query.py +6 -2
  56. fuzzy_dl_owl2/fuzzydl/query/defuzzify/som_defuzzify_query.py +2 -0
  57. fuzzy_dl_owl2/fuzzydl/query/instance_query.py +5 -0
  58. fuzzy_dl_owl2/fuzzydl/query/kb_satisfiable_query.py +12 -2
  59. fuzzy_dl_owl2/fuzzydl/query/max/max_instance_query.py +6 -1
  60. fuzzy_dl_owl2/fuzzydl/query/max/max_query.py +7 -1
  61. fuzzy_dl_owl2/fuzzydl/query/max/max_related_query.py +6 -1
  62. fuzzy_dl_owl2/fuzzydl/query/max/max_satisfiable_query.py +15 -1
  63. fuzzy_dl_owl2/fuzzydl/query/max/max_subsumes_query.py +4 -1
  64. fuzzy_dl_owl2/fuzzydl/query/min/min_instance_query.py +6 -1
  65. fuzzy_dl_owl2/fuzzydl/query/min/min_query.py +7 -1
  66. fuzzy_dl_owl2/fuzzydl/query/min/min_related_query.py +5 -1
  67. fuzzy_dl_owl2/fuzzydl/query/min/min_satisfiable_query.py +17 -1
  68. fuzzy_dl_owl2/fuzzydl/query/min/min_subsumes_query.py +47 -7
  69. fuzzy_dl_owl2/fuzzydl/query/query.py +5 -2
  70. fuzzy_dl_owl2/fuzzydl/query/related_query.py +8 -1
  71. fuzzy_dl_owl2/fuzzydl/query/satisfiable_query.py +17 -0
  72. fuzzy_dl_owl2/fuzzydl/query/subsumption_query.py +5 -0
  73. fuzzy_dl_owl2/fuzzydl/range_axiom.py +4 -0
  74. fuzzy_dl_owl2/fuzzydl/relation.py +5 -0
  75. fuzzy_dl_owl2/fuzzydl/restriction/has_value_restriction.py +2 -0
  76. fuzzy_dl_owl2/fuzzydl/restriction/restriction.py +3 -0
  77. fuzzy_dl_owl2/fuzzydl/role_parent_with_degree.py +6 -1
  78. fuzzy_dl_owl2/fuzzydl/util/config_reader.py +17 -27
  79. fuzzy_dl_owl2/fuzzydl/util/constants.py +100 -0
  80. fuzzy_dl_owl2-1.0.9.dist-info/METADATA +848 -0
  81. {fuzzy_dl_owl2-1.0.7.dist-info → fuzzy_dl_owl2-1.0.9.dist-info}/RECORD +83 -79
  82. fuzzy_dl_owl2-1.0.7.dist-info/METADATA +0 -408
  83. {fuzzy_dl_owl2-1.0.7.dist-info → fuzzy_dl_owl2-1.0.9.dist-info}/LICENSE +0 -0
  84. {fuzzy_dl_owl2-1.0.7.dist-info → fuzzy_dl_owl2-1.0.9.dist-info}/WHEEL +0 -0
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import enum
2
4
  import os
3
5
  import re
@@ -14,6 +16,25 @@ if not os.path.exists(RESULTS_PATH):
14
16
  os.makedirs(RESULTS_PATH)
15
17
 
16
18
 
19
+ class MILPProvider(enum.StrEnum):
20
+ GUROBI = enum.auto()
21
+ MIP = enum.auto()
22
+ # SCIPY = enum.auto()
23
+ PULP = enum.auto()
24
+ PULP_GLPK = enum.auto()
25
+ PULP_HIGHS = enum.auto()
26
+ PULP_CPLEX = enum.auto()
27
+
28
+ @staticmethod
29
+ def from_str(value: str) -> typing.Self:
30
+ try:
31
+ return MILPProvider(value.lower())
32
+ except ValueError:
33
+ raise ValueError(
34
+ f"Invalid MILP provider: {value}. Valid options are: {list(MILPProvider)}"
35
+ )
36
+
37
+
17
38
  class ConcreteFeatureType(enum.Enum):
18
39
  STRING = 0
19
40
  INTEGER = 1
@@ -28,10 +49,15 @@ class ConcreteFeatureType(enum.Enum):
28
49
 
29
50
 
30
51
  class FeatureFunctionType(enum.Enum):
52
+ # Atomic feature
31
53
  ATOMIC = 0
54
+ # Numberic feature
32
55
  NUMBER = 1
56
+ # Sum function
33
57
  SUM = 2
58
+ # Subtraction function
34
59
  SUBTRACTION = 3
60
+ # Product of a number and a feature.
35
61
  PRODUCT = 5
36
62
 
37
63
  def __repr__(self) -> str:
@@ -106,6 +132,8 @@ class KnowledgeBaseRules(enum.Enum):
106
132
  RULE_NOT_HAS_VALUE = 45
107
133
  RULE_ZADEH_IMPLIES = 46
108
134
  RULE_NOT_ZADEH_IMPLIES = 47
135
+ RULE_SIGMA_COUNT = 48
136
+ RULE_NOT_SIGMA_COUNT = 49
109
137
 
110
138
  def __repr__(self) -> str:
111
139
  return str(self)
@@ -128,72 +156,142 @@ class LogicOperatorType(enum.Enum):
128
156
 
129
157
 
130
158
  class ConceptType(enum.Enum):
159
+ # Conjunction
131
160
  AND = 0
161
+ # Goedel conjunction
132
162
  GOEDEL_AND = 1
163
+ # Lukasiewicz conjunction
133
164
  LUKASIEWICZ_AND = 2
165
+ # Disjunction
134
166
  OR = 3
167
+ # Goedel disjunction
135
168
  GOEDEL_OR = 4
169
+ # Lukasiewicz disjunction
136
170
  LUKASIEWICZ_OR = 5
171
+ # Existential restriction
137
172
  SOME = 6
173
+ # Universal restriction
138
174
  ALL = 7
175
+ # Upper fuzzy rough concept
139
176
  UPPER_APPROX = 8
177
+ # Lower fuzzy rough concept
140
178
  LOWER_APPROX = 9
179
+ # Negated fuzzy number
141
180
  FUZZY_NUMBER_COMPLEMENT = 10
181
+ # Tight upper fuzzy rough concept
142
182
  TIGHT_UPPER_APPROX = 11
183
+ # Tight lower fuzzy rough concept
143
184
  TIGHT_LOWER_APPROX = 12
185
+ # Loose upper fuzzy rough concept
144
186
  LOOSE_UPPER_APPROX = 13
187
+ # Loose lower fuzzy rough concept
145
188
  LOOSE_LOWER_APPROX = 14
189
+ # Goedel implication
146
190
  GOEDEL_IMPLIES = 15
191
+ # Negated Goedel implication
147
192
  NOT_GOEDEL_IMPLIES = 16
193
+ # Atomic concept
148
194
  ATOMIC = 17
195
+ # Complement concept
149
196
  COMPLEMENT = 18
197
+ # Top concept
150
198
  TOP = 19
199
+ # Bottom concept
151
200
  BOTTOM = 20
201
+ # At most datatype restriction
152
202
  AT_MOST_VALUE = 21
203
+ # At least datatype restriction
153
204
  AT_LEAST_VALUE = 22
205
+ # Exact datatype restriction
154
206
  EXACT_VALUE = 23
207
+ # Negate at most datatype restriction
155
208
  NOT_AT_MOST_VALUE = 24
209
+ # Negate at least datatype restriction
156
210
  NOT_AT_LEAST_VALUE = 25
211
+ # Negate exact datatype restriction
157
212
  NOT_EXACT_VALUE = 26
213
+ # Weighted concept
158
214
  WEIGHTED = 27
215
+ # NEgated weighted concept
159
216
  NOT_WEIGHTED = 28
217
+ # Weighted sum concept
160
218
  W_SUM = 29
219
+ # Negated weighted sum concept
161
220
  NOT_W_SUM = 30
221
+ # Positive threshold concept
162
222
  POS_THRESHOLD = 31
223
+ # Negated positive threshold concept
163
224
  NOT_POS_THRESHOLD = 32
225
+ # Negative threshold concept
164
226
  NEG_THRESHOLD = 33
227
+ # Negated negative threshold concept
165
228
  NOT_NEG_THRESHOLD = 34
229
+ # Extended positive threshold concept
166
230
  EXT_POS_THRESHOLD = 35
231
+ # Negated extended positive threshold concept
167
232
  NOT_EXT_POS_THRESHOLD = 36
233
+ # Extended negative threshold concept
168
234
  EXT_NEG_THRESHOLD = 37
235
+ # Negated extended negative threshold concept
169
236
  NOT_EXT_NEG_THRESHOLD = 38
237
+ # Concrete concept
170
238
  CONCRETE = 39
239
+ # Negated concrete concept
171
240
  CONCRETE_COMPLEMENT = 40
241
+ # Modified concept
172
242
  MODIFIED = 41
243
+ # Negated modified concept
173
244
  MODIFIED_COMPLEMENT = 42
245
+ # Self reflexivity concept
174
246
  SELF = 43
247
+ # Fuzzy number
175
248
  FUZZY_NUMBER = 44
249
+ # OWA concept
176
250
  OWA = 45
251
+ # Quantified-guided OWA concept
177
252
  QUANTIFIED_OWA = 46
253
+ # Negated OWA concept
178
254
  NOT_OWA = 47
255
+ # Negated quantified-guided OWA concept
179
256
  NOT_QUANTIFIED_OWA = 48
257
+ # Choquet integral concept
180
258
  CHOQUET_INTEGRAL = 49
259
+ # Sugeno integral concept
181
260
  SUGENO_INTEGRAL = 50
261
+ # Quasi-Sugeno integral concept
182
262
  QUASI_SUGENO_INTEGRAL = 51
263
+ # Negated Choquet integral concept
183
264
  NOT_CHOQUET_INTEGRAL = 52
265
+ # Negated Sugeno integral concept
184
266
  NOT_SUGENO_INTEGRAL = 53
267
+ # Negated Quasi-Sugeno integral concept
185
268
  NOT_QUASI_SUGENO_INTEGRAL = 54
269
+ # Weighted maximum concept
186
270
  W_MAX = 55
271
+ # Negated weighted maximum concept
187
272
  NOT_W_MAX = 56
273
+ # Weighted minimum concept
188
274
  W_MIN = 57
275
+ # Negated weighted minimum concept
189
276
  NOT_W_MIN = 58
277
+ # Weighted sum-zero concept
190
278
  W_SUM_ZERO = 59
279
+ # Negated weighted sum-zero concept
191
280
  NOT_W_SUM_ZERO = 60
281
+ # Negated self reflexivity concept
192
282
  NOT_SELF = 61
283
+ # Has value restriction concept
193
284
  HAS_VALUE = 62
285
+ # Negated has value restriction concept
194
286
  NOT_HAS_VALUE = 63
287
+ # Zadeh'set inclusion implication, only used for min-subs queries.
195
288
  ZADEH_IMPLIES = 64
289
+ # Negated Zadeh'set inclusion implication
196
290
  NOT_ZADEH_IMPLIES = 65
291
+ # Sigma-count concept
292
+ SIGMA_CONCEPT = 66
293
+ # Negated sigma-count concept
294
+ NOT_SIGMA_CONCEPT = 67
197
295
 
198
296
  def __repr__(self) -> str:
199
297
  return self.name
@@ -205,6 +303,7 @@ class ConceptType(enum.Enum):
205
303
  class CreatedIndividualBlockingType(enum.Enum):
206
304
  BLOCKED = 0
207
305
  NOT_BLOCKED = 1
306
+ # Unchecked blocking
208
307
  UNCHECKED = 2
209
308
 
210
309
  def __repr__(self) -> str:
@@ -337,6 +436,7 @@ class FuzzyDLKeyword(enum.Enum):
337
436
  FEATURE_SUB = pp.CaselessKeyword("f-")
338
437
  FEATURE_MUL = pp.CaselessKeyword("f*")
339
438
  FEATURE_DIV = pp.CaselessKeyword("f/")
439
+ SIGMA_COUNT = pp.CaselessKeyword("sigma-count")
340
440
  CRISP = pp.CaselessKeyword("crisp")
341
441
  LEFT_SHOULDER = pp.CaselessKeyword("left-shoulder")
342
442
  RIGHT_SHOULDER = pp.CaselessKeyword("right-shoulder")