ontocast.toolbox
¶
ToolBox
¶
A container class for all tools used in the ontology processing workflow.
This class initializes and manages various tools needed for document processing, ontology management, and LLM interactions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
working_directory
|
Path to the working directory. |
required | |
ontology_directory
|
Optional path to ontology directory. |
required | |
model_name
|
Name of the LLM model to use. |
required | |
llm_base_url
|
Optional base URL for LLM API. |
required | |
temperature
|
Temperature setting for LLM. |
required | |
llm_provider
|
Provider for LLM service (default: "openai"). |
required | |
neo4j_uri
|
(optional) URI for Neo4j connection. If provided with neo4j_auth, neo4j will be used as triple store (unless Fuseki is also provided). |
required | |
neo4j_auth
|
(optional) Auth string (user/password) for Neo4j connection. |
required | |
fuseki_uri
|
(optional) URI for Fuseki connection. If provided with fuseki_auth, Fuseki will be used as triple store (preferred over Neo4j). |
required | |
fuseki_auth
|
(optional) Auth string (user/password) for Fuseki connection. |
required | |
clean
|
(optional, default False) If True, triple store (Neo4j or Fuseki) will be initialized as clean (all data deleted on startup). |
required |
Source code in ontocast/toolbox.py
init_toolbox(toolbox)
¶
Initialize the toolbox with ontologies and their properties.
This function fetches ontologies from the triple store and updates their properties using the LLM tool. If a filesystem manager is available for initial loading, it will be used to load ontologies from files first.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toolbox
|
ToolBox
|
The ToolBox instance to initialize. |
required |
Source code in ontocast/toolbox.py
render_ontology_summary(graph, llm_tool)
¶
Generate a summary of ontology properties using LLM analysis.
This function uses the LLM tool to analyze an RDF graph and generate a structured summary of its properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph
|
RDFGraph
|
The RDF graph to analyze. |
required |
llm_tool
|
The LLM tool instance for analysis. |
required |
Returns:
Name | Type | Description |
---|---|---|
OntologyProperties |
OntologyProperties
|
A structured summary of the ontology properties. |
Source code in ontocast/toolbox.py
update_ontology_manager(om, llm_tool)
¶
Update properties for all ontologies in the manager.
This function iterates through all ontologies in the manager and updates their properties using the LLM tool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
om
|
OntologyManager
|
The ontology manager containing ontologies to update. |
required |
llm_tool
|
LLMTool
|
The LLM tool instance for analysis. |
required |
Source code in ontocast/toolbox.py
update_ontology_properties(o, llm_tool)
¶
Update ontology properties using LLM analysis, only if missing.
This function uses the LLM tool to analyze and update the properties of a given ontology based on its graph content, but only if any key property is missing or empty.