fuzzy-dl-owl2 1.0.1__py3-none-any.whl → 1.0.3__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 (31) hide show
  1. fuzzy_dl_owl2/fuzzydl/concept/approximation_concept.py +35 -10
  2. fuzzy_dl_owl2/fuzzydl/concept/concrete/fuzzy_number/triangular_fuzzy_number.py +2 -1
  3. fuzzy_dl_owl2/fuzzydl/concept/concrete/trapezoidal_concrete_concept.py +1 -0
  4. fuzzy_dl_owl2/fuzzydl/concept/implies_concept.py +14 -11
  5. fuzzy_dl_owl2/fuzzydl/concept/operator_concept.py +10 -6
  6. fuzzy_dl_owl2/fuzzydl/concept/value_concept.py +1 -1
  7. fuzzy_dl_owl2/fuzzydl/concrete_feature.py +7 -1
  8. fuzzy_dl_owl2/fuzzydl/feature_function.py +16 -2
  9. fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2.py +1 -1
  10. fuzzy_dl_owl2/fuzzydl/knowledge_base.py +494 -358
  11. fuzzy_dl_owl2/fuzzydl/milp/expression.py +4 -2
  12. fuzzy_dl_owl2/fuzzydl/milp/milp_helper.py +3 -2
  13. fuzzy_dl_owl2/fuzzydl/milp/variable.py +3 -0
  14. fuzzy_dl_owl2/fuzzydl/modifier/triangular_modifier.py +1 -1
  15. fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py +1465 -1210
  16. fuzzy_dl_owl2/fuzzydl/query/defuzzify/mom_defuzzify_query.py +14 -7
  17. fuzzy_dl_owl2/fuzzydl/query/min/min_subsumes_query.py +2 -2
  18. fuzzy_dl_owl2/fuzzydl/util/config_reader.py +0 -6
  19. fuzzy_dl_owl2/fuzzydl/util/constants.py +10 -9
  20. fuzzy_dl_owl2/fuzzydl/util/utils.py +48 -7
  21. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2.py +1 -1
  22. {fuzzy_dl_owl2-1.0.1.dist-info → fuzzy_dl_owl2-1.0.3.dist-info}/METADATA +51 -10
  23. {fuzzy_dl_owl2-1.0.1.dist-info → fuzzy_dl_owl2-1.0.3.dist-info}/RECORD +25 -31
  24. fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2_java.py +0 -953
  25. fuzzy_dl_owl2/fuzzydl/parser/ParserConstants.py +0 -406
  26. fuzzy_dl_owl2/fuzzydl/parser/ebnf.lark +0 -290
  27. fuzzy_dl_owl2/fuzzydl/parser/larkx.py +0 -70
  28. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_java.py +0 -1409
  29. fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl_java.py +0 -956
  30. {fuzzy_dl_owl2-1.0.1.dist-info → fuzzy_dl_owl2-1.0.3.dist-info}/LICENSE +0 -0
  31. {fuzzy_dl_owl2-1.0.1.dist-info → fuzzy_dl_owl2-1.0.3.dist-info}/WHEEL +0 -0
@@ -25,7 +25,9 @@ class Expression:
25
25
  def __init__(self, v: typing.Union[list[Variable], set[Variable]]) -> None: ...
26
26
 
27
27
  def __init__(self, *args) -> None:
28
- if len(args) == 1:
28
+ if len(args) == 0:
29
+ self.__expression_init_1(0)
30
+ elif len(args) == 1:
29
31
  if isinstance(args[0], constants.NUMBER):
30
32
  self.__expression_init_1(*args)
31
33
  elif isinstance(args[0], Expression):
@@ -182,5 +184,5 @@ class Expression:
182
184
  elif n == -1.0:
183
185
  parts.append(f"- {term.get_var()}")
184
186
  else:
185
- parts.append(f"{n} {term.get_var()}")
187
+ parts.append(f"{'+ ' if n >= 0 else '- '}{n} {term.get_var()}")
186
188
  return " ".join(parts)
@@ -492,7 +492,7 @@ class MILPHelper:
492
492
  for v1 in to_process:
493
493
  name: str = str(v1)
494
494
  for old_value, new_value in zip(old_values, new_values):
495
- if name not in old_value:
495
+ if old_value not in name:
496
496
  continue
497
497
  name2: str = name.replace(old_value, new_value, 1)
498
498
  v2: Variable = self.get_variable(name2)
@@ -539,7 +539,8 @@ class MILPHelper:
539
539
  return self.__get_ordered_permutation_1(*args)
540
540
  elif len(args) == 2:
541
541
  assert isinstance(args[1], list) and all(
542
- isinstance(a, Variable) for a in args[1]
542
+ isinstance(a, list) and all(isinstance(ai, Variable) for ai in a)
543
+ for a in args[1]
543
544
  )
544
545
  return self.__get_ordered_permutation_2(*args)
545
546
  else:
@@ -76,6 +76,9 @@ class Variable:
76
76
  def __ne__(self, value: object) -> bool:
77
77
  return not (self == value)
78
78
 
79
+ def __hash__(self) -> int:
80
+ return hash(str(self))
81
+
79
82
  def __repr__(self) -> str:
80
83
  return str(self)
81
84
 
@@ -45,7 +45,7 @@ class TriangularModifier(Modifier):
45
45
  self._c = value
46
46
 
47
47
  def clone(self) -> typing.Self:
48
- return TriangularModifier(self.name, self.c)
48
+ return TriangularModifier(self.name, self.a, self.b, self.c)
49
49
 
50
50
  def compute_name(self) -> str:
51
51
  return f"triangular-modifier({self.a}, {self.b}, {self.c})"