Constraining LLM-Based RDF Generation with Ontology-Guided Prompting in Urban Agriculture

Resumo


The construction and maintenance of knowledge graphs remain labor-intensive tasks, particularly when relevant information is available primarily in semi-structured textual sources. Recent advances in large language models (LLMs) offer new opportunities for automating knowledge graph population, yet generating RDF instances that comply with ontology constraints remains challenging. This paper investigates an ontology-guided prompting strategy for generating RDF knowledge graphs from textual descriptions of horticultural cultivars. The proposed approach embeds a domain ontology together with modeling patterns derived from established semantic standards and provides explicit schema definitions, anchored instances, and few-shot RDF/Turtle examples within the prompt. The method is evaluated on a dataset of 42 cultivar webpages using SHACL-based validation, precision–recall analysis, and hallucination detection. Results show that ontology-guided prompting substantially improves structural validity and semantic accuracy while significantly reducing hallucinated assertions.
Palavras-chave: LLM, RDF generation, Ontology-Guided, Urban Agriculture

Referências

Ali, M., Taha, Z., and Morsey, M. M. (2026). Ontology-grounded knowledge graphs for mitigating hallucinations in large language models for clinical question answering. Journal of Biomedical Informatics, 175:104993.

Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020). Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901.

Caufield, J. H., Hegde, H., Emonet, V., Harris, N. L., Joachimiak, M. P., Matentzoglu, N., Kim, H., Moxon, S., Reese, J. T., Haendel, M. A., et al. (2024). Structured prompt interrogation and recursive extraction of semantics (spires): A method for populating knowledge bases using zero-shot learning. Bioinformatics, 40(3):btae104.

Ciatto, G., Agiollo, A., Magnini, M., and Omicini, A. (2025). Large language models as oracles for instantiating ontologies with domain-specific knowledge. Knowledge-based systems, 310:112940.

Frey, J., Meyer, L.-P., Arndt, N., Brei, F., and Bulert, K. (2023). Benchmarking the abilities of large language models for rdf knowledge graph creation and comprehension: how well do llms speak turtle? In ISWC: Workshop Deep Learning for Knowledge Graphs.

Gong, R. and Li, X. (2025). The application progress and research trends of knowledge graphs and large language models in agriculture. Computers and electronics in agriculture, 235:110396.

Norouzi, S. S., Barua, A., Christou, A., Gautam, N., Eells, A., Hitzler, P., and Shimizu, C. (2025). Ontology population using llms. In Handbook on Neurosymbolic AI and Knowledge Graphs, pages 421–438. IOS Press.

Pan, S., Luo, L., Wang, Y., Chen, C., Wang, J., and Wu, X. (2024). Unifying large language models and knowledge graphs: A roadmap. IEEE Transactions on Knowledge and Data Engineering, 36(7):3580–3599.

Wilson, S., Ginige, A., and Goonatilake, J. (2024). Design science research approach for ontology development in agriculture: Utilising advances of llm for automated entity extraction.

Zeng, C., Hartmann, T., and Ma, L. (2026). Ontology-based prompting with large language models for inferring construction activities from construction images. Advanced Engineering Informatics, 69:103869.
Publicado
08/09/2026
NASCIMENTO, Leonardo Vianna do; OLIVEIRA, José Palazzo Moreira de. Constraining LLM-Based RDF Generation with Ontology-Guided Prompting in Urban Agriculture. In: SIMPÓSIO BRASILEIRO DE BANCO DE DADOS (SBBD), 41. , 2026, São Carlos/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2026 . p. 197-209. ISSN 2763-8979. DOI: https://doi.org/10.5753/sbbd.2026.249179.