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

24 statements  

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

1"""Statement: a reified RDF triple.""" 

2from .resource import Resource 

3 

4class Statement(Resource): 

5 """An RDF triple (subject, predicate, object) described as a resource, so it can be documented.""" 

6 

7 def __init__(self, **kwargs): 

8 """Create a positive statement with no subject, predicate or object.""" 

9 super().__init__(**kwargs) 

10 

11 self.is_positive_statement = True # bool [1] 

12 self.has_subject = None # Resource [1] 

13 self.has_object = None # Resource [1] 

14 self.has_predicate = None # Property [1] 

15 

16 # Attributes 

17 def get_is_positive_statement(self): 

18 """Return is_positive_statement.""" 

19 return self.is_positive_statement 

20 

21 def set_is_positive_statement(self, statement): 

22 """Set is_positive_statement.""" 

23 self.is_positive_statement = statement 

24 

25 # Relations with Resource 

26 def get_has_subject(self): 

27 """Return has_subject.""" 

28 return self.has_subject 

29 

30 def set_has_subject(self, statement): 

31 """Set has_subject.""" 

32 self.has_subject = statement 

33 

34 def get_has_object(self): 

35 """Return has_object.""" 

36 return self.has_object 

37 

38 def set_has_object(self, statement): 

39 """Set has_object.""" 

40 self.has_object = statement 

41 

42 # Relation with Property 

43 def get_has_predicate(self): 

44 """Return has_predicate.""" 

45 return self.has_predicate 

46 

47 def set_has_predicate(self, statement): 

48 """Set has_predicate.""" 

49 self.has_predicate = statement