02The default prelude
@ontology/palantir
Objects, links, actions, and queries: the language the standard library is written in.
runs today · v0.1
Your operational model took a year to build and lives inside one vendor's UI. When the contract comes up, the model is the one thing you can't take with you.
The ontology prelude is where Open Ontology started, and it's what @ontology/std is written in. Use it to model your own operations too: object types, link types that carry their own facts, actions that commit as one transaction, and named Datalog queries. It's the same core as Palantir Foundry's Ontology, as a plain file you own, and it elaborates to a portable IR that runs on Triplex.
- → ontology IR
- actions → Triplex transactions
- queries → Datalog
oo add @ontology/palantir
(object-type WorkOrder {:title String :status String})
(object-type Technician {:name String})
(link-type assigned-to WorkOrder Technician
{:assigned-at Instant})
(: assign (-> (Id WorkOrder) (Id Technician) (Action Bool)))
(define assign [order tech]
(do! [_ (update! order {:status "assigned"})
_ (link! assigned-to order tech {:assigned-at (now)})]
true))
(query assigned-work
:from WorkOrder
:where (= status "assigned")
:select [title])
[{ "title": "Repair cooling pump" }]