It is shown that when domain vocabulary and semantics are captured in a well-designed Web Ontology Language (OWL) ontology, Large Language Models (LLMs) can generate accurate structured queries zero-shot, without task-specific fine-tuning, retrieval augmentation, or multi-agent orchestration.
Abstract
Researchers need to answer ad-hoc questions about the contents of domain-specific archives but often lack the expertise to write structured queries on the metadata. We show that when domain vocabulary and semantics are captured in a well-designed Web Ontology Language (OWL) ontology, Large Language Models (LLMs) can generate accurate structured queries zero-shot, without task-specific fine-tuning, retrieval augmentation, or multi-agent orchestration. We present the Natural Language Knowledge Graph Query (NLKGQ) system, a framework and development process that enables natural language access to metadata in such archives. The framework includes a web interface that helps researchers pose natural language questions, which a domain-agnostic harness translates to SPARQL via an LLM and executes against a knowledge graph. The development process begins with capturing domain vocabulary and semantics in a formal OWL ontology. Domain-specific code then extracts metadata from archive sources and imports it into a knowledge graph defined by the ontology. Both are designed for reuse across domains. We demonstrate the system on metadata derived from a large-scale neuroimaging research archive, evaluating multiple LLMs and ontology representations. The best configurations achieve 100% accuracy on a 21-question competency and regression test set developed with domain experts. An ablation study across eight ontology representations reveals that readable entity names and semantic annotations are the dominant factors in accuracy, more significant than model choice or prompt engineering. We also compare SPARQL to an auto-generated SQL database as query backends, showing that OWL's structural features provide a substantial advantage over SQL DDL for LLM-driven query generation. Our demonstration domain requires local LLMs on modest institutional hardware to address privacy concerns for human subject data.
It is shown that for database queries, data model concepts pass to LLMs more effectively through representations whose vocabulary terms carry declared, machine-readable semantics (controlled semantics).
This paper studies the VKG-QA task, which enables users to interact with the VKGs through a natural language (NL) interface by translating their questions into SPARQL queries, and pro-poses NaVQA (Navigation-based VKG Question Answering), a framework leveraging Large Language Models.
Guohui Xiao, Haohan Xue, Lin Ren et al.· Proceedings of the Thirty-Fi...· 0 citations
OntologyToUI is presented, a framework that treats ontologies written in OWL/RDF as a Domain-Specific Language (DSL) for user-interface specification and validate the framework’s extensibility through two case studies developed in the scope of the Smart_LEM project.
Da Costa, Júlio Costa, P. Jorge et al.· 0 citations
This work presents an agentic text-to-SPARQL system that goes one step beyond static tool-using agents: a researcher agent that, after each round of inference on a validation set, proposes and tests changes to its own prompts, rules, and tool-orchestration code.
The results support the feasibility of ontology-driven generation for static-classification systems, whereas arithmetic risk computation and temporal event processing remain better suited to complementary procedural technologies.
Borivoj Bogdanović, S. Nikolić· Computers· 0 citations
A seven-stage graph-grounded pipeline that converts domain documents into a complete, auditable Web Ontology Language (OWL) Terminological Box (TBox) without any unconstrained generation step is presented, demonstrating that the pipeline produces stable, reusable domain representations from large document corpora.
Maruf Ahmed Mridul, A. Talukder, O. Seneviratne· 0 citations