A database management system for ontologies
OntoDB is a database management system for ontologies. Data is RDF, the query language is SPARQL, and a database can live in a directory with a write-ahead log and snapshots.
$ brew install pkgconf raptor cmake ninja $ git clone https://github.com/lamng3/OntoDB.git && cd OntoDB $ cmake --preset dev && cmake --build --preset dev
Query a real database
output of the ontodb shellTry it: Pick a query, press Run for its rows, then Explain analyze for the plan the optimizer chose.
Each query ran in the real shell on the Pizza ontology (loaded 27 triples). The page shows what the shell printed, with IRI prefixes shortened. \explain analyze prints each plan node with its estimated and actual rows.
What it does
RDF in, SPARQL out, with the machinery of a database underneath.
This manual describes how to install OntoDB, load ontologies, query and update them, keep a database on disk, and recover it after a crash. The last parts describe how OntoDB works inside and how the project is developed.
For the theory behind each part (pages, buffer pools, B+ trees, query plans, locking, the write-ahead log, and ARIES), read the companion book, OntoDB: Database Internals by Example. Its design-decision boxes explain why OntoDB is built the way it is: each names the choice, the alternatives, and the cost.
What OntoDB does today
- Loads Turtle, N-Triples, and RDF/XML. OWL files load as RDF triples; there is no reasoner.
- Answers SPARQL
SELECTqueries over a basic graph pattern withFILTER, and runsINSERT DATAandDELETE DATA. See SPARQL reference. - Keeps a database on disk when started with a directory: every update is a transaction, a checksummed write-ahead log records it,
\checkpointwrites a snapshot, and reopening the directory restores every committed transaction. See Persistent databases. - Checks itself:
\verifyrebuilds the database from its files and compares it with the live one.
Indexes, the cost-based optimizer, concurrent transactions, and the page-based disk store are designed and being built. See Roadmap.
Quick start
cmake --preset dev && cmake --build --preset dev
./build/dev/ontodb mydbOntoDB> \load data/tiny.owl
loaded 14 triples in 5.2 ms
OntoDB> SELECT ?kind WHERE { ?kind <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.org/materials#Material> . }
?kind
<http://example.org/materials#Metal>
<http://example.org/materials#Polymer>
(2 rows)Installation has the prerequisites, and the Tutorial walks through a full session.
How this manual is organized
Conventions
OntoDB> is the shell prompt. Commands that start with \ are shell commands; everything else is SPARQL. A Status box says what works today. A Planned box describes work that is designed but not built. Features that are not built yet answer not built yet (PLAN x.y), where x.y is the item in the project's PLAN.md.