pub struct GettingStartedGuide;Expand description
§Quick Start Guide
This section provides the fastest way to get up and running with the OxiRS Rule Engine.
§Basic Example
use oxirs_rule::{RuleEngine, Rule, RuleAtom, Term};
// Create a new rule engine
let mut engine = RuleEngine::new();
// Define a simple rule: if X is a person, then X is mortal
let rule = Rule {
name: "mortality_rule".to_string(),
body: vec![
RuleAtom::Triple {
subject: Term::Variable("X".to_string()),
predicate: Term::Constant("type".to_string()),
object: Term::Constant("Person".to_string()),
}
],
head: vec![
RuleAtom::Triple {
subject: Term::Variable("X".to_string()),
predicate: Term::Constant("type".to_string()),
object: Term::Constant("Mortal".to_string()),
}
],
};
// Add the rule to the engine
engine.add_rule(rule);
// Add initial facts
let facts = vec![
RuleAtom::Triple {
subject: Term::Constant("socrates".to_string()),
predicate: Term::Constant("type".to_string()),
object: Term::Constant("Person".to_string()),
}
];
// Run forward chaining to derive new facts
let derived_facts = engine.forward_chain(&facts).expect("should succeed");
println!("Derived facts: {:?}", derived_facts);Implementations§
Source§impl GettingStartedGuide
impl GettingStartedGuide
Sourcepub fn create_basic_engine() -> RuleEngine
pub fn create_basic_engine() -> RuleEngine
Create a basic rule engine setup for learning
Sourcepub fn basic_example() -> Result<Vec<RuleAtom>>
pub fn basic_example() -> Result<Vec<RuleAtom>>
Demonstrate basic rule creation and execution
Sourcepub fn backward_chaining_example() -> Result<bool>
pub fn backward_chaining_example() -> Result<bool>
Demonstrate backward chaining for goal-driven reasoning
Sourcepub fn family_relationships_example() -> Result<Vec<RuleAtom>>
pub fn family_relationships_example() -> Result<Vec<RuleAtom>>
Demonstrate family relationship reasoning
Sourcepub fn ontology_reasoning_example() -> Result<Vec<RuleAtom>>
pub fn ontology_reasoning_example() -> Result<Vec<RuleAtom>>
Demonstrate ontology reasoning with classes and properties
Auto Trait Implementations§
impl Freeze for GettingStartedGuide
impl RefUnwindSafe for GettingStartedGuide
impl Send for GettingStartedGuide
impl Sync for GettingStartedGuide
impl Unpin for GettingStartedGuide
impl UnsafeUnpin for GettingStartedGuide
impl UnwindSafe for GettingStartedGuide
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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 more