Coverage for lode / models / property.py: 94%
34 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
1from .resource import Resource
3class Property(Resource):
4 """Represents an RDF Property"""
6 def __init__(self, **kwargs):
8 super().__init__(**kwargs)
10 # Attributes
11 self.is_functional = False # bool [1]
13 # Relations with Properties (0..*)
14 self.is_sub_property_of = []
15 self.is_disjoint_with = []
16 self.is_equivalent_to = []
18 # Relation with Resource (1..*)
19 # Nell'extractor - default per OWL ontologies = OWL.Thing
20 self.has_range = []
22 # Relations with Concept (1..*)
23 # Nell'extractor - default per OWL ontologies = OWL.Thing
24 self.has_domain = []
26 # Metodi per is_functional
27 def set_is_functional(self, bool):
28 """Imposta is_functional"""
29 self.is_functional = bool
31 def get_is_functional(self):
32 """Restituisce is_functional"""
33 return self.is_functional
35 # Metodi per is_sub_property_of
36 def set_is_sub_property_of(self, property_obj):
37 """Aggiunge una property a is_sub_property_of"""
38 self.is_sub_property_of.append(property_obj)
40 def get_is_sub_property_of(self):
41 """Restituisce una copia della lista is_sub_property_of"""
42 return list(set(self.is_sub_property_of))
44 # Metodi per is_disjoint_with
45 def set_is_disjoint_with(self, property_obj):
46 """Aggiunge una property a is_disjoint_with"""
47 self.is_disjoint_with.append(property_obj)
49 def get_is_disjoint_with(self):
50 """Restituisce una copia della lista is_disjoint_with"""
51 return list(set(self.is_disjoint_with))
53 # Metodi per is_equivalent_to
54 def set_is_equivalent_to(self, property_obj):
55 """Aggiunge una property a is_equivalent_to"""
56 self.is_equivalent_to.append(property_obj)
58 def get_is_equivalent_to(self):
59 """Restituisce una copia della lista is_equivalent_to"""
60 return list(set(self.is_equivalent_to))
62 # Metodi per has_range
63 def set_has_range(self, resource):
64 """Aggiunge una risorsa a has_range"""
65 self.has_range.append(resource)
67 def get_has_range(self):
68 """Restituisce una copia della lista has_range"""
69 return list(set(self.has_range))
71 # Metodi per has_domain
72 def set_has_domain(self, concept):
73 """Aggiunge un concept a has_domain"""
74 self.has_domain.append(concept)
76 def get_has_domain(self):
77 """Restituisce una copia della lista has_domain"""
78 return list(set(self.has_domain))