site HelloWorld
origin: model.dbquity.com/examples
version: 1.0.0
description:
"Hello World", says Dbquity.
Illustrating site, class, invariant, area, and multiline.
class Period
description:
This Period class comprises the Start, Days and End fields to
capture an interval of a certain number of days starting and ending
at certain dates.
It uses the invariant property to declare the formula that ties
together these three fields.
date Start # initializes to today() by default
integer Days
date End
# when a user changes one value, Dbquity seeks to update another as
# needed to satisfy the invariant
invariant:
Start + Days = End and Start <= End
area Welcome
Period Meeting
text Greeting
multiline
placeholder:
"type a few kind words here, please
(you may use emojiis 👌)"
site ShoppingList
origin: model.dbquity.com/examples
version: 1.0.0
area Setup
importance: additional
entity Unit
collection: Units
text Name
importance: promoted
identity: Name
text Description
multiline
decimal DefaultAmount
entity Item
collection: Items
text Name
importance: promoted
identity: Name
text Description
multiline
decimal DefaultAmount
default: DefaultUnit.DefaultAmount
link DefaultUnit
entity: Unit
area Shopping
entity List
importance: promoted
collection: Lists
decimal Progress
percent
expression:
if (n: (tobuy: List@ToBuy).count()) then
(100 * tobuy.count(Fulfillment >= Amount) / n)
association ToBuy
end List
end Item
multiplicity: 1..*
decimal Amount
default: Item.DefaultAmount
link Unit
default: Item.DefaultUnit
decimal Fulfillment