Abstract
SPARTIQULATION is a system designed to translate complex, machine-readable SPARQL queries into natural English statements. By identifying a "main entity" within a query and reorienting the data graph around it, the system helps users verify that a search engine has correctly understood their natural language questions.
Introduction
As we move toward more intuitive Natural Language Interfaces (NLIs) for databases, a common workflow has emerged: a user asks a question in plain English, and a system translates it into a structured query language like SPARQL to fetch data from the Semantic Web. However, there is a significant "trust gap." If the system generates a SPARQL query, how does the average user know it actually matches what they asked? SPARQL is notoriously difficult for non-experts to read. While much research has focused on the "English-to-SPARQL" direction, SPARTIQULATION tackles the inverse: Query Verbalization. The goal is to provide a feedback loop where the system can confirm its understanding of a user's question in plain English.
Methodology
The authors implement a pipeline architecture for Natural Language Generation (NLG) consisting of three main stages: the Document Planner, the Microplanner, and the Surface Realizer.
1. Document Planner
The Document Planner is the core of the system's contribution and involves two critical steps:
- Main Entity Identification: The system uses "exclusion rules" to find the primary subject of the query. Rules prioritize variables that are not hidden in
OPTIONALblocks and those constrained byrdf:type. - Graph Transformation: Once the main entity is identified, the system treats it as the root of a tree. It ensures all edges in the query graph point away from this root, reversing properties where necessary (e.g., changing "Book has author Person" to "Person is author of Book") to maintain a logical narrative flow.
2. Microplanner
This stage handles Lexicalization (finding the right words for URIs using RDFS labels), Aggregation (combining multiple triple patterns into a single concise sentence), and Referring Expression Generation (using pronouns like "they" to avoid repetition).
3. Surface Realizer
The final stage converts the abstract plan into actual English text using predefined linguistic rules. The system is designed to be schema-agnostic, relying on the underlying structure of the RDF data and RDFS vocabulary rather than manual templates.
Key Insights: Message Types
A central innovation of SPARTIQULATION is the identification of 14 schema-agnostic "message types" (MTs). These represent common paths in a query graph and allow the system to handle a wide variety of queries without domain-specific knowledge.
By utilizing these message types, the system can structure a "story" around the main entity rather than just listing disconnected facts. For instance, simple heuristic rules (like ignoring variables that only appear in OPTIONAL blocks) were highly effective, narrowing down the main entity in over 40% of cases.
Evaluation and Results
The authors evaluated SPARTIQULATION using a corpus of 263 SPARQL SELECT queries from the QALD-1 and ILD2012 challenges. After excluding queries with unsupported features like UNION or GROUP BY, they focused on a training set of 209 queries.
Key results include:
- High Coverage: The approach successfully covered 85% of the queries in the training set.
- Rule Efficiency: For all 209 queries tested, the exclusion rules successfully identified a single "main entity," proving the robustness of the heuristic approach.
- Readability: The system transforms technical queries into readable sentences. For example, a query about authors and book titles becomes: "Authors of books with English name 'The Pillars of the Earth' and if available their English names."
Limitations and Future Work
While effective, the current version of SPARTIQULATION has limitations. It cannot yet handle UNION, GROUP BY, or disconnected graphs in the WHERE clause. Furthermore, the 14 message types are currently hard-coded, and the system lacks nuance in lexicalization (e.g., it does not distinguish between "who" for people and "which" for objects). Future work will focus on dynamic message type loading, improved lexicalization, and formal user studies to evaluate the naturalness of the generated text.
Summary updated