pub struct Rule {
pub head: Atom,
pub body: Vec<BodyPredicate>,
pub constraints: Vec<Constraint>,
}Expand description
Fields§
§head: Atom§body: Vec<BodyPredicate>§constraints: Vec<Constraint>Implementations§
Source§impl Rule
impl Rule
Sourcepub fn new(
head: Atom,
body: Vec<BodyPredicate>,
constraints: Vec<Constraint>,
) -> Self
pub fn new( head: Atom, body: Vec<BodyPredicate>, constraints: Vec<Constraint>, ) -> Self
Create a new rule
Sourcepub fn new_simple(
head: Atom,
body: Vec<Atom>,
constraints: Vec<Constraint>,
) -> Self
pub fn new_simple( head: Atom, body: Vec<Atom>, constraints: Vec<Constraint>, ) -> Self
Create a rule with only positive body atoms (no negation)
Sourcepub fn is_safe(&self) -> bool
pub fn is_safe(&self) -> bool
Check if this rule is safe (all head variables appear in positive body atoms)
Sourcepub fn positive_body_variables(&self) -> HashSet<String>
pub fn positive_body_variables(&self) -> HashSet<String>
Get all variables in positive body atoms
Sourcepub fn is_recursive(&self) -> bool
pub fn is_recursive(&self) -> bool
Check if this rule is recursive (head relation appears in body)
Sourcepub fn positive_body_atoms(&self) -> Vec<&Atom>
pub fn positive_body_atoms(&self) -> Vec<&Atom>
Get all positive body atoms
Sourcepub fn negated_body_atoms(&self) -> Vec<&Atom>
pub fn negated_body_atoms(&self) -> Vec<&Atom>
Get all negated body atoms
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
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