Dieses Verzeichnis enthält die lauffähige Demo zum Vortrag „Let your data write the code – Was semantische Daten mit KI möglich machen" (DevLand 2026 / Europapark, Track Data Dock).
Zwei Ontologien (ShopProduct → CatalogItem) werden einem LLM übergeben.
Das LLM generiert einen Mapping-Vorschlag mit Confidence-Levels, der Fachbereich korrigiert
eine offene Stelle (promotionScore), und aus dem validierten Mapping entsteht lauffähiger
Python-Code und SQL – vollautomatisch.
# Python 3.10+
pip install -r requirements.txt
# Anthropic API Key
export ANTHROPIC_API_KEY=sk-ant-...# Aus dem Repo-Root:
bash setup_demo.shEntfernt alle generierten Dateien (mapping_proposal.yaml, map_python.py, map_sql.sql,
catalog_items.csv) für einen sauberen Start.
ontologies/shop_product.ttl und ontologies/catalog_item.ttl sind in Metaphactory
importiert. promotionScore hat den Comment „Calculation TBD" – sichtbar als offene Stelle.
python -m src.generate_mappingLiest beide .ttl-Dateien via rdflib, baut System- und User-Prompt, ruft die Claude API auf,
schreibt mappings/mapping_proposal.yaml.
Erwartetes Ergebnis: promotionScore mit confidence: none und
note: "No source field found. Calculation TBD per ontology comment.".
mappings/mapping_v1.yaml liegt vor (manuell erstellt / in Metaphactory bestätigt).
Enthält die promotionScore-Formel mit confidence: high.
python -m src.generate_codeLiest mappings/mapping_v1.yaml, ruft die Claude API auf, schreibt:
output/map_python.py– Python-Transformationsfunktionmap_product()output/map_sql.sql– äquivalentes SQL
python -m src.apply_mappingLädt output/map_python.py, wendet map_product() auf jede Zeile in
data/sample_products.csv an, schreibt output/catalog_items.csv.
demo/
ontologies/ # shop_product.ttl, catalog_item.ttl (Quell-Ontologien)
mappings/ # mapping_proposal.yaml (LLM), mapping_v1.yaml (validiert)
data/ # sample_products.csv
output/ # map_python.py, map_sql.sql, catalog_items.csv (generiert)
src/
extract_schema.py # rdflib: TTL → Property-Liste
generate_mapping.py # Step 1: Ontologien → Mapping-YAML via LLM
generate_code.py # Step 3: Mapping-YAML → Python + SQL via LLM
apply_mapping.py # Step 4: map_product() auf CSV anwenden
tests/ # pytest-Suite (unit + end-to-end)
metaphactory_ontologies/ # Exports aus Metaphactory (Referenz, nicht für den Run)
prompts/ # Gespeicherte Prompts (werden bei Step 1+3 erzeugt)
requirements.txt
# Unit-Tests (kein API-Key nötig)
pytest tests/test_extract_schema.py tests/test_generate_code.py -v
# End-to-End (benötigt ANTHROPIC_API_KEY)
pytest tests/test_end_to_end.py -v