How to generate UML diagram from tables in SQL Server Object Explorer of Visual Studios? - visual-studio-2012

In SQL Server Object Explorer, I see a list of tables under "Tables" under my database within the "Databases" directory. How do I automatically create a UML diagram of these tables. How do I do this?

UML has no diagram for database content.
Classes from class diagram can be implemented as DB tables. They CAN model simple tables. But if you have a table with inner references, it could be modelled as one or several classes. And nobody except you can say exactly how many classes will be got from a table.
MS Visio has non-UML Database diagram. THEY have Table element and surely, can be generated from most of the DBs. Look here

Related

How can I copy from excel table to Lucidchart entity relationship?

I have a large number of rows in excel which I would like to use ase fields in an entity relationship in a Lucidchart ERD. When I try to copy this into Lucidchart it is pasted as a table and I can't convert it into a entity relationship. Is it possible to do this in any way?
This video from Lucidchart explains entity relationship diagrams (ERD) imports.
This video also covers how to access preformatted queries for your DBMS in order to obtain your .csv, .tsv etc.
It sounds like you already have this in your excel file mentioned, but if not it is your query that builds the foundation for the db schema structure.
Without that, Lucidchart won't know how to structure your data and will be a cause of the failed entity relationship mapping you're seeing.

Add database and interface CRUD functions to class diagram

I am creating a class diagram.
Process
1)Read Employee data from Active Directory
2) Add Employee detail to SQL Employee table
3) Read Details from XML file and update SQL table
4) update the employee detail in active directory
I have created a class for employee , XML file and a class for Linq to SQL crud functions and another class for the Linq to LDAP.
Question
I am not sure if i need to add all the crud operations and logging functions into the class diagram
It is impossible to answer your question unless you provide more information. Do you have any specific design rules which tell what needs to be specified in the class diagram and what doesn't need to be specified in it? If there are no such rules, I would first consider adding the database layer functions to the class diagram and if the class diagram becomes too complicated then perhaps consider removing these.
This might be a good moment to have a discussion with the other team members what rules are used to make the class diagrams. What do you want to be in the diagrams and what can be omitted? If different persons have different opinions, then this conflict needs to be resolved somehow quickly because it's not a productive use of people's time to keep endlessly arguing what should be specified in a UML class diagram.

Creating a meta model using UML convention and creating a data model out of it

Sorry if the question sounds too vague. I will improve based on your feedback.
I have managed to prepare a UML model of a problem domain. This is essentially a class diagram describing class attributes and aggregation relationships amongst classes. Intention now is to fill data.
For example, class-A aggregates N instances of Class-B. I would like to create a data model that has data for one instance Class-A and 5 instances of Class-B.
Basically, data pertaining to this meta model is available in a document (e.g. xls, framemaker) and it should be possible to read the source and populate the data model.
Are there tools that will let me create this data model? Please advise.
You have two options to creates your database model from our UML model.
You can use the UML model and then add a code generator to generate the database then finally reverse it with a database modeling tool such as erwin.
Another approach is to use the database modeling profile inside your UML model. It means that ypu model and add database stereotype related to java ORM.
Both works pretty well.

What is the difference between 'class diagrams' and 'data models' in UML?

