ontocast link commands: keep the resolution graph in step with the documents.
The resolution graph holds one identity links graph per document graph
(<graph>/identity-links). build recomputes all of them, add
updates the given documents' links, and remove drops them. None of these
makes a model call, though the toolbox they start still needs the LLM
settings ontocast serve needs.
Classes
Functions:
add_command(graphs, tenant, project)
Write the links of the given documents (an update of the resolution graph).
Source code in ontocast/cli/link.py
| @link.command("add")
@_graph_option
@_tenant_option
@_project_option
def add_command(
graphs: tuple[str, ...], tenant: str | None, project: str | None
) -> None:
"""Write the links of the given documents (an update of the resolution graph)."""
async def operation(tools: ToolBox, domain: str, values: frozenset[str]):
assert tools.triple_store_manager is not None
return await add_documents(
tools.triple_store_manager,
graphs,
tools.ontology_manager.identity_declarations(),
domain=domain,
value_classes=values,
)
_echo(_run(tenant, project, operation))
|
build_command(tenant, project)
Recompute every document's links; drop links of documents that are gone.
Source code in ontocast/cli/link.py
| @link.command("build")
@_tenant_option
@_project_option
def build_command(tenant: str | None, project: str | None) -> None:
"""Recompute every document's links; drop links of documents that are gone."""
async def operation(tools: ToolBox, domain: str, values: frozenset[str]):
assert tools.triple_store_manager is not None
return await build(
tools.triple_store_manager,
tools.ontology_manager.identity_declarations(),
domain=domain,
value_classes=values,
)
_echo(_run(tenant, project, operation))
|
link()
Cross-document identity: build, update or trim the resolution graph.
Source code in ontocast/cli/link.py
| @click.group("link")
def link() -> None:
"""Cross-document identity: build, update or trim the resolution graph."""
|
remove_command(graphs, tenant, project)
Drop the links of the given documents from the resolution graph.
Source code in ontocast/cli/link.py
| @link.command("remove")
@_graph_option
@_tenant_option
@_project_option
def remove_command(
graphs: tuple[str, ...], tenant: str | None, project: str | None
) -> None:
"""Drop the links of the given documents from the resolution graph."""
async def operation(tools: ToolBox, domain: str, values: frozenset[str]):
assert tools.triple_store_manager is not None
return await remove_documents(tools.triple_store_manager, graphs)
_echo(_run(tenant, project, operation))
|