Skip to main content

GraphRead

Trait GraphRead 

Source
pub trait GraphRead {
    // Required methods
    fn matching_quads<'a>(
        &'a self,
        subject: Option<NamedOrBlankNodeRef<'_>>,
        predicate: Option<NamedNodeRef<'_>>,
        object: Option<TermRef<'_>>,
        graph: Option<GraphNameRef<'_>>,
    ) -> impl Iterator<Item = Result<Quad>> + use<'a, Self>;
    fn named_graphs(
        &self,
    ) -> impl Iterator<Item = Result<NamedOrBlankNode>> + '_;
    fn contains_named_graph(&self, graph: &NamedOrBlankNode) -> Result<bool>;
}
Expand description

A fallible stream of stored quads, with explicit graph matching.

None matches every graph; Some(DefaultGraph) matches only the default graph. Implementations preserve stored RDF terms and graph contexts. This interface neither constructs a graph union nor copies the base dataset. Storage owners remain responsible for exact-term encoding: a reader cannot recover lexical forms already normalized by its storage backend. During a consistent read, identical patterns must yield the same first quad; no lexical sorting is required. Borrowed views use this stable representative to deduplicate graph contexts without retaining all previously visited triples.

Required Methods§

Source

fn matching_quads<'a>( &'a self, subject: Option<NamedOrBlankNodeRef<'_>>, predicate: Option<NamedNodeRef<'_>>, object: Option<TermRef<'_>>, graph: Option<GraphNameRef<'_>>, ) -> impl Iterator<Item = Result<Quad>> + use<'a, Self>

Stream matching quads. Read failures must remain errors, never omissions. Retain the source borrow, not the caller’s temporary pattern references.

Source

fn named_graphs(&self) -> impl Iterator<Item = Result<NamedOrBlankNode>> + '_

Stream each named graph exactly once, including empty backend graphs. Iteration must not materialize the set of graph names.

Source

fn contains_named_graph(&self, graph: &NamedOrBlankNode) -> Result<bool>

Test graph existence, including empty graphs in capable storage backends.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl GraphRead for Dataset

Source§

fn matching_quads<'a>( &'a self, subject: Option<NamedOrBlankNodeRef<'_>>, predicate: Option<NamedNodeRef<'_>>, object: Option<TermRef<'_>>, graph: Option<GraphNameRef<'_>>, ) -> impl Iterator<Item = Result<Quad>> + use<'a>

Source§

fn named_graphs(&self) -> impl Iterator<Item = Result<NamedOrBlankNode>> + '_

Source§

fn contains_named_graph(&self, graph: &NamedOrBlankNode) -> Result<bool>

Source§

impl<'tx> GraphRead for Transaction<'tx>

Source§

fn matching_quads<'a>( &'a self, subject: Option<NamedOrBlankNodeRef<'_>>, predicate: Option<NamedNodeRef<'_>>, object: Option<TermRef<'_>>, graph: Option<GraphNameRef<'_>>, ) -> impl Iterator<Item = Result<Quad>> + use<'a, 'tx>

Source§

fn named_graphs(&self) -> impl Iterator<Item = Result<NamedOrBlankNode>> + '_

Source§

fn contains_named_graph(&self, graph: &NamedOrBlankNode) -> Result<bool>

Implementors§

Source§

impl<'source, G: GraphRead + ?Sized, S: GraphRead + ?Sized> GraphRead for OverlayGraph<'source, G, S>

Source§

impl<'source, G: GraphRead + ?Sized> GraphRead for UnionGraph<'source, G>