pub struct KnowledgeBaseUtils;Expand description
Utility functions for knowledge base operations
Implementations§
Source§impl KnowledgeBaseUtils
impl KnowledgeBaseUtils
Sourcepub fn from_facts(facts: Vec<Predicate>) -> KnowledgeBase
pub fn from_facts(facts: Vec<Predicate>) -> KnowledgeBase
Create a knowledge base from a list of facts
Sourcepub fn merge(kb1: &KnowledgeBase, kb2: &KnowledgeBase) -> KnowledgeBase
pub fn merge(kb1: &KnowledgeBase, kb2: &KnowledgeBase) -> KnowledgeBase
Merge two knowledge bases
Sourcepub fn filter_facts(kb: &KnowledgeBase, predicate_name: &str) -> Vec<Predicate>
pub fn filter_facts(kb: &KnowledgeBase, predicate_name: &str) -> Vec<Predicate>
Filter facts by predicate name
Sourcepub fn count_predicates(kb: &KnowledgeBase) -> HashMap<String, usize>
pub fn count_predicates(kb: &KnowledgeBase) -> HashMap<String, usize>
Count predicates by name
Sourcepub fn predicate_names(kb: &KnowledgeBase) -> Vec<String>
pub fn predicate_names(kb: &KnowledgeBase) -> Vec<String>
Get all unique predicate names in the knowledge base
Sourcepub fn contains_fact(kb: &KnowledgeBase, fact: &Predicate) -> bool
pub fn contains_fact(kb: &KnowledgeBase, fact: &Predicate) -> bool
Check if a fact exists in the knowledge base
Sourcepub fn deduplicate(kb: &mut KnowledgeBase)
pub fn deduplicate(kb: &mut KnowledgeBase)
Remove duplicate facts from a knowledge base
Auto Trait Implementations§
impl Freeze for KnowledgeBaseUtils
impl RefUnwindSafe for KnowledgeBaseUtils
impl Send for KnowledgeBaseUtils
impl Sync for KnowledgeBaseUtils
impl Unpin for KnowledgeBaseUtils
impl UnwindSafe for KnowledgeBaseUtils
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more