Hi Marcos and Jens, Some answer below.
On Mon, Apr 27, 2009 at 10:29 AM, Jens Klein <[email protected]> wrote: > Am Sun, 26 Apr 2009 11:18:56 +0200 schrieb Marcos Aurélio: > >> > >> Is it possible to express this kind of constraint in XMI and within > >> ArgoUML? A tiny example or a simple "No way" would help me a lot. > >> Searching the web brought up tons of crap results, but no good document > >> explaining XMI and UML-Profiles in depth. > >> > >> > > Hi, I think you can represent this adding an OCL annotation to your > > profile I would need to look at the UML spec to write the proper > > expression, but I'm sure it is possible. > > > > Can you send me an example of such profile? I can add the OCL expression > > to you > > > > *maas* > > the current profile xmi file is located here: > https://svn.plone.org/svn/archetypes/ArchGenXML/trunk/umltools/argouml > > Example 1: > ---------- > > if you take the last entry, a tag definition for a tagged value (i > replaced the uuids for better readability): > > <UML:TagDefinition xmi.id = '...' name = 'index:extras' > isSpecification = 'false' tagType = 'String'> > <UML:TagDefinition.multiplicity> > <UML:Multiplicity xmi.id = '...'> > <UML:Multiplicity.range> > <UML:MultiplicityRange xmi.id = '...' lower = '0' > upper = '1'/> > </UML:Multiplicity.range> > </UML:Multiplicity> > </UML:TagDefinition.multiplicity> > </UML:TagDefinition> > > I'd like to tell the tag definition to be valid only on "Class" elements. I think TagDefinition should be bound to a stereotype and with the stereotype you can say it apply only on Class elements. TagDefinition should always be bound to a stereotype in UML2. > > > Example 2 > --------- > the following shoudl be allowed only on classes with the stereotype > <<tool>> > > the stereotype <<tool>> should be allowed only on classes. You wanted to say "tool_instance_name" tagged-value should be allowed only on elements with <<tool>> stereotype", no? <<tool>> stereotype is already for "Class" elements : <UML:Stereotype xmi.id = '5d6b1dca-45fc-569e-b7bd-aab2ca3acc72' name = 'tool' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'> <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass> </UML:Stereotype> If you open the profile in argouml, select tool_instance_name tagDefinition and change owner to the <<tool>> stereotype, export the xmi, you get : <UML:Stereotype xmi.id = '5d6b1dca-45fc-569e-b7bd-aab2ca3acc72' name = 'tool' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'> <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass> <UML:Stereotype.definedTag> <UML:TagDefinition xmi.id = 'd2558c78-8aad-5af8-ab11-6979bc21e721' name = 'tool_instance_name' isSpecification = 'false' tagType = 'String'> <UML:TagDefinition.multiplicity> <UML:Multiplicity xmi.id = 'c95e6681-d169-5750-94c3-dde71c488a95'> <UML:Multiplicity.range> <UML:MultiplicityRange xmi.id = '5a64da82-8374-562c-a0a4-c264239b0ac5' lower = '0' upper = '1'/> </UML:Multiplicity.range> </UML:Multiplicity> </UML:TagDefinition.multiplicity> </UML:TagDefinition> </UML:Stereotype.definedTag> </UML:Stereotype> The tool_instance_name tagDefinition will be available only if you applied the <<tool>> stereotype on the Class. > > <UML:TagDefinition xmi.id = '...1' name = 'tool_instance_name' > isSpecification = 'false' tagType = 'String'> > <UML:TagDefinition.multiplicity> > <UML:Multiplicity xmi.id = '...'> > <UML:Multiplicity.range> > <UML:MultiplicityRange xmi.id = '...' lower = '0' > upper = '1'/> > </UML:Multiplicity.range> > </UML:Multiplicity> > </UML:TagDefinition.multiplicity> > </UML:TagDefinition> > > Id really appreciate examples for both. As you see in the file we have > lots of tagged values and selecting them from this very long drop-down in > argouml is no fun. > > Different topic, but it would also help if the dropdown helps selecting > the value by jumping to the entry by pressing its first letter. This is > not so important if we can reduce the list to relevant entries only using > the OCL-approach you mentioned. > > thanks and best regards > -- > Jens W. Klein - Klein & Partner KEG - BlueDynamics Alliance > For OCL constraint, I think an example will be to allow methods with stereotype <<action>> only if the class has the <<archetype>> stereotype for example. How do we do that in OCL? And how do we include such a constraint in the profile? Regards -- Vincent Fretin ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=1980612 To unsubscribe from this discussion, e-mail: [[email protected]].
