HeriKGQA: Grounded Knowledge-Graph Question Answering over Cultural Heritage Sensor Data
Organizations: Fraunhofer Institute for Applied Information Technology FIT · University of Cologne · Athena Research and Innovation Centre · University Hospital of Cologne
Abstract
Cultural heritage sites are increasingly monitored by sensor networks, but querying their data requires database expertise. Large Language Models (LLMs) offer a natural-language interface, yet over raw sensor records they lose track of which sensor, site, and time each value belongs to, and silently miscompute. We present HeriKGQA, a knowledge-graph question-answering method that confines the LLM to interpreting questions and phrasing answers, leaving computation to SPARQL and deterministic code. Questions are parsed into intents constrained by a heritage ontology aligning W3C SOSA/SSN with CIDOC-CRM, compiled into SPARQL, and answered from query results and temporal, spatial, and anomaly facts derived by a grounding layer, with error correction guarding each LLM step. On 500 questions over real data from five heritage sites, HeriKGQA reaches 99.0% accuracy, 18.2 points above the strongest of three baselines using the same LLM and receiving the same anomaly rules and answer conventions, with comparable answer quality while running almost four times faster. Without grounding, accuracy drops by 12.2 points and on anomaly questions from 99% to 66%. We report lessons from development and live deployment.
Figures & tables
| Accuracy (%) | Quality † | Latency (s) | ||||||||
| System | Mean | Basic | Spatial | Temporal | Anomaly | Follow | Mean | 4 (%) | Median | p90 |
| TextRAG | 37.6 | 17 | 63 | 26 | 63 | 19 | 4.72 | 8.4 | 3.9 | 12.4 |
| TableRAG | 48.2 | 76 | 22 | 57 | 26 | 60 | 4.39 | 32.2 | 8.9 | 17.1 |
| Interactive-KBQA | 80.8 | 95 | 54 | 91 | 79 | 85 | 4.85 | 6.2 | 46.7 | 130.9 |
| HeriKGQA | 99.0 | 99 | 100 | 98 | 99 | 99 | 4.79 | 3.2 | 12.0 | 22.9 |
| w/o grounding | 86.8 | 99 | 83 | 98 | 66 | 88 | 4.78 | 9.8 | 11.4 | 24.4 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Type | Question | Reference answer |
| Basic | What is the average soil temperature observed at Baltanas? | 28.216 |
| Spatial | What is the distance between sensor nodes AF3 and GNSS-Rover at Baltanas? | 11.0 m |
| Temporal | What was the average temperature at Baltanas over the last 24 hours? | 25.871 (4,713 observations, window ending 12 Aug, 09:15) |
| Anomaly | According to the AD-RT anomaly rules, was there a rainfall anomaly at Ranverso on 2026-07-20? | No: 7-day rainfall 5.2, below the threshold of 20 ( R2_rain_7d ) |
| Follow-up | Q1: What is the average temperature at Lucretili? (23.639 °C) Q2: What about Baltanas? (21.722 °C) Q3: And the maximum there? | 44.6 °C |
| Undeterminable (anomaly) | Did the crack width at Schenkenberg exceed its AD-RT threshold on 2026-06-02? | Cannot be determined: no crack width readings at Schenkenberg |
| TextRAG | TableRAG | Interactive-KBQA | HeriKGQA | |
| Representation and querying | ||||
| Data representation | Plain-text rows, chunked by site, node, sensor, property, and day | One flattened table (pandas) | The same virtual RDF knowledge graph (Ontop) | Virtual RDF knowledge graph (Ontop) |
| Retrieval | Hybrid BM25 and dense retrieval (RRF) | LLM query expansion, then schema and cell retrieval (top 5 per query) | Multi-turn exploration via SPARQL tools | Single structured intent |
| Query generation | – | Pandas commands written by the LLM in a ReAct loop | Free-form SPARQL written by the LLM | Deterministic compilation of the LLM’s intent |
| Schema knowledge | Chunk titles only | Retrieved columns with types and example values | Hand-written schema, tool descriptions, and patterns | Ontology-derived schema of instantiated classes |
| In-context examples | None | No task-specific ones (official prompts) | 3 demonstration dialogs | 14 question–intent examples covering question types |
| Question type | Category | ||||||||
| System | Mean | Basic | Spatial | Temporal | Anomaly | Follow | Readability | Conciseness | Comprehension |
| TextRAG | 4.72 | 4.61 | 4.70 | 4.60 | 4.89 | 4.77 | 4.87 | 4.48 | 4.80 |
| TableRAG | 4.39 | 4.70 | 4.28 | 4.58 | 3.94 | 4.45 | 4.31 | 4.86 | 4.00 |
| Interactive-KBQA | 4.85 | 4.93 | 4.84 | 4.80 | 4.95 | 4.71 | 4.98 | 4.72 | 4.84 |
| HeriKGQA | 4.79 | 4.77 | 4.85 | 4.65 | 4.96 | 4.72 | 4.90 | 4.57 | 4.90 |
| w/o grounding | 4.78 | 4.82 | 4.90 | 4.72 | 4.70 | 4.76 | 5.00 | 4.63 | 4.71 |
| Human preference | |||||
| HeriKGQA | IKBQA | Tie | Agree w/ judge | ||
| By judge verdict | |||||
| HeriKGQA win | 34 | 31 | 1 | 2 | 91% |
| IKBQA win | 33 | 10 | 22 | 1 | 67% |
| Tie | 33 | 25 | 5 | 3 | 9% |
| By evaluator | |||||
| System | Wrong | No answer | Declined (size) | False abst. | Missed decline | Wrong verdict | Wrong value |
| TextRAG | 312 | 8 | 0 | 61 | 0 | 44 | 199 |
| TableRAG | 259 | 92 | 0 | 53 | 1 | 25 | 88 |
| Interactive-KBQA | 96 | 2 | 0 | 19 | 3 | 25 | 47 |
| HeriKGQA | 5 | 0 | 0 | 2 | 1 | 0 | 2 |
| w/o grounding | 66 | 0 | 35 | 2 | 1 | 5 | 23 |
| w/o error corr. | 12 | 0 | 0 | 9 | 1 | 0 | 2 |
| (a) Generality: MultiTQ | |||||||
| System | Mean | Equal | Before/ After | First/ Last | Equal Multi | Before Last | After First |
| HeriKGQA | 75.4 | 94.0 | 71.4 | 96.3 | 53.7 | 67.9 | 69.0 |
| Interactive-KBQA | 73.4 | 90.5 | 72.6 | 92.7 | 56.1 | 61.9 | 66.7 |
| (b) Robustness: backbone LLM on our benchmark | |||||||
| Backbone | Mean | Basic | Spatial | Temporal | Anomaly | Follow-up | |
| gpt-oss-120b | 99.0 | 99 | 100 | 98 | 99 | 99 | |
Knowledge Graph Question Answering
Knowledge Graph Question Answering answers natural-language questions by finding and reasoning over entities and relations in structured knowledge graphs.
See all 180 papers