Dbquity model Examples

page modified: 2024/08/29 17:17:55

HelloWorld

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 👌)"

download HelloWorld.dbquity HelloWorld.v1.0.0.dbquity-site.bin
HelloWorld.v1.0.0.dbquity-site.txt

ShoppingList

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
download ShoppingList.dbquity
ShoppingList.dbquity-data
ShoppingList.v1.0.0.dbquity-site.bin
ShoppingList.v1.0.0.dbquity-site.txt

RollDice

download RollDice.dbquity
RollDice.dbquity-test

These notes explain the idea of behavior and steps using the RollDice example.