Artículos

RAG basado en ontologías con SPARQL y modelos de lenguaje locales para documentación técnica

Autores/as

  • Julián Rafael Coronel Andrade Universidad del Azuay image/svg+xml
  • Edwin Alexander Siguenza Siguenza Universidad del Azuay image/svg+xml
  • Andrew Sebastian Cantos Vasquez Universidad del Azuay image/svg+xml
  • Pablo Sebastián Vélez Mejía Universidad del Azuay image/svg+xml
  • Marcos Orellana {"es_ES":"Universidad del Azuay"}

Resumen

Este artículo presenta LIDI-AI, un sistema de Generación Aumentada por Recuperación (RAG) cuya base de conocimiento es la documentación técnica del Asistente de Investigación LIDI-AI, una aplicación web de análisis de datos desarrollada en la Universidad del Azuay. La arquitectura en tiempo de ejecución integra dos fuentes de conocimiento complementarias: una ontología OWL 2 (artefacto versión 2.0) con seis clases y veinticinco propiedades (nueve de objeto y dieciséis de datos) que modela el flujo de trabajo de cinco etapas, los formatos de archivo aceptados, los tipos de análisis estadístico y los errores del sistema; y una capa de consultas SPARQL 1.1 para la resolución estructurada de intenciones. Una base Prolog con representación Objeto-Atributo-Valor (OAV), compuesta por 172 hechos, 17 reglas de inferencia y tres motores de diagnóstico, se especifica y valida formalmente como capa de razonamiento simbólico, aunque aún no es invocable desde el orquestador Python en tiempo de ejecución. Un módulo de recuperación léxica selecciona fragmentos de la ontología como contexto fundamentado para un modelo de lenguaje alojado localmente, en concreto, Llama-3.2-3B desplegado a través del framework Ollama con cuantización Q4_K_M.. La evaluación de diez consultas de usuarios reales muestra que siete se resolvieron con alta precisión mediante recuperación fundamentada en SPARQL, dos mediante recuperación léxica con trazabilidad ontológica, y una consulta fuera de dominio recibió un reconocimiento explícito de los límites del conocimiento, logrando una tasa de respuesta adecuada sin alucinaciones.

Palabras clave

asistente inteligente consultas estructuradas modelos locales de lenguaje razonamiento simbólico representación del conocimiento SPARQL

Cómo citar

Coronel Andrade, J. R., Siguenza Siguenza, E. A., Cantos Vasquez, A. S., Vélez Mejía, P. S., & Orellana, M. (2026). RAG basado en ontologías con SPARQL y modelos de lenguaje locales para documentación técnica. Revista Tecnológica - ESPOL, 38(E1), 84-99. https://doi.org/10.37815/rte.v38nE1.1603
BibTeX

Estadísticas

Referencias

AlAgha, I. (2015). Using Linguistic Analysis to Translate Arabic Natural Language Queries to SPARQL. International Journal of Web & Semantic Technology, 6(3), 25–39. https://doi.org/10.5121/ijwest.2015.6303

Almeida, J. P. A., Guizzardi, G., Sales, T. P., & Fonseca, C. M. (2026). gUFO: A Gentle Foundational Ontology for Semantic Web Knowledge Graphs. arXiv preprint. https://doi.org/10.48550/arXiv.2603.20948

Anuyah, S., Kaushik, M. M., Dwarampudi, K., Shiradkar, R., Durresi, A., & Chakraborty, S. (2025). Automated Knowledge Graph Construction using Large Language Models and Sentence Complexity Modelling. https://doi.org/10.18653/v1/2025.emnlp-main.783

Brown, A., Roman, M., & Devereux, B. (2025). A Systematic Literature Review of Retrieval-Augmented Generation: Techniques, Metrics, and Challenges. Big Data and Cognitive Computing, 9(12), 320. https://doi.org/10.3390/bdcc9120320

Di, Z., Zhang, C., Lv, H., Cui, L., & Liu, L. (2025). LoRP: LLM-based Logical Reasoning via Prolog. Knowledge-Based Systems, 327, 114140. https://doi.org/10.1016/j.knosys.2025.114140

García-Montero, P. S., Orellana, M., & Zambrano-Martinez, J. L. (2025). Enriching Dataset Metadata with LLMs to Unlock Semantic Meaning. In Conference on Information and Communication Technologies of Ecuador (pp. 63 –77). Cham: Springer Nature Switzerland. https://doi.org/10.1007/978-3-032-08366-1_5

Garg, M., Wang, L.-C., Ghanchi, B., Dumpala, S., Kakde, S., & Chen, Y. C. (2025). Biomedical Literature Q&A System Using Retrieval-Augmented Generation (RAG).

Glimm, B., Horrocks, I., Motik, B., Stoilos, G., & Wang, Z. (2014). HermiT: An OWL 2 Reasoner. Journal of Automated Reasoning, 53(3). https://doi.org/10.1007/s10817-014-9305-1

Grattafiori, A., Dubey, A., Jauhri, A., Pandey, A., Kadian, A., Al-Dahle, A., Letman, A., Mathur, A., Schelten, A., Vaughan, A., Yang, A., Fan, A., Goyal, A., Hartshorn, A., Yang, A., Mitra, A., Sravankumar, A., Korenev, A., Hinsvark, A., … Ma, Z. (2024). The Llama 3 Herd of Models. https://arxiv.org/abs/2407.21783

