pub struct GRLQuery {
pub name: String,
pub goal: String,
pub strategy: GRLSearchStrategy,
pub max_depth: usize,
pub max_solutions: usize,
pub enable_memoization: bool,
pub on_success: Option<QueryAction>,
pub on_failure: Option<QueryAction>,
pub on_missing: Option<QueryAction>,
pub params: HashMap<String, String>,
pub when_condition: Option<String>,
}Expand description
A GRL Query definition
Fields§
§name: StringQuery name
goal: StringGoal pattern to prove (as string expression)
strategy: GRLSearchStrategySearch strategy
max_depth: usizeMaximum search depth
max_solutions: usizeMaximum number of solutions
enable_memoization: boolEnable memoization
on_success: Option<QueryAction>Action on success
on_failure: Option<QueryAction>Action on failure
on_missing: Option<QueryAction>Action on missing facts
params: HashMap<String, String>Parameters for parameterized queries
when_condition: Option<String>Conditional execution (as string condition)
Implementations§
Source§impl GRLQuery
impl GRLQuery
Sourcepub fn with_strategy(self, strategy: GRLSearchStrategy) -> Self
pub fn with_strategy(self, strategy: GRLSearchStrategy) -> Self
Set search strategy
Sourcepub fn with_max_depth(self, max_depth: usize) -> Self
pub fn with_max_depth(self, max_depth: usize) -> Self
Set max depth
Sourcepub fn with_max_solutions(self, max_solutions: usize) -> Self
pub fn with_max_solutions(self, max_solutions: usize) -> Self
Set max solutions
Sourcepub fn with_memoization(self, enable: bool) -> Self
pub fn with_memoization(self, enable: bool) -> Self
Set memoization
Sourcepub fn with_on_success(self, action: QueryAction) -> Self
pub fn with_on_success(self, action: QueryAction) -> Self
Add success action
Sourcepub fn with_on_failure(self, action: QueryAction) -> Self
pub fn with_on_failure(self, action: QueryAction) -> Self
Add failure action
Sourcepub fn with_on_missing(self, action: QueryAction) -> Self
pub fn with_on_missing(self, action: QueryAction) -> Self
Add missing facts action
Sourcepub fn with_param(self, name: String, type_name: String) -> Self
pub fn with_param(self, name: String, type_name: String) -> Self
Add parameter
Sourcepub fn should_execute(&self, _facts: &Facts) -> Result<bool, RuleEngineError>
pub fn should_execute(&self, _facts: &Facts) -> Result<bool, RuleEngineError>
Check if query should execute based on when condition
Sourcepub fn execute_success_actions(
&self,
facts: &mut Facts,
) -> Result<(), RuleEngineError>
pub fn execute_success_actions( &self, facts: &mut Facts, ) -> Result<(), RuleEngineError>
Execute success actions
Sourcepub fn execute_failure_actions(
&self,
facts: &mut Facts,
) -> Result<(), RuleEngineError>
pub fn execute_failure_actions( &self, facts: &mut Facts, ) -> Result<(), RuleEngineError>
Execute failure actions
Sourcepub fn execute_missing_actions(
&self,
facts: &mut Facts,
) -> Result<(), RuleEngineError>
pub fn execute_missing_actions( &self, facts: &mut Facts, ) -> Result<(), RuleEngineError>
Execute missing facts actions
Sourcepub fn to_config(&self) -> BackwardConfig
pub fn to_config(&self) -> BackwardConfig
Convert to BackwardConfig
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GRLQuery
impl RefUnwindSafe for GRLQuery
impl Send for GRLQuery
impl Sync for GRLQuery
impl Unpin for GRLQuery
impl UnwindSafe for GRLQuery
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
Mutably borrows from an owned value. Read more