pub struct ModelQuery<'a> { /* private fields */ }Expand description
Query builder for SAMM Aspect Models
Provides a fluent API for querying and analyzing SAMM models.
Implementations§
Source§impl<'a> ModelQuery<'a>
impl<'a> ModelQuery<'a>
Sourcepub fn find_properties_with_collection_characteristic(&self) -> Vec<&Property>
pub fn find_properties_with_collection_characteristic(&self) -> Vec<&Property>
Finds all properties with Collection, List, Set, or SortedSet characteristics
§Returns
Vector of properties that have collection-type characteristics
Sourcepub fn find_optional_properties(&self) -> Vec<&Property>
pub fn find_optional_properties(&self) -> Vec<&Property>
Sourcepub fn find_required_properties(&self) -> Vec<&Property>
pub fn find_required_properties(&self) -> Vec<&Property>
Sourcepub fn find_properties_in_namespace(&self, namespace: &str) -> Vec<&Property>
pub fn find_properties_in_namespace(&self, namespace: &str) -> Vec<&Property>
Sourcepub fn find_properties_by_characteristic<F>(
&self,
predicate: F,
) -> Vec<&Property>
pub fn find_properties_by_characteristic<F>( &self, predicate: F, ) -> Vec<&Property>
Sourcepub fn find_all_referenced_entities(&self) -> HashSet<String>
pub fn find_all_referenced_entities(&self) -> HashSet<String>
Finds all entities referenced directly or indirectly by the aspect
This performs a breadth-first search through all properties and their characteristics to discover all entity references.
§Returns
Set of unique entity URNs referenced by the model
Sourcepub fn build_dependency_graph(&self) -> Vec<Dependency>
pub fn build_dependency_graph(&self) -> Vec<Dependency>
Builds a dependency graph of all model elements
§Returns
Vector of dependencies showing relationships between elements
Sourcepub fn detect_circular_dependencies(&self) -> Vec<Vec<String>>
pub fn detect_circular_dependencies(&self) -> Vec<Vec<String>>
Detects circular dependencies in the model
Uses depth-first search to detect cycles in the dependency graph.
§Returns
Vector of URN chains representing circular dependencies
Sourcepub fn complexity_metrics(&self) -> ComplexityMetrics
pub fn complexity_metrics(&self) -> ComplexityMetrics
Calculates complexity metrics for the model
§Returns
Complexity metrics including property counts, nesting depth, and reference counts
Sourcepub fn find_properties_by_name_pattern(&self, pattern: &str) -> Vec<&Property>
pub fn find_properties_by_name_pattern(&self, pattern: &str) -> Vec<&Property>
Sourcepub fn group_properties_by_characteristic_type(
&self,
) -> HashMap<String, Vec<&Property>>
pub fn group_properties_by_characteristic_type( &self, ) -> HashMap<String, Vec<&Property>>
Groups properties by their characteristic type
§Returns
HashMap mapping characteristic type names to vectors of properties
Sourcepub fn fuzzy_find_properties(
&self,
query: &str,
max_distance: usize,
) -> Vec<(&Property, usize)>
pub fn fuzzy_find_properties( &self, query: &str, max_distance: usize, ) -> Vec<(&Property, usize)>
Find properties by fuzzy name matching
Uses Levenshtein distance to find properties whose names are similar to the query. Useful for finding properties when you don’t know the exact name.
§Arguments
query- The property name to search for (partial or misspelled)max_distance- Maximum Levenshtein distance (lower = stricter matching)
§Returns
Vector of (property, distance) tuples, sorted by distance (best matches first)
§Examples
use oxirs_samm::query::ModelQuery;
let query = ModelQuery::new(aspect);
// Find properties with names similar to "temperture" (misspelled)
let results = query.fuzzy_find_properties("temperture", 3);
for (property, distance) in results {
println!("Found: {} (distance: {})", property.name(), distance);
}Sourcepub fn fuzzy_find_operations(
&self,
query: &str,
max_distance: usize,
) -> Vec<(&Operation, usize)>
pub fn fuzzy_find_operations( &self, query: &str, max_distance: usize, ) -> Vec<(&Operation, usize)>
Sourcepub fn fuzzy_find_any_element(
&self,
query: &str,
max_distance: usize,
) -> Vec<(String, String, usize)>
pub fn fuzzy_find_any_element( &self, query: &str, max_distance: usize, ) -> Vec<(String, String, usize)>
Sourcepub fn suggest_properties(&self, prefix: &str, limit: usize) -> Vec<String>
pub fn suggest_properties(&self, prefix: &str, limit: usize) -> Vec<String>
Find properties with similar names (auto-suggest)
Provides auto-complete style suggestions based on prefix matching combined with fuzzy matching as fallback.
§Arguments
prefix- The partial property name to matchlimit- Maximum number of suggestions to return
§Returns
Vector of suggested property names
Auto Trait Implementations§
impl<'a> Freeze for ModelQuery<'a>
impl<'a> RefUnwindSafe for ModelQuery<'a>
impl<'a> Send for ModelQuery<'a>
impl<'a> Sync for ModelQuery<'a>
impl<'a> Unpin for ModelQuery<'a>
impl<'a> UnsafeUnpin for ModelQuery<'a>
impl<'a> UnwindSafe for ModelQuery<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.