Skip to main content

GraphView

Trait GraphView 

Source
pub trait GraphView {
    // Required methods
    fn objects(&self, subject: &str, predicate: &str) -> Vec<String>;
    fn subjects_with(&self, predicate: &str, object: &str) -> Vec<String>;
    fn subjects_of(&self, predicate: &str) -> Vec<String>;
    fn objects_of(&self, predicate: &str) -> Vec<String>;
    fn predicates_for_subject(&self, subject: &str) -> Vec<String>;
    fn all_nodes(&self) -> Vec<String>;

    // Provided methods
    fn is_subclass_of(&self, child: &str, parent: &str) -> bool { ... }
    fn subclasses_of(&self, parent: &str) -> BTreeSet<String> { ... }
    fn instances_of(&self, class: &str) -> Vec<String> { ... }
    fn is_instance_of(&self, node: &str, class: &str) -> bool { ... }
}
Expand description

A read-only view of the data graph for SHACL validation. The validator only ever asks targeted questions — a focus node’s values, the subjects of a predicate, the instances of a class — so this surface is small enough to back two ways: an in-memory triple set (DataGraph, eager) or a .rete file’s index directly (ReteGraph), which routes each lookup as a range read so a remote validation faults only the tiles holding the shapes’ targets, not the whole graph. The class/instance helpers are derived from the primitives, so a backend only implements the six lookups.

Required Methods§

Source

fn objects(&self, subject: &str, predicate: &str) -> Vec<String>

Objects of (subject, predicate, ?).

Source

fn subjects_with(&self, predicate: &str, object: &str) -> Vec<String>

Subjects of (?, predicate, object).

Source

fn subjects_of(&self, predicate: &str) -> Vec<String>

Distinct subjects of (?, predicate, ?).

Source

fn objects_of(&self, predicate: &str) -> Vec<String>

Distinct objects of (?, predicate, ?).

Source

fn predicates_for_subject(&self, subject: &str) -> Vec<String>

Distinct predicates of (subject, ?, ?).

Source

fn all_nodes(&self) -> Vec<String>

Every node (subject or object). The one inherently non-targeted lookup — a remote validation that reaches it reads the whole graph (only a general inverse path or a target-less shape does).

Provided Methods§

Source

fn is_subclass_of(&self, child: &str, parent: &str) -> bool

Is child a reflexive/transitive rdfs:subClassOf of parent?

Source

fn subclasses_of(&self, parent: &str) -> BTreeSet<String>

The (transitive) subclasses of parent.

Source

fn instances_of(&self, class: &str) -> Vec<String>

Instances of class (direct, or via a subclass).

Source

fn is_instance_of(&self, node: &str, class: &str) -> bool

Is node an instance of class (direct, or via a subclass)?

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§