Coverage for lode / models / resource.py: 89%
124 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-10-05 16:02 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-10-05 16:02 +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 # Relation with Resources (0..*)
39 self.is_in_range_of = []
41 def set_has_identifier(self, value):
42 """Imposta has_identifier"""
43 self.has_identifier = value
45 def get_has_identifier(self):
46 """Restituisce has_identifier"""
47 return self.has_identifier
49 def set_is_deprecated(self, value):
50 """Imposta is_deprecated"""
51 self.is_deprecated = value
53 def get_is_deprecated(self):
54 """Restituisce is_deprecated"""
55 return self.is_deprecated
57 def set_has_comment(self, literal):
58 """Aggiunge un literal a has_comment"""
59 self.has_comment.append(literal)
61 def get_has_comment(self):
62 """Restituisce una copia della lista has_comment"""
63 return list(set(self.has_comment))
65 def set_has_label(self, literal):
66 """Aggiunge un literal a has_label"""
67 self.has_label.append(literal)
69 def get_has_label(self):
70 """Restituisce una copia della lista has_label"""
71 return list(set(self.has_label))
73 def set_has_preferred_label(self, literal):
74 """Aggiunge un literal a has_preferred_label"""
75 self.has_preferred_label.append(literal)
77 def get_has_preferred_label(self):
78 """Restituisce una copia della lista has_preferred_label"""
79 return list(set(self.has_preferred_label))
81 def set_has_alternative_label(self, literal):
82 """Aggiunge un literal a has_alternative_label"""
83 self.has_alternative_label.append(literal)
85 def get_has_alternative_label(self):
86 """Restituisce una copia della lista has_alternative_label"""
87 return list(set(self.has_alternative_label))
89 def set_has_hidden_label(self, literal):
90 """Aggiunge un literal a has_hidden_label"""
91 self.has_hidden_label.append(literal)
93 def get_has_hidden_label(self):
94 """Restituisce una copia della lista has_hidden_label"""
95 return list(set(self.has_hidden_label))
97 def set_has_notation(self, literal):
98 """Aggiunge un literal a has_notation"""
99 self.has_notation.append(literal)
101 def get_has_notation(self):
102 """Restituisce una copia della lista has_notation"""
103 return list(set(self.has_notation))
105 def set_has_note(self, literal):
106 """Aggiunge un literal a has_note"""
107 self.has_note.append(literal)
109 def get_has_note(self):
110 """Restituisce una copia della lista has_note"""
111 return list(set(self.has_note))
113 def set_has_change_note(self, literal):
114 """Aggiunge un literal a has_change_note"""
115 self.has_change_note.append(literal)
117 def get_has_change_note(self):
118 """Restituisce una copia della lista has_change_note"""
119 return list(set(self._has_change_note))
121 def set_has_definition(self, literal):
122 """Aggiunge un literal a has_definition"""
123 self.has_definition.append(literal)
125 def get_has_definition(self):
126 """Restituisce una copia della lista has_definition"""
127 return list(set(self.has_definition))
129 def set_has_editorial_note(self, literal):
130 """Aggiunge un literal a has_editorial_note"""
131 self.has_editorial_note.append(literal)
133 def get_has_editorial_note(self):
134 """Restituisce una copia della lista has_editorial_note"""
135 return list(set(self.has_editorial_note))
137 def set_has_example(self, literal):
138 """Aggiunge un literal a has_example"""
139 self.has_example.append(literal)
141 def get_has_example(self):
142 """Restituisce una copia della lista has_example"""
143 return list(set(self.has_example))
145 def set_has_history_note(self, literal):
146 """Aggiunge un literal a has_history_note"""
147 self.has_history_note.append(literal)
149 def get_has_history_note(self):
150 """Restituisce una copia della lista has_history_note"""
151 return list(set(self.has_history_note))
153 def set_has_scope_note(self, literal):
154 """Aggiunge un literal a has_scope_note"""
155 self.has_scope_note.append(literal)
157 def get_has_scope_note(self):
158 """Restituisce una copia della lista has_scope_note"""
159 return list(set(self.has_scope_note))
161 def set_see_also(self, resource):
162 """Aggiunge una risorsa a see_also"""
163 self.see_also.append(resource)
165 def get_see_also(self):
166 """Restituisce una copia della lista see_also"""
167 return list(set(self.see_also))
169 def set_is_defined_by(self, resource):
170 """Aggiunge una risorsa a is_defined_by"""
171 self.is_defined_by.append(resource)
173 def get_is_defined_by(self):
174 """Restituisce una copia della lista is_defined_by"""
175 return list(set(self.is_defined_by))
177 def set_has_version_info(self, resource):
178 """Aggiunge una risorsa a has_version_info"""
179 self.has_version_info.append(resource)
181 def get_has_version_info(self):
182 """Restituisce una copia della lista has_version_info"""
183 return list(set(self.has_version_info))
185 def set_has_type(self, concept):
186 if concept not in self.has_type:
187 self.has_type.append(concept)
189 def get_has_type(self):
190 return list(self.has_type)
192 def set_is_included_in(self, model):
193 """Aggiunge un model a is_included_in"""
194 self.is_included_in.append(model)
196 def get_is_included_in(self):
197 """Restituisce una copia della lista is_included_in"""
198 return list(set(self.is_included_in))
200 def set_has_contributor(self, literal):
201 self.has_contributor.append(literal)
203 def get_has_contributor(self):
204 return list(set(self.has_contributor))
206 def set_has_creator(self, literal):
207 self.has_creator.append(literal)
209 def get_has_creator(self):
210 return list(set(self.has_creator))
212 def get_also_defined_as(self):
213 """Returns the list of also defined as"""
214 return list(self.also_defined_as)
216 def set_also_defined_as(self, resource):
217 """Aggiunge un Resource alla lista di also_defined_as"""
218 self.also_defined_as.append(resource)
220 def set_is_in_range_of(self, prop):
221 if prop not in self.is_in_range_of:
222 self.is_in_range_of.append(prop)
224 def get_is_in_range_of(self):
225 return list(self.is_in_range_of)