Skip to content

ontocast.integrations.schemas

Argument schemas for the LangChain tool wrappers.

Each model becomes a tool's args_schema, which providers turn into a JSON Schema for tool calling. Two constraints follow from that and shape everything here: every field must be a JSON-primitive type (no RDFGraph, no Ontology), and every field needs a description, because the description is the only instruction the model gets about how to fill it.

Attributes

Classes

AlignEntitiesArgs

Bases: BaseModel

Find equivalent entities across graphs.

Source code in ontocast/integrations/schemas.py
class AlignEntitiesArgs(BaseModel):
    """Find equivalent entities across graphs."""

    graphs: list[TaggedGraphArg] = Field(
        description="Two or more named graphs to align against each other."
    )
    regime: str = Field(
        default="ontology_loose",
        description="Matching strictness preset, e.g. 'ontology_loose'.",
    )

Attributes

graphs = Field(description='Two or more named graphs to align against each other.') class-attribute instance-attribute
regime = Field(default='ontology_loose', description="Matching strictness preset, e.g. 'ontology_loose'.") class-attribute instance-attribute

ApplyGraphUpdateArgs

Bases: BaseModel

Apply an insert/delete patch to a graph.

Source code in ontocast/integrations/schemas.py
class ApplyGraphUpdateArgs(BaseModel):
    """Apply an insert/delete patch to a graph."""

    insert_ttl: str = Field(
        default="",
        description=(
            "Turtle for triples to add. Include all prefixes you use. May be "
            "empty if you are only deleting."
        ),
    )
    delete_ttl: str = Field(
        default="",
        description=(
            "Turtle for triples to remove. Patterns must match existing triples "
            "exactly. May be empty if you are only inserting."
        ),
    )
    base_ttl: str | None = Field(
        default=None,
        description=(
            "Turtle for the graph to patch. Omit to patch the ontology "
            "currently held by the triple store."
        ),
    )
    target: str = Field(
        default="ontology",
        description="Which graph to patch: 'ontology' or 'facts'.",
    )
    persist: bool = Field(
        default=False,
        description=(
            "Write the result back to the triple store. When false (the "
            "default) the patch is applied and returned but nothing is stored."
        ),
    )

Attributes

base_ttl = Field(default=None, description='Turtle for the graph to patch. Omit to patch the ontology currently held by the triple store.') class-attribute instance-attribute
delete_ttl = Field(default='', description='Turtle for triples to remove. Patterns must match existing triples exactly. May be empty if you are only inserting.') class-attribute instance-attribute
insert_ttl = Field(default='', description='Turtle for triples to add. Include all prefixes you use. May be empty if you are only deleting.') class-attribute instance-attribute
persist = Field(default=False, description='Write the result back to the triple store. When false (the default) the patch is applied and returned but nothing is stored.') class-attribute instance-attribute
target = Field(default='ontology', description="Which graph to patch: 'ontology' or 'facts'.") class-attribute instance-attribute

ChunkTextArgs

Bases: BaseModel

Split text into size-bounded chunks.

Source code in ontocast/integrations/schemas.py
class ChunkTextArgs(BaseModel):
    """Split text into size-bounded chunks."""

    text: str = Field(description="The document text to split.")

Attributes

text = Field(description='The document text to split.') class-attribute instance-attribute

ConvertDocumentArgs

Bases: BaseModel

Convert a document file to markdown.

Source code in ontocast/integrations/schemas.py
class ConvertDocumentArgs(BaseModel):
    """Convert a document file to markdown."""

    path: str = Field(description="Filesystem path to the document to convert.")

Attributes

path = Field(description='Filesystem path to the document to convert.') class-attribute instance-attribute

DeleteOntologyArgs

Bases: BaseModel

Remove an ontology and everything derived from it.

Source code in ontocast/integrations/schemas.py
class DeleteOntologyArgs(BaseModel):
    """Remove an ontology and everything derived from it."""

    iri: str = Field(
        description=(
            "IRI of the ontology to delete. This drops its named graph, removes "
            "its file from the ontology directory, and deletes its vectors. "
            "It cannot be undone."
        )
    )

Attributes

iri = Field(description='IRI of the ontology to delete. This drops its named graph, removes its file from the ontology directory, and deletes its vectors. It cannot be undone.') class-attribute instance-attribute

ExtractArgs

Bases: BaseModel

Run the OntoCast extraction pipeline over a piece of text.

Source code in ontocast/integrations/schemas.py
class ExtractArgs(BaseModel):
    """Run the OntoCast extraction pipeline over a piece of text."""

    text: str = Field(description="The source text to extract from.")
    render_mode: str | None = Field(
        default=None,
        description=(
            "What to produce: 'ontology' for schema only, 'facts' for instances "
            "against the existing ontology, or 'ontology_and_facts' for both. "
            "Omit to use the server's configured RENDER_MODE."
        ),
    )
    instruction: str = Field(
        default="",
        description=(
            "Optional extra guidance for the extractor, e.g. 'focus on "
            "experimental conditions'. Appended to the built-in prompt."
        ),
    )
    domain: str | None = Field(
        default=None,
        description="Optional base IRI domain for minted instance identifiers.",
    )

Attributes

domain = Field(default=None, description='Optional base IRI domain for minted instance identifiers.') class-attribute instance-attribute
instruction = Field(default='', description="Optional extra guidance for the extractor, e.g. 'focus on experimental conditions'. Appended to the built-in prompt.") class-attribute instance-attribute
render_mode = Field(default=None, description="What to produce: 'ontology' for schema only, 'facts' for instances against the existing ontology, or 'ontology_and_facts' for both. Omit to use the server's configured RENDER_MODE.") class-attribute instance-attribute
text = Field(description='The source text to extract from.') class-attribute instance-attribute

