Welcome!

Microsoft Cloud Authors: Yeshim Deniz, Janakiram MSV, Andreas Grabner, Stackify Blog, Liz McMillan

Related Topics: Microsoft Cloud

Microsoft Cloud: Article

Database Modeling with ORM - Part 2

A thorough and accurate conceptual model significantly increases the chance of an application's success.

Object Role Modeling (ORM) is an excellent modeling methodology that you can use to construct a conceptual database model. This article is the second in a series of articles that introduce ORM.

Object Role Modeling is an approach to describing data in terms of objects and the roles they play. An elementary fact is a statement affirming that an object has a property or participates in a relationship with one or more other objects. ORM expresses these elementary facts in a natural language that is easily understood and verifiable by the domain experts. In addition, ORM source modeling is supported by Microsoft and can be implemented using Visio for Enterprise Architects.

The focus of the first article in this series (.NETDJ, Vol.1, issue 10) was working with domain experts to identify the various object types and fact types that need to be included in a conceptual model. It introduced the various common types of predicate arities, as well as the use of Visio to construct an ORM source model. This article continues the study of ORM source modeling using Visio. The process of developing a database model is iterative and involves the continual refinement and verification of the various fact types and object types that make up the model. This article introduces some of the concepts involved in the refinement process. It focuses on the concepts of primitive entity types, subtypes, derived fact types, and unique constraints. In addition, this article covers the process of using Visio to incorporate the concepts into an ORM model.

Primitive Entity Types, Subtypes, and Derived Fact Types
As you develop the database model using ORM you need to continually refine and verify the model. One of the tasks of model refinement is to ensure that the entity types defined in the model are in primitive form. Primitive entity types are mutually exclusive, which means the populations of the entity types do not overlap. As an example, you may be tempted to model the fact type verbalizations "a class begins at start time" and "a class is over at end time," as shown in Figure 1. In reality, the entity types "start time" and "end time" are not mutually exclusive. The primitive entity type "time" plays both roles, "start time" and "end time", in these fact types. Figure 2 shows the updated representation of the fact types.

 

 

As you examine your database model you may find that some of the entity types have common characteristics or that a fact type needs to be expanded to include similar entity types. For example, the fact type "a parking permit is issued for a car" is examined, and it is determined that this needs to be expanded to include motorcycles. Cars and motorcycles share many common characteristics. An atomic primitive entity type "vehicle" becomes a supertype in the model. The entity types "car" and "vehicle" become subtypes of the "vehicle" primitive entity type. Figure 3 demonstrates how subtypes are modeled using ORM. A solid arrow connects the subtype to the primitive entity supertype pointing toward the supertype.

 

In the initial stages of your database design, you may have identified entity types that are not primitive entity types but rather are the result of a derivation from primitive entity types. As an example, consider the fact type "class lasts for duration". You may be tempted to model the role "duration" as a primitive entity type. In reality, the fact type "class lasts for duration" is a derived fact type. It derives from the role "time" in the fact types "class begins at time" and "class ends at time". Figure 4 shows the ORM representation of the derived fact type "class lasts for duration". The asterisk appended to the predicate shape indicates that "duration" is a derived (through a query) entity type.

 

Modeling Subtypes and Derived Fact Types in Visio
The following activity demonstrates adding subtypes and derived fact types to a Visio ORM model. Note: You need Visio for Enterprise Architects in order to create an ORM source model.

Modeling Subtypes:

  1. Start up Visio. From the File menu, choose New > Database > ORM Source Model.
  2. If the Business Rules Editor (see Figure 5) is not visible at the bottom of the window, choose View > Business Rules from the Database menu.

     

  3. Double-click the first Object Type cell in the Business Rules Editor. Create a Vehicle entity object type. Repeat this procedure to create Car, Motorcycle, and Parking Permit entity object types. Note: Do not worry about the Physical Data or Reference Mode at this time.
  4. Select the Fact Types tab at the bottom of the Business Rules Editor. Press the F2 key to launch the Fact Editor window. Using the left Object dropdown list, choose Parking Permit. In the relationship text box enter "is issued for". Choose Vehicle from the right object dropdown list. Figure 6 shows the completed entries. Notice that the bottom of the widow contains the natural language syntax expression of the fact type. This natural language syntax plays an important role in verifying the model with the domain experts. Click OK to save the fact type and close the window.

     

  5. Click and drag the fact type from the Business Rules Editor onto the drawing surface. Drag the Car and Motorcycle object types onto the design surface and arrange them to the right of the Vehicle object type.
  6. From the object toolbox window, drag a Subtype Relationship arrow to the design surface. Attach the tail to the Car object type and the head to the Vehicle object type. Repeat this procedure to connect the Motorcycle object type to the Vehicle object type. The completed diagram should resemble Figure 3.
  7. Select the Car object type in the diagram. In the Business Rules Editor select the Data Base properties tab. Select Subtype from the Categories dropdown list. Notice that the Vehicle Object type is designated as the Primary supertype (see Figure 7).

     
