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

pub trait AnnotationStorage<T> {
    fn get_annotations_for_item(&self, item: &T) -> Vec<Annotation>;
fn number_of_annotations(&self) -> usize;
fn number_of_annotations_by_name(
        &self,
        ns: Option<String>,
        name: String
    ) -> usize;
fn exact_anno_search<'a>(
        &'a self,
        namespace: Option<String>,
        name: String,
        value: ValueSearch<String>
    ) -> Box<dyn Iterator<Item = Match> + 'a>;
fn regex_anno_search<'a>(
        &'a self,
        namespace: Option<String>,
        name: String,
        pattern: &str,
        negated: bool
    ) -> Box<dyn Iterator<Item = Match> + 'a>;
fn guess_max_count(
        &self,
        ns: Option<String>,
        name: String,
        lower_val: &str,
        upper_val: &str
    ) -> usize;
fn guess_max_count_regex(
        &self,
        ns: Option<String>,
        name: String,
        pattern: &str
    ) -> usize;
fn get_all_values(
        &self,
        key: &AnnoKey,
        most_frequent_first: bool
    ) -> Vec<&str>;
fn annotation_keys(&self) -> Vec<AnnoKey>; }

Access annotations for nodes or edges.

Required methods

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

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

fn number_of_annotations(&self) -> usize

Return the total number of annotations contained in this AnnotationStorage.

fn number_of_annotations_by_name(
    &self,
    ns: Option<String>,
    name: String
) -> usize

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 - If given, only annotation having exactly the given value are returned.

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).

fn guess_max_count(
    &self,
    ns: Option<String>,
    name: String,
    lower_val: &str,
    upper_val: &str
) -> usize

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.

fn guess_max_count_regex(
    &self,
    ns: Option<String>,
    name: String,
    pattern: &str
) -> usize

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.

fn get_all_values(&self, key: &AnnoKey, most_frequent_first: bool) -> Vec<&str>

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

fn annotation_keys(&self) -> Vec<AnnoKey>

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

Loading content...

Implementors

impl AnnotationStorage<u64> for Graph[src]

Loading content...