engine.rete.compiler ==================== .. py:module:: engine.rete.compiler .. autoapi-nested-parse:: Rule compilation into RETE intermediate representations. Classes ------- .. autoapisummary:: engine.rete.compiler.AlphaConstraint engine.rete.compiler.CompiledTripleCondition engine.rete.compiler.CompiledPredicateCondition engine.rete.compiler.CompiledRule engine.rete.compiler.JoinOptimizer engine.rete.compiler.RuleCompiler Module Contents --------------- .. py:class:: AlphaConstraint(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` A constant-position filter used by the alpha side of the network. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: position :type: Literal['subject', 'predicate', 'object'] .. py:attribute:: value :type: rdflib.term.Node .. py:class:: CompiledTripleCondition(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Normalized triple body condition with explicit alpha constraints and binders. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: source_index :type: int .. py:attribute:: pattern :type: engine.rules.TriplePattern .. py:attribute:: constraints :type: tuple[AlphaConstraint, Ellipsis] :value: None .. py:attribute:: bound_variables :type: tuple[str, Ellipsis] :value: None .. py:class:: CompiledPredicateCondition(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Normalized predicate condition with explicit binding dependencies. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: source_index :type: int .. py:attribute:: predicate :type: str .. py:attribute:: arguments :type: tuple[rdflib.term.Node, Ellipsis] :value: None .. py:attribute:: required_variables :type: tuple[str, Ellipsis] :value: None .. py:class:: CompiledRule(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Compiler output consumed by RETE network construction. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: rule_id :type: engine.proof.RuleId .. py:attribute:: salience :type: int :value: 0 .. py:attribute:: silent :type: bool :value: False .. py:attribute:: bootstrap :type: bool :value: False .. py:attribute:: triple_conditions :type: tuple[CompiledTripleCondition, Ellipsis] :value: None .. py:attribute:: predicate_conditions :type: tuple[CompiledPredicateCondition, Ellipsis] :value: None .. py:attribute:: productions :type: tuple[engine.rete.consequents.TripleProduction, Ellipsis] :value: None .. py:attribute:: callbacks :type: tuple[engine.rete.consequents.CallbackSchedule, Ellipsis] :value: None .. py:attribute:: contradictions :type: tuple[engine.rete.consequents.ContradictionSchedule, Ellipsis] :value: None .. py:attribute:: variables :type: tuple[str, Ellipsis] :value: None .. py:class:: JoinOptimizer Construction-time utility for ordering joins in conjunctive rule bodies. .. py:method:: order_triple_conditions(conditions: tuple[CompiledTripleCondition, Ellipsis]) -> tuple[CompiledTripleCondition, Ellipsis] :staticmethod: Order triple joins using simple selectivity heuristics. More constants are better. Constant predicates are preferred, and constants other than `rdf:type` are treated as more selective. .. py:class:: RuleCompiler Entry point for translating public rule definitions into RETE IR. This remains a programmatic rule-definition boundary; no text syntax is implied by this scaffold. .. py:method:: compile_rule(rule: engine.rules.Rule) -> CompiledRule :classmethod: Translate one public :class:`~rdflib_reasoning.engine.rules.Rule` into compiled RETE IR.