pub struct InternedGraph { /* private fields */ }Expand description
Term dictionary + triple store backed by interned u32 IDs.
Implementations§
Source§impl InternedGraph
impl InternedGraph
Sourcepub fn intern(&mut self, term: &str) -> u32
pub fn intern(&mut self, term: &str) -> u32
Intern term: return existing ID if present, otherwise allocate a new one.
Sourcepub fn intern_or_none(&self, term: &str) -> Option<u32>
pub fn intern_or_none(&self, term: &str) -> Option<u32>
Intern without inserting. Returns None when the term is unknown.
Sourcepub fn add_triple(&mut self, s: &str, p: &str, o: &str)
pub fn add_triple(&mut self, s: &str, p: &str, o: &str)
Add a triple, interning each component as needed.
Sourcepub fn predicate_pairs(&self, pred_id: u32) -> &[(u32, u32)]
pub fn predicate_pairs(&self, pred_id: u32) -> &[(u32, u32)]
Return all (subject_id, object_id) pairs for the given predicate ID.
Returns an empty slice when the predicate has no triples.
Sourcepub fn num_entities(&self) -> usize
pub fn num_entities(&self) -> usize
Number of distinct terms in the dictionary.
Sourcepub fn num_triples(&self) -> usize
pub fn num_triples(&self) -> usize
Total number of triples stored.
Sourcepub fn from_rdf_triples(triples: Vec<RdfTriple>) -> Self
pub fn from_rdf_triples(triples: Vec<RdfTriple>) -> Self
Build an InternedGraph from a collection of RdfTriples.
Uses parallel term-collection when triples.len() <= PARALLEL_THRESHOLD,
single-threaded otherwise.
Sourcepub fn into_quad_store(&self) -> QuadStore
pub fn into_quad_store(&self) -> QuadStore
Emit a QuadStore (default graph only) containing all stored triples.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InternedGraph
impl RefUnwindSafe for InternedGraph
impl Send for InternedGraph
impl Sync for InternedGraph
impl Unpin for InternedGraph
impl UnsafeUnpin for InternedGraph
impl UnwindSafe for InternedGraph
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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