LDTab-Diff is a tool for diffing ontologies and updating LDTab databases w.r.t. such diffs.
- This is an experimental prototype to showcase LDTab's diffing capabilities.
make allsimulates an example scenario involving three versions of an ontology. The following steps are executed:- install LDTab
- initialize an LDTab database (located in
example/ldtab.db) - ingest the three versions
a,b, andcof an example ontology (located inresources/ontologies) intoexample/ldtab.db - write the diffs between the three ontology versions to
example/diff - re-create the three input ontology versions using
example/ldtab.db(generated files are inexample/fromLDTab)
- You can play around with different ontology versions. Simply replace the contents of the example ontologies
resources/ontologies/*.xml(serialized in RDF/XML).
An LDTab database encodes the editing history of an OWL ontology. So, an LDTab database is not an ontology. However, an LDTab database can be used to reconstruct an OWL ontology up to a point in its editing history. Specifically, if an LDTab database only encodes one point in the editing history of an ontology, i.e., the database only contains database entries about asserted facts at the given point in time, then such a database can be interpreted in terms of a serialization format for an OWL ontology.
To make this distinction clear, we will refer to an LDTab database that can be interpreted as an OWL ontology as an LDTab ontology. (Note that an LDTab ontology is an LDTab database but not every LDTab database is an LDTab ontology).
Build an LDTab ontology from an LDTab database up to the transaction point-in-history:
python3 cli.py build ldtab-database point-in-history output
The resulting LDTab ontology will be written to output.
Compute the diff between two LDTab ontologies:
python3 cli.py diff ontology-1 ontology-2
The diff between the two ontologies will be written to the folder ./tmp.
A diff includes the following files:
added: LDTab rows that are inontology-2but not inontology-1deleted: LDTab rows that are inontology-1but not inontology-2duplicates_1: duplicated rows inontology-1duplicates_2: duplicated rows inontology-2patch.tsv: rows that represent the diff between the two ontology versions in an LDTab database
Add the diff between the most recent LDTab ontology encoded in an LDTab database and an input LDTab ontology to the LDTab database:
python3 cli.py add-delta database ontology
This does the following:
- Build the most recent LDTab ontology
recentencoded in the inputdatabase - Compute the diff between
recentandontology - Add this diff to
databaseas a new point in the editing history.