middleware.dataset_model ======================== .. py:module:: middleware.dataset_model .. autoapi-nested-parse:: Schema-facing RDF dataset boundary models for Research Agent tools and state. Design rules for these models are governed by: - `docs/dev/architecture.md` under "Structural elements and middleware" - `docs/dev/decision-records/DR-011 Schema-Facing RDF Boundary Models.md` Attributes ---------- .. autoapisummary:: middleware.dataset_model.N3GraphContext Classes ------- .. autoapisummary:: middleware.dataset_model.N3Triple middleware.dataset_model.N3Quad middleware.dataset_model.MutationResponse middleware.dataset_model.NewResourceNodeResponse middleware.dataset_model.SerializationResponse middleware.dataset_model.SerializeRequest middleware.dataset_model.TripleBatchRequest middleware.dataset_model.TripleListResponse Module Contents --------------- .. py:type:: N3GraphContext :canonical: Annotated[Graph, SkipJsonSchema()] .. py:class:: N3Triple(/, **data: Any) Bases: :py:obj:`_HasSpo` RDF triple accepted in canonical N3 lexical form and serialized in N3. Use this model when a statement is scoped only by its subject, predicate, and object. See RDF 1.1 Concepts and Abstract Syntax § 3.1 RDF Triples. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:property:: as_rdflib :type: rdflib_reasoning.axiom.common.Triple Return this triple as an RDFLib ``(subject, predicate, object)`` tuple. .. py:method:: from_rdflib(triple: tuple[rdflib.Node, rdflib.Node, rdflib.Node]) -> Self :classmethod: Build an ``N3Triple`` from an RDFLib triple tuple. .. py:class:: N3Quad(/, **data: Any) Bases: :py:obj:`_HasSpo` RDF quad accepted in canonical N3 lexical form and serialized in N3. Use this model when the triple is asserted within a specific named graph given by `graph_id`. See RDF 1.1 Concepts and Abstract Syntax § 4 RDF Datasets. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: graph_id :type: Final[rdflib_reasoning.axiom.common.N3ContextIdentifier] :value: None .. py:property:: graph :type: N3GraphContext Return the RDF graph context parsed from ``graph_id``. .. py:property:: as_rdflib :type: tuple[rdflib.IdentifiedNode, rdflib.URIRef, rdflib.Node, rdflib.graph.Graph] Return this quad as an RDFLib ``(s, p, o, graph)`` tuple. .. py:method:: from_rdflib(quad: tuple[rdflib.Node, rdflib.Node, rdflib.Node, rdflib.IdentifiedNode | rdflib.graph.Graph | None]) -> Self :classmethod: Build an ``N3Quad`` from an RDFLib quad tuple. .. py:class:: MutationResponse(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Response payload for state-mutating dataset tools. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: requested :type: pydantic.NonNegativeInt | None :value: None .. py:attribute:: updated :type: pydantic.NonNegativeInt :value: None .. py:attribute:: unchanged :type: pydantic.NonNegativeInt :value: None .. py:attribute:: inferred :type: pydantic.NonNegativeInt :value: None .. py:attribute:: retracted :type: pydantic.NonNegativeInt :value: None .. py:attribute:: no_action_needed :type: bool :value: None .. py:attribute:: message :type: str :value: None .. py:class:: NewResourceNodeResponse(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Response payload when a blank node or IRI is defined. This resource is not in the knowlede base until it is asserted in a statement. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: resource :type: str :value: None .. py:class:: SerializationResponse(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Response payload for dataset or graph serialization. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: format :type: Literal['trig', 'turtle', 'nt', 'n3'] :value: None .. py:attribute:: content :type: str :value: None .. py:attribute:: default_graph_triple_count :type: pydantic.NonNegativeInt :value: None .. py:attribute:: is_empty :type: bool :value: None .. py:attribute:: message :type: str | None :value: None .. py:class:: SerializeRequest(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Request payload for serializing dataset state. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: format :type: Literal['trig', 'turtle', 'nt', 'n3'] :value: None .. py:class:: TripleBatchRequest(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Request payload for exact-match triple updates. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: triples :type: tuple[N3Triple, Ellipsis] :value: None .. py:class:: TripleListResponse(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Response payload listing triples from the default graph. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: triples :type: tuple[N3Triple, Ellipsis] :value: None