Generate UML from a conceptual data model - uml

I have an conceptual data model (Relational model) created using powerAMC for my database but i wanted to generate DAO from it using acceleo and for that i need it in UML , is there a way to generate UML from a conceptual data model model ?

Acceleo can generate code from any models defined with any EMF based metamodel. The UML project of the Eclipse Foundation defines an UML metamodel based on EMF so that users can create UML models based on EMF and Acceleo can thus generate code from those models.
If you want to use another metamodel, you can do it, so if you want to create a metamodel that matches more closely your data structure, feel free to do so. As an example, you can see here a metamodel that I have created of the Scala language and my generator uses models defined from this metamodel to generate the code. You can find an example of a generator using this metamodel here. You can see in this example that the Acceleo generator is defined on my scala metamodel "http://github.com/sbegaudeau/acceleo/scalametamodel/2011/01" (contrary to an Acceleo generator that would be defined on UML that would be using the standard UML metamodel "http://www.eclipse.org/uml2/3.0.0/UML") and I can manipulate in Acceleo some concepts from this metamodel directly like traits (if you are familiar with Scala).
So you can:
create a metamodel that matches your concepts
create a small converter in java to create an EMF model (instance of your metamodel defining the concepts of your database) and then transform the data in your database to an EMF model that you just have to save.
use Acceleo with your models :)
Regards,
Stephane Begaudeau
Disclaimer: I am the leader of Acceleo.

PowerAMC has a data model which is not object like UML. It is therefore impossible to transform it to UML.
If you have directly the generated database then you can create the UML model from the code but not from database modeler.

Related

How to create uml class diagram and notations by programming?

Package model = UMLFactory.eINSTANCE.createPackage();
model.setName("MyPackage");
Class cls = model.createOwnedClass("MyClass", false);
I created some uml2 models by code above, now I want to create a class diagram and some notations for package/class etc. How can I do this by programming? (We can initialize class diagram for .uml by uml2tools in eclipse, but what's the API for it?)
Thanks a lot.
The uml2 model provides you with the entities needed to create uml models. UML diagrams are views of these models and are not part of the mode definition. So you can't create a 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.

Can I use Eclipse-EMF's internal data structure?

In EMF, a user can draw UML diagram and that UML model can be transformed into Java code. As far as I know EMF has its own internal data structure to capture the UML model user draws. And what I want to do is to make UML model by coding, not by drawing, i.e., by using EMF's internal data structure representing UML metamodel(Class, Package, Attribute, etc). Like,
UmlClass myClass = new UmlClass();
UmlAttribute myAttr = new UmlAttribute();
myClass.addAttribute(myAttr);
Is this possible(not even by EMF)? Anyway, I want to use a robust data structure that exactly reflects OMG's standard UML specification.
Thanks in advance.
EMF is a modelling framework designed to support modelling in general, not just UML.
If it is UML in particular you're after, there is indeed such an implementation built on top of EMF. Check out UML2.
There are no classes exactly reflecting the OMG specification, but EMF ECore is a meta model for models. Therefore you can do what you want using EMF ECore. There is lots of doc at http://www.eclipse.org/modeling/emf/docs/#overviews and an excellent book. The link has a picture and link to the book.
An example:
EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
EClass myClass = ecoreFactory.createEClass();
myClass.setName("MyClass");
EAttribute myAttr = ECoreFactory.createEAttribute();
myAttr.setName("myAttr");
myAttr.setEType(EcorePackage.Literals.ESTRING);
myClass.getEStructuralFeatures().add(myAttr);

Converting XSD file to UML Model

We have an application that generates a XSD file that represents database tables.
I now need to convert the XSD in to a UML model. This will allow clients to change the model using a modelling tool (such as Magicdraw, RSA, Eclipse, ct) and then run another of our tools to generate other artifacts.
How can I convert from XSD to UML ?
We own MagicDraw so I was looking in to the Transformations functionality that should do this for me but for some reason I can't import the XSD, although it is valid.
I'm also confused when it talks about XML Schemas and XMI format. How do these differ from my XSD file?
Thanks.
Sarah
The best tool that I have found for this purpose is the XML modelling tool. Its been a while since it was updated, but it works. I blogged about it at Modelling wsdl as uml
There are some tools able to transform XML schemas into UML diagrams (see a list here, read the comments in the post) but the XML/XMI import of MagicDraw (and in general of any other UML tool) will not work in your schema since they expect a specific type of XML file (XMI format) which is the standard used to provide a XML-based definition of a UML model.
That is, XMI files are used to store UML models in XML and they follow a predefined XSD. In theory UML tools should be able to exchange UML models stored in XMI but unfortunately, this "model once open anywhere" is not true (but this is another story)
You can try to use the Eclipse Dali plugin which would generate a java code directly from your database. Once you get the code you can reverse into UML.
From UML to database you could try to add java persistence annotations in your code coming from your UML class diagram. When you have the annotated code then try hibernate to create your database.
This would do the job but having multiple layers means that you loose tracability between your original data model and UML and back. This is called the pojo cycle.

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