Introduction
What is Dolfin?
Dolfin is a language for modelling knowledge.
You use it to describe the concepts in a domain, the relationships between them, the constraints they must satisfy, and the rules that can be inferred from them. The result is an ontology: a precise, human-readable definition of what exists in your world and how the pieces fit together.
Dolfin is not tied to any particular storage backend or runtime. The model you write is independent of whether your data lives in a graph database, a relational database, a document store, or something else entirely. Dolfin describes what your data means; the implementation decides where and how it is stored and queried.
This separation is what makes ontologies powerful. The same model can drive validation in one system, feed a reasoning engine in another, and serve as shared vocabulary across a team, all without being rewritten.
What is an ontology?
The word ontology comes from philosophy. It’s the study of what exists. In software, an ontology is a formal description of the concepts in a domain and the relationships between them.
Think of it like a schema, but with more expressive power:
| A database schema can says things like … | A Dolfin ontology can also says… |
|---|---|
An animal has a name column | An animal must have exactly one name |
An appointment has a vet_id foreign key | An intern cannot treat an emergency |
| — | An unvaccinated animal is automatically flagged |
| — | Animal in this model is the same concept as fao:Animal in the global species registry |
Dolfin lets you express all of that in a clean, readable file.
What you will build
This tutorial follows Dr. Helen Portbridge as she designs the data model for her new veterinary clinic, Happy Paws. Over ten chapters, starting from a blank file, you will build a complete ontology that:
- Describes animals, owners, appointments, and veterinary staff
- Enforces rules like “a surgeon must be on call for any surgery”
- Automatically flags at-risk or overdue patients
- Connects to external registries using standard IRIs
By the end, you will have touched every major feature of the language.
What Dolfin looks like
Here is a small taste. Don’t worry about the details — each piece will be introduced step by step.
concept Animal:
has name: one string
has species: one Species
has owner: optional Owner
has vaccinations: Vaccination
concept Dog:
sub Animal
has breed: optional string
has neutered: one boolean
rule flag_unvaccinated:
match:
?animal a Animal
?animal vaccinations 0
then:
?animal a UnvaccinatedAnimal
Dolfin is designed to be readable without training. A domain expert, a developer, and a data architect can all look at the same file and understand it.
How to read this tutorial
The tutorial is structured as a story. Each chapter opens with a short scene from the clinic, poses a new modelling problem, introduces the Dolfin feature that solves it, and ends with a prompt for the next problem.
You can read it cover to cover, or use it as a reference — the Reference section at the end is a complete description of the language.
Ready? The clinic opens in Chapter 1.