pub struct GraphStatistics { /* private fields */ }Expand description
Core statistics about an RDF graph.
Tracks total triple count and the number of distinct subjects, predicates, and objects. Supports incremental updates as triples are added or removed.
Implementations§
Source§impl GraphStatistics
impl GraphStatistics
Sourcepub fn add_triple(&mut self, subject: &str, predicate: &str, object: &str)
pub fn add_triple(&mut self, subject: &str, predicate: &str, object: &str)
Record that a triple (subject, predicate, object) was added.
Sourcepub fn remove_triple(&mut self, subject: &str, predicate: &str, object: &str)
pub fn remove_triple(&mut self, subject: &str, predicate: &str, object: &str)
Record that a triple was removed. If the triple was never added, this is a no-op.
Sourcepub fn total_triples(&self) -> u64
pub fn total_triples(&self) -> u64
Total number of triples.
Sourcepub fn distinct_subjects(&self) -> u64
pub fn distinct_subjects(&self) -> u64
Number of distinct subjects.
Sourcepub fn distinct_predicates(&self) -> u64
pub fn distinct_predicates(&self) -> u64
Number of distinct predicates.
Sourcepub fn distinct_objects(&self) -> u64
pub fn distinct_objects(&self) -> u64
Number of distinct objects.
Sourcepub fn predicate_frequency(&self, predicate: &str) -> u64
pub fn predicate_frequency(&self, predicate: &str) -> u64
Frequency of predicate (number of triples with that predicate).
Sourcepub fn top_predicates(&self, limit: usize) -> Vec<(String, u64)>
pub fn top_predicates(&self, limit: usize) -> Vec<(String, u64)>
All predicates sorted by frequency (most frequent first).
Sourcepub fn estimate_cardinality(
&self,
subject: Option<&str>,
predicate: Option<&str>,
object: Option<&str>,
) -> u64
pub fn estimate_cardinality( &self, subject: Option<&str>, predicate: Option<&str>, object: Option<&str>, ) -> u64
Estimate the number of triples for a given triple pattern.
None in a slot means “wildcard”. The estimate uses frequency data where available
and falls back to uniform distribution otherwise.
Sourcepub fn merge(&mut self, other: &GraphStatistics)
pub fn merge(&mut self, other: &GraphStatistics)
Merge another GraphStatistics instance into this one (union semantics — no dedup).
Trait Implementations§
Source§impl Clone for GraphStatistics
impl Clone for GraphStatistics
Source§fn clone(&self) -> GraphStatistics
fn clone(&self) -> GraphStatistics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphStatistics
impl Debug for GraphStatistics
Source§impl Default for GraphStatistics
impl Default for GraphStatistics
Source§fn default() -> GraphStatistics
fn default() -> GraphStatistics
Auto Trait Implementations§
impl Freeze for GraphStatistics
impl RefUnwindSafe for GraphStatistics
impl Send for GraphStatistics
impl Sync for GraphStatistics
impl Unpin for GraphStatistics
impl UnsafeUnpin for GraphStatistics
impl UnwindSafe for GraphStatistics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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