Skip to content
Leon Starr edited this page Sep 5, 2021 · 2 revisions

Given two tables t1 and t2 with zero or more attributes in common (same name, same type), the join operation yields a table where each row in t1 is matched with every compatible row in t2. For now, let’s ignore the case where there are no attributes in common. A row is compatible if values match for all of the attributes shared by the two tables.

You can imagine the join symbol ## as depicting two tables joined together.

t #= Air Traffic Controller ## On Duty Controller

As a result of the join, t will be assigned a table with columns ID, Name, Rating, Time logged in and Station. Since the attribute ID has the same name and type in each class, each row represents all the common and specific data for an on duty air traffic controller.

If we only wanted a table of log in times organized by ID later than some specific time, we could do this:

late times #= (Air Traffic Controller ## On Duty Controller( Time logged in > some time )).(ID, Time logged in)

By surrounding the join result in parenthesis we can add a projection expression after a dot just as we would with any table.

If you join two tables with no attributes in common, each row in the first table will be compatible with every row in the second table. Consequently, you end up with the cartesian product.

Let’s say we have a class called Assembly Station with attributes ID and Location and another class called Manufacturing Task with attributes Name and Duration.

max assignments = ?(Assembly Station ## Manufacturing Task)  // Total possible task-station assignments

Since there are no attributes in common, we end up with a table having attributes ID, Location, Name and Duration where each instance of Assembly Station is matched with every instance of Manufacturing Task to yield a table of all combinations and then we take the cardinality of that resulting table to get max assignments. Note that the cartesian product table was an intermediate result that was not assigned to any table variable.

Introduction

Model semantics

Flows (as Variables)

Constants and literals

Structure of an activity

Accessing the class model

Data flow


Grammar and parsing notes

Components

Clone this wiki locally