Posts tonen met het label datamodeling. Alle posts tonen
Posts tonen met het label datamodeling. Alle posts tonen

zondag 22 november 2026

Data modelling series : Assertions

Introduction

In data modeling, assertions (also known as business rules or structural assertions) are short, unambiguous sentences written in plain language that define the cardinality between two entities. They serve as a direct translation from a diagram (such as an ERD) into clear agreements with the business.
A well-crafted assertion almost always follows a fixed pattern to capture both minimum (optional vs. mandatory) and maximum (one vs. many) cardinality, and is always read in both directions.


The formula


The Standard Formula for an Assertion : 

A/An [Entity A] [MUST / MAY] [relationship verb] [one / one or more] [Entity B].

MUST = Mandatory (Minimum = 1)
MAY = Optional (Minimum = 0)
one = Maximum = 1
one or more = Maximum = N (many)


Some examples


1. One-to-Many (1:N)  The Most Common Relationship

Scenario: An online store with customers and orders.

Direction 1 (Customer → Order): "A Customer may place one or more Orders." 
Optional, because someone can create an account without buying anything right away: 0..N

Direction 2 (Order → Customer): "An Order must be placed by exactly one Customer." 
Mandatory, an orphaned order without a customer cannot exist: 1..1



2. One-to-One (1:1) – Strict Pairing

Scenario: Employees and their company cars.

Direction 1 (Employee → Company Car): "An Employee may drive at most one Company Car." Optional, not everyone has a company car: 0..1

Direction 2 (Company Car → Employee): "A Company Car must be assigned to exactly one Employee." 
Mandatory, this company does not register unused pool cars: 1..1


3. Many-to-Many (M:N) – Mutual Multiplicity

Scenario: Students and courses at a university.

Direction 1 (Student → Course): "A Student must enroll in one or more Courses." 
Mandatory to maintain active enrollment: 1..N

Direction 2 (Course → Student): "A Course may be attended by one or more Students." 
Optional, a newly created course might still have 0 enrollments: 0..N


Assertions are the ultimate stress test for your data model. When a domain expert reads an assertion and says, "No, that's not how it works in reality" (for example: "An order may also be placed by a guest without an account"), you immediately know you need to adjust your data model and database constraints (NOT NULL vs. NULL) before writing a single line of code.



Hennie


vrijdag 20 november 2026

Data modelling series : Cardinality

Introduction

Data modeling remains essential because it transforms raw data into reliable, usable, and scalable information, regardless of how fast technologies like cloud storage, NoSQL, or AI evolve. Without a solid data model, organizations end up with data chaos : leading to flawed analytics, slow systems, and untrustworthy AI outputs.

 

Reasons

Reasons why data modelling is still important : 

  • Foundation for AI and Machine Learning: AI models and LLMs are only as good as the data feeding them (garbage in, garbage out). A clear data model provides context, clean relationships, and consistent definitions, enabling AI systems to make accurate predictions and hallucinate less.
  • Single Source of Truth: Within a company, terms like "active customer" or "revenue" often mean different things to marketing than they do to finance. Data modeling forces organizations to agree on and enforce clear business rules and definitions before building reports or dashboards.
  • Preventing High Cloud Costs and Technical Debt: Modern cloud data platforms (such as Snowflake or BigQuery) make it easy to dump massive amounts of unstructured data. However, without a proper model, complex queries become painfully slow and cloud compute costs skyrocket.
  • Data Governance and Privacy Compliance (GDPR): Privacy laws and security standards require organizations to know exactly what personal data they hold, where it lives, and how it connects. A data model makes data lineage and access control transparent and auditable.
  • Bridge Between Business and IT: A data model (especially at the conceptual and logical levels) acts as a shared language. It aligns domain experts and software engineers on business processes and expectations before a single line of code is written.


Cardinality

In this blogpost I want to go more in depth about cardinality between entities. Below an example of a Customer, order and product. It's not a perfect example but assume it is ;-). I borrowed this example from a youtube video from Lucidchart.



We have a minimum and maximum number that an entity instance(s) can have related to another entitiy instance(s). Lets understand the maximum and minimum cardinality.


