Crate oxirs_rule

Crate oxirs_rule 

Source
Expand description

§OxiRS Rule Engine

Version docs.rs

Status: Alpha Release (v0.1.0-alpha.2) ⚠️ APIs may change. Not recommended for production use.

Forward/backward rule engine for RDFS, OWL, and SWRL reasoning with RETE optimization. Provides Jena-compatible rule-based inference for knowledge graphs.

§Features

  • Forward Chaining - Data-driven rule inference
  • Backward Chaining - Goal-driven query answering
  • RETE Algorithm - Efficient pattern matching
  • RDFS/OWL Support - Standard ontology reasoning
  • SWRL Integration - Semantic Web Rule Language
  • Rule Composition - Complex multi-step reasoning

§Quick Start

use oxirs_rule::{RuleEngine, Rule, RuleAtom, Term};

let mut engine = RuleEngine::new();

// Define rule: parent(X,Y) → ancestor(X,Y)
engine.add_rule(Rule {
    name: "ancestor".to_string(),
    body: vec![RuleAtom::Triple {
        subject: Term::Variable("X".to_string()),
        predicate: Term::Constant("parent".to_string()),
        object: Term::Variable("Y".to_string()),
    }],
    head: vec![RuleAtom::Triple {
        subject: Term::Variable("X".to_string()),
        predicate: Term::Constant("ancestor".to_string()),
        object: Term::Variable("Y".to_string()),
    }],
});

// Add facts and infer
let facts = vec![RuleAtom::Triple {
    subject: Term::Constant("john".to_string()),
    predicate: Term::Constant("parent".to_string()),
    object: Term::Constant("mary".to_string()),
}];

let results = engine.forward_chain(&facts)?;

§See Also

Modules§

backward
Backward Chaining Inference Engine
cache
Advanced Caching System for Rule Engines
comprehensive_tutorial
Comprehensive OxiRS Rule Engine Tutorial
debug
Rule Engine Debugging Tools
forward
Forward Chaining Inference Engine
getting_started
Getting Started with OxiRS Rule Engine
integration
Integration Bridge with OxiRS Core
owl
OWL Reasoning Engine
performance
Performance analysis and profiling utilities for the rule engine
rdf_integration
RDF Integration Module for OxiRS Rule Engine
rdf_processing_simple
Simplified RDF Data Processing Module
rdfs
RDFS Reasoning Engine
rete
RETE Pattern Matching Network
rete_enhanced
Enhanced RETE Pattern Matching Network
swrl
SWRL (Semantic Web Rule Language) Implementation

Structs§

Rule
Rule representation
RuleEngine
Integrated rule engine combining all reasoning modes

Enums§

RuleAtom
Rule atom (triple pattern or builtin)
Term
Rule term