semantica.change_management provides enterprise-grade versioning and audit trails for knowledge graphs and ontologies:
- SHA-256 checksums on every snapshot: tamper detection without external infrastructure
- Structural diff between any two versions: nodes added, removed, or modified
- Full rollback to any named snapshot
- Per-entity mutation history for audit trail queries
- Compliance frameworks supported: HIPAA, SOX, GDPR, FDA 21 CFR Part 11
Compliance frameworks supported out of the box: HIPAA, SOX, GDPR, and FDA 21 CFR Part 11.
Exported Classes
What You Get
- TemporalVersionManager — Snapshot, diff, rollback, and per-entity audit trail for knowledge graphs.
- OntologyVersionManager — Version control for OWL ontologies with diff and schema migration support.
- VersionStorage — Pluggable backends:
InMemoryVersionStoragefor tests,SQLiteVersionStoragefor production. - Integrity Verification — SHA-256 checksums on every snapshot to detect any unauthorised modification.
- ChangeLogEntry — Internal metadata validated on every snapshot: ISO 8601 timestamp, email author, and description (max 500 chars).
- Version History — Full tamper-evident version history via
list_versions()anddiff()for regulatory review.
Typical Workflow
1
Initialise the version manager
2
Snapshot before every destructive operation
3
Make your changes
Run deduplication, conflict resolution, merges, or any graph modification. The version manager tracks nothing automatically: you control when snapshots are taken.
4
Snapshot the result
5
Diff to review what changed
TemporalVersionManager
Version control for knowledge graphs: snapshot, diff, and rollback.Constructor Parameters
List and Retrieve
TemporalVersionManager Methods
Diff Analysis
Compare any two snapshots to see exactly what changed: useful for code review, incident investigation, and regulatory audit:diff() return schema
diff() return schema
OntologyVersionManager
Version control for ontologies: save, diff, and track schema changes:VersionStorage Backends
- SQLite (production)
- In-Memory (tests)
Integrity Verification
SHA-256 checksums detect any unauthorized modification to a graph between snapshots:ChangeLogEntry
ChangeLogEntry is the internal metadata object created inside create_snapshot. It validates the author (must be a valid email address) and description (non-empty, max 500 characters) before the snapshot is stored.
ChangeLogEntry schema
ChangeLogEntry schema
Compliance and Version History
All version snapshots form a tamper-evident audit trail. Uselist_versions() and diff() to reconstruct and review changes for regulatory purposes:
verify_checksum() before any compliance export to confirm snapshot integrity:
Compliance Coverage
HIPAA: subject-access requests
HIPAA: subject-access requests
Use
manager.get_node_history("patient_001") to retrieve every recorded mutation on a patient entity. Each MutationRecord includes timestamp, operation, entity_id, payload, and version_label. The SHA-256 checksum on each snapshot proves the record has not been altered.SOX: quarterly reviews
SOX: quarterly reviews
Use
manager.list_versions() to enumerate all snapshots and manager.diff(v1, v2) to scope the change report to the relevant quarter. The immutable snapshot chain provides the chain of custody required by SOX Section 404.GDPR: right to erasure verification
GDPR: right to erasure verification
After deleting a data subject’s entities, snapshot the graph and diff against the pre-deletion snapshot.
diff["entities_removed"] provides a machine-readable record of exactly what was deleted and when, satisfying Article 17 documentation requirements.FDA 21 CFR Part 11: electronic records
FDA 21 CFR Part 11: electronic records
Every snapshot dict includes
author, timestamp, and checksum: the three fields required for a compliant electronic record. verify_checksum(snapshot) provides the tamper-evidence required by 21 CFR § 11.10(e).- Provenance — W3C PROV-O lineage tracking.
- Knowledge Graph — The graph being versioned.
- Export — Export versioned snapshots.
- Conflicts — Detect conflicts introduced between versions.
