Trait graphannis::graph::AnnotationStorage[][src]

pub trait AnnotationStorage<T>: Send + Sync + MallocSizeOf where
    T: Send + Sync + MallocSizeOf
{ pub fn insert(
        &mut self,
        item: T,
        anno: Annotation
    ) -> Result<(), GraphAnnisCoreError>;
pub fn get_all_keys_for_item(
        &self,
        item: &T,
        ns: Option<&str>,
        name: Option<&str>
    ) -> Vec<Arc<AnnoKey>, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
;
pub fn remove_annotation_for_item(
        &mut self,
        item: &T,
        key: &AnnoKey
    ) -> Result<Option<Cow<'_, str>>, GraphAnnisCoreError>;
pub fn clear(&mut self) -> Result<(), GraphAnnisCoreError>;
pub fn get_qnames(&self, name: &str) -> Vec<AnnoKey, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
;
pub fn get_annotations_for_item(&self, item: &T) -> Vec<Annotation, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
;
pub fn get_value_for_item(
        &self,
        item: &T,
        key: &AnnoKey
    ) -> Option<Cow<'_, str>>;
pub fn has_value_for_item(&self, item: &T, key: &AnnoKey) -> bool;
pub fn get_keys_for_iterator(
        &self,
        ns: Option<&str>,
        name: Option<&str>,
        it: Box<dyn Iterator<Item = T> + 'static, Global>
    ) -> SmallVec<[Match; 8]>;
pub fn number_of_annotations(&self) -> usize;
pub fn is_empty(&self) -> bool;
pub fn number_of_annotations_by_name(
        &self,
        ns: Option<&str>,
        name: &str
    ) -> usize;
pub fn exact_anno_search(
        &'a self,
        namespace: Option<&str>,
        name: &str,
        value: ValueSearch<&str>
    ) -> Box<dyn Iterator<Item = Match> + 'a, Global>;
pub fn regex_anno_search(
        &'a self,
        namespace: Option<&str>,
        name: &str,
        pattern: &str,
        negated: bool
    ) -> Box<dyn Iterator<Item = Match> + 'a, Global>;
pub fn guess_max_count(
        &self,
        ns: Option<&str>,
        name: &str,
        lower_val: &str,
        upper_val: &str
    ) -> usize;
pub fn guess_max_count_regex(
        &self,
        ns: Option<&str>,
        name: &str,
        pattern: &str
    ) -> usize;
pub fn guess_most_frequent_value(
        &self,
        ns: Option<&str>,
        name: &str
    ) -> Option<Cow<'_, str>>;
pub fn get_all_values(
        &self,
        key: &AnnoKey,
        most_frequent_first: bool
    ) -> Vec<Cow<'_, str>, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
;
pub fn annotation_keys(&self) -> Vec<AnnoKey, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
;
pub fn get_largest_item(&self) -> Option<T>;
pub fn calculate_statistics(&mut self);
pub fn load_annotations_from(
        &mut self,
        location: &Path
    ) -> Result<(), GraphAnnisCoreError>;
pub fn save_annotations_to(
        &self,
        location: &Path
    ) -> Result<(), GraphAnnisCoreError>; }

Access annotations for nodes or edges.

Required methods

pub fn insert(
    &mut self,
    item: T,
    anno: Annotation
) -> Result<(), GraphAnnisCoreError>
[src]

Insert an annotation anno (with annotation key and value) for an item item.

pub fn get_all_keys_for_item(
    &self,
    item: &T,
    ns: Option<&str>,
    name: Option<&str>
) -> Vec<Arc<AnnoKey>, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Get all the annotation keys of a node, filtered by the optional namespace (ns) and name.

pub fn remove_annotation_for_item(
    &mut self,
    item: &T,
    key: &AnnoKey
) -> Result<Option<Cow<'_, str>>, GraphAnnisCoreError>
[src]

Remove the annotation given by its key for a specific item Returns the value for that annotation, if it existed.

pub fn clear(&mut self) -> Result<(), GraphAnnisCoreError>[src]

Remove all annotations.

pub fn get_qnames(&self, name: &str) -> Vec<AnnoKey, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Get all qualified annotation names (including namespace) for a given annotation name

pub fn get_annotations_for_item(&self, item: &T) -> Vec<Annotation, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Get all annotations for an item (node or edge).

pub fn get_value_for_item(
    &self,
    item: &T,
    key: &AnnoKey
) -> Option<Cow<'_, str>>
[src]

Get the annotation for a given item and the annotation key.

pub fn has_value_for_item(&self, item: &T, key: &AnnoKey) -> bool[src]

Returns true if the given item has an annotation for the given key.

