Class: Dbd::ProvenanceFact
Overview
ProvenanceFact
ProvenanceFact is derived from Fact and behaves very similar.
The ProvenanceFacts with same subject form a ProvenanceResource and this is used as the target for the provenance_subject of a Fact.
The provenance_subject of a ProvenanceFact itself is empty, so the usage of provenance_subject is not recursive on this level (this allows efficient single pass loading in an underlying database).
In the serialisation of a fact stream, the presence or absence of a provenance_subject marks the difference between a (base) Fact and a ProvenanceFact.
The predicates in a ProvenanceFact would typically come from a defined "provenance ontology". An experimental example of a provenance ontology is built-up on https://data.vandenabeele.com/ontologies/provenance.
Instance Method Summary collapse
-
#dup_with_subject(subject_arg) ⇒ ProvenanceFact
Builds duplicate with the subject set.
-
#initialize(options) ⇒ ProvenanceFact
constructor
Builds a new ProvenanceFact.
-
#provenance_subject_error(provenance_subject) ⇒ Object
Validates the presence or absence of provenance_subject.
-
#update_used_provenance_subjects(h) ⇒ Object
Executes the required update in used_provenance_subjects.
Methods inherited from Fact
attributes, #errors, new_id, new_subject, #provenance_subject=, #subject=, #time_stamp=, #values
Constructor Details
#initialize(options) ⇒ ProvenanceFact
Builds a new ProvenanceFact.
31 32 33 34 |
# File 'lib/dbd/provenance_fact.rb', line 31 def initialize() validate_provenance_subject() super end |
Instance Method Details
#dup_with_subject(subject_arg) ⇒ ProvenanceFact
Builds duplicate with the subject set.
60 61 62 63 64 65 |
# File 'lib/dbd/provenance_fact.rb', line 60 def dup_with_subject(subject_arg) self.class.new( subject: subject_arg, # from arg predicate: predicate, object: object) end |
#provenance_subject_error(provenance_subject) ⇒ Object
Validates the presence or absence of provenance_subject.
Here, in the derived ProvenanceFact, it must not be present. Return [nil, String] nil if valid, an error message if not
51 52 53 |
# File 'lib/dbd/provenance_fact.rb', line 51 def provenance_subject_error(provenance_subject) "Provenance subject should not be present in Provenance Fact" if provenance_subject end |
#update_used_provenance_subjects(h) ⇒ Object
Executes the required update in used_provenance_subjects.
For a ProvenanceFact, there is no provenance_subject, so pointless to mark it in used_provenance_subjects hash.
41 42 43 |
# File 'lib/dbd/provenance_fact.rb', line 41 def update_used_provenance_subjects(h) # Do nothing (override the behaviour from super). end |