feat: YARRRML → SPARQL converter + API endpoint#63
Open
ThHanke wants to merge 2 commits into
Open
Conversation
added 2 commits
June 25, 2026 14:16
yarrrml-parser silently drops valid two-line nested-list po: blocks. Add normalize_yarrrml_nested_lists (yarrrml_utils.py) that converts them to inline-list form before the request hits yarrrml-parser. Wire normalization into convert_yarrrml_to_rml (handles all callers) and refactor /api/yarrrmltorml to use that helper. Add /api/normalizeyarrrml endpoint for inspection/debugging. Unit tests in test_normalize_yarrrml.py; integration tests added to test_createrdfupload.py.
…ndpoint Converts YARRRML mapping YAML to SPARQL SELECT queries that reconstruct the original JSON from an RDF graph. Handles flat, sub-object (non-array), and array patterns with GROUP_CONCAT; ghost sub-object detection skips duplicate fields; numeric/boolean coercion in output; STRSTARTS scoping filter for cross-mapping isolation. Roundtrip verified: 28/28 production EDCAR mappings pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
yarrrml_to_sparql()utility andPOST /api/yarrrmltosparqlendpoint that converts a YARRRML mapping YAML into a SPARQL SELECT query reconstructing the original JSON from an RDF graph.What it does
CONCAT(...)SELECT column building JSON from RDF triplesGROUP_CONCAT(DISTINCT ...)with per-item JSON fragments{}keyed by predicate local nameIF(REGEX(...))in SPARQL outputSTRSTARTSsubject prefix filter for cross-mapping isolationVerification
test_yarrrml_sparql.py)test_yarrrml_sparql_roundtrip.py)SimulationParameterskipped: empty{}sub-objects don't survive RDF roundtrip by design