Maximum cardinality rules :

  • One-to-One (1:1): One instance of Entity A connects to at most one instance of Entity B, and vice versa (e.g., a person and a passport). 
  • One-to-Many (1:N) / Many-to-One (N:1): One instance of A connects to many instances of B, while each instance of B connects to at most one instance of A (e.g., one customer places many orders).
  • Many-to-Many (M:N): Multiple instances of A connect to multiple instances of B and vice versa (e.g., students and courses). We also call this in datamodelling an associative entity.

Minimum cardinality (optionality) rules :

  • Mandatory (Minimum = 1): An entity instance must participate in the relationship.
  • Optional (Minimum = 0): An entity instance may participate without a matching record on the other side (e.g., a customer may have 0 orders). 

There is a difference between : and .. . If you say it is 1:N then we reason from maximum cardinality and if we say 0..N. Use a double dot (..) when defining the exact rules for one specific direction (minimum..maximum). 


How they fit together? Take a standard One-to-Many (1:N) relationship between a Customer and an Order:
  • Overall (maximum) relationship: 1:N (Customer to Orders).
  • Customer → Order (0..N): "A Customer may place zero, one, or many Orders."
  • Order → Customer (1..1): "An Order must belong to one and only one Customer."

So it's a bit confusing, when we say a relation is 1:N, because this the MAXIMUM relationship, and this gives only a specific view of the reality. 






So we have four options :




Now let's investigate this in more depth. So what does this mean? How many combinations can we create? As it seems we can create 10 combinations.





One to one (3 variants)

In a One-to-One relationship, a single record in Entity A links to at most one record in Entity B, and vice versa. Here are the variants with examples:





Why It Matters: 1:1 relationships are often used to separate sensitive data (like user credentials or medical records) from general profile data for security and performance.


One to many (4 variants)

The One-to-Many relationship is the most common building block in relational databases. One record in the "parent" entity can link to multiple records in the "child" entity, while each child record belongs to only one parent.



Why It Matters: Getting the direction of 1:N right prevents catastrophic reporting bugs : such as accidentally multiplying revenue numbers when joining customer and order tables in BI dashboards.

Many to Many (3 variants)

In a Many-to-Many relationship, multiple records in Entity A can link to multiple records in Entity B, and vice versa.



Why It Matters: N:M relations are often used in conceptual modelling. Relational databases cannot store a direct M:N link cleanly without duplicating data. To solve this, data modelers introduce a bridge table (such as Enrollment), splitting one M:N relationship into two clean 1:N relationships.

Hennie

zondag 15 december 2019

Azure series : Comparing Azure SQLDB vs SQLDW vs AAS

Introduction

There are two SQL Database solutions, available at this moment : Azure SQL Database and Azure SQL Datawarehouse (which is now part of the Synapse analytics solution) and I was wondering what are the differences between the two solutions. For the sake of completeness I've also included Azure Analysis Services.

So my question is : "What is the best Azure SQL data platform solution for implementing a data warehouse solution?" In the schema below I've gathered the pros and the cons of the three solutions (SQLDB, SQLDW and AAS) but focussed on the SQLDB and SQLDW.

Comparing the three data platforms

In the diagram below, I've compared the three solutions based on the characteristics of these technologies.


Final thoughts

All the data platforms have advantages and disadvantages. Depending on your requirements it's probably not always a good fit to choose one of the data platforms. Sometimes you can choose a combination of tooling to make it an acceptable fit for purpose.

Love to hear your opinion...

Hennie

woensdag 6 maart 2019

Fact Oriented Modeling constraints (part II)

Introduction

In my previous blogpost about FOM, I've discussed the basics of FOM. In this blogpost I would like to elaborate on constraints in FOM. Constraints are important in data modelling because they limit the degrees of freedom (of the data) in the model. In this blogpost I'll describe the different constraints that can be applied to the FOM data models.

Constraints
As said before, there are different constraints possible in FOM :
  • Value Constraints.
  • Uniqueness Constraints.
  • Totality Constraints.
  • Subset Constraints.
  • Equality Constraints.
  • Mutually Exclusion Constraints.
  • Number constraints.

Value Constraints
Valueconstraints are limitations of certain labeltypes, for instance a sequencenumber can only exist of 1, 2 or 3. You can add this in CaseTalk. 




This result in the following change in the diagram. It is now visible that sequencenumber can only exist of 1, 2 or 3.