Modeling a Derived Fact Type:
  1. Using the Business Rules Editor, create a class entity object type, a Time value type, and a Duration value type. Note: Do not worry about the Physical Data or Reference Mode at this time.
  2. Using the Fact Editor, create "Class starts at Time", "Class ends at Time", and "Class lasts for Duration" fact types.
  3. Click and drag the fact types from the business rules editor onto the drawing surface.
  4. Right-click the "starts at" predicate phrase on the design surface and choose Database Properties in the pop-up menu. In the Database Properties Editor, select Readings in the Categories list. Enter a role name of "StartTime" in the Role name text box (see Figure 8). Repeat this procedure to add a Role name of "EndTime" for the "ends at" predicate phrase.

     

  5. Right-click the "lasts for" predicate phrase on the design surface and choose Database Properties from the pop-up menu. In the Database Properties Editor, select Derived in the Categories list. Click on the Derived option button and enter a rule definition of "Class.EndTime – Class.StartTime" in the Rule text box (see Figure 9). Notice that an asterisk is appended to the predicate phrase on the design surface. The completed diagram should look similar to Figure 4.

     
Identifying Constraints
Enforcement of constraints is fundamental to designing the structure of relational data. Constraints limit the involvement of roles within the defined predicates. Remember that predicates are verb phrases defining the relationships between the various roles defined in the model. If you are designing a database system to track students enrolled at a computer-training center, a valid fact type could be "a student has a last name".

In addition to defining the fact type, you often need to define conditions for the fact type. These conditions usually take the form of constraints. For example, if you want to ensure that every student has a last name recorded, you need to define a mandatory constraint on the student role. Placing a solid dot on the role connector line in the ORM diagram indicates that the role is mandatory. The fact type verbalization changes to "each student has a last name", where the word "each" indicates the mandatory constraint. By examining the supporting data documents of the student tracking system you find that not only must each student have a last name, but each student can have only one last name. Placing an arrow above the last name role box in the predicate phrase restricts each student to having only one last name. Figure 10 shows the ORM visualization of the previous fact type with the unique constraint added.

 

In some instances a unique constraint spans two or more roles defined in the predicate. For example, a student can enroll in multiple classes and a class contains multiple students, but the same student cannot enroll in the same class more than once. This constrains the combination of student and class as unique. Figure 11 demonstrates the visualization of this type of constraint. Figure 12 shows a separate line drawn above each role in the predicate phrase. In this case, each student is associated with zero or one vehicle, and each vehicle is associated with exactly one student. Compare this with the constraint shown in Figure 10, which constrains each student to have only one last name but allows several students to have the same last name. The examples covered thus far have been for binary fact types. Figure 13 demonstrates the same types of constraints applied to a ternary fact type as well. In this case a unique constraint spans the room role and time role. In other words, two different classes cannot occupy the same room at the same time. A unique constraint also applies to the time and class roles. This restricts two different instances of the same class from occurring at the same time.

 

 

 

