Welcome!

Microsoft Cloud Authors: Janakiram MSV, Yeshim Deniz, David H Deans, Andreas Grabner, Stackify Blog

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
    While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, will discuss how data centers of the future will be managed, how th...
    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 Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...
    SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
    SYS-CON Events announced today that Keisoku Research Consultant Co. will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Keisoku Research Consultant, Co. offers research and consulting in a wide range of civil engineering-related fields from information construction to preservation of cultural properties. For more information, vi...
    SYS-CON Events announced today that Interface Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Interface Corporation is a company developing, manufacturing and marketing high quality and wide variety of industrial computers and interface modules such as PCIs and PCI express. For more information, visit http://www.i...
    SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
    SYS-CON Events announced today that TMC has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo and Big Data at Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Global buyers rely on TMC’s content-driven marketplaces to make purchase decisions and navigate markets. Learn how we can help you reach your marketing goals.
    SYS-CON Events announced today that Enroute Lab will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Enroute Lab is an industrial design, research and development company of unmanned robotic vehicle system. For more information, please visit http://elab.co.jp/.
    There is huge complexity in implementing a successful digital business that requires efficient on-premise and cloud back-end infrastructure, IT and Internet of Things (IoT) data, analytics, Machine Learning, Artificial Intelligence (AI) and Digital Applications. In the data center alone, there are physical and virtual infrastructures, multiple operating systems, multiple applications and new and emerging business and technological paradigms such as cloud computing and XaaS. And then there are pe...
    SYS-CON Events announced today that Daiya Industry will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Daiya Industry specializes in orthotic support systems and assistive devices with pneumatic artificial muscles in order to contribute to an extended healthy life expectancy. For more information, please visit https://www.daiyak...
    Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...
    In his session at @ThingsExpo, Greg Gorman is the Director, IoT Developer Ecosystem, Watson IoT, will provide a short tutorial on Node-RED, a Node.js-based programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes in the palette that can be deployed to its runtime in a single-click. There is a large library of contributed nodes that help so...
    With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
    SYS-CON Events announced today that App2Cloud 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. App2Cloud is an online Platform, specializing in migrating legacy applications to any Cloud Providers (AWS, Azure, Google Cloud).
    Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are now increasingly adopting Agile practices across their organizations in order to successfully navigate the disruptive waters that threaten to drown them. In our quest for establishing change as a core competency in our organizations, this business-centric notion of Agile is an essential component of Agile Digital Transformation. In the years since the publication of the Agile Manifesto, the conn...
    WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a mu...
    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...
    Mobile device usage has increased exponentially during the past several years, as consumers rely on handhelds for everything from news and weather to banking and purchases. What can we expect in the next few years? The way in which we interact with our devices will fundamentally change, as businesses leverage Artificial Intelligence. We already see this taking shape as businesses leverage AI for cost savings and customer responsiveness. This trend will continue, as AI is used for more sophistica...
    SYS-CON Events announced today that SourceForge 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. SourceForge is the largest, most trusted destination for Open Source Software development, collaboration, discovery and download on the web serving over 32 million viewers, 150 million downloads and over 460,000 active development projects each and every month.