Visio-based database modeling in Visual Studio. NET Enterprise Architect: Part III

Source: Internet
Author: User
Tags comparison contains dashed line reference split visual studio
enterprise|visual| Data | database
Terry Halpin
Microsoft Corporation
November 2001

Summary:This article is the third in a series of articles on the Visio-based database modeling component in Microsoft Visual Studio. NET Enterprise Architect, the first part discusses how to create the basic object role Modeling (ORM) source model, and how to map it to Logical database model, and DDL scripts for how to generate a physical database schema. The second section discusses how to use descriptors to mark object types as standalone types, to object associations, and to add some other ORM constraints to the ORM Source model. The third part will explain how to add set comparison constraints (subset constraints, equivalence constraints and exclusion constraints), and how to obtain the differences or constraints by combining the exclusion constraint and the separation force constraint.

Directory

    • Brief introduction
    • Set comparison constraint
    • XOR or Constraint
    • Summarize
    • Reference bibliography
Brief Introduction
This article is the third in a series of articles on the database modeling solution in Microsoft Visio for Enterprise Architects (VEA), Vea included in Visual Studio. NET Enterprise Architec In the T version. This article discusses how to add a collection comparison constraint to an object role modeling (ORM) source model, and how to form an exclusive or constraint by combining exclusion constraints and decoupled constraint constraints. Suppose the reader of this article is already familiar with ORM and relational database modeling. An ORM overview can be downloaded from the Web [bibliography] 1 and Bibliography 2], and information on how ORM and database modeling is handled is discussed in detail in my recently published book [Bibliography]3]. For the first two articles of this series, see Bibliography 4 and Bibliography 5. Set comparison constraint
If two roles are served by the same object type, or if the role's two object types share common parent types, they can be said to be "mutually compatible", and it makes sense to compare what they contain. The same rule applies to the role sequence (the sorted list of roles). For a database, there are only three related collection comparison operators: the subset operator (), the equivalent operator (=), and the mutex operator ().
A subset constraint rule from the source role sequence to the target role sequence: Members in the source role sequence (a set of instances) must always be a subset of the target role sequence members. The graph of the constraint is displayed as a circled "", connected by a dashed arrow, pointing from the source role sequence to the target role sequence (see Figure 1 for an example). In previous versions of ORM tools, the dashed arrows themselves specified a subset constraint. In Vea, subset symbols with loops are always displayed explicitly. This clarifies the meaning of the constraint notation and supports a very small number of cases where the source and target roles belong to the same association, and also allows for the use of dashed arrows in other direct constraints (for example, ≤, which may be added to the graphical constraint notation later).

Figure 1: Subset constraints between single roles
The simplest role sequence is a single role. In Figure 1, the subset constraint between two single roles means that a group of patients with a second name must be a subset of the group of patients with the first name. In other words, if a patient has a second name, then he or she must have the first name.
To add the subset constraint in Vea, first enter two fact types (for example, add them to the business Rules editor, and then drag them into the drawing window). Hold down the Shift key while you select the related verb, right-click and select from the shortcut menu ADD Constraints(add constraints). When the display ADD Constraints(Add Constraint) dialog box, select the subset (subset) in the Constraint Type field, and then select the source and target roles for the constraint. When you select multiple role boxes in the dialog box, they are numbered 1, 2, 3, and so on, in the order they are selected. If the user performs the operation correctly, the dialog box shown in Figure 2 is displayed. The constraint is automatically described in the lower section of the dialog box. If this is the only constraint that you want to apply immediately to those fact types, click OK(OK). If you want to add additional constraints to one or more types of these fact types now, click Apply(apply), and then add additional constraints.

Figure 2: Select the subset constraint type, select the source role [1], and select the target role [2] (click the image to view the larger picture)
Notice the use of the hyphen in the predicate "has first-" (owning the first) and "has second-" (having a second). When describing the constraints of those predicates, the hyphen binds the adjective "first" and "second" (the second) to the givenname (name) so that the user inserts the keyword before the adjective, not after it (for example, "some" [some]). For example, if a hyphen is omitted from the current example, the description information is displayed as "if Patient P has second some givenname then Patient P has first some givenname" (if the patient P has a second name The patient P has the first name), the description is difficult to understand.
Figure 3 illustrates the subset constraints between role pairs (each role sequence contains two roles). Here, if a pair of roles is contiguous, the constraint is connected to the intersection of the two roles. This constraint means that the collection of Employee-committee (employee-Committee) pairs associated with the instantiated Chairperson (Chairman) must be a subset of the member-Identity Association collection. In other words, each person acting as chairman of the Committee must be a member of the Committee.

Figure 3: Subset constraints between role pairs
To add this subset constraint, first add two fact types in the chart window, hold down the Shift key when you select the verb, right-click, and select from the shortcut menu ADD Constraints(add constraints). When the display ADD Constraints(Add Constraint) dialog box, select in the Constraint type (constraint type) field subset(subset). Note the prompts in the lower section of the dialog box: if there are multiple roles on both sides of the constraint, add the indicated number of roles at each end (the numbers on each side) to indicate this. By default, the number of roles on both ends of the constraint is set to 1. Because the constraint has two roles on each side, this setting is changed to 2 (as shown in Figure 4).
Now select the source role pair, then select the target role pair, and sort the roles in each pair so that they match the corresponding roles in the other pair. When you select more than one Role box in the dialog box, they are numbered 1.1, 1.2, 2.1, and 2.2 In the order you select. The first part of the number represents the role sequence, and the second part represents the position in the role sequence. If the above operation is correct, the dialog box shown in Figure 4 is displayed. The constraint is automatically described in the lower section of the dialog box. Click OK(OK) accept the constraint and add it to the diagram.

