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

14 statements  

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

1"""Cardinality: an OWL cardinality restriction (exactly, min or max).""" 

2from .propertyConceptRestriction import PropertyConceptRestriction 

3 

4class Cardinality(PropertyConceptRestriction): 

5 """A restriction on how many values a property can take on a concept.""" 

6 

7 def __init__(self, **kwargs): 

8 """Create a cardinality restriction with no number and no type set.""" 

9 super().__init__(**kwargs) 

10 

11 self.has_cardinality = None # int[1] 

12 self.has_cardinality_type = None # str[1] 

13 

14 def get_has_cardinality(self): 

15 """Return has_cardinality, the number of values.""" 

16 return self.has_cardinality 

17 

18 def set_has_cardinality(self, var): 

19 """Set has_cardinality, converting the value to int.""" 

20 self.has_cardinality = int(var) 

21 

22 def get_has_cardinality_type(self): 

23 """Return has_cardinality_type ("exactly", "min" or "max").""" 

24 return self.has_cardinality_type 

25 

26 def set_has_cardinality_type(self, string): 

27 """Set has_cardinality_type ("exactly", "min" or "max").""" 

28 self.has_cardinality_type = string 

29