Ord - Outline and Relational Data

A simple and powerful markup language for note-taking and structured information.

Ord semantics

Version 0.7.0-draft, 2026-11-22. A companion spec to Ord specification, of the same version. The Spec's conventions (S1 to S6) and versioning (S10) apply here, and rule IDs that start with C, L, D, T or F refer to the Spec. This spec's rules start with M.

The Spec says how text becomes a tree of nodes and fields. This spec says what that tree means across a workspace: which node a reference points to, what types and states a node has, who owns whom, and what formulas and queries written in files stand for.

1. Scope and the line

2. The graph

3. Fields

4. Ownership

5. Types and IDs

Built-in types (informative)

A workspace usually starts with this definition in its workspace file. It is an ordinary type definition, so its fields and settings can be changed like on any type.

Task +_type
	name:: task
	fields::
		due::

Journal nodes, where tools put things for a date, are ordinary nodes found by their ID: journal- and the date, such as Monday 12, 2026 ^journal-2026-10-12 and October, 2026 ^journal-2026-10. They have no type. Tools create them when something goes to a date.

5a. System types and fields

6. References

6a. Mirrors

7. States

8. Field definitions and formulas

Tests in Appendix A cover each rule of this section. The rules run from definitions, through what tools write, options and tags, and formulas, to the function library and one-time formulas.

9. Queries

Tests in Appendix A cover each rule of this section.

10. Diagnostics

Codes, severities and positions work as in the Spec (C35 to C37). Positions are in the file the diagnostic is about.

Code Severity Given when Position
M10 error A node has a second _label, _id, _state or _mirror value the second value
M11.1 error A node writes a _name value the value
M11.2 error A node writes a _file value the value
M14.1 warning A _parent or _children cell names a node owned by indentation the cell
M14.2 warning _parent and _children cells give a node different owners the later cell
M15 error A node is in an ownership loop the node
M17.1 error A type definition's name isn't a name, or a tag definition's isn't a tag the value
M17.2 error A type or a tag is defined twice, or a system type in a file the second name field
M17.3 warning A type definition has no name the +_type trigger
M20.1 error Two nodes have one ID each ID after the first, in file order (M5)
M20.3 error An ID isn't a name the ID
M22.1 error A reference's ID matches no node the reference
M22.2 warning A reference's label no longer matches the node its ID names the reference
M22.3 warning A reference is one node's ID and another node's label the reference
M23.1 warning A label matches no node the reference
M23.2 warning A label matches several nodes the reference
M26 warning A _state value is neither a built-in state nor a custom state of the node's types the value
M27.1 warning A custom state isn't name [m] > base with a built-in base and a new name the state setting
M28.1 warning A custom state uses a built-in marker the state setting
M28.2 warning A marker belongs to a custom state already the state setting
M39 error A formula on a setting of a node of a system type, other than a field definition node's value and valid and a search node's footer the value
M40 error A valid formula isn't true the value, or the node's line for a calculated field (M87)
M41.1 error A workspace formula's key can't be written after $, or names a JSONata or Ord function the field
M41.2 error A workspace formula's key is given by another formulas:: field already the field
M44.1 error A computed field is in a cycle the formula
M44.2 error A computed field depends on a cycle the formula
M44.3 error A formula fails to evaluate the formula
M46 warning A value is none of the field's options the value, or the node's line for a calculated field (M87)
M48.1 warning A mirror's path names no file of the workspace the mirror's _mirror value
M50.1 warning A mirror is under its own source the mirror's _mirror value
M50.2 warning A line is under a mirror the line
M55.1 error A field is defined by two field definition nodes the second key field
M55.2 error A system field (M11) is defined again the key value
M55.3 warning A field definition node has no key the +_field trigger
M58.1 error A type gives a field definition node's key a value or child lines the field line
M60.1 error search written as a type, not as ? query, or a query field line under a search node the type, or the field line's key
M87.1 error A node writes a field that one of its types calculates the value
M87.2 error A calculated field's definition has a nested field, or a local field definition has a formula alone on a child line the line
M85.1 warning A field definition's value is auto expr, now written ~(expr) the value
M88.1 warning A second _workspace node in the workspace file, or one in another file the type
M92 error A name or key that starts with _ names no system field or system type the type, tag or ID, the field's key, or the name or key value

