Coverage for lode / models / model.py: 95%

39 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-10-05 16:02 +0000

1from .resource import Resource 

2 

3class Model(Resource): 

4 

5 def __init__(self, **kwargs): 

6 super().__init__(**kwargs) 

7 self.has_version = [] # 0..* 

8 self.is_backward_compatible_with = [] # 0..*  

9 self.imports = [] # 0..* 

10 self.is_incompatible_with = [] # 0..* 

11 self.has_top_concept = [] # 0..1 

12 self.has_prior_version = None # 0..1 

13 self.has_namespaces = {} # 1 (prefix -> URI) 

14 

15 def get_has_version(self): 

16 """Restituisce la lista has_version""" 

17 return list(self.has_version) 

18 

19 def set_has_version(self, model): 

20 """Aggiunge un Model a has_version """ 

21 self.has_version.append(model) 

22 

23 def get_is_backward_compatible_with(self): 

24 """Restituisce la lista is_backward_compatible_with""" 

25 return list(self.is_backward_compatible_with) 

26 

27 def set_is_backward_compatible_with(self, model): 

28 """Aggiunge un Model a is_backward_compatible_with""" 

29 self.is_backward_compatible_with.append(model) 

30 

31 def get_imports(self): 

32 """Restituisce la lista imports""" 

33 return list(self.imports) 

34 

35 def set_imports(self, model): 

36 """Aggiunge un Model a imports""" 

37 self.imports.append(model) 

38 

39 def get_is_incompatible_with(self): 

40 """Restituisce la lista is_incompatible_with""" 

41 return list(self.is_incompatible_with) 

42 

43 def set_is_incompatible_with(self, model): 

44 """Aggiunge un Model a is_incompatible_with""" 

45 self.is_incompatible_with.append(model) 

46 

47 def get_has_top_concept(self): 

48 """Restituisce la lista has_top_concept""" 

49 return self.has_top_concept 

50 

51 def set_has_top_concept(self, concept): 

52 """Aggiunge un Concept a has_top_concept""" 

53 self.has_top_concept = concept 

54 

55 def get_has_prior_version(self): 

56 """Restituisce la lista has_prior_version""" 

57 return self.has_prior_version 

58 

59 def set_has_prior_version(self, model): 

60 """Aggiunge un Model a has_prior_version""" 

61 self.has_prior_version = model 

62 

63 def get_has_namespaces(self): 

64 """Restituisce il dizionario prefix -> URI""" 

65 return dict(self.has_namespaces) 

66 

67 def set_has_namespaces(self, namespaces: dict): 

68 """Imposta il dizionario dei namespace (prefix -> URI)""" 

69 self.has_namespaces = namespaces 

70