Uniqueness Constraints
Yet another constraint is uniqueness, meaning that values are unique in a population. You can do this with the menu option Set Unique Constraint in CaseTalk.


This results in the following constraint on Student, saying that there can be only one student with a firstname and a lastname.


There are also other combinations possible, for instance :


Here you say that Peter Jansen is unique and this means that Peter cannot live in two places at the same time. The other way around: In Nijmegen it is possible that two students live here. So, there is not an unique constraint needed.

Another example is presented below. Here you can see that there are two unique constraints on separate columns, meaning that a student is unique and internship is unique. This means that a student can only do one internship and an internship can only be done by one student.


Here is a more complicated uniqueness constraint. In this diagram there 3 roles and two uniqueness constraints:
  • Student and internship.
  • Student and sequencenumber.

The combination of student and internship is unique. That makes sense. You can not apply twice for the same internship. The other uniqueness constraint is student and sequencenumber is also logical. A student can not apply for an internship with the same sequencenumber. The student should make an order of internships.


After determining the uniqueness constraints a couple of tests are necessary and they are organized as follows:
  • Elementary test
    • n-1 rule test
    • n rule test
    • Projection/Join test
  • Nominalisation test


Totality Constraints.
Totality constraints are constraints that says that every tuple from a role of a (nominalised) facttype should be present in a involved role. For instance: "Every student should have a place to live" meaning that when a student is known, the place is also known. If a place is not known, this is not possible in the semantics. This is not the fact. The fact is that a student has a place. So, you identify is with a totality constraint. How to set this up in CaseTalk?

I had to figure this one out but I managed to make a totality constraint. First you have to press the <CTRL> button and then click on the role you want to put a Totality constraint on.



Now when you are done, The following diagram has Totality Constraints.


Setting Totality Constraints should be handled with care, because when generating a data model with a totalityconstraints can result in a NOT NULL column.

Subset Constraints.
Subset constraints are constraints that says something about subsetting of particular roles. This states that the set of roles is a subset of another set of roles.The values of oneset of roles should be present in the other set of roles.

Let's experiment this with CASE Talk. First press on the subset constraint Icon in the top left in diagram pane.


This will show the following window and here you can enter the subset constraint with the From and To part.


And here is the result of the subset constraint.


The plotted size is a bit huge in contrast with the diagram. You can change that in the diagram with Style and Options.

And here you set the font size.



Equality Constraints.
An equality constraint is needed when two set of roles are equal. This is entered as two subset constraint and is only changed in the From and To.

Mutually exclusion constraints
Mutually exclusive constraints are constraints that are exclusive between two roles. These roles cannot have a common population. For instance, You're married or divorced. You can not be both at the same time.

Number constraints
Number constraints are constraints that limit the values in a role. For instance a student can only enter three preferences for a internship.

Final thoughts

Setting the constraints on the FOM datamodel with CaseTalk will limit the degrees of freedom in your information model and help you structure the information and ultimately a physical model.

Regards,

Hennie de Nooijer

vrijdag 8 februari 2019

Fact Oriented Modeling Introduction (Part I)

Introduction

Today, I want to write something about Fact based Oriented Modelling (FOM). FOM is not about modeling objects in the real world but it is focused on modeling the communication about the objects in the world around us. This is another focus than methods like Codd or Chen. During projects, I gathered information about the area of interest and one of the next steps was trying to imagine the objects and model the data. For instance, you have Patient data and you define the Patient entity. This approach is different than FOM. With FOM you gather the information from communication and verbalize the information in so called fact expressions. 

Semantics

I've noticed that during discussions I've had so far, semantics is a much used keyword. Although I was aware of a kind of meaning of this word, I decided to google it, and here is what I found:

"The branch of linguistics and logic concerned with meaning. The two main areas are logical semantics, concerned with matters such as sense and reference and presupposition and implication, and lexical semantics, concerned with the analysis of word meanings and relations between them."

In my opinion, this is saying that semantics is the area of understanding the meaning of communication between (business)people. As a data modeler it is important to understand the wording, the meaning and the relations between the (certain) words.

Verbalization

Fact expressions are important in FOM. FOM expressions are based on predicate logic. They are true or not. For instance you can say something like: "There is a student called Peter Janssen" or  "Order 12345 is ordered on February 15th, 2019". The first one is a so called postulated existent expression (I hope I translated that from Dutch correctly) and the latter one is elementary fact expression, meaning it is the minimal information to identify the fact. In other words, there is no redundant information and there is not to less information. 

