From 76644f55f514f6af493b3eef25cefab17aa21363 Mon Sep 17 00:00:00 2001 From: kempersc Date: Fri, 9 Jan 2026 11:56:18 +0100 Subject: [PATCH] feat(rag): add database routing to geographic query templates Add databases: ["oxigraph"] to 4 geographic templates to skip vector search: - list_institutions_by_type_city - list_institutions_by_type_region - list_institutions_by_type_country - list_institutions_in_city Also add documentation explaining database routing configuration in _metadata. --- data/sparql_templates.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/data/sparql_templates.yaml b/data/sparql_templates.yaml index 5eecb49827..276e153226 100644 --- a/data/sparql_templates.yaml +++ b/data/sparql_templates.yaml @@ -50,6 +50,29 @@ _metadata: # ui_template: # nl: "Gevonden: {{ count }} {{ institution_type_nl }} in {{ city }}." # en: "Found: {{ count }} {{ institution_type_en }} in {{ city }}." + # + # Database Routing Configuration + # ============================== + # Each template can specify which databases to query via `databases` (list). + # This allows skipping unnecessary data sources for faster, deterministic results. + # + # Available databases: + # - "oxigraph": SPARQL Knowledge Graph (deterministic, has coordinates) + # - "qdrant": Vector search (probabilistic, semantic similarity) + # + # Examples: + # databases: ["oxigraph", "qdrant"] # Default: query both (backward compatible) + # databases: ["oxigraph"] # SPARQL only - skip vector search + # databases: ["qdrant"] # Vector only - for exploration queries + # + # Use ["oxigraph"] for: + # - Geographic/map queries (Oxigraph has lat/lon coordinates) + # - Factual queries with known schema (counts, lists by type) + # - Deterministic results without vector noise + # + # Use ["qdrant"] for: + # - Semantic exploration ("similar institutions to X") + # - Free-text search without structured slots # Standard SPARQL prefixes used in all templates _prefixes: | @@ -473,6 +496,7 @@ templates: description: "List heritage institutions of a specific type in a city" intent: ["geographic", "exploration"] response_modes: ["table", "map"] + databases: ["oxigraph"] # Geographic query - Oxigraph has lat/lon coordinates ui_template: nl: "Gevonden: {{ result_count }} {{ institution_type_nl }} in {{ city }}." en: "Found: {{ result_count }} {{ institution_type_en }} in {{ city }}." @@ -556,6 +580,7 @@ templates: description: "List heritage institutions of a specific type in a province/region" intent: ["geographic", "exploration"] response_modes: ["table", "map"] + databases: ["oxigraph"] # Geographic query - Oxigraph has lat/lon coordinates ui_template: nl: "Gevonden: {{ result_count }} {{ institution_type_nl }} in {{ region }}." en: "Found: {{ result_count }} {{ institution_type_en }} in {{ region }}." @@ -620,6 +645,7 @@ templates: description: "List heritage institutions of a specific type in a country" intent: ["geographic", "exploration"] response_modes: ["table", "map"] + databases: ["oxigraph"] # Geographic query - Oxigraph has lat/lon coordinates ui_template: nl: "Gevonden: {{ result_count }} {{ institution_type_nl }} in {{ country }}." en: "Found: {{ result_count }} {{ institution_type_en }} in {{ country }}." @@ -839,6 +865,7 @@ templates: description: "List all heritage institutions in a city" intent: ["geographic", "exploration"] response_modes: ["table", "map"] + databases: ["oxigraph"] # Geographic query - Oxigraph has lat/lon coordinates ui_template: nl: "Gevonden: {{ result_count }} erfgoedinstellingen in {{ city }}." en: "Found: {{ result_count }} heritage institutions in {{ city }}."