Using Visio to Add Constraints to the ORM Model
Follow these steps to add constraints to a Visio ORM model.

  1. Start up Visio. From the File menu, choose New > Database > ORM Source Model.
  2. If the Business Rules Editor (see Figure 5) is not visible at the bottom of the window, from the Database menu choose View > Business Rules.
  3. Double-click the first Object Type cell in the Business Rules Editor. Create Class, Student, and Room entity object types. Also create a Time value object type. Note: Don't worry about the Physical Data or Reference Mode at this time.
  4. Select the Fact Types tab at the bottom of the Business Rules Editor. Press the F2 key to launch the Fact Editor window. Choose Student from the left Object dropdown list. In the relationship text box enter "attends". Choose Class from the right object dropdown list.
  5. Click on the Constraints tab in the Fact Editor. Experiment with the various selections in the righthand constraint dropdowns. Notice how the various selections alter the fact type diagram and the verbalization at the bottom of the editor. After experimenting, choose the selections as shown in Figure 14, and click OK.

     

  6. Select the Fact Types tab at the bottom of the Business Rules Editor. Press the F2 key to launch the Fact Editor window. In the input style section, select the Guided option and choose Ternary from the dropdown list. Choose Class from the left Object dropdown list. In the relationship text box, enter "occurs at". Choose Time from the right object dropdown list. In the second row relationship text box enter "in". Choose Room from the object dropdown list.
  7. Click on the Constraints tab in the Fact Editor. Experiment with the various constraint selections. Notice how the various selections alter the fact type diagram and the verbalization at the bottom of the editor. After experimenting, choose the options as shown in Figure 15, and click OK.

     
Conclusion
ORM is an excellent aid for modeling the data and data relations that will comprise the back-end database structure of your application. The real strength of ORM is its ability to extract the business data requirements from the domain experts into a conceptual model that is easily understood and verifiable by those same domain experts. By spending time creating a thorough and accurate conceptual model, an application's chance of success as it progresses to the logical and physical stages significantly increases.

The process of developing the database model involves the refinement and verification of the various fact types and object types that make up the model. This article introduced some of the concepts involved in the refinement process. It focused on the concepts of primitive entity types, subtypes, derived fact types, and unique constraints. In addition, this article covered the process of using Visio to incorporate the concepts into an ORM model. A future article will continue the study of ORM source modeling using Visio. It will cover additional types of constraints commonly enforced in many database models. In addition, it will examine the process of verifying the ORM model with the domain experts using the fact verbalizer and population checks.

More Stories By Dan Clark

Dan is a Microsoft Certified Trainer, Microsoft Certified Solution Developer, and a Microsoft Certified Database Administrator. For the past seven years he has been developing applications and training others how to develop applications using Microsoft technologies. Dan has been developing and training Microsoft's .NET technologies since the early betas. He has recently authored the book "An Introduction to Object-Oriented Programming with Visual Basic .NET," published by Apress.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
"We provide IoT solutions. We provide the most compatible solutions for many applications. Our solutions are industry agnostic and also protocol agnostic," explained Richard Han, Head of Sales and Marketing and Engineering at Systena America, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We've been engaging with a lot of customers including Panasonic, we've been involved with Cisco and now we're working with the U.S. government - the Department of Homeland Security," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Calligo, an innovative cloud service provider offering mid-sized companies the highest levels of data privacy and security, has been named "Bronze Sponsor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalised support service from its globally located cloud plat...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
"The Striim platform is a full end-to-end streaming integration and analytics platform that is middleware that covers a lot of different use cases," explained Steve Wilkes, Founder and CTO at Striim, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We are focused on SAP running in the clouds, to make this super easy because we believe in the tremendous value of those powerful worlds - SAP and the cloud," explained Frank Stienhans, CTO of Ocean9, Inc., in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
DX World EXPO, LLC., a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
In his opening keynote at 20th Cloud Expo, Michael Maximilien, Research Scientist, Architect, and Engineer at IBM, discussed the full potential of the cloud and social data requires artificial intelligence. By mixing Cloud Foundry and the rich set of Watson services, IBM's Bluemix is the best cloud operating system for enterprises today, providing rapid development and deployment of applications that can take advantage of the rich catalog of Watson services to help drive insights from the vast t...
SYS-CON Events announced today that EnterpriseTech has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. EnterpriseTech is a professional resource for news and intelligence covering the migration of high-end technologies into the enterprise and business-IT industry, with a special focus on high-tech solutions in new product development, workload management, increased effic...
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and ...
SYS-CON Events announced today that CHEETAH Training & Innovation will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CHEETAH Training & Innovation is a cloud consulting and IT training firm specializing in improving clients cloud strategies and infrastructures for medium to large companies.
SYS-CON Events announced today that Datanami has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datanami is a communication channel dedicated to providing insight, analysis and up-to-the-minute information about emerging trends and solutions in Big Data. The publication sheds light on all cutting-edge technologies including networking, storage and applications, and thei...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...