Find out how to create logical data models in Vertabelo! If you have some experience with physical diagrams, this will be as easy as pie.
There are three different levels of data models: conceptual, logical, and physical. Of these, the conceptual model is the most abstract, and the logical model has a few more technical details. The physical model has all the details of the physical database, such as data types (
varchar, etc.), constraints, schemas, and indexes. If you want to find out more about the different levels of data models, read our article What Are Conceptual, Logical, and Physical Data Models?.
In 2019, we added a new feature to Vertabelo: you can now create logical ER diagrams in addition to the physical ones. You can use Vertabelo logical diagrams to implement both conceptual and logical data models; just add as little or as much detail in the logical diagram as you need. We implemented only one type of diagram that can be used for both conceptual and logical models, because we believe the difference between them is not well defined.
How to Create a Logical Diagram in Vertabelo
To start, go to my.vertabelo.com, and log in. Then, click on the “Create new document” button.
... then click on the Create button next to the Logical data model.
A pop-up will ask you for the name of the document; type it in, and you’ll be ready to go. Note that, unlike with physical data models, you don't select the database you're going to use.
Tip: to tell the logical and the physical data models apart from each other, take a look at the icons from the previous screenshot:
The logical data model icon has a tiny entity diagram in it. The physical data model icon has a tiny diagram and a small database barrel, emphasizing that it deals with the physical database. The same icons are used in the model list.
Adding Objects to the Logical Data Model in Vertabelo
Let's take a closer look at the tools we can use to create our logical ER diagrams.
Using the buttons, or the respective keyboard shortcuts, you can:
|Select an element (press
|Select an area (press
|Move the diagram around (press
|Add a new entity (press
|Add a new association (press
|Add a new one-to-many relationship (press
|Add a new many-to-many relationship (press
|Add a new association (press
|Add a new inheritance (press
|Add a text note (press
|Add a subject area (press
You don't have to memorize all of it now; each button will show you a tooltip with the description and its shortcut. If you want this close at hand, bookmark this page or check out the doc pages.
An entity is something about which we want to store information: a person, a place, a thing, an event, a concept, a transaction, etc. Entities in logical data models are like tables in physical models. Each entity has a name and attributes that describe it.
Add a new entity by clicking on the icon or pressing 3 on your keyboard. Then click in the model area at the place where you want to have a new entity.
Now that we have our panel adjusted, we may change the generic name into something we want. To add a new attribute, click on “+ Add attribute” in the right Entity properties panel.
Then new fields will appear. Type in the name and change the data type. The two check boxes stand for "Mandatory" (this attribute must always have a value) and "Primary Identifier" (an attribute that identifies this entity). The drop-down icon opens additional options, and the x button at the end of the row deletes the given attribute.
If you already know all of the data types available, you may simply type them in. If you prefer to see all available options, click on the gear icon () to the right of the text box.
The general groups of data types are numeric, string, date and time, and large objects and other. In the logical diagram, you only choose the general data type. They will be transformed to physical data types available in your DBMS when you generate a physical model from the logical model.
Now that you have your entities all set up, let's create relationships among them. In Vertabelo logical ER diagrams, you may use these relationship types:
- One-to-many (press
- Many-to-many (press
- Association (press
- Inheritance (press
Pick the relationship type you want and drag from one entity to another.
Once you do this, you will see the options in the Properties panel. You'll be able to change the type of the relationship and set if either of the sides should be mandatory or dependent. As with all other elements, you can also change its color if you want.
In a one-to-many relationship, an instance of one entity can be referenced in multiple instances of a second entity. For example, a product-category relationship is a one-to-many relationship. You can have a product entity (the "many"-side of the relationship) and a category entity (the "one"-side); a product belongs to exactly one category, while a category may contain (i.e., refer to) many different products.
The many-to-many relationship is similar to the one-to-one relationship, but it associates entities that can be referenced multiple times both ways. Take stores and products as an example: one store has multiple products, and one product can be found in many different stores. In Vertabelo logical data model, it'll look like this:
Note that there are circles near the ends of the relationship. This stands for 0 / not mandatory; for example, a product may not be available in any of the stores, and a store can have no products.
We can set either or both of the sides to 1 / mandatory in the relationship properties. Then it will look like this:
In an inheritance relationship, the child entity inherits all attributes of the parent entity. This relationship type is often used in object-oriented programming and is not as common in databases. For example, we could consider a specific type of products – say, food, and record the “best before” date for each product in the database:
A Special Type of Relationship: Association
Let's talk about association, a special type of relationship. An association is a relationship between two entities, which can have additional attributes. You can implement a many-to-many relationship with attributes or a ternary relationship this way. When you join entities with an association relationship, you'll be able to set association properties which consist of its name and attributes.
Keeping the Logical Model Organized: Subject Areas and Text Notes
To make your model more readable, you may add colored rectangles to identify subject areas.
Click and hold the left mouse button and drag your cursor to draw a box around all of the elements you want to include in your subject area.
In the properties panel, you can change the name of the area and give it a unique look by changing the color or the line style.
Organizing your logical data model with subject areas will put your entities in the left panel in groups so you can manage them more easily.
You may also add text notes next to more complex objects, so your team can get back later and understand what you mean.
As with other elements, you may change text note contents via the properties panel:
Here is what an example note looks like:
Checking for Errors: Live Model Validation
Vertabelo will automatically check your model for some errors such as logical errors (wrong associations, names, or missing or incorrect values). To check if you have any errors in the model, take a look at the Problems section on the left side of the screen.
We have two errors here. To fix them, simply click on each of the errors on this list so the problematic object is selected, and you'll be able to resolve the issue.
Sharing the Model With Your Team
Now that we're all set, we may share our model with colleagues, so they can make their changes or suggestions, and export the model.
The main toolbar contains all options you need:
- Save changes (
Ctrl+S). Saves the changes in the model you are currently editing. Keep in mind that Vertabelo saves your database model automatically every few seconds and always when you close the diagram, so you don't have to worry about losing your work. During an autosave, the save icon turns green.
- Share this model with your team. You can invite your team members to share your model with them. There are 3 types of sharing: Owner, Editor, and Viewer.
- Export model as PNG image. Generates a PNG image of your model.
- Export for printing (PDF). Generates a PDF of your model so you can print it.
- Generate model documentation. Generates as a PDF, an HTML, or a DOCX.
Collaborating With Your Team
Vertabelo enables your team to work together on the model. So, if you've shared the model with your team, you all can open it at the same time. Only one person can make changes at a time, but anyone may click "Take control" to become the current editor at any moment.
Importing and Exporting Logical Models
If you'd like to save your model in XML (the format which allows you to import the model back into Vertabelo), open the menu in the main toolbar by clicking on the name of your model, and select Export » Export to XML.
Also, if you want to include some objects from another model, you may use the Import option to import an .xml file of that model. The second option is to just copy and paste the elements.
Generating the Physical Model From the Logical Model
Finally, we come to that point in the development process: the logical model is ready, and we start working on the physical model. Vertabelo has an option to do this automatically. Simply open the menu in the main toolbar (see the previous screenshot). Then in the menu, click on the option “Generate physical database model.” In the pop-up, you'll have a few fields to set up your model.
The Name field will be filled automatically (Vertabelo will append "Physical Model" to the name), but you'll need to select a database engine you want to work with. You may also decide not to generate sequences and/or not to copy text notes.
After you click on “Generate Physical Model,” the new tab with the physical model will be opened, and you'll be able to work with it. Entities and associations are generated into tables, attributes become columns, primary identifiers become primary keys, etc.
Be sure to resolve all problems that occurred during the generation process, as some decisions cannot be made automatically by the generator. For example, a given problem may have multiple correct solutions, and you may have to choose which one is best for you.
Logical Data Model in Vertabelo: Key Takeaways
That's it from us for this article! Vertabelo is easy to work with. But there is so much information here, so you might want to bookmark this article and come back later for a refresher or a quick sanity check. Our doc pages are also a good place to search for the answers. If you have a question and can't find the answer for it, check out our FAQs here or ask us in our support system.