pub struct StreamingSubgraphExtractor { /* private fields */ }Expand description
In-memory streaming subgraph manager.
Implementations§
Source§impl StreamingSubgraphExtractor
impl StreamingSubgraphExtractor
Sourcepub fn new(max_depth: usize, max_nodes: usize) -> Self
pub fn new(max_depth: usize, max_nodes: usize) -> Self
Create a new extractor.
max_depth– BFS depth limit for subgraph extractionmax_nodes– node cap for subgraph extraction
Sourcepub fn add_triple(&mut self, s: &str, p: &str, o: &str) -> Vec<SubgraphEvent>
pub fn add_triple(&mut self, s: &str, p: &str, o: &str) -> Vec<SubgraphEvent>
Add a triple to the graph and emit the corresponding events.
Returns the events produced by this mutation (also buffered internally).
Sourcepub fn remove_triple(&mut self, s: &str, p: &str, o: &str) -> Vec<SubgraphEvent>
pub fn remove_triple(&mut self, s: &str, p: &str, o: &str) -> Vec<SubgraphEvent>
Remove a triple from the graph and emit the corresponding events.
Returns the events produced by this mutation.
Sourcepub fn extract_subgraph(
&self,
pattern: &SubgraphPattern,
) -> Vec<(String, String, String)>
pub fn extract_subgraph( &self, pattern: &SubgraphPattern, ) -> Vec<(String, String, String)>
Extract (subject, predicate, object) triples matching pattern.
If pattern.anchor is "?x" the extractor uses all known subjects
as starting points (up to max_nodes).
Sourcepub fn extract_neighborhood(
&self,
node: &str,
depth: usize,
) -> Vec<(String, String, String)>
pub fn extract_neighborhood( &self, node: &str, depth: usize, ) -> Vec<(String, String, String)>
Extract the BFS neighbourhood of node up to depth hops.
Sourcepub fn drain_events(&mut self) -> Vec<SubgraphEvent>
pub fn drain_events(&mut self) -> Vec<SubgraphEvent>
Drain and return all buffered events.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes currently in the graph.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Number of directed edges currently in the graph.
Auto Trait Implementations§
impl Freeze for StreamingSubgraphExtractor
impl RefUnwindSafe for StreamingSubgraphExtractor
impl Send for StreamingSubgraphExtractor
impl Sync for StreamingSubgraphExtractor
impl Unpin for StreamingSubgraphExtractor
impl UnsafeUnpin for StreamingSubgraphExtractor
impl UnwindSafe for StreamingSubgraphExtractor
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