Gruber, T. R. (1993). A translation approach to portable ontology specifications. Knowledge Acquisition, 5(2). https://doi.org/10.1006/knac.1993.1008

Harris, S., & Seaborne, A. (2013). SPARQL 1.1 Query Language. W3C Recommendation.

Hogan, A., Blomqvist, E., Cochez, M., D’amato, C., Melo, G. De, Gutierrez, C., Kirrane, S., Gayo, J. E. L., Navigli, R., Neumaier, S., Ngomo, A.-C. N., Polleres, A., Rashid, S. M., Rula, A., Schmelzeisen, L., Sequeda, J., Staab, S., & Zimmermann, A. (2021). Knowledge Graphs. ACM Computing Surveys, 54(4), 1 –37. https://doi.org/10.1145/3447772

Ji, Z., Lee, N., Frieske, R., Yu, T., Su, D., Xu, Y., Ishii, E., Bang, Y. J., Madotto, A., & Fung, P. (2023). Survey of Hallucination in Natural Language Generation. En ACM Computing Surveys, 55(12). https://doi.org/10.1145/3571730

Kabbaj, A., Frasson, C., Kaltenbach, M., & Djamen, J.-Y. (1994). A conceptual and contextual object-oriented logic programming: The PROLOG++ language (pp. 251-274). https://doi.org/10.1007/3-540-58328-9_17

Kim, S., Song, H., Seo, H., & Kim, H. (2025). Optimizing Retrieval Strategies for Financial Question Answering Documents in Retrieval-Augmented Generation Systems.

Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W. T., Rocktäschel, T., Riedel, S., & Kiela, D. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. Advances in Neural Information Processing Systems, 2020-December.

Liu, Y., Cao, Y., Lin, X., Shang, Y., Wang, S., & Pan, S. (2025). Enhancing Large Language Model for Knowledge Graph Completion via Structure-Aware Alignment-Tuning. Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, 20981–20995. https://doi.org/10.18653/v1/2025.emnlp-main.1061

Mishra, D. S., Agarwal, A., Swathi, B. P., & Akshay, K. C. (2022). Natural language query formalization to SPARQL for querying knowledge bases using Rasa. Progress in Artificial Intelligence, 11(3), 193–206. https://doi.org/10.1007/s13748-021-00271-1

Musen, M. A. (2015). The protégé project. AI Matters, 1(4), 4–12. https://doi.org/10.1145/2757001.2757003

Noy, N. F., & McGuinness, D. L. (2001). Ontology Development 101: A Guide to Creating Your First Ontology. En Stanford Knowledge Systems Laboratory.

https://protege.stanford.edu/publications/ontology_development/ontology101.pdf

Paltin Chica, D. L., Mejía Mendieta, J. D., Orellana, M., & Zambrano-Martinez, J. L. (2025). Semantic Modeling of ECU 911 Emergencies Using NLP and Ontologies. Revista Tecnológica - Espol, 37(E1), 112–125. https://doi.org/10.37815/rte.v37nE1.1351

Procko, T. T., & Ochoa, O. (2024). Graph Retrieval-Augmented Generation for Large Language Models: A Survey. Proceedings - 2024 Conference on AI, Science, Engineering, and Technology, AIxSET 2024. https://doi.org/10.1109/AIxSET62544.2024.00030

Rajesh, V., Jodhpurkar, O., Anbuselvan, P., Singh, M., Jallepali, A., Godbole, S., Sharma, P. K., & Shrivastava, H. (2025). Production-Grade Local LLM Inference on Apple Silicon: A Comparative Study of MLX, MLC-LLM, Ollama, llama.cpp, and PyTorch MPS.

RDFLib Team. (2026). rdflib: A Python library for working with RDF. RDFLib. https://rdflib.readthedocs.io/en/stable/

Sheth, A., Gaur, M., Roy, K., & Faldu, K. (2021). Knowledge-Intensive Language Understanding for Explainable AI. IEEE Internet Computing, 25(5). https://doi.org/10.1109/MIC.2021.3101919

Vogt, L., Farfar, K. E., Karanth, P., Konrad, M., Oelen, A., Prinz, M., & Stroemert, P. (2026). Rosetta Statements: Simplifying FAIR Knowledge Graph Construction with a User-Centered Approach. https://doi.org/10.1093/database/baag030

Wampler, D., Nielson, D., & Seddighi, A. (2025). Engineering the RAG Stack: A Comprehensive Review of the Architecture and Trust Frameworks for Retrieval-Augmented Generation Systems. arXiv preprint. https://doi.org/10.48550/arXiv.2601.05264

Wielemaker, J., Schrijvers, T., Triska, M., & Lager, T. (2012). SWI-Prolog. Theory and Practice of Logic Programming, 12(1–2), 67–96. https://doi.org/10.1017/S1471068411000494

World Wide Web Consortium. (2012). OWL 2 Web Ontology Language document overview. World Wide Web Consortium.

Zheng, C., Chen, X., Xu, R., & Chang, B. (2022). A Double-Graph Based Framework for Frame Semantic Parsing. https://doi.org/10.18653/v1/2022.naacl-main.368