NormEngineer
Menu
Rules as codeSupported

Blawx

Block-based rules as code on s(CASP): attributed rules, exceptions and overrules, with explained answers.

What it is

Blawx, by Jason Morris (Lexpedite, Canada), encodes rules as visual blocks that compile to s(CASP), a reasoner that answers with a justification in plain language. NormEngineer writes project files for the open-source Blawx v1 (MIT, last release 1.6.22-alpha); the hosted later versions are out of scope.

Good for

  • Explaining an answer: s(CASP) shows why a norm applies to a case.
  • Editing rules as blocks in Blawx, next to the act's text.
  • Rules-as-code work in the tradition of the Government of Canada pilots.

What an extraction gives you

One project per act: the rule text with the cited quotes, a category per bearer, a workspace per provision holding an attributed rule per norm, conditions as attributes, exceptions and precedence as overrules, and tests.

The download

One file, blawx.blawx: a Blawx v1 project: YAML holding Blockly XML and s(CASP). The disclaimer and the fidelity summary are # comments at the top of the file.

How norms appear

The graph and the file name each part of a norm in Blawx's own terms.

How a norm's parts are named in Blawx
In the actIn Blawx
A party the norm addressesCategory
ObligationObligation rule
PermissionPermission rule
ProhibitionProhibition rule
What the party doesConclusion
ConditionAttribute (when we know)
Exceptiondoes not apply
Precedence over another normoverrules
Blawx excerpt (s(CASP) in the project file)Digital Operational Resilience Act (DORA, CELEX 32022R2554), Art. 19(1). From NormEngineer's test samples; their source quotes are abridged. Shortened: … marks lines left out of the file.
    ruledoc: 1
    workspace_name: "sec_19__subsec_1_section"
…
      according_to(sec_19__subsec_1_section,dora_art19_1x,X) :- financial_entity(X),
      an_ict_related_incident_is_classified_as_major(X).
…
- model: blawx.blawxtest
  pk: 3
  fields:
    ruledoc: 1
    test_name: "dora_art19_1x_applies"
    xml_content: "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"unattributed_fact\" id=\"t00001\" x=\"20\" y=\"20\"><statement name=\"statements\"><block type=\"object_declaration\" id=\"t00002\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" category_name=\"financial_entity\" prefix=\"null\" postfix=\"null\"></mutation><field name=\"prefix\"></field><field name=\"object_name\">dora_art19_1x_applies</field><field name=\"postfix\">is a Financial entity</field><next><block type=\"unary_attribute_selector\" id=\"t00003\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" attributename=\"an_ict_related_incident_is_classified_as_major\" attributetype=\"boolean\"></mutation><field name=\"prefix\">for</field><field name=\"postfix\">it holds that an ICT-related incident is classified as major</field><value name=\"first_element\"><block type=\"object_selector\" id=\"t00004\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" objectname=\"dora_art19_1x_applies\"></mutation><field name=\"object_name\">dora_art19_1x_applies</field></block></value></block></next></block></statement></block><block type=\"query\" id=\"t00005\" x=\"20\" y=\"156\"><statement name=\"query\"><block type=\"unary_attribute_selector\" id=\"t00006\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" attributename=\"dora_art19_1x\" attributetype=\"boolean\"></mutation><field name=\"prefix\"></field><field name=\"postfix\">is obliged to report the incident to the relevant competent authority (to Relevant competent authority)</field><value name=\"first_element\"><block type=\"object_selector\" id=\"t00007\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" objectname=\"dora_art19_1x_applies\"></mutation><field name=\"object_name\">dora_art19_1x_applies</field></block></value></block></statement></block></xml>"
    scasp_encoding: |-
      financial_entity(dora_art19_1x_applies).
      an_ict_related_incident_is_classified_as_major(dora_art19_1x_applies).

      ?- dora_art19_1x(dora_art19_1x_applies).

On the extraction's page

Graph
The norms as a 2D or 3D graph in Blawx's vocabulary, each traced to its source quote.
Source
The Blawx file with its validation result, to read and download.
Fidelity
How fully each norm is expressed in Blawx, and which checks ran.

How it is checked

  • Every source quote is verified against the act.
  • NormEngineer's structural validator checks the Blawx file of every extraction.
  • The official toolchain, the s(CASP) reasoner on the included tests, does not check each extraction. NormEngineer's tests check sample output written the same way with it; check your download with it to confirm.
  • The file includes two tests per norm, one where it applies and one for another party; NormEngineer does not execute them on your extraction.

The Fidelity tab of each extraction says which checks ran on it. An extraction is AI-generated and not legal advice.

How fully it expresses a norm

When each norm applies, from its category, attributes, exceptions and precedence, is s(CASP) logic, and so are deadlines in seconds to days.

What Blawx does not express fully

  • Partly expressed

    The DSL computes when the norm applies; whether it obliges, permits or prohibits, and what, is text rather than logic.

    Every norm: the rule decides whether it applies; what it requires is the wording of its conclusion.

  • Partly expressed

    The deadline, or part of it, is in a comment or prose and is not computed.

    When a deadline is in months or years, or recurs.

  • Partly expressed

    A precedence over another norm is left out because it would make the rules circular.

    Rarely: when two norms would each take precedence over the other.

Each extraction's fidelity report counts the norms each of these applies to.