This repository provides the artifact for MASEO, a research-oriented multi-agent system that automated generate ontologies from competency questions, with a built-in focus on explainability. It aims to make the process of ontology generation more transparent, modular, and intelligent by distributing tasks among specialized agents. Each specialized agent is designed to keep track the logic behind each entity in generated ontology.
The pipeline consists of four sequential stages:
| Agent | Model | Responsibility |
|---|---|---|
Ontology Generation Agent |
deepseek-reasoner |
Generates the initial OWL ontology from CQs |
Syntax Repair Agent |
deepseek-reasoner |
Fixes RDF/XML syntax errors reported by the parser |
Logical Consistency Agent |
deepseek-reasoner |
Repairs logical inconsistencies reported by HermiT |
Pitfall Resolution Agent |
deepseek-reasoner |
Resolves ontology modeling pitfalls reported by OOPS! |
The illustration of the MASOE framework:
- End-to-end automation — from a list of CQs to a validated ontology
- Role-based agents — each stage is handled by a dedicated LLM agent with a specific instruction and responsibility
- Provenance tracking — every ontology entity carries an append-only
vaem:rationalelog attributed to the agent that made each change, and adc:sourcelog linking each change back to the CQ, pitfall, or error that motivated it
pip install agno rdflib requests beautifulsoup4 pydantic| Tool | Purpose | Setup |
|---|---|---|
| HermiT Reasoner | Logical consistency checking | Download HermiT.jar and update the path in reason_ontology() |
| OOPS! REST API | Ontology pitfall detection | No local setup required — uses the public REST endpoint |
| Java (JRE 8+) | Required to run HermiT | sudo apt install default-jre |
Make the changes in the agent_framework.py to ensure the correctness of variables.
# Path to your OOPS! request template
REQUEST_TEMPLATE = "src/templates/oops_request_template.xml"
# Path to HermiT JAR inside reason_ontology()
"java", "-jar", "/path/to/HermiT.jar"| Argument | Required | Description |
|---|---|---|
--api_key |
Yes | DeepSeek API key |
--cqs_file |
Yes | Path to a JSON file containing the list of competency questions |
--save_file |
Yes | Path where the final OWL ontology will be saved |
--agent_method |
No | true runs the full 4-stage pipeline; false runs generation only (default: true) |
python cli.py \
--api_key YOUR_DEEPSEEK_API_KEY \
--cqs_file dataset/competency_questions/VGO.json \
--save_file dataset/generated_ontology/Gen_VGO.owl \
--agent_method trueThe input file that contains Competency Questions should be a JSON array of strings:
{
"CQ1": "What is the genre of a game?",
"CQ2": "Which players have purchased an in-app item?",
"CQ3": "What is the username of a player?",
...
}The internal representation and output format is available at our documentation [TBD]
Additional documentation of the project is available at https://maseo.readthedocs.io/en/latest/?badge=latest
This work was supported by the grant SOEL: Supporting Ontology Engineering with Large Language Models PID2023-152703NA-I00 funded by MCIN/AEI/10.13039/501100011033 and by ERDF/UE. The authors would also like to thank the EDINT (Espacios de Datos para las Infraestructuras Urbanas Inteligentes) ontology development team for sharing the project resources for evaluation purposes.
