Skip to main content

PathBackend

Trait PathBackend 

Source
pub trait PathBackend {
    // Required methods
    fn objects(&self, subject: &Term, predicate: &NamedNode) -> HashSet<Term>;
    fn subjects(&self, predicate: &NamedNode, object: &Term) -> HashSet<Term>;
    fn out_predicates(&self, subject: &Term) -> BTreeSet<NamedNode>;

    // Provided method
    fn contains(
        &self,
        subject: &Term,
        predicate: &NamedNode,
        object: &Term,
    ) -> bool { ... }
}
Expand description

Storage backend for path evaluation. Exposes the three adjacency primitives succ/pred/sh:closed need, so path evaluation can dispatch to either a linear oxrdf::Graph or the indexed FrozenIndexedDataset.

Required Methods§

Source

fn objects(&self, subject: &Term, predicate: &NamedNode) -> HashSet<Term>

{ o | (subject, predicate, o) ∈ G } — forward step.

Source

fn subjects(&self, predicate: &NamedNode, object: &Term) -> HashSet<Term>

{ s | (s, predicate, object) ∈ G } — backward step.

Source

fn out_predicates(&self, subject: &Term) -> BTreeSet<NamedNode>

Predicates of the outgoing triples of subject (used by sh:closed).

Provided Methods§

Source

fn contains(&self, subject: &Term, predicate: &NamedNode, object: &Term) -> bool

Whether (subject, predicate, object) is in the evaluation graph.

Witnessing asks this once per candidate value to certify the edge that produced it. The default answers it by materializing the whole successor set, which makes a value-set of size n cost O(n²); backends with an index should override it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PathBackend for Graph

Linear backend over oxrdf’s B-tree indexes. Used by inference, whose graph grows during forward chaining and so cannot share an immutable snapshot.

Source§

fn objects(&self, subject: &Term, predicate: &NamedNode) -> HashSet<Term>

Source§

fn subjects(&self, predicate: &NamedNode, object: &Term) -> HashSet<Term>

Source§

fn out_predicates(&self, subject: &Term) -> BTreeSet<NamedNode>

Source§

fn contains(&self, subject: &Term, predicate: &NamedNode, object: &Term) -> bool

Implementors§

Source§

impl PathBackend for FrozenIndexedDataset

Indexed backend over the dictionary-encoded post-inference snapshot. Built once at the inference→validation boundary and shared across focus nodes; the u32-keyed sorted indexes replace per-call term hashing and B-tree walks. Unknown terms intern to fresh ids that match no stored triple — exactly the empty-result semantics path evaluation needs.