fuzzy-dl-owl2 1.0.8__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 +190 -34
- fuzzy_dl_owl2/fuzzydl/knowledge_base.py +60 -78
- 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.8.dist-info → fuzzy_dl_owl2-1.0.10.dist-info}/METADATA +225 -192
- {fuzzy_dl_owl2-1.0.8.dist-info → fuzzy_dl_owl2-1.0.10.dist-info}/RECORD +19 -18
- {fuzzy_dl_owl2-1.0.8.dist-info → fuzzy_dl_owl2-1.0.10.dist-info}/WHEEL +1 -1
- {fuzzy_dl_owl2-1.0.8.dist-info → fuzzy_dl_owl2-1.0.10.dist-info/licenses}/LICENSE +0 -0
|
@@ -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())),
|