Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL check
OCL check [message #557168] Sun, 05 September 2010 12:26 Go to next message
Akhtar  is currently offline Akhtar
Messages: 13
Registered: April 2010
Junior Member
Hi,

I am checking link / association between usecase and an actor.
I did not find a way to check this. Can any provide some hints, how can I proceed.

regards,
Akhtar
Re: OCL check [message #557172 is a reply to message #557168] Sun, 05 September 2010 13:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3846
Registered: July 2009
Senior Member
Hi Akhtar

You don't provide much of a clue as to what you're trying to do.

If you want to use the Java API to evaluate an OCL constraint you should
be able to proceed whether using UML or Ecore respresentations.

Most other facilities such as embedded OCL constraints, the Interactive
Console and OCL editors will only work on Ecore representations in
MDT/OCL 3.0.

Ecore/UML asymmetries should vanish in MDT/OCL 3.2 for Indigo.

Regards

Ed Willik


On 05/09/2010 17:26, Akhtar wrote:
> Hi,
>
> I am checking link / association between usecase and an actor.
> I did not find a way to check this. Can any provide some hints, how can
> I proceed.
>
> regards,
> Akhtar
>
Re: OCL check [message #557189 is a reply to message #557172] Sun, 05 September 2010 18:22 Go to previous messageGo to next message
Akhtar  is currently offline Akhtar
Messages: 13
Registered: April 2010
Junior Member
Hi Edward,

Thanks for the reply. I am not using Java API.
I am trying to find a way to identify the use case or actor which is not linked to actor or usecase by applying OCL query on UML meta-model using Interactive OCL console.

For example use case diagram contains:
actor1---->UC1
actor2----> UC2
actor3 no usecase connected to it

context uml::Actor
inv: self.?? ---- // actor / usecase which is not linked to other usecase or actor are not directly linked, so we can not navigate with the association or attribute property. What should I check here

I hope I have cleared my query.

Best regards,
AK
Re: OCL check [message #557203 is a reply to message #557189] Mon, 06 September 2010 01:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3846
Registered: July 2009
Senior Member
Hi Akhtar

Have you tried

self.useCase->notEmpty()

?

Regards

Ed Willink

On 05/09/2010 23:22, Akhtar wrote:
> Hi Edward,
>
> Thanks for the reply. I am not using Java API. I am trying to find a way
> to identify the use case or actor which is not linked to actor or
> usecase by applying OCL query on UML meta-model using Interactive OCL
> console.
> For example use case diagram contains:
> actor1---->UC1
> actor2----> UC2
> actor3 no usecase connected to it
>
> context uml::Actor
> inv: self.?? ---- // actor / usecase which is not linked to other
> usecase or actor are not directly linked, so we can not navigate with
> the association or attribute property. What should I check here
>
> I hope I have cleared my query.
> Best regards,
> AK
Re: OCL check [message #557255 is a reply to message #557203] Mon, 06 September 2010 05:46 Go to previous messageGo to next message
Akhtar  is currently offline Akhtar
Messages: 13
Registered: April 2010
Junior Member
Hi Edward,

I tried this query

self.useCase->notEmpty()

this query should provide result like this:
When usecase is connected to actor, it should return true otherwise false.

but when I execute use case which is connected to actor or not returns the same value false.

Best regards,
Ak
Re: OCL check [message #557314 is a reply to message #557255] Mon, 06 September 2010 11:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3846
Registered: July 2009
Senior Member
Hi Akhtar

Since you do get a result, albeit not what you expect I suggest doing
some debugging. Certainly since you have provided no real contxt, it is
for you to debug it. In these curcumstances it is surprising how often
the OCL behaviour eventually proves to be exactly right.

See what self.useCase gives.

Regards

Ed Willink


On 06/09/2010 10:46, Akhtar wrote:
> Hi Edward,
>
> I tried this query
> self.useCase->notEmpty()
>
> this query should provide result like this: When usecase is connected to
> actor, it should return true otherwise false.
>
> but when I execute use case which is connected to actor or not returns
> the same value false.
> Best regards,
> Ak
Re: OCL check [message #557338 is a reply to message #557314] Mon, 06 September 2010 17:39 Go to previous messageGo to next message
Akhtar  is currently offline Akhtar
Messages: 13
Registered: April 2010
Junior Member
Hi Ed,

I tried to explore your hint, with context usecase as well as with Actor.

context uml::UseCase
inv: self.useCase

This only returns usecase name.

I am executing queries on UML meta-model M2 layer in eclipse console. I have been just stucked with this simple query.

Is there any other way in OCL to check link between usecase and actor exists or not.

Best regards,
Ak
Re: OCL check [message #557353 is a reply to message #557338] Tue, 07 September 2010 01:27 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3846
Registered: July 2009
Senior Member
Hi Ak

I really cannot understand what you are doing, since a variety of your
statements variously do not make sense or seem impossible.

- there is no usecase to be a context
- why are you using Complete OCL in the OCL Console

-------------------

To see if there is any problem, I created a UML model comprising

Package p
Actor a
UseCase u

I then selected actor a, and evaluated

self.useCase->notEmpty()

in the OCL Console against the Ecore or UML M2 meta-model and got 'false'.

I then set a's useCase to be u and evaluated again and got 'true',
which is exactly what I would expect with the expression I suggested.

If you cannot make this work, you must describe what you are doing very
carefully and accurately so that whatever strange things yoiu are doing
can be identified.

Regards

Ed Willink


On 06/09/2010 22:39, Akhtar wrote:
> Hi Ed,
>
> I tried to explore your hint, with context usecase as well as with Actor.
>
> context uml::UseCase
> inv: self.useCase
>
> This only returns usecase name.
> I am executing queries on UML meta-model M2 layer in eclipse console. I
> have been just stucked with this simple query.
>
> Is there any other way in OCL to check link between usecase and actor
> exists or not.
>
> Best regards,
> Ak
Re: OCL check [message #557410 is a reply to message #557353] Tue, 07 September 2010 06:52 Go to previous messageGo to next message
Akhtar  is currently offline Akhtar
Messages: 13
Registered: April 2010
Junior Member
Hi Ed,

Sorry to bother you again, Still problem exists, for simplicity I have created test model to understand the problem.
- I am using Magic Draw 16.5 UML too and exported my model as an EMF ( EMF UML2 ( v2.x) XMI File. Here it is the sample file:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MagicDrawProfile="http:///schemas/MagicDrawProfile/_yb1oELppEd-GdZDkt2pGIg/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML" xsi:schemaLocation="http:///schemas/MagicDrawProfile/_yb1oELppEd-GdZDkt2pGIg/0 UML_Standard_Profile.MagicDraw_Profile.profile.uml#_ycIlfbppEd-GdZDkt2pGIg">
  <uml:Model xmi:id="eee_1045467100313_135436_1" name="Data" viewpoint="">
    <ownedComment xmi:id="_16_5_e480333_1283854775217_123429_327" body="Author:AK.&#xA;Created:9/7/10 12:19 PM.&#xA;Title:.&#xA;Comment:.&#xA;" annotatedElement="eee_1045467100313_135436_1"/>
    <packageImport xmi:id="_0primitiveTypesData">
      <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
    </packageImport>
    <packageImport xmi:id="_0javaPrimitiveTypesData">
      <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
    </packageImport>
    <packagedElement xmi:type="uml:Package" xmi:id="magicdraw_uml_standard_profile_v_0001" name="UML Standard Profile">
      <ownedComment xmi:id="_be00301_1078843546940_242228_131" body="UML Standard Profile contains several popular stereotypes, tag definitions and constraints described in UML  2 Specifications." annotatedElement="magicdraw_uml_standard_profile_v_0001"/>
    </packagedElement>
    <packagedElement xmi:type="uml:Model" xmi:id="_16_5_e480333_1283854831629_740893_486" name="System" viewpoint="">
      <packagedElement xmi:type="uml:UseCase" xmi:id="_16_5_e480333_1283854841922_899095_518" name="Buy Food"/>
      <packagedElement xmi:type="uml:UseCase" xmi:id="_16_5_e480333_1283854875136_226552_552" name="Login"/>
    </packagedElement>
    <packagedElement xmi:type="uml:Actor" xmi:id="_16_5_e480333_1283854834853_316958_498" name="Client"/>
    <packagedElement xmi:type="uml:Association" xmi:id="_16_5_e480333_1283854841938_913942_520" name="" memberEnd="_16_5_e480333_1283854841938_181138_521 _16_5_e480333_1283854841938_201578_522" navigableOwnedEnd="_16_5_e480333_1283854841938_181138_521 _16_5_e480333_1283854841938_201578_522">
      <ownedEnd xmi:id="_16_5_e480333_1283854841938_181138_521" name="" visibility="private" type="_16_5_e480333_1283854841922_899095_518" association="_16_5_e480333_1283854841938_913942_520"/>
      <ownedEnd xmi:id="_16_5_e480333_1283854841938_201578_522" name="" visibility="private" type="_16_5_e480333_1283854834853_316958_498" association="_16_5_e480333_1283854841938_913942_520"/>
    </packagedElement>
    <packagedElement xmi:type="uml:Actor" xmi:id="_16_5_e480333_1283854865243_698153_534" name="Admin"/>
    <profileApplication xmi:id="_11_5_f720368_1159529670215_231387_1profileApplicationData">
      <eAnnotations xmi:id="_ycSVeLppEd-GdZDkt2pGIg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="UML_Standard_Profile.Validation_Profile.profile.uml#_ycInZ7ppEd-GdZDkt2pGIg"/>
      </eAnnotations>
      <appliedProfile href="UML_Standard_Profile.Validation_Profile.profile.uml#_11_5_f720368_1159529670215_231387_1"/>
    </profileApplication>
    <profileApplication xmi:id="_9_0_be00301_1108050582343_527400_10847profileApplicationData">
      <eAnnotations xmi:id="_yccFAbppEd-GdZDkt2pGIg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="UML_Standard_Profile.UML_Standard_Profile.profile.uml#_ycIj07ppEd-GdZDkt2pGIg"/>
      </eAnnotations>
      <appliedProfile href="UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_be00301_1108050582343_527400_10847"/>
    </profileApplication>
    <profileApplication xmi:id="_be00301_1073394351331_445580_2profileApplicationData">
      <eAnnotations xmi:id="_yccFA7ppEd-GdZDkt2pGIg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="UML_Standard_Profile.MagicDraw_Profile.profile.uml#_ycIlfbppEd-GdZDkt2pGIg"/>
      </eAnnotations>
      <appliedProfile href="UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_1073394351331_445580_2"/>
    </profileApplication>
    <profileApplication xmi:id="_11_5_be00301_1153310565718_226811_161profileApplicationData">
      <eAnnotations xmi:id="_yccFBbppEd-GdZDkt2pGIg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.profile.uml#_ycIjArppEd-GdZDkt2pGIg"/>
      </eAnnotations>
      <appliedProfile href="UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.profile.uml#_11_5_be00301_1153310565718_226811_161"/>
    </profileApplication>
  </uml:Model>
  <MagicDrawProfile:useCaseModel xmi:id="_yhVzO7ppEd-GdZDkt2pGIg" base_Model="_16_5_e480333_1283854831629_740893_486"/>
  <MagicDrawProfile:auxiliaryResource xmi:id="_yhVzPLppEd-GdZDkt2pGIg" base_Element="magicdraw_uml_standard_profile_v_0001" base_Package="magicdraw_uml_standard_profile_v_0001"/>
</xmi:XMI>
 


- Model conatins two actors ( Admin and Client) and two usecases ( Login and Buy Food)
- Clinet is associated with the Buy Food but actor Admin and usecase Login have no connection at all both are isolated elements.
- Now I have to identify which actor or usecase does not have any association/ link or not connected with eachother.

- I select actor Admin and run self.useCase->notEmpty() but the result was false ( expected result was true)
- again I run same query on another actor Client, the result was false ( expected result was also false)

What do you think, where is the problem, is it in the model or in the query itself.

Best regards,
Ak
Re: OCL check [message #557491 is a reply to message #557410] Tue, 07 September 2010 13:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3846
Registered: July 2009
Senior Member
Hi Akhtar

Your example uses non-Eclipse profiles which you don't supply.

I deleted them so the your moderl validates.

Both actors have empty Actor.useCase features, so it is not surprising
that use of useCase in an expression returns 'empty' consistently.

You have used an Association between your Actor and UseCase so you must
navigate the association, or more likely you should use the correct
MagicDraw technique for defining/exporting your 'association'.

Regards

Ed Willink




On 07/09/2010 11:52, Akhtar wrote:
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:MagicDrawProfile="http:///schemas/MagicDrawProfile/_yb1oELppEd-GdZDkt2pGIg/0"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xsi:schemaLocation="http:///schemas/MagicDrawProfile/_yb1oELppEd-GdZDkt2pGIg/0
> UML_Standard_Profile.MagicDraw_Profile.profile.uml#_ycIlfbpp Ed-GdZDkt2pGIg ">
>
> <uml:Model xmi:id="eee_1045467100313_135436_1" name="Data" viewpoint="">
> <ownedComment xmi:id="_16_5_e480333_1283854775217_123429_327"
> body="Author:AK.
> Created:9/7/10 12:19 PM.
> Title:.
> Comment:.
> " annotatedElement="eee_1045467100313_135436_1"/>
> <packageImport xmi:id="_0primitiveTypesData">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypesData">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Package"
> xmi:id="magicdraw_uml_standard_profile_v_0001" name="UML Standard Profile">
> <ownedComment xmi:id="_be00301_1078843546940_242228_131" body="UML
> Standard Profile contains several popular stereotypes, tag definitions
> and constraints described in UML 2 Specifications."
> annotatedElement="magicdraw_uml_standard_profile_v_0001"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Model"
> xmi:id="_16_5_e480333_1283854831629_740893_486" name="System" viewpoint="">
> <packagedElement xmi:type="uml:UseCase"
> xmi:id="_16_5_e480333_1283854841922_899095_518" name="Buy Food"/>
> <packagedElement xmi:type="uml:UseCase"
> xmi:id="_16_5_e480333_1283854875136_226552_552" name="Login"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Actor"
> xmi:id="_16_5_e480333_1283854834853_316958_498" name="Client"/>
> <packagedElement xmi:type="uml:Association"
> xmi:id="_16_5_e480333_1283854841938_913942_520" name=""
> memberEnd="_16_5_e480333_1283854841938_181138_521
> _16_5_e480333_1283854841938_201578_522"
> navigableOwnedEnd="_16_5_e480333_1283854841938_181138_521
> _16_5_e480333_1283854841938_201578_522">
> <ownedEnd xmi:id="_16_5_e480333_1283854841938_181138_521" name=""
> visibility="private" type="_16_5_e480333_1283854841922_899095_518"
> association="_16_5_e480333_1283854841938_913942_520"/>
> <ownedEnd xmi:id="_16_5_e480333_1283854841938_201578_522" name=""
> visibility="private" type="_16_5_e480333_1283854834853_316958_498"
> association="_16_5_e480333_1283854841938_913942_520"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Actor"
> xmi:id="_16_5_e480333_1283854865243_698153_534" name="Admin"/>
> <profileApplication
> xmi:id="_11_5_f720368_1159529670215_231387_1profileApplicationData ">
> <eAnnotations xmi:id="_ycSVeLppEd-GdZDkt2pGIg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.Validation_Profile.profile.uml#_ycInZ7p pEd-GdZDkt2pGIg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.Validation_Profile.profile.uml#_11_5_f7 20368_1159529670215_231387_1 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id=" _9_0_be00301_1108050582343_527400_10847profileApplicationDat a ">
> <eAnnotations xmi:id="_yccFAbppEd-GdZDkt2pGIg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_ycIj0 7ppEd-GdZDkt2pGIg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.UML_Standard_Profile.profile.uml#_9_0_b e00301_1108050582343_527400_10847 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id="_be00301_1073394351331_445580_2profileApplicationData ">
> <eAnnotations xmi:id="_yccFA7ppEd-GdZDkt2pGIg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_ycIlfbpp Ed-GdZDkt2pGIg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.MagicDraw_Profile.profile.uml#_be00301_ 1073394351331_445580_2 "/>
>
> </profileApplication>
> <profileApplication
> xmi:id=" _11_5_be00301_1153310565718_226811_161profileApplicationData ">
> <eAnnotations xmi:id="_yccFBbppEd-GdZDkt2pGIg"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_ycIjArppEd-GdZDkt2pGIg "/>
>
> </eAnnotations>
> <appliedProfile
> href=" UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.pro file.uml#_11_5_be00301_1153310565718_226811_161 "/>
>
> </profileApplication>
> </uml:Model>
> <MagicDrawProfile:useCaseModel xmi:id="_yhVzO7ppEd-GdZDkt2pGIg"
> base_Model="_16_5_e480333_1283854831629_740893_486"/>
> <MagicDrawProfile:auxiliaryResource xmi:id="_yhVzPLppEd-GdZDkt2pGIg"
> base_Element="magicdraw_uml_standard_profile_v_0001"
> base_Package="magicdraw_uml_standard_profile_v_0001"/>
> </xmi:XMI>
>
>
Re: OCL check [message #557507 is a reply to message #557491] Tue, 07 September 2010 17:02 Go to previous message
Akhtar  is currently offline Akhtar
Messages: 13
Registered: April 2010
Junior Member
Thanks Ed,

I navigate the association and got the required result with following query.

context UseCase
inv: Association.allInstances().getEndTypes()->includes(self)

Best regards,
Akhtar
Previous Topic:[Announce] MDT/OCL 3.0.1 SR RC3 is now available
Next Topic:Some OCL beginner questions
Goto Forum:
  


Current Time: Thu Apr 24 01:30:20 EDT 2014

Powered by FUDForum. Page generated in 0.38770 seconds