I have homework and I'm supposed to draw a class diagram AND data model. I wrote the class diagram. I don't know what to do about the data model. What are the differences?
According to texts on the Internet they seems to me, ie: class diagrams and data models are the same thing.
What is the difference between class diagrams and data models.
Unified Modelling Language, as you may already know, is a means of describing systems with diagrams. They don't just relate to software, but can also relate to hardware, economics, everyday items, in fact anything, although they are more generally used with software systems.
A class diagram details how you have split your system into discrete objects, how those objects relate to each other and any know interfaces that they may have. Each class in a class diagram can hold both data and function.
For example a Car class has an Engine, a Steering Wheel class and multiple Wheel, Door, Seat and Pedal classes linked to it. In all of this a class diagram is static.
I'm not exactly sure what you mean by data model.
I've seen class diagrams used to model database tables, usually these are without any functional element and just show how the data tables relate to each other.
There are those that argue that there needs to be an addition to the UML standard for Data Diagrams, but as yet none have been ratified.
This is because persistence of data, key relationships and constraints between tables can be difficult to model with a standard class diagram and most UML tools implement tweaks to the standard in order to allow this.
Then there are dataflow diagrams which are really Activity diagrams, used to show the flow of data between processes within a system.
Now if we go back to class diagrams and assume that a data diagram is used to model a database then you'll notice that there a few differences that may be overlooked.
A class on a class diagram can have data properties (code variables etc) and functional properties (methods, procedures, functions etc.) but these elements of a class can also have access properties (private, public etc.). A class diagram can also show inheritence e.g. a Volkswagon is a Car, so is a Ford, both will inherit from Car and this can be shown.
A data diagram in the database sense will show data items (columns/fields in database tables) but the idea of access properties (public, private etc.) or the idea of inheritence has no meaning and thus can't be shown.
This is because it isn't modelling discrete objects that have both data and function but the data associated with those objects. For example a Car table may have a relational link to a Manufacturers table in which is stored the values Volkswagon and Ford. It may have a Wheels column, but this will only show the number of wheels. Stored procedures for the database exist at a level labstracted from the data - they utilise the data, but are not governed or owned by the data tables that they get the data from.
I've probably not explained myself very well, but I hope that I've helped.
Here's a useful site
And here's another and on that site data modelling specifically.
Generally data models define how the database is implemented. Those diagrams are entity diagrams. A class model is the functional relationships between objects in your system. A class has data but it isn't the data model. A design has both a class model and a data model. As a simple example, a data model exists for a customer. That data model was the design for our customer database. A class model design exists to implement how to process a customer order. The data model is what the database designer uses. The class model is what the software designer uses to implement a ordering business function. Both the data model and class model have diagrams. They use different symbols and rules. Class diagram vs Entity diagram. Two different kinds of diagrams.
Datamodeling is not UML which is focused on object approach.
Having said that you can model inside a class diagram at object level and create your database using Hibernate annotations in the Java code.
I mean that you create your code and add persistence annotation at the same time. This would create your database at deployment.
UML which is not supposed to be datamodeling can also create data at deployment level if you use the Omondo Persistence profile. It means that you can model at object level and also create your database. Very powerful approach because the data creation stage is now joined with the object
This is still an initiative but it could become a standard if bigger companies adopt this approach which is for me one of the best practices when codding in Java that I would recommend.

How to generate UML class model from a Relational Model?

Does anyone know if it's possible to generate a UML Class Model from a Database Relational Model? How?
edit:
To clarify what I consider to be a UML Class Model (UCM) and a Database Relational Model (DRM).
The UCM is a higher abstraction than DRM. On the UCM we don't talk about table but rather about entities. In UCM we model the properties of an entities and the relationships with which other.
In the DRM it is the opposite, we don't talk about entities, we talk about tables. Typically, if not every time, the DRM will have more tables than the number of entities in the UML.
I hope I have made myself clear now.
P.S: I am using SparxSystems Enterprise Arquitecht.
Thanks.
A database relational model in [Enterprise Architect][1] is just a stereotyped Class diagram where the Class elements are tables and the attributes are the columns.
So to answer your question, Yes it is possible to generate the relational model into a class model simply by using the Model Driven Architecture (MDA) transforms of Enterprise Architect to transform it directly to a class model.
To do this:
In the Project Browser of Enterprise Architect right on the DRM package then select Transform current package (Crtl+Shift+H)
Select an appropriate language.
Click "Do Transform" - and follow the promps to save the new class elements in the project browser.
Once this is done you can tweek exactly how you want the UCM to look (more/less entities etc). Hopefully this will get you 99% of the way there.

Resources