Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Semantic annotations for UML elements
Semantic annotations for UML elements [message #803075] Mon, 20 February 2012 17:26 Go to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hi,

ok, this one is a more conceptual question: I have created a UML model and now I want to add some semantic information. For example: I have a class and an operation X. Now I want to add the information, that X takes 10 seconds to be performed. Furthermore I want to add a description in terms of a long text.

How should this information be added? There are several chances I see:

1. Usage of UML comments/annotations

Advantage: Within the same model

Disadvantage: The model becomes bigger and bigger with more information. The information is informal.

2. Usage of a database that keeps these information

Advantage: The model is only for the model and no additional semantic information. The model does not become bigger. I can create a database schema that conforms to the information I want to store.

Disadvantage: I need to synchronize database and model. When the model changes (class is deleted), the information within the database has to be updated.

3. Creation of a UML profile

I create a UML profile with stereotypes "explanation" and "duration" and create classes with these stereotypes that are referenced by the operation. (I am not sure: is it possible to associate an operation with a class?). Then I could use two associations named "explanation" and "duration" that refer to the semantic information.

Advantage: It is formalized. Within on model. No synchronization needed.
Disadvantage: Additional UML profile, not standardized, big models.


4. Usage of links to other models (OWL classes)

Advantage: The information is formalized and I do not have to synchronize as much information as within a database. There are different types of models with different purposes.
Disadvantage: Again the model size increases. Maybe hard to understand?

What do you think? Where should I store this information?

Thanks

Michael
Re: Semantic annotations for UML elements [message #803108 is a reply to message #803075] Mon, 20 February 2012 18:36 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad Varnica
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
It is always the same dilema in UML.
Should we save more information in the model itself or work mainly at graphical level.

I would say yes we need to save more information directly in the model itself because with the new graphical UML views we have already reach the UML limits. UML will either die because no more real evolution or will start a new life if we use the model itself.

No real evolution has been done in that UML model used as a datawarehouse except by only one company Omondo in the last few years. I therefore don't know if this UML metamodeling will ever become a standard !!

[Updated on: Mon, 20 February 2012 18:44]

Report message to a moderator

Re: Semantic annotations for UML elements [message #803346 is a reply to message #803075] Tue, 21 February 2012 03:11 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

UML is quite good for graphical problems and dreadful for textual
problems. In the UML specification all textual difficulties are deferred
to OCL. I suggest you do the same. Create one or more Complete OCL
documents to complement your meta-model.

The OCL Examples and Editors provides an Xtext editor for Complete OCL.
It was first provided in Helios and has steadily improved. Juno finally
adds the ability to load the document into many forms of modeling tool
so that you can use additional consdytriants in the modeling tool.

Regards

Ed Willink


On 20/02/2012 22:26, Michael Bob wrote:
> Hi,
>
> ok, this one is a more conceptual question: I have created a UML model
> and now I want to add some semantic information. For example: I have a
> class and an operation X. Now I want to add the information, that X
> takes 10 seconds to be performed. Furthermore I want to add a
> description in terms of a long text.
> How should this information be added? There are several chances I see:
>
> 1. Usage of UML comments/annotations
>
> Advantage: Within the same model
> Disadvantage: The model becomes bigger and bigger with more
> information. The information is informal.
>
> 2. Usage of a database that keeps these information
>
> Advantage: The model is only for the model and no additional semantic
> information. The model does not become bigger. I can create a database
> schema that conforms to the information I want to store.
> Disadvantage: I need to synchronize database and model. When the model
> changes (class is deleted), the information within the database has to
> be updated.
> 3. Creation of a UML profile
>
> I create a UML profile with stereotypes "explanation" and "duration"
> and create classes with these stereotypes that are referenced by the
> operation. (I am not sure: is it possible to associate an operation
> with a class?). Then I could use two associations named "explanation"
> and "duration" that refer to the semantic information.
>
> Advantage: It is formalized. Within on model. No synchronization needed.
> Disadvantage: Additional UML profile, not standardized, big models.
>
>
> 4. Usage of links to other models (OWL classes)
>
> Advantage: The information is formalized and I do not have to
> synchronize as much information as within a database. There are
> different types of models with different purposes. Disadvantage:
> Again the model size increases. Maybe hard to understand?
>
> What do you think? Where should I store this information?
>
> Thanks
>
> Michael
Re: Semantic annotations for UML elements [message #803434 is a reply to message #803346] Tue, 21 February 2012 05:45 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad Varnica
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
I agree with Ed currently OCL is a standard and you can use it to add textual information.

Having said that if you work at metamodel level you can directly synchronize the graphical diagram with your model and add needed textual information. No transformation stage such as done by the GMF framework with Topcased, and Papyrus.

Omondo allows you to enter any textual information in your model and show it, update etc... at graphical level no more need for OCL. But this is not an official OMG standard therefore what is saved in your model will only be usable graphically by the tool in which you have created this textual information. No textual model interchange is possible.
Our Customers are usually directly adding queries on the xmi of the model. They can found and trace any change because using the model as a datawarehouse. This is not annymore dealing with OCL but xml which could be done with any good xml editor such as Ultra Edit.
Re: Semantic annotations for UML elements [message #803506 is a reply to message #803434] Tue, 21 February 2012 07:36 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hi,

hm, very interesting. But when applying your answers on my question: How can I add some textual description or the information that operation X takes 10 seconds in OCL?

I create the operation. Then I add an OCL constraint with the content:

'textual_description = "Hello World"'

And another OCL constraint with:

'duration = 10'?

What about the usage of alternative 3? I create stereotypes and now create a class "<<semantic>> description" with tagged values "textual description" and "duration" and set these values?

Regards,

Michael
Re: Semantic annotations for UML elements [message #803720 is a reply to message #803506] Tue, 21 February 2012 12:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

You can add arbitrary properties for your concerns.

For standard properties you may want to look at the MARTE profile for
which Papyrus has direct support.

Regards

Ed Willink

On 21/02/2012 12:36, Michael Bob wrote:
> Hi,
>
> hm, very interesting. But when applying your answers on my question:
> How can I add some textual description or the information that
> operation X takes 10 seconds in OCL?
>
> I create the operation. Then I add an OCL constraint with the content:
>
> 'textual_description = "Hello World"'
>
> And another OCL constraint with:
>
> 'duration = 10'?
>
> What about the usage of alternative 3? I create stereotypes and now
> create a class "<<semantic>> description" with tagged values "textual
> description" and "duration" and set these values?
>
> Regards,
>
> Michael
Re: Semantic annotations for UML elements [message #804513 is a reply to message #803720] Wed, 22 February 2012 13:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

One of the powerful features/implementation challenges of Complete OCL
is the ability to "def" additional operations and properties for use by
OCL in conjunction with the complemented meta-model.

Regards

Ed Willink


On 22/02/2012 15:22, Max Plano wrote:
> Hi,
>
> are these properties OCL invariants? Because the properties are not
> defined yet in the metamodel.
>
> Regards,
>
> Michael
Re: Semantic annotations for UML elements [message #804569 is a reply to message #804513] Wed, 22 February 2012 14:42 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hi,

hm I am not sure, whether we mean the same Smile

I have created a UML model (no UML profile) with two classes: "Car" and "Train". Then, each class has an operation "run()". Now, I want to add the information about the duration. But I don't want to create a profile, because maybe later I need more information to be saved. And additionally: When exchanging the model, everybody would need to have my UML profile.

Now, I create an OCL constraint for the operations and def new properties? Is it possible to parse this information with OCL?

Seems to look nice, but the last time I tried to use OCL programmatically (I have to programmatically create and manipulate models) I did not get it working Smile UML and profiles work pretty well, but I will keep trying Smile

Michael
Re: Semantic annotations for UML elements [message #804592 is a reply to message #804569] Wed, 22 February 2012 14:58 Go to previous messageGo to next message
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Wrong account sorry

[Updated on: Wed, 22 February 2012 15:39]

Report message to a moderator

Re: Semantic annotations for UML elements [message #804624 is a reply to message #804592] Wed, 22 February 2012 15:44 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hm, I tried to create a model with OCL using the UML2 Tools (before going the programmatical way).

Is it correct that the UML constraints are child of the package and not of the operation it refers to? The constrained element is set. But I thought the constraint has to be subordinated within the operation element.
Re: Semantic annotations for UML elements [message #804626 is a reply to message #804592] Wed, 22 February 2012 15:47 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hi,

what I don't understand when going the programmatical way: I can use the OCL java library to execute queries on models. But the OCL constraints are formalized within the body of a OCL constraint within the model itself. Do I have to parse the model for getting the body of the model and then put it into the OCL parser?

Regards,

Michael
Re: Semantic annotations for UML elements [message #804631 is a reply to message #804592] Wed, 22 February 2012 15:44 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hm, I tried to create a model with OCL using the UML2 Tools (before going the programmatical way).

Is it correct that the UML constraints are child of the package and not of the operation it refers to? The constrained element is set. But I thought the constraint has to be subordinated within the operation element.
Re: Semantic annotations for UML elements [message #804645 is a reply to message #804626] Wed, 22 February 2012 16:15 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hi,

I have seen that it is much easier. I will use the Constraint element and then the Specification Child, such as a Literal Boolean. Then I can access the values without using any OCL programmatically. Great Smile Thank you for your help.

Michael
Re: Semantic annotations for UML elements [message #809200 is a reply to message #803506] Tue, 28 February 2012 10:37 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Michael,

I would suggest using constraints (based on the language of your
choosing, be it OCL, Java, or whatever) if the kind of information
you're looking to add represents rules or conditions on the elements.
Another (less-structured) alternative is to use comments.

Otherwise, I would recommend using profiles/stereotypes because that's
what they are for - to extend UML with additional "non-standard"
information that's meaningful in a specific domain...

Kenn

On 12-02-21 7:36 AM, Michael Bob wrote:
> Hi,
>
> hm, very interesting. But when applying your answers on my question: How
> can I add some textual description or the information that operation X
> takes 10 seconds in OCL?
>
> I create the operation. Then I add an OCL constraint with the content:
>
> 'textual_description = "Hello World"'
>
> And another OCL constraint with:
>
> 'duration = 10'?
>
> What about the usage of alternative 3? I create stereotypes and now
> create a class "<<semantic>> description" with tagged values "textual
> description" and "duration" and set these values?
>
> Regards,
>
> Michael
Re: Semantic annotations for UML elements [message #811528 is a reply to message #803075] Fri, 02 March 2012 08:22 Go to previous messageGo to next message
Michael Bob is currently offline Michael Bob
Messages: 29
Registered: February 2012
Junior Member
Hi,

thanks. I think, I will use stereotyped constraints. Or do I have to use stereotyped specifications subordinate to constraints?

However, I have one question: Is it possible to use constraints to add Lists of values? Currently, I have only found LiteralInteger Specifications etc. But is there a specification that enables list of values? Especially references to other elements (List of classes with certain stereotype)

Regards,

Michael
Re: Semantic annotations for UML elements [message #811553 is a reply to message #811528] Fri, 02 March 2012 08:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

If you use OCL constraints you can have nested collections and tuples.

Regards

Ed Willink

On 02/03/2012 13:22, Michael Bob wrote:
> Hi,
>
> thanks. I think, I will use stereotyped constraints. Or do I have to
> use stereotyped specifications subordinate to constraints?
>
> However, I have one question: Is it possible to use constraints to add
> Lists of values? Currently, I have only found LiteralInteger
> Specifications etc. But is there a specification that enables list of
> values? Especially references to other elements (List of classes with
> certain stereotype)
>
> Regards,
>
> Michael
Re: Semantic annotations for UML elements [message #814338 is a reply to message #811553] Tue, 06 March 2012 05:27 Go to previous message
Eclipse User
And one last remark on this...

The information you want to store in the model sounds to me pretty much like
non-/extra- functional requirements. So, UML constraints are definitely more
appropriate than comments or derived OCL properties - althought it'd work.
However, in your case it might be worth to have a look into the MARTE
profile, which is a (huge and sophisticated) UML profile to model, among
other things, non-functional properties qof software-intensive systems
(which doesn't have to be embedded systems necessarily).

Marc-Florian

"Ed Willink" schrieb im Newsbeitrag news:jiqjju$feo$1@news.eclipse.org...

Hi

If you use OCL constraints you can have nested collections and tuples.

Regards

Ed Willink

On 02/03/2012 13:22, Michael Bob wrote:
> Hi,
>
> thanks. I think, I will use stereotyped constraints. Or do I have to use
> stereotyped specifications subordinate to constraints?
>
> However, I have one question: Is it possible to use constraints to add
> Lists of values? Currently, I have only found LiteralInteger
> Specifications etc. But is there a specification that enables list of
> values? Especially references to other elements (List of classes with
> certain stereotype)
>
> Regards,
>
> Michael
Previous Topic:Model or package as root element
Next Topic:UML 2 ecore and association.navigableOwnedEnd
Goto Forum:
  


Current Time: Wed Jul 23 14:14:01 EDT 2014

Powered by FUDForum. Page generated in 0.02427 seconds