Difference between revisions of "Modeler:Tutorial/Constraints"

From CaseTalk Wiki
Jump to: navigation, search
m
Line 39: Line 39:


[[File:Igdwithucs.png]]
[[File:Igdwithucs.png]]
= Removing a uniqueness constraint =
You can always remove a UC. Suppose the UC on role 15 is wrong.
1. Make sure the button ''select objects/facts'' is selected: 
[[File:SelectOT.png]]
2. Right click on the role from which you want to remove the UC.
In this case, right click on role 15.
3. In the pop up menu, select Task, Delete Constraint. If there are multiple constraints that can be removed, all are shown:
[[File:DeleteConstraint.png]]
4. Click on the constrait you want to remove. In this case, the UC on Rol 15.
5. The UC on role 15 wasn’t wrong, so add the UC on role 15 again. (Or use Undo.)


= Adding totality constraints =
= Adding totality constraints =
Line 49: Line 68:
   
   
[[File:Igdwithtcs.GIF]]
[[File:Igdwithtcs.GIF]]
= Removing intra fact type constraints =
'''Step 18'''
1. Select the fact type 'Assigned Apprenticeship' in the Diagram Designer.
2. Select Delete Constraint, UC5 (over role 15) from it's popup-menu.
The uniqueness constraint is now removed from both the IG and the IGD.
3. Open the Edit menu and select Undo.


= Removing and adding inter fact type constraints =
= Removing and adding inter fact type constraints =

Revision as of 04:02, 24 March 2021

In this lesson you will learn how to add constraints to the information grammar using the Diagram Designer.

The constraints you are adding will not be applied to the population. As a result it is posible to add population that violates the constraints in the information grammar.

Adding uniqueness constraints

1. Open the Diagram.

2. Click on Student in the Diagram, then click on the UC button.

IgdUc.png

Notice the double arrow above role 1 and 2.

IgdUcStudent.png

3. Repeat step 2 to add the uniqueness constraint to Apprenticeship.

4. Hold the Ctrl-key, and select role 3 and click the UC button.

Note: You may select multiple roles also using the multiple role button from the diagram toolbar.

Multiroleselect.png

5. Repeat step 4 to add the UC to role 14. After adding the UC, you must deselect that role before adding a new UC to another role.

6. Repeat step 4 to add the UC to role 15.

7. Repeat step 4 to add the UC to role 7.

8. Repeat step 4 to add the UC to role 9.

9. Hold the Ctrl-key, select both roles 11 and 12 and add the UC.

10. Repeat steps 8 and 9 to add the UC to role combination 11 + 13.

The UC's in your diagram should look like this:

Igdwithucs.png

Removing a uniqueness constraint

You can always remove a UC. Suppose the UC on role 15 is wrong.

1. Make sure the button select objects/facts is selected:

SelectOT.png

2. Right click on the role from which you want to remove the UC. In this case, right click on role 15.

3. In the pop up menu, select Task, Delete Constraint. If there are multiple constraints that can be removed, all are shown:

DeleteConstraint.png

4. Click on the constrait you want to remove. In this case, the UC on Rol 15.

5. The UC on role 15 wasn’t wrong, so add the UC on role 15 again. (Or use Undo.)

Adding totality constraints

Step 17

1. Hold the Ctrl-key and select role 3, then select the menu 'Diagram\Constraint\TC'.

2. Repeat step 1 to add totality constraints to the seperate roles 7 and 9.

Igdwithtcs.GIF

Removing and adding inter fact type constraints

Step 18

1. Select inter fact type totality constraint 1 (besides City).

2. Select Delete from it's popup-menu.

3. Hold the Ctrl-key and select both role 4 and 8.

4. Select the menu 'Diagram\Constraint\TC'.

Adding comment to constraints

Step 19

1. Select the fact type 'City of Residence'.

2. Select the menu 'Diagram\Constraint\Edit UC':

You can now enter your comment for the constraints related to 'City of Residence'.

Edituc.GIF

This comment will be displayed in the Fact Type Documentation.

3. Close the window.

Note: In a similar way you can add comment to uniqueness constraints and value constraints.

Adding subset constraints

Step 19

1. Select the menu 'Diagram\Constraint\Edit SC':

2. Click New.

3. Open the left combobox and select role 15, then open the right combobox and select role 13 as is displayed above.

Subseteditor.GIF

4. Click Ok.

Select Show Subset Constraint Info from the IGD menu:

A list of subset contraints will be displayed.

5. Open the Edit menu and select Undo SC Editor.

6. Select Hide from the popup-menu of the Subset Constraints Info box.

7. Save the project by selecting Save Project from the File menu.


Back: Editing Information Grammar

Next: Deriving a Database Schema