For this blogpost, I've used the following examples (translated from Dutch) from the book Fully Communication Oriented Information Modeling (FCO-IM) by G.Bakema, J. Zwart and H. van der Lek. This is a very readable book about FOM. English version here.

There is a student Peter Jansen.
There is a student Jan Hendriks.
Student Peter Jansen lives in Nijmegen.
Student Jan Hendriks lives in Nijmegen.
Internship S101 is available.
Internship S102 is available.
Student Peter Jansen prefers nr 1 stage S101.
Student Peter Jansen prefers nr 2 stage S203.
Stage S101 takes place in Nijmegen.
Stage S102 takes place in Eindhoven.
Stage S101 is developing a time registration program.
Stage S102 is researching CASE tooling.
Student Peter Jansen is assigned to internship S101.
Student Jan Hendriks is assigned to internship S203.

As you can see, these sentences are easier to verify by business users than a Bachman- or a Chen diagram. Users can say: "No that is not correct, it should be this or that". So this is the first, but very important step in data modeling with FOM. I've not seen this kind of approach earlier. You can say that is the conceptual level of modelling! It models the facts in the communication.

Qualification and Classification

When you are satisfied with the verbalizing the facts, the next step starts. That is grouping the fact expressions into categories and giving the group a name. This is called qualification and classification. For instance, sentences like "There is a student Peter jansen" and "There is a student Jan Hendriks" are grouped together and named "Student".

[Student]
There is a student Peter Jansen.
There is a student Jan Hendriks.

[Residence]
Student Peter Jansen lives in Nijmegen.
Student Jan Hendriks lives in Nijmegen.

[Internship]
Internship S101 is available.
Internship S102 is available.

[Internshippreference]
Student Peter Jansen prefers nr 1 stage S101.
Student Peter Jansen prefers nr 2 stage S203.

[Internshiplocation]
Stage S101 takes place in Nijmegen.
Stage S102 takes place in Eindhoven.

[Internshipdescription]
Stage S101 is developing a time registration program.
Stage S102 is researching CASE tooling.

[internshipassignment]
Student Peter Jansen is assigned to internship S101.
Student Jan Hendriks is assigned to internship S203.

Creating an Information Grammatical Diagram (IGD)

When verbalization is done the next step is executed: designing an IGD. This model is not used for communication with end users because the diagram can be overwhelming and difficult to understand by novice users. IT people prefer abstract diagrams to understand the area of interest better.

Now, you can do it manually or you can use a tool like CaseTalk. Let's take the first fact expression and try to identify the labels and objects here. Objects are things that we want to know more about it. Objects should have an unique identification. Labels are descriptive information.

Below, I have used CaseTalk to identify the labels firstname and lastname. On the right an impression of the diagram is shown. FactType Student has two roles with two labels firstname and lastname.


This results in the following part of an IGD. A fact expression with placeholders 1 and 2 that can instantiated by "Peter Jansen" and "Jan Hendriks". I've entered the second sentence into CaseTalk too.
The next step is to enter all of the sentences aka fact expressions into CaseTalk. For instance, when the next fact expression is entered, the diagram is changed into the following :


Now we can derive two fact expressions from this model : There is a Student Jan Hendriks and Student Peter Jansen lives in Nijmegen.

When all of the Fact expressions are entered in CaseTalk the diagram appears as follows:


In this diagram all of the Fact types are added and the Factexpressions can be derived from the model. For instance,

F2 : <3> lives in <4>.
Role 3 is played by the nominalized objecttype Student which is Student <1><2>.
Role 1 is played by labeltype first name and role 2 is played by labeltype last name.
Role 4 is played by Nominalized objecttype Place <5>.
Role 5 is played by the labeltype placename.

Now this result in the following substitution:

"Student Jan Hendriks lives in Nijmegen"

Final thoughts

This is a short description about Fact Oriented Modelling. I've explained verbalization, classification and qualification, deriving an IGD from  fact expressions. In the next blogpost, I'll focus on the constraints of a model. Although there is a structure in the model, there are more limitations/constraints possible, for instance there can be only one student with the same name. This will be subject for the following blogpost.

Hennie