Trait terminus_store::Layer

source ·
pub trait Layer: Send + Sync {
Show 32 methods // Required methods fn name(&self) -> [u32; 5]; fn parent_name(&self) -> Option<[u32; 5]>; fn node_and_value_count(&self) -> usize; fn predicate_count(&self) -> usize; fn subject_id(&self, subject: &str) -> Option<u64>; fn predicate_id(&self, predicate: &str) -> Option<u64>; fn object_node_id(&self, object: &str) -> Option<u64>; fn object_value_id(&self, object: &TypedDictEntry) -> Option<u64>; fn id_subject(&self, id: u64) -> Option<String>; fn id_predicate(&self, id: u64) -> Option<String>; fn id_object(&self, id: u64) -> Option<ObjectType>; fn id_object_is_node(&self, id: u64) -> Option<bool>; fn all_counts(&self) -> LayerCounts; fn clone_boxed(&self) -> Box<dyn Layer>; fn triple_exists(&self, subject: u64, predicate: u64, object: u64) -> bool; fn triples(&self) -> Box<dyn Iterator<Item = IdTriple> + Send>; fn triples_s( &self, subject: u64 ) -> Box<dyn Iterator<Item = IdTriple> + Send>; fn triples_sp( &self, subject: u64, predicate: u64 ) -> Box<dyn Iterator<Item = IdTriple> + Send>; fn triples_p( &self, predicate: u64 ) -> Box<dyn Iterator<Item = IdTriple> + Send>; fn triples_o( &self, object: u64 ) -> Box<dyn Iterator<Item = IdTriple> + Send>; fn triple_addition_count(&self) -> usize; fn triple_removal_count(&self) -> usize; fn single_triple_sp(&self, subject: u64, predicate: u64) -> Option<IdTriple>; // Provided methods fn id_object_node(&self, id: u64) -> Option<String> { ... } fn id_object_value(&self, id: u64) -> Option<TypedDictEntry> { ... } fn id_object_is_value(&self, id: u64) -> Option<bool> { ... } fn id_triple_exists(&self, triple: IdTriple) -> bool { ... } fn value_triple_exists(&self, triple: &ValueTriple) -> bool { ... } fn value_triple_to_id(&self, triple: &ValueTriple) -> Option<IdTriple> { ... } fn value_triple_to_partially_resolved( &self, triple: ValueTriple ) -> PartiallyResolvedTriple { ... } fn id_triple_to_string(&self, triple: &IdTriple) -> Option<ValueTriple> { ... } fn triple_count(&self) -> usize { ... }
}
Expand description

A layer containing dictionary entries and triples.

A layer can be queried. To answer queries, layers will check their own data structures, and if they have a parent, the parent is queried as well.

Required Methods§

source

fn name(&self) -> [u32; 5]

The name of this layer.

source

fn parent_name(&self) -> Option<[u32; 5]>

source

fn node_and_value_count(&self) -> usize

The amount of nodes and values known to this layer. This also counts entries in the parent.

source

fn predicate_count(&self) -> usize

The amount of predicates known to this layer. This also counts entries in the parent.

source

fn subject_id(&self, subject: &str) -> Option<u64>

The numerical id of a subject, or None if the subject cannot be found.

source

fn predicate_id(&self, predicate: &str) -> Option<u64>

The numerical id of a predicate, or None if the predicate cannot be found.

source

fn object_node_id(&self, object: &str) -> Option<u64>

The numerical id of a node object, or None if the node object cannot be found.

source

fn object_value_id(&self, object: &TypedDictEntry) -> Option<u64>

The numerical id of a value object, or None if the value object cannot be found.

source

fn id_subject(&self, id: u64) -> Option<String>

The subject corresponding to a numerical id, or None if it cannot be found.

source

fn id_predicate(&self, id: u64) -> Option<String>

The predicate corresponding to a numerical id, or None if it cannot be found.

source

fn id_object(&self, id: u64) -> Option<ObjectType>

The object corresponding to a numerical id, or None if it cannot be found.

source

fn id_object_is_node(&self, id: u64) -> Option<bool>

Check if the given id refers to a node.

This will return None if the id doesn’t refer to anything.

source

fn all_counts(&self) -> LayerCounts

Create a struct with all the counts

source

fn clone_boxed(&self) -> Box<dyn Layer>

Return a clone of this layer in a box.

source

fn triple_exists(&self, subject: u64, predicate: u64, object: u64) -> bool

Returns true if the given triple exists, and false otherwise.

source

fn triples(&self) -> Box<dyn Iterator<Item = IdTriple> + Send>

Iterator over all triples known to this layer.

source

fn triples_s(&self, subject: u64) -> Box<dyn Iterator<Item = IdTriple> + Send>

source

fn triples_sp( &self, subject: u64, predicate: u64 ) -> Box<dyn Iterator<Item = IdTriple> + Send>

source

fn triples_p(&self, predicate: u64) -> Box<dyn Iterator<Item = IdTriple> + Send>

source

fn triples_o(&self, object: u64) -> Box<dyn Iterator<Item = IdTriple> + Send>

source

fn triple_addition_count(&self) -> usize

Returns the total amount of triple additions in this layer and all its parents.

source

fn triple_removal_count(&self) -> usize

Returns the total amount of triple removals in this layer and all its parents.

source

fn single_triple_sp(&self, subject: u64, predicate: u64) -> Option<IdTriple>

Provided Methods§

source

fn id_object_node(&self, id: u64) -> Option<String>

The object node corresponding to a numerical id, or None if it cannot be found. Panics if the object is actually a value.

source

fn id_object_value(&self, id: u64) -> Option<TypedDictEntry>

The object value corresponding to a numerical id, or None if it cannot be found. Panics if the object is actually a node.

source

fn id_object_is_value(&self, id: u64) -> Option<bool>

Check if the given id refers to a value.

This will return None if the id doesn’t refer to anything.

source

fn id_triple_exists(&self, triple: IdTriple) -> bool

Returns true if the given triple exists, and false otherwise.

source

fn value_triple_exists(&self, triple: &ValueTriple) -> bool

Returns true if the given triple exists, and false otherwise.

source

fn value_triple_to_id(&self, triple: &ValueTriple) -> Option<IdTriple>

Convert a ValueTriple to an IdTriple, returning None if any of the strings in the triple could not be resolved.

source

fn value_triple_to_partially_resolved( &self, triple: ValueTriple ) -> PartiallyResolvedTriple

Convert all known strings in the given string triple to ids.

source

fn id_triple_to_string(&self, triple: &IdTriple) -> Option<ValueTriple>

Convert an id triple to the corresponding string version, returning None if any of those ids could not be converted.

source

fn triple_count(&self) -> usize

Returns the total amount of triples in this layer and all its parents.

Implementors§