Coverage for lode / models / resource.py: 69%
117 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-03-25 15:05 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-03-25 15:05 +0000
1class Resource():
2 """Rappresenta una Risorsa RDF"""
4 def __init__(self):
5 # Init Attributes
6 self.has_identifier = None
7 self.is_deprecated = False
9 # Relations with Literals (0..*)
10 self.has_comment = []
11 self.has_label = []
12 self.has_preferred_label = []
13 self.has_alternative_label = []
14 self.has_hidden_label = []
15 self.has_notation = []
16 self.has_note = []
17 self.has_change_note = []
18 self.has_definition = []
19 self.has_editorial_note = []
20 self.has_example = []
21 self.has_history_note = []
22 self.has_scope_note = []
23 self.has_contributor = []
24 self.has_creator = []
26 # Relations with Resources (0..*)
27 self.see_also = []
28 self.is_defined_by = []
29 self.has_version_info = []
30 self.also_defined_as = []
32 # Relation with Concepts (0..*)
33 self.has_type = []
35 # Relation with Models (1..*)
36 self.is_included_in = [] # NEEDS TO BE CHECKED
38 def set_has_identifier(self, value):
39 """Imposta has_identifier"""
40 self.has_identifier = value
42 def get_has_identifier(self):
43 """Restituisce has_identifier"""
44 return self.has_identifier
46 def set_is_deprecated(self, value):
47 """Imposta is_deprecated"""
48 self.is_deprecated = value
50 def get_is_deprecated(self):
51 """Restituisce is_deprecated"""
52 return self.is_deprecated
54 def set_has_comment(self, literal):
55 """Aggiunge un literal a has_comment"""
56 self.has_comment.append(literal)
58 def get_has_comment(self):
59 """Restituisce una copia della lista has_comment"""
60 return list(set(self.has_comment))
62 def set_has_label(self, literal):
63 """Aggiunge un literal a has_label"""
64 self.has_label.append(literal)
66 def get_has_label(self):
67 """Restituisce una copia della lista has_label"""
68 return list(set(self.has_label))
70 def set_has_preferred_label(self, literal):
71 """Aggiunge un literal a has_preferred_label"""
72 self.has_preferred_label.append(literal)
74 def get_has_preferred_label(self):
75 """Restituisce una copia della lista has_preferred_label"""
76 return list(set(self.has_preferred_label))
78 def set_has_alternative_label(self, literal):
79 """Aggiunge un literal a has_alternative_label"""
80 self.has_alternative_label.append(literal)
82 def get_has_alternative_label(self):
83 """Restituisce una copia della lista has_alternative_label"""
84 return list(set(self.has_alternative_label))
86 def set_has_hidden_label(self, literal):
87 """Aggiunge un literal a has_hidden_label"""
88 self.has_hidden_label.append(literal)
90 def get_has_hidden_label(self):
91 """Restituisce una copia della lista has_hidden_label"""
92 return list(set(self.has_hidden_label))
94 def set_has_notation(self, literal):
95 """Aggiunge un literal a has_notation"""
96 self.has_notation.append(literal)
98 def get_has_notation(self):
99 """Restituisce una copia della lista has_notation"""
100 return list(set(self.has_notation))
102 def set_has_note(self, literal):
103 """Aggiunge un literal a has_note"""
104 self.has_note.append(literal)
106 def get_has_note(self):
107 """Restituisce una copia della lista has_note"""
108 return list(set(self.has_note))
110 def set_has_change_note(self, literal):
111 """Aggiunge un literal a has_change_note"""
112 self.has_change_note.append(literal)
114 def get_has_change_note(self):
115 """Restituisce una copia della lista has_change_note"""
116 return list(set(self._has_change_note))
118 def set_has_definition(self, literal):
119 """Aggiunge un literal a has_definition"""
120 self.has_definition.append(literal)
122 def get_has_definition(self):
123 """Restituisce una copia della lista has_definition"""
124 return list(set(self.has_definition))
126 def set_has_editorial_note(self, literal):
127 """Aggiunge un literal a has_editorial_note"""
128 self.has_editorial_note.append(literal)
130 def get_has_editorial_note(self):
131 """Restituisce una copia della lista has_editorial_note"""
132 return list(set(self.has_editorial_note))
134 def set_has_example(self, literal):
135 """Aggiunge un literal a has_example"""
136 self.has_example.append(literal)
138 def get_has_example(self):
139 """Restituisce una copia della lista has_example"""
140 return list(set(self.has_example))
142 def set_has_history_note(self, literal):
143 """Aggiunge un literal a has_history_note"""
144 self.has_history_note.append(literal)
146 def get_has_history_note(self):
147 """Restituisce una copia della lista has_history_note"""
148 return list(set(self.has_history_note))
150 def set_has_scope_note(self, literal):
151 """Aggiunge un literal a has_scope_note"""
152 self.has_scope_note.append(literal)
154 def get_has_scope_note(self):
155 """Restituisce una copia della lista has_scope_note"""
156 return list(set(self.has_scope_note))
158 def set_see_also(self, resource):
159 """Aggiunge una risorsa a see_also"""
160 self.see_also.append(resource)
162 def get_see_also(self):
163 """Restituisce una copia della lista see_also"""
164 return list(set(self.see_also))
166 def set_is_defined_by(self, resource):
167 """Aggiunge una risorsa a is_defined_by"""
168 self.is_defined_by.append(resource)
170 def get_is_defined_by(self):
171 """Restituisce una copia della lista is_defined_by"""
172 return list(set(self.is_defined_by))
174 def set_has_version_info(self, resource):
175 """Aggiunge una risorsa a has_version_info"""
176 self.has_version_info.append(resource)
178 def get_has_version_info(self):
179 """Restituisce una copia della lista has_version_info"""
180 return list(set(self.has_version_info))
182 def set_has_type(self, concept):
183 """Aggiunge un concept a has_type"""
184 self.has_type.append(concept)
186 def get_has_type(self):
187 """Restituisce una copia della lista has_type"""
188 return list(set(self.has_type))
190 def set_is_included_in(self, model):
191 """Aggiunge un model a is_included_in"""
192 self.is_included_in.append(model)
194 def get_is_included_in(self):
195 """Restituisce una copia della lista is_included_in"""
196 return list(set(self.is_included_in))
198 def set_has_contributor(self, literal):
199 self.has_contributor.append(literal)
201 def get_has_contributor(self):
202 return list(set(self.has_contributor))
204 def set_has_creator(self, literal):
205 self.has_creator.append(literal)
207 def get_has_creator(self):
208 return list(set(self.has_creator))
210 def get_also_defined_as(self):
211 """Returns the list of also defined as"""
212 return list(self.also_defined_as)
214 def set_also_defined_as(self, resource):
215 """Aggiunge un Model a has_prior_version"""
216 self.also_defined_as.append(resource)