Constraining LLM-Based RDF Generation with Ontology-Guided Prompting in Urban Agriculture - Nascimento, Leonardo Vianna do; Oliveira, José Palazzo Moreira de (Anais do Simpósio Brasileiro de Banco de Dados (SBBD); 2026: Anais do XLI Simpósio Brasileiro de Bancos de DadosDO - 10.5753/sbbd.2026.249179, 2026)
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.