pub fn get_keys_for_iterator(
    &self,
    ns: Option<&str>,
    name: Option<&str>,
    it: Box<dyn Iterator<Item = T> + 'static, Global>
) -> SmallVec<[Match; 8]>
[src]

Get the matching annotation keys for each item in the iterator.

This function allows to filter the received annotation keys by the specifying the namespace and name.

pub fn number_of_annotations(&self) -> usize[src]

Return the total number of annotations contained in this AnnotationStorage.

pub fn is_empty(&self) -> bool[src]

Return true if there are no annotations in this AnnotationStorage.

pub fn number_of_annotations_by_name(
    &self,
    ns: Option<&str>,
    name: &str
) -> usize
[src]

Return the number of annotations contained in this AnnotationStorage filtered by name and optional namespace (ns).

Returns an iterator for all items that exactly match the given annotation constraints. The annotation name must be given as argument, the other arguments are optional.

  • namespace- If given, only annotations having this namespace are returned.
  • name - Only annotations with this name are returned.
  • value - Constrain the value of the annotation.

The result is an iterator over matches. A match contains the node ID and the qualifed name of the matched annotation (e.g. there can be multiple annotations with the same name if the namespace is different).

Returns an iterator for all items where the value matches the regular expression. The annotation name and the pattern for the value must be given as argument, the
namespace argument is optional and can be used as additional constraint.

  • namespace- If given, only annotations having this namespace are returned.
  • name - Only annotations with this name are returned.
  • pattern - If given, only annotation having a value that mattches this pattern are returned.
  • negated - If true, find all annotations that do not match the value

The result is an iterator over matches. A match contains the node ID and the qualifed name of the matched annotation (e.g. there can be multiple annotations with the same name if the namespace is different).

pub fn guess_max_count(
    &self,
    ns: Option<&str>,
    name: &str,
    lower_val: &str,
    upper_val: &str
) -> usize
[src]

Estimate the number of results for an annotation exact search for a given an inclusive value range.

  • ns - If given, only annotations having this namespace are considered.
  • name - Only annotations with this name are considered.
  • lower_val- Inclusive lower bound for the annotation value.
  • upper_val- Inclusive upper bound for the annotation value.

pub fn guess_max_count_regex(
    &self,
    ns: Option<&str>,
    name: &str,
    pattern: &str
) -> usize
[src]

Estimate the number of results for an annotation regular expression search for a given pattern.

  • ns - If given, only annotations having this namespace are considered.
  • name - Only annotations with this name are considered.
  • pattern- The regular expression pattern.

pub fn guess_most_frequent_value(
    &self,
    ns: Option<&str>,
    name: &str
) -> Option<Cow<'_, str>>
[src]

Estimate the most frequent value for a given annotation name with an optional namespace (ns).

If more than one qualified annotation name matches the defnition, the more frequent value is used.

pub fn get_all_values(
    &self,
    key: &AnnoKey,
    most_frequent_first: bool
) -> Vec<Cow<'_, str>, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Return a list of all existing values for a given annotation key. If the most_frequent_first parameter is true, the results are sorted by their frequency.

pub fn annotation_keys(&self) -> Vec<AnnoKey, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Get all the annotation keys which are part of this annotation storage

pub fn get_largest_item(&self) -> Option<T>[src]

Return the item with the largest item which has an annotation value in this annotation storage.

This can be used to calculate new IDs for new items.

pub fn calculate_statistics(&mut self)[src]

(Re-) calculate the internal statistics needed for estimitating annotation values.

An annotation storage can not have a valid statistics, in which case the estimitation function will not return valid results.

pub fn load_annotations_from(
    &mut self,
    location: &Path
) -> Result<(), GraphAnnisCoreError>
[src]

Load the annotation from an external location.

pub fn save_annotations_to(
    &self,
    location: &Path
) -> Result<(), GraphAnnisCoreError>
[src]

Save the current annotation to a location on the disk, but do not remember this location.

Loading content...

Implementations on Foreign Types

impl<T> AnnotationStorage<T> for AnnoStorageImpl<T> where
    T: Ord + Hash + MallocSizeOf + Default + Clone + Send + Sync + Serialize + DeserializeOwned,
    (T, Arc<AnnoKey>): Into<Match>, 
[src]

impl<'de, T> AnnotationStorage<T> for AnnoStorageImpl<T> where
    T: FixedSizeKeySerializer + Send + Sync + MallocSizeOf + PartialOrd<T> + Clone + Default + Serialize + DeserializeOwned,
    (T, Arc<AnnoKey>): Into<Match>, 
[src]

Loading content...

Implementors

Loading content...