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 of relational operators
  • Converse
  • Composition
  • How to type boolean operators in your script
  • Other explanation
Export as PDF
  1. The language Ampersand
  2. Terms
  3. Semantics in logic

Relational operators

PreviousBoolean operatorsNextResidual operators

Last updated 6 years ago

Purpose of relational operators

To say things such as "the name of the owner", we want to string together multiple relations (viz. name and owner). Relational operators allow us to make such statements.

Converse

A relation can be altered by swapping the elements of every pair in the relation. Mathematically, (a,b)(a, b)(a,b) is a different from (b,a)(b,a)(b,a). This operation is called the converse operator. It produces a new relation from an existing one. It is denoted by writing \smallsmile\ (pronounced 'wok' or ’flip’) after the relation name. This is how converse is defined:

a(r⌣)b ⇔ b r aa(r\smallsmile)b\ \Leftrightarrow\ b\ r\ aa(r⌣)b ⇔ b r a

If rrr has type[A×B][A\times B][A×B], then r\smallsmile\ has type [B×A][B\times A][B×A].

Composition

The composition operator is denoted by a semicolon ;;; between two terms. It is pronounced as 'composed with'. Let us take a look at rrr composed with sss. Let r[A×B]r_{[A\times B]}r[A×B]​ and s[B×C]s_{[B\times C]}s[B×C]​ be two relations, with the target of r being the same as the source of s. Then the composition of rrr and sss is defined by:

a(r;s)c ⇔ ∃b∈B ∙ a r b∧b s ca(r;s)c\ \Leftrightarrow\ ∃ b∈B\ ∙\ a\ r\ b ∧ b\ s\ ca(r;s)c ⇔ ∃b∈B ∙ a r b∧b s c

If rrr has type[A×B][A\times B][A×B]and ssshas type[B×C][B\times C][B×C], then r;sr;sr;s has type [A×C][A\times C][A×C].

How to type boolean operators in your script

Other explanation

shows how you can type boolean (and other) operators in your Ampersand script.

Would you like a different explanation of the relational operators? explains the relational operators in terms of set theory. explains them in natural language. for some algebraic rules about relational operators.

This page
This page
Click here
This page