Modeling Language and Tools for Dbquity

page modified: 2024/09/14 14:48:04

Hiearchcy of data on a Dbquity Site

Dbquity collaboration evolves around Dbquity sites where users collaborate on the hierarchy of data that each site stores per the declarations of deployed site models.

Language Syntax

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

The site model above, HelloWorld.dbquity, comprises a single area called Welcome, and like all the other models you can write in the Dbquity Language, it follows the Dbquity Metamodel, where information is always organised in such areas.

This particular area lets the user type in a greeting in a multiline text field and specify a certain period of days during which some meeting should be taking place...

Using the deploy command of the Dbquity Command Line Interface:

dbquity deploy hello -caption:"Salute!" HelloWorld.dbquity

the HelloWorld.dbquity source file is parsed and deployed to a local Dbquity site named hello.test from where the Test UI is able to access it, so that you may test out what your users will experience when they access Dbquity sites based on your site model:

The UI of the HelloWorld site, where you can enter a greeting and choose when and for how many days to meet

Model Examples

Click here for a few examples of models, and find more explanation and commands to try out on GitHub

Test UI

The Test UI is a .NET MAUI app that lets you interactively test your Dbquity site models, once you have used the CLI to deploy them to the %LOCALAPPDATA%\Dbquity\<sitename>.test subfolder.

Test UI Privacy Policy

'TestUI on Dbquity' does not collect any data beyond those that the Microsoft Store itself collects about installations and crashes.

The Test UI simply and only lets the local user interact with dbquity-specific data files that reside in a designated folder (and subfolders thereof) on the local hard drive.

Command Line Interface (CLI)

Parses and publishes dbquity models, creates diagrams to illustrate said models, and runs tests against them.
It is currently available for Windows only.

You can get started on your Windows 10/11 PC with the CLI, if you

to get the list of commands and the command line syntax that the CLI supports like this:

C:\Web\dbquity.com\model>dbquity
Dbquity CLI v0.10.8158

Usage:
dbquity <command> <parameters and options>
 - where <command> is one of:
   deploy, delete, testsite, import, validate, export, sites, publish, test, dot, transactions, rollback, listoutput, deleteoutput
 - use 'dbquity <command> ?' for command specific info on <parameters and options>

Source file extensions

Many CLI commands take textual source files that contain model information, data, or automated test scripts.

extension description
.dbquity model source file as the one in the HelloWorld example above
.dbquity-data import/export data file that contains site data in a textual format
.dbquity-test test source file with test cases combining data with actions, assertions, and invariants

Deployment artefact extensions

The CLI publish command produces a binary artefact to be provisioned from a web location.

extension description
.dbquity-site.bin a site model as a deployable binary resource that the In on Dbquity app consumes from the web
.dbquity-site.txt information about a published, binary site model - stored on the publishedat property of the model, next to the site binary

Automated Test of models

The CLI has a couple of commands to test model source as well as models already deployed to a test site:

to... issue this command
deploy model(s) and run test(s) dbquity test <source> [*] , [<options>] <test-source>
branch a test site and run test(s) against the branch dbquity testsite <site-name> [<options>] <test-source>

And here is an example of testing the invariant from the HelloWorld example:

Invariant.dbquity-test Invariant.dbquity

test Invariant
    act:    # create 2 named values
        period: Period();
        today: today()
    assert: # check the values
        period.Start = today;
        not period.Days;
        period.End = today
    act:    # make a change
        period.set(Days: 5)
    assert: # validate
        period.End = today + 5
    act:    # make another change
        period.set(Start: today + 7)
    assert: # validate
        period.Start = today + 7;
        period.End = today + 12
    act:    # make one more change
        period.set(End: today - 3 * Days)
    assert: # validate
        period.Start = today - 20;
        period.End = today - 15
    act:    # Days < 0 violates invariant
        period.set(Days: -3)
    assert: # validate that it's ignored
        period.Days = 5;
        period.Start = today - 20;
        period.End = today - 15


site Invariant
    class Period
        date Start
        integer Days
        date End
        invariant:
            Start + Days = End and
            Start <= End

If you run the test from a prompt, you should see it PASSING :-)

C:\Web\dbquity.com\model\examples>dbquity test Invariant , Invariant   
Dbquity CLI v0.10.8190
    test Invariant , Invariant
Parsing Invariant.dbquity:
    site Invariant....
validating
    site Invariant......ok
    Warning: site Invariant: No entities defined.

Creating test site: LocalFolder>Invariant-20240425T123609...
    site Invariant (:Invariant)
Running Invariant.dbquity-test
TEST Invariant:

PASSING
deleting test site LocalFolder>Invariant-20240425T123609
ok

Check out RollDice.dbquity and RollDice.dbquity-test for a more elaborate example.