Figure 4: Adding a subset constraint between role pairs (click the image to see a larger picture)
The "equivalent constraint" between the role sequences indicates that their collections must always be equal. The equivalent constraint is displayed as a circled "=" that is connected to the role sequence by a dotted line. Earlier ORM tools used a dashed line with an arrowhead at each end to reflect the equivalence between the equivalent constraint and the two directions of a pair of subset constraints, and now no longer supports this old notation.

Figure 5: Equivalent constraints between two single roles
To add this equivalent constraint, first add two fact types in the Diagram window, hold down the Shift key when you select the verbs, right-click, and select from the shortcut menu ADD Constraint(add constraints). When the display ADD Constraint(Add Constraint) dialog box, select in the Constraint type (constraint type) field Equality(equivalent), and then select the role sequence (in this example, each sequence contains only one role). If the above operation is correct, the dialog box shown in Figure 6 is displayed. In fact, the order of the role sequences in the equivalence constraint is not important because the equivalence is symmetric (different from the subset). The constraint is described in the lower area of the dialog box. Using a similar method, you can add an equivalent constraint between longer role sequences.

Figure 6: Add a simple equivalent constraint between roles (click the image to see a larger picture)
The "exclusion constraint" between the role sequences indicates that their collections must always be disjoint (repel). The exclusion constraint is displayed as a circled "X" that is connected by a dotted line to the role sequence. Figure 7 contains an exclusion constraint (no one can write and review the same book) and a Simple exclusion constraint (no book can be recommended for reading and no reading at the same time).

Figure 7: Exclusion constraints and simple exclusion constraints
To quickly add these exclusion constraints, first add four fact types in the drawing window, hold down the Shift key when you select the four verbs, right-click, and select from the shortcut menu ADD Constraints(add constraints). When the display ADD Constraints(Add Constraint) dialog box, select in the Constraint type (constraint type) field exclusion, and then select the recommended roles and prohibited roles (as shown in Figure 8). Click Apply(apply) to accept and display the constraint, keeping the dialog box open so that additional exclusion constraints can be added.

Figure 8: Adding a simple exclusion constraint (click the image to see a larger picture)
Select in the Constraint type (constraint type) field exclusion(repulsion), increase the number of roles at each end to 2, and then choose to write and review the role pairs in the fact type (see Figure 9). Click OK(OK) accept the constraint and exit this dialog box.

Figure 9: Add to Exclusion constraint (click image to view large picture) XOR or Constraint
In ORM, an "XOR" is simply an orthogonal combination of a decoupled coercion (or) constraint and exclusion constraint. By default, these two constraints overlap, as shown in the left figure in Figure 10, to create a life buoy symbol by overlaying the circled dots (detach coercion) and the circled "X" (repulsion). To create the example, add two fact types to the Chart window, select them, and right-click to open ADD Constraint(Add Constraint) dialog box, add the first constraint, and add another constraint to the same role; After you add the first constraint, click Apply(apply), add the second constraint, and then click OK(OK).
If you want to visually separate the two constraints that make up a decoupled constraint, right-click the buoy symbol and select Split x/or Constraint(Split x/or constraint) option. The constraint will be displayed separately (as shown in Figure 10, in the right figure). You can now handle any of the constraints individually, for example, select one of the constraints and click Delete(delete) to delete it. If all two constraints appear alone, select one of the constraints and drag them to another constraint, which can be merged into a life buoy symbol.

Figure 10: The XOR or constraint equals the detach constraint plus the exclusion constraints (click the image to view the large picture) Summary
In addition to subtypes, there is a lot of information about recreating the sample Employee ORM source model that shipped with the product. The next two articles discuss subtypes and other ORM constraints (frequency constraints, ring constraints, and index constraints) and related issues, such as constraint layers. If you have any constructive feedback on this article, please send me an email (TerryHa@microsoft.com). Reference Bibliography
    1. Halpin, T. A. Object role Modeling:an Overview (English), msdn,2001 (also access to www.orm.net,1998).
    2. Halpin, t.a. "Object Role Modeling (Orm/niam)", Handbook on Architectures of Information Systems, chapter fourth, P. Bernus, K. mertins and G. Schmidt (heidelberg:springer-verlag,1998), you can also visit Www.orm.net (English).
    3. Halpin, T.a. " Information Modeling and Relational Databases (San Francisco:morgan Kaufmann publishers,2001) can also access http://www.mkp.com /books_catalog/catalog.asp? Isbn=1-55860-672-6 (English).
    4. Halpin, T.a. Visio-based database modeling in Visual Studio. NET Enterprise Architect: The first part, msdn,2001.
    5. Halpin, T.a. Visio-based database modeling in Visual Studio. NET Enterprise Architect: Part II, msdn,2001.

(This article was originally published in Inconcept, Inc., the Journal of conceptual modeling.) )

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.