Documentation
  • Introduction
  • Why Ampersand?
    • The Business Rules Manifesto and Ampersand
  • Tutorial
    • Example system: Enrollment
    • Conceptual Model: Enrollment
    • Your tool: RAP4
    • Making your first Ampersand script
  • Reactive programming
  • The language Ampersand
    • How to read syntax statements
    • Truth
    • Atoms
    • The CONCEPT statement
    • The RELATION statement
    • The MEANING statement
    • The PURPOSE statement
    • The CLASSIFY statement
    • The RULE statement
    • Terms
      • Semantics
      • Semantics in logic
        • Primitive terms
        • Boolean operators
        • Relational operators
        • Residual operators
      • Semantics in natural language
        • Primitive terms in natural language
        • Boolean operators in natural language
        • Relational operators in natural language
        • Residual operators in natural language
      • Semantics in sets
        • Primitive terms in set theory
        • Boolean operators in set theory
        • Relational operators in set theory
      • Semantics of terms, defined algebraically
        • Boolean operators in algebra
        • Relational operators in algebra
      • Semantics visualized
        • Semantics of boolean operators visualized
        • Semantics of relational operators visualized
        • Semantics of residuals visualized
    • Context
    • Module
    • Best Practices
    • Syntactical Conventions
      • The CONCEPT statement
      • The RELATION statement
      • The RULE statement
      • The CONTEXT statement
      • The INCLUDE statement
      • Explanation
      • Patterns
      • Population
        • Population in spreadsheets
      • The PURPOSE statement
      • The IDENT statement
      • The TABLE statement
      • Language support
    • The INCLUDE statement
    • Patterns
    • Services
      • Example: Client
      • Example: Login
      • Syntax and meaning
      • Explanation
      • Layout of user interfaces
        • Your own widgets (HTML and CSS)
      • CRUD
    • Population
      • Population in spreadsheets
    • The ENFORCE statement
    • The IDENT statement
    • The TABLE statement
    • Language support
    • Current date
    • The Preprocessor
    • Design considerations
  • Running the Ampersand compiler
    • Configuration
    • Commands (vs. 4.0.0 and later)
    • Options (up to vs. 3.17.4)
  • Architecture of an Ampersand Application
    • Backend framework
    • Hooks
    • Extensions
      • The ExecEngine
  • Deploying your Ampersand script
    • Compiler
    • Deploy your own web application on your laptop
    • Prototype multi-stage build
    • Prototype database
  • Reusing Available Modules
    • Modules
    • Security
    • SIAM (Sessions, Identity and Access Management) Module
  • Exercises
    • Delivery
    • VOG (in Dutch)
  • Installing Ampersand
    • Deploying your Prototype
    • Installing the tools manually
  • Modeling
    • Domain Driven Design
    • Data modeling
    • Legal modeling
    • Architecture modeling
    • Metamodeling
    • Limitations of Ampersand
  • Configuring your application
  • The Excel Importer
  • Plans
    • Current State
    • NoSQL storage
    • API documentation
    • OWL and RDFS input
    • Refactor the front-end
  • Research
Powered by GitBook
On this page
  • Purpose
  • Description
  • Examples
  • Syntax
  • Operators
  • Brackets
  • Notation on the keyboard
Export as PDF
  1. The language Ampersand

Terms

This page describes the notion of term. Its subpages provide several interpretations of terms, all of which are valid so you can use each interpretation at your own discretion.

Purpose

The purpose of a term is to compute pairs that constitute a relation. We use operators to assemble terms from smaller terms, to express in formal language precisely what is meant in the natural language of the business. The smallest term is a single relation.

We noticed that our readers have different backgrounds. They have different preferences about the way we explain the operators in Ampersand. Some prefer an explanation in logic, others in algebra, and still others in set theory. So we decided to explain the operators in many different ways simultaneously, hoping that one of them suits your preference.

Description

A term is a combination of operators and relations. Its meaning is a set of pairs, which is in fact a newly created relation. The word "expression" may be used as a synonym for "term" in the context of Ampersand.

Examples

owner

r;s~

I /\ goalkeeper;goalkeeper~

destination;"Algarve" |- spoken;"Portugese"

Syntax

Every term is built out of relations, which are combined by operators. An term has one of the following 8 syntactic structures

<Term> <BinaryOperator> <Term>
<UnaryOpPre> <Term>
<Term> <UnaryOpPost>
<RelationRef> <type>?
I <type>?
V <type>?
<atom>
( <Term> )

Operators

The operators come in families. We advise novices to study only the rule operators, boolean operators and relational operators. There is a wealth of things you can express with just these operators. The residual operators seem harder to learn and the Kleene operators are not fully implemented yet. You can click the hyperlink to navigate to the semantics of each family.

Family
binary operators
binding power
unary operators
binding power

rules

1 (weakest)

2

prefix

4

postfix

3

Kleene

postfix

Brackets

Notation on the keyboard

When coding in Ampersand, these operators are typed with characters on the keyboard. The following table shows the operators in math and their equivalent in code:

operator name
code
math
remark

equivalence (equal)

=

use only in a rule

inclusion

|-

use only in a rule

intersect

/\

associative, commutative, idempotent

union

\/

associative, commutative, idempotent

difference (minus)

-

complement

-

in code: Prefix; in math: Overline

compose

;

associative

converse (flip)

~

postfix

left residual

/

right residual

\

diamond

<>

relational product

!

associative

cartesian product

#

deprecated

reflexive transitive closure

*

in code: not implemented; in math: Postfix

transitive closure

+

in code: not implemented; in math: Postfix

PreviousThe RULE statementNextSemantics

Last updated 9 months ago

and

, , and

, , and

, , and

and

Operators with different binding power may be used in the same term without brackets, because the binding power tells how it is interpreted. For example, r∩s;tr\cap s;tr∩s;t means r∩(s;t)r\cap(s;t)r∩(s;t) because ;;; has a higher binding power than ∩\cap∩.

Operators with the same binding power must be used unambiguously. For example: r∩(s−t)r\cap(s-t)r∩(s−t) means something different than (r∩s)−t(r\cap s)-t(r∩s)−t. In such cases Ampersand insists on the use of brackets, so readers without knowledge of the binding powers of the operators can read a term unambiguously.

Repeated uses of an associative operator does not require brackets. So r∩s∩tr\cap s \cap tr∩s∩t is allowed because ∩\cap∩ is associative.

∪\cup∪
∩\cap∩
−-−
;;;
×\times×
†\dagger†
⌣\smallsmile⌣
\\backslash\
///
♢♢♢
∗∗∗
+++
===
⊆\subseteq⊆
∩∩∩
∪∪∪
−-−
;;;
⌣\smallsmile⌣
///
\\backslash\
◊\Diamond◊
†\dagger†
×\times×
∗∗∗
+++
boolean
relational
residual
===
\subseteq\
\overline{\strut}
\overline{\strut }