Trait stam::AnnotationIterator
source · pub trait AnnotationIterator<'store>: Iterator<Item = ResultItem<'store, Annotation>>where
Self: Sized,{
Show 39 methods
// Provided methods
fn parallel(self) -> IntoIter<ResultItem<'store, Annotation>> { ... }
fn annotations(
self
) -> ResultIter<<Vec<ResultItem<'store, Annotation>> as IntoIterator>::IntoIter> ⓘ { ... }
fn annotations_unchecked(
self
) -> Box<dyn Iterator<Item = ResultItem<'store, Annotation>> + 'store>
where Self: 'store { ... }
fn annotations_in_targets(
self,
depth: AnnotationDepth
) -> ResultIter<<Vec<ResultItem<'store, Annotation>> as IntoIterator>::IntoIter> ⓘ { ... }
fn data(
self
) -> ResultIter<<Vec<ResultItem<'store, AnnotationData>> as IntoIterator>::IntoIter> ⓘ { ... }
fn data_unchecked(
self
) -> Box<dyn Iterator<Item = ResultItem<'store, AnnotationData>> + 'store>
where Self: 'store { ... }
fn keys(
self
) -> ResultIter<<Vec<ResultItem<'store, DataKey>> as IntoIterator>::IntoIter> ⓘ { ... }
fn text(
self
) -> TextIter<'store, <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter> ⓘ { ... }
fn resources_as_metadata(
self
) -> ResultIter<<BTreeSet<ResultItem<'store, TextResource>> as IntoIterator>::IntoIter> ⓘ { ... }
fn resources(
self
) -> ResultIter<<BTreeSet<ResultItem<'store, TextResource>> as IntoIterator>::IntoIter> ⓘ { ... }
fn textselections(
self
) -> <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter ⓘ { ... }
fn related_text(
self,
operator: TextSelectionOperator
) -> <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter ⓘ { ... }
fn filter_one(
self,
annotation: &ResultItem<'_, Annotation>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_any(
self,
annotations: Annotations<'store>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_all(
self,
annotations: Annotations<'store>,
store: &'store AnnotationStore
) -> FilterAllIter<'store, Annotation, Self> ⓘ { ... }
fn filter_any_byref(
self,
annotations: &'store Annotations<'store>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_handle(
self,
handle: AnnotationHandle
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotation(
self,
annotation: &ResultItem<'_, Annotation>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotations(
self,
annotations: Annotations<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotations_byref(
self,
annotations: &'store Annotations<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotation_in_targets(
self,
annotation: &ResultItem<'_, Annotation>,
depth: AnnotationDepth
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotations_in_targets(
self,
annotations: Annotations<'store>,
depth: AnnotationDepth,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotations_in_targets_byref(
self,
annotations: &'store Annotations<'store>,
depth: AnnotationDepth,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_data(
self,
data: Data<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_data_byref(
self,
data: &'store Data<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_resource(
self,
resource: &ResultItem<'store, TextResource>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_resource_as_metadata(
self,
resource: &ResultItem<'store, TextResource>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_annotationdata(
self,
data: &ResultItem<'store, AnnotationData>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_key_value(
self,
key: &ResultItem<'store, DataKey>,
value: DataOperator<'store>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_key(
self,
key: &ResultItem<'store, DataKey>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_key_handle(
self,
set: AnnotationDataSetHandle,
key: DataKeyHandle
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_value(
self,
value: DataOperator<'store>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_key_handle_value(
self,
set: AnnotationDataSetHandle,
key: DataKeyHandle,
value: DataOperator<'store>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_set(
self,
set: &ResultItem<'store, AnnotationDataSet>
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_set_handle(
self,
set: AnnotationDataSetHandle
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_text(
self,
text: String,
case_sensitive: bool,
delimiter: &'store str
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_text_byref(
self,
text: &'store str,
case_sensitive: bool,
delimiter: &'store str
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_text_regex(
self,
regex: Regex,
delimiter: &'store str
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
fn filter_related_text(
self,
operator: TextSelectionOperator
) -> FilteredAnnotations<'store, Self> ⓘ { ... }
}Expand description
Trait for iteration over annotations (ResultItem<Annotation>; encapsulation over
Annotation). Implements numerous filter methods to further constrain the iterator, as well
as methods to map from annotations to other items.
Provided Methods§
fn parallel(self) -> IntoIter<ResultItem<'store, Annotation>>
sourcefn annotations(
self
) -> ResultIter<<Vec<ResultItem<'store, Annotation>> as IntoIterator>::IntoIter> ⓘ
fn annotations( self ) -> ResultIter<<Vec<ResultItem<'store, Annotation>> as IntoIterator>::IntoIter> ⓘ
Iterates over all the annotations that reference any annotations (i.e. via a Selector::AnnotationSelector) in this iterator.
The iterator will be consumed and an extra buffer is allocated.
Annotations will be returned sorted chronologically and returned without duplicates
If you want annotations unsorted and with possible duplicates, then just do: .map(|a| a.annotations()).flatten()
sourcefn annotations_unchecked(
self
) -> Box<dyn Iterator<Item = ResultItem<'store, Annotation>> + 'store>where
Self: 'store,
fn annotations_unchecked(
self
) -> Box<dyn Iterator<Item = ResultItem<'store, Annotation>> + 'store>where
Self: 'store,
Iterates over all the annotations that reference any annotations (i.e. via a Selector::AnnotationSelector) in this iterator.
The iterator will be consumed and an extra buffer is allocated.
Annotations will be returned unsorted and returned with possible duplicates
sourcefn annotations_in_targets(
self,
depth: AnnotationDepth
) -> ResultIter<<Vec<ResultItem<'store, Annotation>> as IntoIterator>::IntoIter> ⓘ
fn annotations_in_targets( self, depth: AnnotationDepth ) -> ResultIter<<Vec<ResultItem<'store, Annotation>> as IntoIterator>::IntoIter> ⓘ
Iterates over all the annotations targeted by the annotation in this iterator (i.e. via a Selector::AnnotationSelector)
Use Self::annotations() if you want to find the annotations that reference these ones (the reverse).
Annotations will be returned sorted chronologically, without duplicates
sourcefn data(
self
) -> ResultIter<<Vec<ResultItem<'store, AnnotationData>> as IntoIterator>::IntoIter> ⓘ
fn data( self ) -> ResultIter<<Vec<ResultItem<'store, AnnotationData>> as IntoIterator>::IntoIter> ⓘ
Maps annotations to data, consuming the iterator. Returns a new iterator over the AnnotationData in all the annotations. This returns data sorted chronologically and without duplicates. It does not include the annotations.
sourcefn data_unchecked(
self
) -> Box<dyn Iterator<Item = ResultItem<'store, AnnotationData>> + 'store>where
Self: 'store,
fn data_unchecked(
self
) -> Box<dyn Iterator<Item = ResultItem<'store, AnnotationData>> + 'store>where
Self: 'store,
Maps annotations to data, consuming the iterator. Returns a new iterator over the AnnotationData in all the annotations. This returns data unsorted and with possible duplicates.
sourcefn keys(
self
) -> ResultIter<<Vec<ResultItem<'store, DataKey>> as IntoIterator>::IntoIter> ⓘ
fn keys( self ) -> ResultIter<<Vec<ResultItem<'store, DataKey>> as IntoIterator>::IntoIter> ⓘ
Get an iterator over all keys (DataKey) used by data of this annotation. Shortcut for .data().keys().
sourcefn text(
self
) -> TextIter<'store, <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter> ⓘ
fn text( self ) -> TextIter<'store, <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter> ⓘ
Shortcut for .textselections().text()
sourcefn resources_as_metadata(
self
) -> ResultIter<<BTreeSet<ResultItem<'store, TextResource>> as IntoIterator>::IntoIter> ⓘ
fn resources_as_metadata( self ) -> ResultIter<<BTreeSet<ResultItem<'store, TextResource>> as IntoIterator>::IntoIter> ⓘ
Maps annotations to resources, consuming the iterator. This only covers resources targeted via a ResourceSelector (i.e. annotations as metadata) Will return in chronological order without duplicates.
sourcefn resources(
self
) -> ResultIter<<BTreeSet<ResultItem<'store, TextResource>> as IntoIterator>::IntoIter> ⓘ
fn resources( self ) -> ResultIter<<BTreeSet<ResultItem<'store, TextResource>> as IntoIterator>::IntoIter> ⓘ
Maps annotations to resources, consuming the iterator. This only covers resources targeted via a TextSelector (i.e. annotations on the text) Will return in chronological order without duplicates.
sourcefn textselections(
self
) -> <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter ⓘ
fn textselections( self ) -> <Vec<ResultTextSelection<'store>> as IntoIterator>::IntoIter ⓘ
Maps annotations to textselections, consuming the iterator. Results will be returned in textual order.
Maps annotations to related text selections, as specified by the operator. The iterator will be consumed. Results will be returned in textual order.
This method is slightly different from .textselections().related_text(). This method
will consider multiple textselections pertaining to an annotation as a single set, the
other method treats each textselection separately.
sourcefn filter_one(
self,
annotation: &ResultItem<'_, Annotation>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_one( self, annotation: &ResultItem<'_, Annotation> ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to only a single annotation
This method can only be used once! Use Self::filter_any() to filter on multiple annotations (disjunction).
sourcefn filter_any(
self,
annotations: Annotations<'store>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_any( self, annotations: Annotations<'store> ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on any one of the mentioned annotations
sourcefn filter_all(
self,
annotations: Annotations<'store>,
store: &'store AnnotationStore
) -> FilterAllIter<'store, Annotation, Self> ⓘ
fn filter_all( self, annotations: Annotations<'store>, store: &'store AnnotationStore ) -> FilterAllIter<'store, Annotation, Self> ⓘ
Constrain this iterator to filter on all of the mentioned annotations, that is. If not all of the items in the parameter exist in the iterator, the iterator returns nothing.
sourcefn filter_any_byref(
self,
annotations: &'store Annotations<'store>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_any_byref( self, annotations: &'store Annotations<'store> ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on any one of the mentioned annotations
sourcefn filter_handle(
self,
handle: AnnotationHandle
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_handle( self, handle: AnnotationHandle ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter only a single annotation (by handle) amongst its own results. This is a lower-level method, use Self::filter_annotation() instead.
This method can only be used once! Use Self::filter_annotations() to filter on multiple annotations (disjunction).
sourcefn filter_annotation(
self,
annotation: &ResultItem<'_, Annotation>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotation( self, annotation: &ResultItem<'_, Annotation> ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on annotations that are annotated by this annotation
If you are looking to directly constrain the annotations in this iterator, then use [Self.filter_one()] instead.
sourcefn filter_annotations(
self,
annotations: Annotations<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotations( self, annotations: Annotations<'store>, mode: FilterMode ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on annotations that are annotated by by one of the mentioned annotations
The mode parameter determines whether to constrain on any match (FilterMode::Any) or whether to require that the iterator contains all of the items in the collection (FilterMode::All). If in doubt, pick the former.
If you are looking to directly constrain the annotations in this iterator, then use [Self.filter_any()] instead.
sourcefn filter_annotations_byref(
self,
annotations: &'store Annotations<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotations_byref( self, annotations: &'store Annotations<'store>, mode: FilterMode ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on annotations that are annotated by one of the mentioned annotations
The mode parameter determines whether to constrain on any match (FilterMode::Any) or whether to require that the iterator contains all of the items in the collection (FilterMode::All). If in doubt, pick the former.
If you are looking to directly constrain the annotations in this iterator, then use [Self.filter_any_byref()] instead.
sourcefn filter_annotation_in_targets(
self,
annotation: &ResultItem<'_, Annotation>,
depth: AnnotationDepth
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotation_in_targets( self, annotation: &ResultItem<'_, Annotation>, depth: AnnotationDepth ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on annotations that annotate the annotation in the parameter.
If you are looking to directly constrain the annotations in this iterator, then use [Self.filter_one()] instead.
sourcefn filter_annotations_in_targets(
self,
annotations: Annotations<'store>,
depth: AnnotationDepth,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotations_in_targets( self, annotations: Annotations<'store>, depth: AnnotationDepth, mode: FilterMode ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on annotations that annotate any one of the annotations in the parameter.
The mode parameter determines whether to constrain on any match (FilterMode::Any) or whether to require that the iterator contains all of the items in the collection (FilterMode::All). If in doubt, pick the former.
If you are looking to directly constrain the annotations in this iterator, then use [Self.filter_any()] instead.
sourcefn filter_annotations_in_targets_byref(
self,
annotations: &'store Annotations<'store>,
depth: AnnotationDepth,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotations_in_targets_byref( self, annotations: &'store Annotations<'store>, depth: AnnotationDepth, mode: FilterMode ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain this iterator to filter on annotations that annotate any one of the annotations in the parameter.
The mode parameter determines whether to constrain on any match (FilterMode::Any) or whether to require that the iterator contains all of the items in the collection (FilterMode::All). If in doubt, pick the former.
If you are looking to directly constrain the annotations in this iterator, then use [Self.filter_multiple_byref()] instead.
sourcefn filter_data(
self,
data: Data<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_data( self, data: Data<'store>, mode: FilterMode ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain the iterator to only return annotations that have data that corresponds with the items in the passed data.
The mode parameter determines whether to constrain on any match (FilterMode::Any) or whether to require that the iterator contains all of the items in the collection (FilterMode::All). If in doubt, pick the former.
If you have a single AnnotationData instance, use Self::filter_annotationdata() instead.
If you have a borrowed reference, use Self::filter_data_byref() instead.
This filter is evaluated lazily, it will obtain and check the data for each annotation.
sourcefn filter_data_byref(
self,
data: &'store Data<'store>,
mode: FilterMode
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_data_byref( self, data: &'store Data<'store>, mode: FilterMode ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain the iterator to only return annotations that have data that corresponds with the items in the passed data.
The mode parameter determines whether to constrain on any match (FilterMode::Any) or whether to require that the iterator contains all of the items in the collection (FilterMode::All). If in doubt, pick the former.
If you have a single AnnotationData instance, use Self::filter_annotationdata() instead.
If you do not have a borrowed reference, use Self::filter_data() instead.
This filter is evaluated lazily, it will obtain and check the data for each annotation.
sourcefn filter_resource(
self,
resource: &ResultItem<'store, TextResource>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_resource( self, resource: &ResultItem<'store, TextResource> ) -> FilteredAnnotations<'store, Self> ⓘ
Filter annotations that target text in the specified resource (i.e. via a TextSelector)
sourcefn filter_resource_as_metadata(
self,
resource: &ResultItem<'store, TextResource>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_resource_as_metadata( self, resource: &ResultItem<'store, TextResource> ) -> FilteredAnnotations<'store, Self> ⓘ
Filter annotations that target the specified resource as whole as metadata (i.e. via a ResourceSelector)
sourcefn filter_annotationdata(
self,
data: &ResultItem<'store, AnnotationData>
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_annotationdata( self, data: &ResultItem<'store, AnnotationData> ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain the iterator to return only the annotations that have this exact data item
To filter by multiple data instances (union/disjunction), use Self::filter_data() or (intersection/conjunction) Self::filter_data() with FilterMode::All instead.
This filter is evaluated lazily, it will obtain and check the data for each annotation.
fn filter_key_value( self, key: &ResultItem<'store, DataKey>, value: DataOperator<'store> ) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_key( self, key: &ResultItem<'store, DataKey> ) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_key_handle( self, set: AnnotationDataSetHandle, key: DataKeyHandle ) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_value( self, value: DataOperator<'store> ) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_key_handle_value( self, set: AnnotationDataSetHandle, key: DataKeyHandle, value: DataOperator<'store> ) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_set( self, set: &ResultItem<'store, AnnotationDataSet> ) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_set_handle( self, set: AnnotationDataSetHandle ) -> FilteredAnnotations<'store, Self> ⓘ
sourcefn filter_text(
self,
text: String,
case_sensitive: bool,
delimiter: &'store str
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_text( self, text: String, case_sensitive: bool, delimiter: &'store str ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain the iterator to only return annotations that have text matching the specified text
If you have a borrowed reference, use Self::filter_text_byref() instead.
This filter is evaluated lazily, it will obtain and check the text for each annotation.
The delimiter parameter determines how multiple possible non-contiguous text selections are joined prior to comparison, you most likely want to set it to either a space or an empty string.
sourcefn filter_text_byref(
self,
text: &'store str,
case_sensitive: bool,
delimiter: &'store str
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_text_byref( self, text: &'store str, case_sensitive: bool, delimiter: &'store str ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain the iterator to only return annotations that have text matching the specified text
If you set case_sensitive to false, then text MUST be a lower-cased &str!
This filter is evaluated lazily, it will obtain and check the text for each annotation.
The delimiter parameter determines how multiple possible non-contiguous text selections are joined prior to comparison, you most likely want to set it to either a space or an empty string.
sourcefn filter_text_regex(
self,
regex: Regex,
delimiter: &'store str
) -> FilteredAnnotations<'store, Self> ⓘ
fn filter_text_regex( self, regex: Regex, delimiter: &'store str ) -> FilteredAnnotations<'store, Self> ⓘ
Constrain the iterator to only return text selections that have text matching the specified regular expression.
This filter is evaluated lazily, it will obtain and check the text for each annotation.
The delimiter parameter determines how multiple possible non-contiguous text selections are joined prior to comparison, you most likely want to set it to either a space or an empty string.
Find only annotations whose text selections are related to any text selections of annotations in this iterator, the operator determines the type of the relation.