Appendix A: Graph dump and tests

Tests work as in the Test format, part B, with one more option.

--- a.ord
Acme Corp +company ^acme
Anna +person
Call [[Anna]] about [[Acme Corp]]
	client:: acme
.
file "a.ord"
  node "Acme Corp" @1
    id "acme"
    type "company"
  node "Anna" @2
    type "person"
  node "Call [[Anna]] about [[Acme Corp]]" @3
    ref "_link" -> a.ord:2
    ref "_link" -> a.ord:1
--- types.ord
Bug +_type
	name:: bug
	state:: triage [t] > new | review [r] > in-progress | shipped > done | someday
--- work.ord
[r] Fix login +bug
Ship it +bug
	_state:: shipped
Later +bug
	_state:: someday
[x] Twice +bug
	_state:: shipped
[q] Unknown
Odd
	_state:: shipped
.
file "types.ord"
  node "Bug" @1
    type "_type"
file "work.ord"
  node "Fix login" @1
    type "bug"
    state "review"
    base "in-progress"
  node "Ship it" @2
    type "bug"
    state "shipped"
    base "done"
  node "Later" @4
    type "bug"
    state "someday"
  node "Twice" @6
    type "bug"
    state "done"
  node "Unknown" @8
  node "Odd" @9
    state "shipped"
! M10 work.ord:7:11
! L11 work.ord:8:1
! M26 work.ord:10:11
--- Ord.workspace
Types
	+task
	Task +_type
		name:: task
--- a.ord
Write +task
+task
Task +_type
	name:: task
.
file "Ord.workspace"
  node "Types" @1
    node "" @2
      type "task"
    node "Task" @3
      type "_type"
file "a.ord"
  node "Write" @1
    type "task"
  node "" @2
    type "task"
  node "Task" @3
    type "_type"
! M17.2 a.ord:4:2

Names that start with _ are reserved (M92): only the system fields and system types use them.

--- a.ord
Draft +_task #_draft ^_x1
	_due:: 2026-12-01
Bug +_type
	name:: _bug
.
file "a.ord"
  node "Draft #_draft" @1
    id "_x1"
    type "_task"
  node "Bug" @3
    type "_type"
! M92 a.ord:1:7
! M92 a.ord:1:14
! M92 a.ord:1:22
! M92 a.ord:2:2
! M92 a.ord:4:9
--- a.ord
Invoice 42 ^i42
Anna +person ^anna
Erik ^anna
Now ^today
Task +_type
	name:: task
	fields::
		owner::
			options:: +person
Fix +task
	owner:: "Anna"
	contacts::
		Erik
--- lines.csv
_id,_label,_parent
l1,Workshop,i42
l2,Review,l3
l3,Loop,l2
.
file "a.ord"
  node "Invoice 42" @1
    id "i42"
    node "Workshop" @lines.csv:2
      id "l1"
      ref "_parent" -> a.ord:1
  node "Anna" @2
    id "anna"
    type "person"
  node "Erik" @3
    id "anna"
  node "Now" @4
    id "today"
  node "Task" @5
    type "_type"
  node "Fix" @10
    type "task"
    ref "owner" -> a.ord:2
    node "Erik" @13 in "contacts"
file "lines.csv"
  node "Review" @3
    id "l2"
    ref "_parent" -> lines.csv:4
  node "Loop" @4
    id "l3"
    ref "_parent" -> lines.csv:3
