Coverage for lode / models / truthFunction.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-11-22 15:54 +0000

1"""TruthFunction: a class expression built with a logical operator (and, or, not).""" 

2from .restriction import Restriction 

3 

4class TruthFunction(Restriction): 

5 """A class expression combining concepts with a logical operator (and, or, not).""" 

6 

7 # the has_cardinality_type can have one of three values: "max", "min", and "exact". Any other string will be interpreted as "exact". 

8 # fallback = exact 

9 

10 def __init__(self, **kwargs): 

11 """Create a truth function with no operator and no concepts.""" 

12 super().__init__(**kwargs) 

13 

14 self.has_logical_operator = None # string[1] 

15 self.applies_on_concept = [] # 1..* 

16 

17 def get_has_logical_operator(self): 

18 """Return has_logical_operator.""" 

19 return self.has_logical_operator 

20 

21 def set_has_logical_operator(self, literal): 

22 """Set has_logical_operator.""" 

23 self.has_logical_operator = literal 

24 

25 def get_applies_on_concept(self): 

26 """Return a copy of applies_on_concept.""" 

27 return list(self.applies_on_concept) 

28 

29 def set_applies_on_concept(self, concept): 

30 """Add a concept to applies_on_concept.""" 

31 self.applies_on_concept.append(concept) 

32