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: InMemoryVersionStorage for tests, SQLiteVersionStorage for 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() and diff() 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

Snapshot before every destructive operation. Call manager.create_snapshot() before running deduplication, conflict resolution, or merge operations. restore_snapshot() is only possible if a snapshot exists before the change.

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:
Use diff() for code review and incident investigation. manager.diff("v1.0", "v2.0") returns a plain dict with "summary", "entities_added", "entities_removed", and "entities_modified": use the "summary" sub-dict to get counts and "entities_modified" to inspect property-level changes.

OntologyVersionManager

Version control for ontologies: save, diff, and track schema changes:

VersionStorage Backends

Persists all version history to disk. Survives process restarts. Recommended for any environment where you need to retain the audit trail.
The default TemporalVersionManager() with no arguments uses in-memory storage. Always pass storage_path="versions.db" or an explicit SQLiteVersionStorage in production: otherwise your entire version history disappears on restart.
Use SQLiteVersionStorage in production. The default in-memory storage loses all version history when the process exits. Pass storage_path="versions.db" to TemporalVersionManager or create SQLiteVersionStorage(db_path="versions.db") explicitly.

Integrity Verification

SHA-256 checksums detect any unauthorized modification to a graph between snapshots:
verify_checksum takes the full snapshot dict (which contains the stored "checksum" key). Pass the dict returned by create_snapshot or get_version directly: no separate expected_checksum argument is needed.

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.

Compliance and Version History

All version snapshots form a tamper-evident audit trail. Use list_versions() and diff() to reconstruct and review changes for regulatory purposes:
Use list_versions() and diff() for compliance reviews. manager.list_versions() returns a list of metadata dicts (with label, author, timestamp, checksum). Run verify_checksum(snapshot) on the dict returned by get_version() to confirm integrity before any export.
Use verify_checksum() before any compliance export to confirm snapshot integrity:
Per-node mutation history is available for HIPAA subject-access and SOX audit workflows:

Compliance Coverage

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.
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.
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.
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).