LDTab is a tool for working with RDF Datasets and OWL using SQL databases. The immediate use case for LDTab is an ontology term browser with support for history and multiple named graphs. The current version is focused on embedded database use case, building on SQLite.
First initialize the SQLite file with required tables:
ldtab init test.db
This creates tables with the following structure:
- ldtab: metadata
- key
- value
- prefix: used to convert between IRIs and CURIEs
- prefix: the short prefix string
- base: its expansion
- statement
- transaction: an integer indicating when the statement was asserted
- retraction: an integer indicating when the statement was retracted; defaults to 0, which means no retraction; must be greater than the transaction
- graph
- subject
- predicate
- object
- datatype
- annotation: for RDF reifications and OWL annotations
Prefixes are used to shorten IRIs to CURIEs. Add your preferred prefixes from a TSV file:
ldtab prefix test.db prefix.tsv
You can now import an RDFXML file into the 'statement' table using those prefixes:
ldtab import test.db test-v1.owl
The first import will result in transaction 1. The next import will result in the next transaction, and so on.
You can export to a file
ldtab export test.db test-v2.ttl