engine.rete_store ================= .. py:module:: engine.rete_store .. autoapi-nested-parse:: RDFLib store wrapper that materializes RETE inference per graph context. Exceptions ---------- .. autoapisummary:: engine.rete_store.RetractionRematerializeWarning Classes ------- .. autoapisummary:: engine.rete_store.RETEStore Module Contents --------------- .. py:exception:: RetractionRematerializeWarning Bases: :py:obj:`UserWarning` Warning emitted when a store removal is logically ineffective. The engine still derives the removed triple, so ``RETEStore`` re-adds it to the backing context graph after the original removal pass completes. Callers that intend the triple to actually disappear must retract a supporting stated fact instead. .. py:class:: RETEStore(store: rdflib.store.Store, factory: engine.rete_factory.RETEEngineFactory) Bases: :py:obj:`rdflib.store.Store` Context-aware RDFLib store that runs a RETE engine behind graph mutations. .. py:attribute:: store :type: rdflib.store.Store .. py:attribute:: factory :type: engine.rete_factory.RETEEngineFactory .. py:attribute:: engines :type: dict[rdflib_reasoning.axiom.common.ContextIdentifier, engine.rete_engine.RETEEngine] .. py:attribute:: engine_contexts :type: dict[rdflib_reasoning.axiom.common.ContextIdentifier, rdflib.Graph] .. py:attribute:: context_aware :value: True .. py:attribute:: graph_aware .. py:attribute:: formula_aware :value: False .. py:attribute:: transaction_aware :value: False .. py:attribute:: dispatcher .. py:method:: create(configuration: str) -> None Delegate store creation to the backing store. .. py:method:: open(configuration: str | tuple[str, str], create: bool = False) -> _OpenResult Open the backing store and warm engines for existing contexts. .. py:method:: close(commit_pending_transaction: bool = False) -> None Delegate store shutdown to the backing store. .. py:method:: gc() -> None Delegate garbage collection to the backing store. .. py:method:: add(triple: rdflib.graph._TripleType, context: rdflib.graph._ContextType, quoted: bool = False) -> None Add one triple after emitting a pre-mutation event on the raw dispatcher. .. py:method:: addN(quads: collections.abc.Iterable[rdflib.graph._QuadType]) -> None Add quads after emitting pre-mutation events on the raw dispatcher. .. py:method:: remove(triple: rdflib.graph._TriplePatternType, context: rdflib.graph._ContextType | None = None) -> None Remove triples after emitting pre-mutation events and flush re-materializations. .. py:method:: triples_choices(triple: rdflib.graph._TripleChoiceType, context: rdflib.graph._ContextType | None = None) -> collections.abc.Generator[tuple[rdflib.graph._TripleType, collections.abc.Iterator[rdflib.graph._ContextType | None]], None, None] Delegate triple choice iteration to the backing store. .. py:method:: triples(triple_pattern: rdflib.graph._TriplePatternType, context: rdflib.graph._ContextType | None = None) -> collections.abc.Iterator[tuple[rdflib.graph._TripleType, collections.abc.Iterator[rdflib.graph._ContextType | None]]] Delegate triple pattern iteration to the backing store. .. py:method:: contexts(triple: rdflib.graph._TripleType | None = None) -> collections.abc.Generator[rdflib.graph._ContextType, None, None] Delegate context lookup to the backing store. .. py:method:: query(query: rdflib.plugins.sparql.sparql.Query | str, initNs: collections.abc.Mapping[str, Any], initBindings: collections.abc.Mapping[str, rdflib.term.Identifier], queryGraph: str, **kwargs: Any) -> rdflib.query.Result Delegate SPARQL query execution to the backing store. .. py:method:: update(update: rdflib.plugins.sparql.update.Update | str, initNs: collections.abc.Mapping[str, Any], initBindings: collections.abc.Mapping[str, rdflib.term.Identifier], queryGraph: str, **kwargs: Any) -> None :abstractmethod: Raise because SPARQL Update is not supported without truth maintenance. .. py:method:: bind(prefix: str, namespace: rdflib.URIRef, override: bool = True) -> None Delegate namespace binding to the backing store. .. py:method:: prefix(namespace: rdflib.URIRef) -> str | None Return the prefix bound to ``namespace`` on the backing store. .. py:method:: namespace(prefix: str) -> rdflib.URIRef | None Return the namespace URI for ``prefix`` on the backing store. .. py:method:: namespaces() -> collections.abc.Iterator[tuple[str, rdflib.URIRef]] Iterate namespace bindings from the backing store. .. py:method:: commit() -> None Delegate transaction commit to the backing store. .. py:method:: rollback() -> None Delegate transaction rollback to the backing store. .. py:method:: add_graph(graph: rdflib.Graph) -> None Ensure an engine exists for ``graph`` and delegate graph addition. .. py:method:: remove_graph(graph: rdflib.Graph) -> None :abstractmethod: Raise because graph removal is not yet supported.