#005: Detect SHACL incompatibilities and assist data migration #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blocked by
Summary
When a SHACL shape is modified in a way that is incompatible with existing data, the system should detect the incompatibility, notify the user, and assist with data migration by suggesting SPARQL Update queries.
Motivation
As schemas evolve, shapes may change: properties are added, removed, renamed, or have their constraints tightened. Existing data that conformed to the old shape may violate the new shape. Without detection, data silently becomes invalid. Without migration assistance, users must manually write complex SPARQL updates to fix the data.
Incompatibility types
sh:minCount 1forex:emailex:emailex:phonefrom shapeex:phoneorphanedxsd:string→xsd:integersh:maxCountreducedsh:class ex:Org→sh:class ex:Companyex:name→ex:fullNamesh:inlist modifiedDesign
Step 1: Detect incompatibility
When a SHACL update is submitted (via
_shacl/_update):If violations exist, the update is not rejected — the new shapes are saved — but the user is notified of the violations.
Step 2: Notify
Present the list of violations grouped by type:
Step 3: Suggest migration queries
For each violation type, generate a SPARQL Update suggestion:
INSERT { ?s ex:email "" } WHERE { ?s a ex:Person . FILTER NOT EXISTS { ?s ex:email ?o } }DELETE WHERE { ?s ex:phone ?o }DELETE { ?s ex:age ?old } INSERT { ?s ex:age ?new } WHERE { ?s ex:age ?old . BIND(xsd:integer(?old) AS ?new) }DELETE { ?s ex:name ?o } INSERT { ?s ex:fullName ?o } WHERE { ?s ex:name ?o }Suggestions are presented as editable SPARQL in the UI. The user can review, modify, and execute them.
Step 4: Validate after migration
After executing migration queries, re-run SHACL validation to confirm all violations are resolved.
History
For this initial implementation, dataset history is not saved. SHACL changes overwrite the previous shapes. Dataset history strategies are addressed in separate issues:
The history strategy is a per-dataset configuration stored in the meta-dataset (see below).
Meta-dataset
Each dataset has an associated meta-dataset that stores:
The meta-dataset concept extends beyond SHACL — it is the place for all metadata about the dataset itself.
Locking during migration
While a migration is running:
Investigation needed: does Oxigraph 0.5.x support per-graph locking or transactions scoped to a named graph?
Destructive migrations
Destructive changes (property removal, datatype narrowing, cardinality reduction, allowed values restriction) require explicit user confirmation before execution. The UI should clearly show:
Permissions
New actions for schema and migration management:
concon:EditShaclActionconcon:ViewMigrationActionconcon:ExecuteMigrationActionconcon:ConfirmDestructiveActionBy default:
ViewMigrationActiononly.EditShaclActionandExecuteMigrationActioncan be granted via roles (same pattern asconcon:FileWriteAction).Tests
Unit tests
Integration tests
Manual tests
No further open questions
References