Type System
Every attribute (has) and property range in Dolfin has a type. A type is
one of:
- a primitive (
string,int,float,boolean), - a temporal type (
date,time,date_time,duration), - a concept you declared, or
- a closed concept (
one of).
Types are what appears after the : in a has declaration or on either side of
a property’s ->:
concept Person:
has name: one string
has born: optional date
has employer: optional Organization
Primitive types
| Type | Description | XSD datatype | Value examples |
|---|---|---|---|
string | Text | xsd:string | "hello", "" |
int | Integer | xsd:integer | 0, 42, -7 |
float | Floating-point | xsd:float | 3.14, -0.5 |
boolean | Boolean | xsd:boolean | true, false |
Temporal types
Temporal types carry dates, times, timestamps and durations. Their values are written as smart literals, a type keyword plus human-friendly notation in parentheses (see Temporal values). Dolfin parses the notation and emits the exact XSD lexical form.
| Type | XSD datatype | Smart literal | Emitted value |
|---|---|---|---|
date | xsd:date | date(June 1st 2026) | 2026-06-01 |
time | xsd:time | time(2:30 PM UTC) | 14:30:00+00:00 |
date_time | xsd:dateTime | date_time(June 1st 2026, 14:30) | 2026-06-01T14:30:00 |
duration | xsd:duration | duration(1y 6mo) | P1Y6M |
Two file-level directives supply defaults used while resolving temporal values:
@locale d/m/y: field order for numeric dates without an inlineasmask.@timezone <zone>: default timezone fortime/date_timevalues without an inline offset.
See File-level directives. Inline
information (an as mask, an inline offset) always overrides the directive.
Concept types
Any concept name is a type. Using it as a range means “an instance of that
concept” (or a subtype of it, since sub inheritance is transitive):
concept Animal
concept Dog:
sub Animal
concept Shelter:
has residents: some Animal # Dogs qualify, being Animals
Concept-typed values are references (:id) or inline anonymous blocks
([ ... ]) in facts, see Facts.
Closed concepts (one of)
A closed concept enumerates a fixed set of named members; only those members are valid values:
concept Status:
one of:
Pending
Active
Archived
concept Ticket:
has status: one Status
Members are referenced unquoted (Active), not as strings.
Cardinality
Cardinality is orthogonal to type: it constrains how many values of the type
an attribute may hold (one, optional, some, N, N..M, …). It is written
before the type. See Cardinality for the full table.
has tags: some string # one or more strings
has born: optional date # zero or one date
has visits: date_time # any number of timestamps