engine.rete_errors

Fatal rule errors and RDF triple well-formedness diagnostics.

Attributes

RDF_TRIPLES_SPEC_URL

Exceptions

FatalRuleError

Fatal error raised by public rule, predicate, or callback execution.

RDFTermConstraintError

RDF term-type constraint violation with optional stated/inference context.

RuleTripleWarning

Warning for triples rejected by RDF 1.1 triple well-formedness checks.

LiteralAsSubjectError

Raised when a stated or inferred triple has a literal subject.

LiteralAsSubjectWarning

Warning emitted when a literal-subject triple is skipped in warning mode.

BlankNodePredicateError

Raised when a stated or inferred triple has a blank node predicate.

BlankNodePredicateWarning

Warning emitted when a blank-node-predicate triple is skipped in warning mode.

LiteralPredicateError

Raised when a stated or inferred triple has a non-IRI predicate.

LiteralPredicateWarning

Warning emitted when a non-IRI-predicate triple is skipped in warning mode.

Functions

format_term_constraint_diagnostics(→ str)

Format a multi-line diagnostic block for an RDF term constraint violation.

Module Contents

engine.rete_errors.RDF_TRIPLES_SPEC_URL = 'https://www.w3.org/TR/rdf11-concepts/#section-triples'
engine.rete_errors.format_term_constraint_diagnostics(triple: axiom.common.Triple, *, source: Literal['stated', 'inferred'] | None, rule_id: Any = None, depth: int | None = None, pattern: tuple[rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable] | None = None, bindings: collections.abc.Mapping[str, rdflib.term.Node] | None = None, premises: tuple[axiom.common.Triple, Ellipsis] | None = None) → str

Format a multi-line diagnostic block for an RDF term constraint violation.

exception engine.rete_errors.FatalRuleError

Bases: RuntimeError

Fatal error raised by public rule, predicate, or callback execution.

exception engine.rete_errors.RDFTermConstraintError(message: str, *, triple: axiom.common.Triple | None = None, source: Literal['stated', 'inferred'] | None = None, rule_id: Any = None, depth: int | None = None, pattern: tuple[rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable] | None = None, bindings: collections.abc.Mapping[str, rdflib.term.Node] | None = None, premises: tuple[axiom.common.Triple, Ellipsis] | None = None)

Bases: FatalRuleError

RDF term-type constraint violation with optional stated/inference context.

triple = None
source = None
rule_id = None
depth = None
pattern = None
bindings = None
premises = None
exception engine.rete_errors.RuleTripleWarning

Bases: UserWarning

Warning for triples rejected by RDF 1.1 triple well-formedness checks.

These warnings are emitted when the engine is configured to warn and skip malformed triples instead of raising. The governing normative source is the RDF 1.1 Concepts triples section: https://www.w3.org/TR/rdf11-concepts/#section-triples

exception engine.rete_errors.LiteralAsSubjectError(message: str, *, triple: axiom.common.Triple | None = None, source: Literal['stated', 'inferred'] | None = None, rule_id: Any = None, depth: int | None = None, pattern: tuple[rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable] | None = None, bindings: collections.abc.Mapping[str, rdflib.term.Node] | None = None, premises: tuple[axiom.common.Triple, Ellipsis] | None = None)

Bases: RDFTermConstraintError

Raised when a stated or inferred triple has a literal subject.

Literal subjects are disallowed by the RDF 1.1 data model, so the engine refuses to admit or materialize such triples in error mode.

When available, RDFTermConstraintError.triple and related fields identify the offending triple and (for inferences) the rule activation.

exception engine.rete_errors.LiteralAsSubjectWarning

Bases: RuleTripleWarning

Warning emitted when a literal-subject triple is skipped in warning mode.

exception engine.rete_errors.BlankNodePredicateError(message: str, *, triple: axiom.common.Triple | None = None, source: Literal['stated', 'inferred'] | None = None, rule_id: Any = None, depth: int | None = None, pattern: tuple[rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable] | None = None, bindings: collections.abc.Mapping[str, rdflib.term.Node] | None = None, premises: tuple[axiom.common.Triple, Ellipsis] | None = None)

Bases: RDFTermConstraintError

Raised when a stated or inferred triple has a blank node predicate.

Predicates must be IRIs in RDF 1.1, so the engine refuses to admit or materialize such triples in error mode.

exception engine.rete_errors.BlankNodePredicateWarning

Bases: RuleTripleWarning

Warning emitted when a blank-node-predicate triple is skipped in warning mode.

exception engine.rete_errors.LiteralPredicateError(message: str, *, triple: axiom.common.Triple | None = None, source: Literal['stated', 'inferred'] | None = None, rule_id: Any = None, depth: int | None = None, pattern: tuple[rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable, rdflib.term.Node | rdflib.term.Variable] | None = None, bindings: collections.abc.Mapping[str, rdflib.term.Node] | None = None, premises: tuple[axiom.common.Triple, Ellipsis] | None = None)

Bases: RDFTermConstraintError

Raised when a stated or inferred triple has a non-IRI predicate.

Literal predicates are explicitly invalid, and this exception is also used for the broader non-IRI predicate path when the engine is configured to fail fast.

exception engine.rete_errors.LiteralPredicateWarning

Bases: RuleTripleWarning

Warning emitted when a non-IRI-predicate triple is skipped in warning mode.