GetOntologyArgs

Bases: BaseModel

Fetch one ontology by IRI.

Source code in ontocast/integrations/schemas.py
class GetOntologyArgs(BaseModel):
    """Fetch one ontology by IRI."""

    iri: str = Field(
        description=(
            "Full ontology IRI, exactly as returned by ontocast_list_ontologies "
            "(not a prefix or short name)."
        )
    )

Attributes

iri = Field(description='Full ontology IRI, exactly as returned by ontocast_list_ontologies (not a prefix or short name).') class-attribute instance-attribute

IngestOntologyArgs

Bases: BaseModel

Register a new ontology from Turtle.

Source code in ontocast/integrations/schemas.py
class IngestOntologyArgs(BaseModel):
    """Register a new ontology from Turtle."""

    ttl: str = Field(description="The complete ontology serialized as Turtle.")
    filename: str | None = Field(
        default=None,
        description="Optional filename to store it under in the ontology directory.",
    )

Attributes

filename = Field(default=None, description='Optional filename to store it under in the ontology directory.') class-attribute instance-attribute
ttl = Field(description='The complete ontology serialized as Turtle.') class-attribute instance-attribute

NoArgs

Bases: BaseModel

Schema for tools that take no arguments.

Source code in ontocast/integrations/schemas.py
class NoArgs(BaseModel):
    """Schema for tools that take no arguments."""

RetrieveOntologyContextArgs

Bases: BaseModel

Retrieve a relevant ontology subgraph as Turtle.

Source code in ontocast/integrations/schemas.py
class RetrieveOntologyContextArgs(BaseModel):
    """Retrieve a relevant ontology subgraph as Turtle."""

    query: str = Field(
        description=(
            "Natural-language description of the area of the ontology you need. "
            "Returns the surrounding subgraph, not just matching terms."
        )
    )
    top_k: int | None = Field(
        default=None, ge=1, le=100, description="Number of seed terms to expand from."
    )
    subgraph_depth: int | None = Field(
        default=None,
        ge=0,
        le=4,
        description="Neighbourhood expansion depth around each seed term.",
    )
    max_total_triples: int | None = Field(
        default=None,
        ge=1,
        description="Cap on triples in the returned subgraph.",
    )

Attributes

max_total_triples = Field(default=None, ge=1, description='Cap on triples in the returned subgraph.') class-attribute instance-attribute
query = Field(description='Natural-language description of the area of the ontology you need. Returns the surrounding subgraph, not just matching terms.') class-attribute instance-attribute
subgraph_depth = Field(default=None, ge=0, le=4, description='Neighbourhood expansion depth around each seed term.') class-attribute instance-attribute
top_k = Field(default=None, ge=1, le=100, description='Number of seed terms to expand from.') class-attribute instance-attribute

SearchOntologyTermsArgs

Bases: BaseModel

Vector search over indexed ontology terms.

Source code in ontocast/integrations/schemas.py
class SearchOntologyTermsArgs(BaseModel):
    """Vector search over indexed ontology terms."""

    query: str = Field(
        description=(
            "Natural-language description of the concept to find, e.g. "
            "'measurement unit for electrical resistance'. Not a SPARQL query."
        )
    )
    top_k: int | None = Field(
        default=None,
        ge=1,
        le=100,
        description="Maximum number of terms to return. Defaults to the store setting.",
    )
    filter_iri: str | None = Field(
        default=None,
        description="Restrict results to a single ontology IRI.",
    )

Attributes

filter_iri = Field(default=None, description='Restrict results to a single ontology IRI.') class-attribute instance-attribute
query = Field(description="Natural-language description of the concept to find, e.g. 'measurement unit for electrical resistance'. Not a SPARQL query.") class-attribute instance-attribute
top_k = Field(default=None, ge=1, le=100, description='Maximum number of terms to return. Defaults to the store setting.') class-attribute instance-attribute

SparqlQueryArgs

Bases: BaseModel

Run a read-only SPARQL query.

Source code in ontocast/integrations/schemas.py
class SparqlQueryArgs(BaseModel):
    """Run a read-only SPARQL query."""

    query: str = Field(
        description=(
            "A complete SPARQL query string. Read-only forms only: SELECT/ASK for "
            "ontocast_sparql_select, CONSTRUCT/DESCRIBE for ontocast_sparql_construct. "
            "Update forms (INSERT/DELETE/DROP/CLEAR) are rejected."
        )
    )
    store: StoreKind = Field(
        default="ontologies",
        description=(
            "Which partition to query: 'ontologies' for schema and reference "
            "individuals, 'facts' for instances extracted from documents, or "
            "'shapes' for the deployment's SHACL shapes."
        ),
    )

Attributes

query = Field(description='A complete SPARQL query string. Read-only forms only: SELECT/ASK for ontocast_sparql_select, CONSTRUCT/DESCRIBE for ontocast_sparql_construct. Update forms (INSERT/DELETE/DROP/CLEAR) are rejected.') class-attribute instance-attribute
store = Field(default='ontologies', description="Which partition to query: 'ontologies' for schema and reference individuals, 'facts' for instances extracted from documents, or 'shapes' for the deployment's SHACL shapes.") class-attribute instance-attribute

TaggedGraphArg

Bases: BaseModel

One named graph in an entity-alignment request.

Source code in ontocast/integrations/schemas.py
class TaggedGraphArg(BaseModel):
    """One named graph in an entity-alignment request."""

    name: str = Field(description="Label identifying this graph in the results.")
    ttl: str = Field(description="The graph serialized as Turtle.")

Attributes

name = Field(description='Label identifying this graph in the results.') class-attribute instance-attribute
ttl = Field(description='The graph serialized as Turtle.') class-attribute instance-attribute