! M20.1 a.ord:3:6
! M15 lines.csv:3:1
! M15 lines.csv:4:1
--- a.ord
Buy milk #urgent
Anna #friend
See [[Buy milk]], [[buy milk #urgent]] and [[anna]]
.
file "a.ord"
  node "Buy milk #urgent" @1
  node "Anna #friend" @2
  node "See [[Buy milk]], [[buy milk #urgent]] and [[anna]]" @3
    ref "_link" -> a.ord:1
    ref "_link" -> a.ord:1
    ref "_link" -> a.ord:2
--- a.ord
Ship **v2** now
Plan _the_ ==launch==
See [[Ship v2 now]], [[ship *v2* now]] and [[Plan the launch]]
.
file "a.ord"
  node "Ship **v2** now" @1
  node "Plan _the_ ==launch==" @2
  node "See [[Ship v2 now]], [[ship *v2* now]] and [[Plan the launch]]" @3
    ref "_link" -> a.ord:1
    ref "_link" -> a.ord:1
    ref "_link" -> a.ord:2
--- a.ord
Monday ^journal
	Standup
	@ Send mapping draft^t9x1
Kickoff
	attendees::
		@ Anna Smith
	with:: @Anna Smith; @Nobody
Anna Smith +person
Apollo +project
	[-] Send mapping draft +task ^t9x1
		Ask Erik
	@ ^gone
.
file "a.ord"
  node "Monday" @1
    id "journal"
    node "Standup" @2
    node "" @3
      ref "_mirror" -> a.ord:10
  node "Kickoff" @4
    ref "attendees" -> a.ord:8
    ref "with" -> a.ord:8
    node "" @6 in "attendees"
      ref "_mirror" -> a.ord:8
  node "Anna Smith" @8
    type "person"
  node "Apollo" @9
    type "project"
    node "Send mapping draft" @10
      id "t9x1"
      type "task"
      state "in-progress"
      node "Ask Erik" @11
    node "" @12
! M23.1 a.ord:7:22
! M22.1 a.ord:12:2
--- a.ord
Apollo +project
	Tasks
		@ Apollo
	@ Tasks
		Stray note
.
file "a.ord"
  node "Apollo" @1
    type "project"
    node "Tasks" @2
      node "" @3
        ref "_mirror" -> a.ord:1
    node "" @4
      ref "_mirror" -> a.ord:2
      node "Stray note" @5
! M50.1 a.ord:3:3
! M50.2 a.ord:5:3

A search is written ? query (M60); +search and a query:: line under a search are errors.

--- a.ord
Open +search
	query:: +task
? +task
	query:: #urgent
	sort:: due
.
file "a.ord"
  node "Open" @1
  node "" @3
    type "search"
! M60.1 a.ord:1:6
! M60.1 a.ord:4:2

A mirror of a file (M48): its source is the file's root, its path resolved from the mirror's folder.

--- a.ord
Today
	@ notes/plan.ord
	@ missing.ord
--- notes/plan.ord
Top
.
file "a.ord"
  node "Today" @1
    node "" @2
      ref "_mirror" -> notes/plan.ord
    node "" @3
file "notes/plan.ord"
  node "Top" @1
! M48.1 a.ord:3:2
--- a.ord
Task +_type
	name:: task
	fields::
		priority::
			options:: low; high
		score:: =(1)
Bug +_type
	name:: bug
	fields::
		priority::
			options:: p1; p2
		score:: =(2)
Note +_field
	key:: note
	options:: ok
A +task +bug
	priority:: p1
	note:: ok
B +bug +task
	priority:: p1
	note:: bad
.
file "a.ord"
  node "Task" @1
    type "_type"
  node "Bug" @7
    type "_type"
  node "Note" @13
    type "_field"
  node "A" @16
    type "task"
    type "bug"
    calc "score" "2"
  node "B" @19
    type "bug"
    type "task"
    calc "score" "1"
! M46 a.ord:20:13
! M46 a.ord:21:9
--- a.ord
Expense +_type
	name:: expense
	fields::
		line_a::
		line_b::
		total:: =(line_a + line_b)
			valid:: =($value >= 0)
		parts::
			double:: =(line_a * 2)
By boat +expense
	line_a:: 2000
	line_b:: 50
	parts::
Refund +expense
	line_a:: -100
	line_b:: 20
	total:: 5
.
file "a.ord"
  node "Expense" @1
    type "_type"
  node "By boat" @10
    type "expense"
    calc "parts.double" "4000"
    calc "total" "2050"
  node "Refund" @14
    type "expense"
    calc "total" "-80"
! M40 a.ord:14:1
! M87.1 a.ord:17:10
--- a.ord
Sums
	a:: 2
	b:: =(a * 3); 7; =([1, 2])
	c:: =(d)
	d:: =(c)
	e:: =(c + 1)
	f:: =($undefinedFn(1))
.
file "a.ord"
  node "Sums" @1
    calc "b" "6" "7" "1" "2"
    calc "c"
    calc "d"
    calc "e"
    calc "f"
! M44.1 a.ord:4:6
! M44.1 a.ord:5:6
! M44.2 a.ord:6:6
! M44.3 a.ord:7:6
--- a.ord
Issue +_type
	name:: issue
	fields::
		kind::
			options:: bug; feature
			tags:: true
		project::
			options:: +project
			tags:: true
		label:: =(_tags)
Ord-notes +project ^on1
Ord Notes +project
Crash +issue #bug #ord-notes #other
Wish +issue [#Ord Notes]
Elsewhere #bug
	label:: =(_tags)
.
file "a.ord"
  node "Issue" @1
    type "_type"
  node "Ord-notes" @11
    id "on1"
    type "project"
  node "Ord Notes" @12
    type "project"
  node "Crash #bug #ord-notes #other" @13
    type "issue"
    ref "project" -> a.ord:11
    calc "label" "other"
  node "Wish" @14
    type "issue"
    ref "project" -> a.ord:12
    calc "label"
  node "Elsewhere #bug" @15
    calc "label" "bug"
--- a.ord
Item +_type
	name:: item
	fields::
		qty::
			valid:: =($value > 0 and $count($values) <= 2)
Good +item
	qty:: 3
Bad +item
	qty:: 0; 2; 5
.
file "a.ord"
  node "Item" @1
    type "_type"
  node "Good" @6
    type "item"
  node "Bad" @8
    type "item"
! M40 a.ord:9:8
! M40 a.ord:9:11
! M40 a.ord:9:14
--- a.ord
Åsa Öberg! #team ^asa
	s:: =($slug())
	t:: =($slug("Hej då"))
	m:: =($slug(missing))
	n:: =($node("^asa")._label)
	f:: =($first([3, 4]))
	l:: =($last(9))
	k:: =(N)
.
file "a.ord"
  node "Åsa Öberg! #team" @1
    id "asa"
    calc "f" "3"
    calc "k" "Åsa Öberg!"
    calc "l" "9"
    calc "m"
    calc "n" "Åsa Öberg! #team"
    calc "s" "asa-oberg"
    calc "t" "hej-da"
--- a.ord
Person +_type
	name:: person
Task +_type
	name:: task
	fields::
		Owner +_field
			key:: owner
			options:: +person
			description:: Who does it.
		due::
			description:: When it is due.
		size:: small
			valid:: =($value in ["small", "large"])
		priority::
Priority +_field
	key:: priority
	options:: low; high
Anna +person
Apollo
	Draft +task
		owner:: Anna
		size:: huge
		priority:: urgent
		up:: =($ancestors()[0]._label)
		all:: =($count($nodes("Apollo")))
		tasks:: =($count($query("+task")))
		slug:: =($slug("Åsa Öberg!"))
		g:: =($uuid())
.
file "a.ord"
  node "Person" @1
    type "_type"
  node "Task" @3
    type "_type"
    node "Owner" @6 in "fields"
      type "_field"
  node "Priority" @15
    type "_field"
  node "Anna" @18
    type "person"
  node "Apollo" @19
    node "Draft" @20
      type "task"
      ref "owner" -> a.ord:18
      calc "all" "1"
      calc "g"
      calc "slug" "asa-oberg"
      calc "tasks" "1"
      calc "up" "Apollo"
! M40 a.ord:22:10
! M46 a.ord:23:14
! M44.3 a.ord:28:7
--- a.ord
Dates
	num:: =($format(1234.5, "#,##0.00"))
	day:: =($format("2026-10-22", "[D1] [MNn] [Y]"))
	week:: =($count($date("2026-W43")))
	month:: =($first($date("2026-02")) & " " & $last($date("2026-02")))
	shift:: =($date("2026-10-22T09:00", 7))
	between:: =($days("2026-10-20", "2026-10-22"))
	back:: =($days("2026-10-22T23:00", "2026-10-20T01:00"))
.
file "a.ord"
  node "Dates" @1
    calc "back" "-2"
    calc "between" "2"
    calc "day" "22 October 2026"
    calc "month" "2026-02-01 2026-02-28"
    calc "num" "1,234.50"
    calc "shift" "2026-10-29T09:00"
    calc "week" "7"
--- a.ord
Clock
	today:: =($today())
	now:: =($now())
	tomorrow:: =($date("tomorrow"))
	yday:: =($date("YDAY"))
	friday:: =($date("friday"))
	thursday:: =($date("thursday"))
	next:: =($date("next-friday"))
	last:: =($date("last-monday"))
	week:: =($first($date("this-week")) & " " & $last($date("this-week")))
	left:: =($days("2026-10-20"))
	name:: =($days("tomorrow"))
.
file "a.ord"
  node "Clock" @1
    calc "friday" "2026-10-16"
    calc "last" "2026-10-05"
    calc "left" "5"
    calc "name"
    calc "next" "2026-10-23"
    calc "now" "2026-10-15T14:30:00"
    calc "thursday" "2026-10-15"
    calc "today" "2026-10-15"
    calc "tomorrow" "2026-10-16"
    calc "week" "2026-10-12 2026-10-18"
    calc "yday" "2026-10-14"
--- t.ord
Todo +_type
	name:: todo
	checkbox:: true
	fields::
		client::
			options:: ACME; Initech
			tags:: true
		due::
		vat:: =(1 + 1)
	nodes::
		Notes
Invoice +_type
	name:: invoice
	fields::
		due:: 30 days
		amount::
--- a.ord
Call Anna
Pay
	amount:: 100
=== a.ord
Call Anna +todo #ACME
Pay +todo +invoice
	amount:: 100
.
--- t.ord
Todo +_type
	name:: todo
	checkbox:: true
	fields::
		client::
			options:: ACME; Initech
			tags:: true
		due::
		vat:: =(1 + 1)
	nodes::
		Notes
Invoice +_type
	name:: invoice
	fields::
		due:: 30 days
		amount::
--- a.ord
[ ] Call Anna +todo #ACME
	due::
	Notes
[ ] Pay +todo +invoice
	amount:: 100
	client::
	due:: 30 days
	Notes
--- t.ord
Invoice +_type
	name:: invoice
	fields::
		vat:: 0.25
		status:: open
		total:: 0
Local +_type
	name:: local
	fields::
		vat:: 0.25
--- a.ord
March +invoice
	vat:: 0.25
	status:: open
	total:: 0
April +invoice
	vat:: 0.06
	status:: open
	total:: 5
May +invoice +local
	vat:: 0.25
	status:: open
	total:: 0
=== t.ord
Invoice +_type
	name:: invoice
	fields::
		vat:: 0.12
		state:: open
		total:: =(1 + 1)
		paid::
Local +_type
	name:: local
	fields::
		vat:: 0.25
.
--- t.ord
Invoice +_type
	name:: invoice
	fields::
		vat:: 0.12
		state:: open
		total:: =(1 + 1)
		paid::
Local +_type
	name:: local
	fields::
		vat:: 0.25
--- a.ord
March +invoice
	vat:: 0.12
	state:: open
	paid::
April +invoice
	vat:: 0.06
	state:: open
	total:: 5
	paid::
May +invoice +local
	vat:: 0.25
	state:: open
	paid::
--- t.ord
Bug +_type
	name:: bug
	fields::
		_id:: ~("BE" & $seq(3))
		code:: ~("C-" & $seq(2))
--- a.ord
Old +bug ^BE006
	code:: C-09
=== a.ord
Old +bug ^BE006
	code:: C-09
New +bug
Newer +bug
Plan
	due:: ~$date("tomorrow")
	x:: ~([{"a": 1}, {"a": 2}])
	n:: ~(1 + 1); ~("6"); keep
	bad:: ~$uuid(
	Ship ~$today()
.
--- t.ord
Bug +_type
	name:: bug
	fields::
		_id:: ~("BE" & $seq(3))
		code:: ~("C-" & $seq(2))
--- a.ord
Old +bug ^BE006
	code:: C-09
New +bug ^BE007
	code:: C-10
Newer +bug ^BE008
	code:: C-11
Plan
	due:: 2026-10-16
	x::
		0::
			a:: 1
		1::
			a:: 2
	n:: 2; 6; keep
	bad:: ~$uuid(
	Ship 2026-10-15
--- a.ord
Task +_type
	name:: task
	fields::
		project::
			options:: +project
			tags:: true
LU +project
[x] Write journal notes +task #area/home
	due:: 2026-10-20
	n:: 1.50
[ ] Mentions be086 +task #LU
Event ^BE086
Old journal +task #archived
Journal day ^journal-2026-10-15
	ref:: journal
? +task
? journal
? #area
? #LU
? [n:: 1.5] | [due::]
? ![x] +task
? ^journal*
? jour*
? #archived journal
Bad +search
	query:: +task
.
file "a.ord"
  node "Task" @1
    type "_type"
  node "LU" @7
    type "project"
  node "Write journal notes #area/home" @8
    type "task"
    state "done"
  node "Mentions be086 #LU" @11
    type "task"
    state "new"
    ref "project" -> a.ord:7
  node "Event" @12
    id "BE086"
  node "Old journal #archived" @13
    type "task"
  node "Journal day" @14
    id "journal-2026-10-15"
  node "" @16
    type "search"
    result -> a.ord:8
    result -> a.ord:11
  node "" @17
    type "search"
    result -> a.ord:8
    result -> a.ord:14
  node "" @18
    type "search"
    result -> a.ord:8
  node "" @19
    type "search"
    result -> a.ord:11
  node "" @20
    type "search"
    result -> a.ord:8
  node "" @21
    type "search"
    result -> a.ord:11
  node "" @22
    type "search"
    result -> a.ord:14
  node "" @23
    type "search"
    result -> a.ord:14
  node "" @24
    type "search"
    result -> a.ord:13
  node "Bad" @25
! M60.1 a.ord:25:5
--- a.ord
Taxi +expense
	amount:: 30
	kind:: travel
Hotel +expense
	amount:: 120
	kind:: travel
Lunch +expense
	amount:: 15
	kind:: food
? +expense
	sort:: amount desc number
	group:: kind
	footer:: =($sum(amount))
? +expense
	sort:: kind; amount
.
file "a.ord"
  node "Taxi" @1
    type "expense"
  node "Hotel" @4
    type "expense"
  node "Lunch" @7
    type "expense"
  node "" @10
    type "search"
    result "travel" -> a.ord:4
    result "travel" -> a.ord:1
    result "food" -> a.ord:7
    footer "165"
    footer "150" in "travel"
    footer "15" in "food"
  node "" @14
    type "search"
    result -> a.ord:7
    result -> a.ord:1
    result -> a.ord:4
--- a.ord
Anna ^anna
Team
	@ Anna^anna
	in team:: =($query("@anna", "Team")._label)
Elsewhere
	in elsewhere:: =($count($query("@anna", "Elsewhere")))
? @anna
.
file "a.ord"
  node "Anna" @1
    id "anna"
  node "Team" @2
    calc "in team" "Anna"
    node "" @3
      ref "_mirror" -> a.ord:1
  node "Elsewhere" @5
    calc "in elsewhere" "0"
  node "" @7
    type "search"
    result -> a.ord:1

Source: Semantics.md in ordlang/ord, licensed under CC BY 4.0.