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 1: A Picture Is Worth a Thousand Words

Database Modeling with ORM - Part 1: A Picture Is Worth a Thousand Words

  • Database Modeling with Object Role Modeling - Part 3
  • Database Modeling with ORM - Part 2 

    It is no secret that proper modeling when developing complex, multitiered applications is vital to the success of a project. Countless studies investigating the poor success rate of enterprise-level application projects point to a lack of adequate modeling and design techniques as a major contributor to the dismal failure rate. By implementing consistent, proven modeling techniques, you facilitate communication between the business stakeholders and the application developers. Proper modeling helps to break up complex systems into smaller, more manageable structures and helps define the scope and requirements of the system.

    As Microsoft continues to evolve the .NET languages, Visual Studio .NET, and SQL Server, the lines of distinction between application programmers and database programmers are increasingly blurring. In addition, as companies trim staff, application programmers are taking on responsibilities traditionally handled by database programmers. As a result, application developers need skills in modeling both the system's application interfaces and the database structures with which the system interacts.

    Many developers are familiar with using Entity Relationship Diagrams (ERDs) to model relational databases. While ERDs are excellent tools for modeling the logical structure of a database, they are not well suited for developing the conceptual model. The conceptual model bridges the gap between the business requirements and the logical design of the system. Without properly developing a conceptual model before developing the logical and physical models of a database, the database is unlikely to meet the business requirements of the system and the application has a much greater risk of failure.

    This article is the first in a series of articles that introduce Object Role Modeling (ORM). ORM is an excellent modeling methodology you can use to construct the conceptual database model. 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 Stages of Database Modeling
    The process of developing a database to support business applications consists of a series of phases. The first phase involves developing the conceptual model. During this phase you work with the domain experts to define and confirm the business requirements. The domain experts are the people who have a clear understanding of the business process that the system is attempting to automate. They understand the data and the data processing that needs to occur. The domain experts include people responsible for data entry, data processing, and data analysis.

    The next step after creating a conceptual model is the creation of the logical model. It is during this phase that the business requirements modeled in the conceptual stage transform into the tables, relationships, and constraints that will comprise the relational database. You create the conceptual model using ORM and transform the ORM model into the logical model. The more familiar Entity Relationship Model is often used to construct the logical database design. By using a modeling tool such as Visio, which supports both ORM and ERD modeling to create the conceptual model, the logical model can be auto-generated from the conceptual model.

    The last stage of database modeling is the creation of the physical model. During this stage, the structure of the database as defined in the logical model is transformed into the actual implementation schema. This schema is dependent upon the database management system chosen, e.g., DB2, Oracle, or Microsoft SQL Server.

    Fact-Driven Design
    The first step in creating the conceptual model is to gather facts about the data. Interviewing the domain experts and reviewing current record-keeping forms along with the required data analysis reports reveals the data types and the data relationships that will comprise the system. The data facts are then broken down into fact types. A fact type is a single assessment of the relationship between data values. Fact types consist of natural-language action statements that are easily verifiable by the domain experts. For example, "a member borrows a book" is a fact type pertaining to a library loan application.

    The fact type is composed of object types and a predicate. The noun phrases identify the object types; in the previous example, "member" and "book" are object types. Object types can be entities or values. Entities represent a person, place, or thing. Both the member and the book represent entity types. Values are simple properties of entity types. For example in the fact type "a book has a title", "title" represents a value type. In order to identify an instance of an entity type, it must be associated with a value type that distinguishes the instance from other instances of the same type. For example, you can identify an instance of a member by social security number and a book by its International Standard Book Number (ISBN). The identifying value of an object type is its reference mode.

    Predicates define the relationship between object types. The verb phrase in the fact type identifies the predicate. In the fact type "a member borrows a book", "borrows" is the predicate. An important feature of the predicate is the ability to reverse the reading. Instead of "a member borrows a book", we can write it as "a book is borrowed by a member". Another feature of the predicate is its arity; the number of roles the predicate is involved in determines the arity. A unary predicate involves one role, a binary two roles, a ternary three roles, and so on. The fact type "a member borrows a book" contains a binary predicate because two roles are involved in the predicate, "member" and "book". An example of a unary predicate in a fact type is "a book is overdue". In this case, the predicate involves only one role played by the "book". An example of a ternary predicate is contained in the fact type "member is contacted at location during time" this predicate involves three roles: "member", "location", and "time". The most common predicate type is the binary. When constructing a fact type, make sure it is elementary. A non-elementary fact type is actually composed of two or more fact types. The fact type "member borrows book identified by ISBN" is not ternary but rather comprised of two binary-predicated fact types: "member borrows book" and "book is identified by ISBN".

    Visualizing Fact Types
    After identifying the fact types that make up the data use cases, the next stage in the development of the ORM model is the creation of a visualization of the fact types. As the old adage says, "A picture is worth a thousand words." In an ORM diagram, ovals represent object types, while rectangular boxes represent predicates. Figure 1 represents the visualization of the fact type "member borrows book". Since this is a binary-predicated fact type, the predicate rectangle consists of two sections (role boxes). Lines connect the object types to the role they play in the predicate. The border of the oval distinguishes entity types from value types. A dashed border indicates a value type, while the entity type's border is solid. Figure 2 symbolizes the fact type "book has page count", where "book" is an entity type and "page count" is a value type. Notice that the "book" entity includes the ISBN value type in parentheses. The ISBN represents the reference mode of the "book" entity. As a final example, Figure 3 shows a unary-predicated, a binary-predicated, and a ternary-predicated fact type - all involving the "book" entity.

     

     

     

    Using Visio to Construct an ORM Model
    Now that you are familiar with some of the notations used to construct an ORM model, you are ready to investigate the use of Visio to create such a model. Note: You need Visio for Enterprise Architects in order to create an ORM Source Model.
    1.  Start up Visio. From the File menu, choose New > Database > ORM Source Model.
    2.  If the Business Rules editor (see Figure 4) 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 Member entity object type with a reference mode of MemberNo. Repeat this procedure, entering the object types shown in Figure 5. Note: Do not worry about the Physical Data Type 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, choose Member. In the relationship textbox enter "borrows". In the right object dropdown, choose Book. Figure 6 shows the completed entries. Notice the bottom of the window contains the natural language syntax expression of the fact type. This natural language syntax plays an important role when verifying the model with the domain experts. Click Apply to save the fact type.

     

    5.  Repeat Step 4 to enter the fact types shown in Figure 7. Notice that there is a unary-predicated and a ternary-predicated fact type.

     

    6.  Click and drag the fact types from the Business Rules editor onto the drawing surface. After a little rearranging, your completed diagram should look similar to Figure 8. Save the ORM model and close Visio.

     

    Review
    This article has introduced you to Object Role Modeling. 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, the application's chances of success as it progresses to the logical and physical stages significantly increase.

    This article focused on identifying object types and fact types. The various common types of predicate arities were discussed and the use of Visio to construct an ORM source model was demonstrated. In a future article I will continue the study of ORM source modeling using Visio. I will cover primitive entity types, subtypes, derived fact types, and unique constraints. In addition, I will demonstrate the process of applying population checks to verify the the ORM model.

  • 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...