pub struct Fact { /* private fields */ }Expand description
Materialized claim backed by at least one evidence record.
Implementations§
Source§impl Fact
impl Fact
Sourcepub fn new(
subject: EntityId,
predicate: KnowledgePredicate,
value: EvidenceValue,
confidence: ConfidenceScore,
evidence_id: EvidenceId,
) -> Self
pub fn new( subject: EntityId, predicate: KnowledgePredicate, value: EvidenceValue, confidence: ConfidenceScore, evidence_id: EvidenceId, ) -> Self
Creates a fact backed by one evidence record.
Sourcepub fn with_confidence(self, confidence: ConfidenceScore) -> Self
pub fn with_confidence(self, confidence: ConfidenceScore) -> Self
Replaces the fact confidence score.
Sourcepub fn add_evidence(&mut self, evidence_id: EvidenceId)
pub fn add_evidence(&mut self, evidence_id: EvidenceId)
Adds provenance without counting the same evidence twice.
Sourcepub fn predicate(&self) -> &KnowledgePredicate
pub fn predicate(&self) -> &KnowledgePredicate
Returns the claim predicate.
Sourcepub fn value(&self) -> &EvidenceValue
pub fn value(&self) -> &EvidenceValue
Returns the claim value.
Sourcepub fn confidence(&self) -> ConfidenceScore
pub fn confidence(&self) -> ConfidenceScore
Returns the confidence score.
Sourcepub fn evidence_ids(&self) -> &BTreeSet<EvidenceId>
pub fn evidence_ids(&self) -> &BTreeSet<EvidenceId>
Returns the evidence records supporting this fact.
Sourcepub fn asserted_at_ms(&self) -> u64
pub fn asserted_at_ms(&self) -> u64
Returns when the fact was asserted in Unix milliseconds.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fact
impl<'de> Deserialize<'de> for Fact
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Fact
impl StructuralPartialEq for Fact
Auto Trait Implementations§
impl Freeze for Fact
impl RefUnwindSafe for Fact
impl Send for Fact
impl Sync for Fact
impl Unpin for Fact
impl UnsafeUnpin for Fact
impl UnwindSafe for Fact
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.