Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » uml:Extension support
uml:Extension support [message #1274390] Fri, 21 March 2014 12:01 Go to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 59
Registered: August 2013
Member
There is an OCL invariant in my profile:
let standardId : String = getValue(getAppliedStereotype('EECProfile::EECDataModel'), 'standardId').oclAsType(String) in
let ss : Package = allOwningPackages()->any(getAppliedStereotype('EECProfile::NamespaceSubset') <> null) in
standardId <> null and standardId.size() > 0 and ss <> null
implies
standardId.substring(1, 8) = ss.oclAsType(Package).extension_EECDataModel.standardId.concat('-')


It works fine in Rational Software Architect. But Eclipse OCL parsers says:
Unrecognized variable: (extension_EECDataModel)

extension_EECDataModel is an association between uml:Package and EECDataModel (uml:Stereotype):
    <packagedElement xmi:type="uml:Stereotype" xmi:id="_QhZAwPQoEeK4sawTC9jIzA" name="EECDataModel">
      <ownedAttribute xmi:id="_xnYL0P2MEeK7ttZiuYmhaw" name="base_Package" association="_xnWWoP2MEeK7ttZiuYmhaw">
        <eAnnotations xmi:id="_6wTfMP2MEeK7ttZiuYmhaw" source="uml2.extensions">
          <details xmi:id="_6wTfMf2MEeK7ttZiuYmhaw" key="addedInVersion" value="205"/>
        </eAnnotations>
        <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Package"/>
      </ownedAttribute>
    </packagedElement>
...
    <packagedElement xmi:type="uml:Extension" xmi:id="_xnWWoP2MEeK7ttZiuYmhaw" name="Package_EECDataModel" memberEnd="_xnW9sP2MEeK7ttZiuYmhaw _xnYL0P2MEeK7ttZiuYmhaw">
      <eAnnotations xmi:id="_6wUGQv2MEeK7ttZiuYmhaw" source="uml2.extensions">
        <details xmi:id="_6wUGQ_2MEeK7ttZiuYmhaw" key="addedInVersion" value="205"/>
      </eAnnotations>
      <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_xnW9sP2MEeK7ttZiuYmhaw" name="extension_EECDataModel" type="_QhZAwPQoEeK4sawTC9jIzA" aggregation="composite" association="_xnWWoP2MEeK7ttZiuYmhaw">
        <eAnnotations xmi:id="_6wUGRP2MEeK7ttZiuYmhaw" source="uml2.extensions">
          <details xmi:id="_6wUGRf2MEeK7ttZiuYmhaw" key="addedInVersion" value="205"/>
        </eAnnotations>
        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_xnXkwP2MEeK7ttZiuYmhaw" value="1">
          <eAnnotations xmi:id="_6wUGRv2MEeK7ttZiuYmhaw" source="uml2.extensions">
            <details xmi:id="_6wUGR_2MEeK7ttZiuYmhaw" key="addedInVersion" value="205"/>
          </eAnnotations>
        </lowerValue>
      </ownedEnd>
    </packagedElement>


Is there a work around to add a support for such associations? It's very strange that it works in RSA... I think it use Eclipse OCL too.
Re: uml:Extension support [message #1274393 is a reply to message #1274390] Fri, 21 March 2014 12:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4086
Registered: July 2009
Senior Member
HI

Which Eclipse OCL, which RSA? RSA can be quite some way behind.

Which Eclipse UML?

Where is the useable repro?

Regards

Ed Willink

On 21/03/2014 12:01, Denis Nikiforov wrote:
> There is an OCL invariant in my profile:
> let standardId : String =
> getValue(getAppliedStereotype('EECProfile::EECDataModel'),
> 'standardId').oclAsType(String) in
> let ss : Package =
> allOwningPackages()->any(getAppliedStereotype('EECProfile::NamespaceSubset')
> <> null) in
> standardId <> null and standardId.size() > 0 and ss <> null
> implies
> standardId.substring(1, 8) =
> ss.oclAsType(Package).extension_EECDataModel.standardId.concat('-')
>
> It works fine in Rational Software Architect. But Eclipse OCL parsers
> says:
> Unrecognized variable: (extension_EECDataModel)
>
> extension_EECDataModel is an association between uml:Package and
> EECDataModel (uml:Stereotype):
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_QhZAwPQoEeK4sawTC9jIzA" name="EECDataModel">
> <ownedAttribute xmi:id="_xnYL0P2MEeK7ttZiuYmhaw"
> name="base_Package" association="_xnWWoP2MEeK7ttZiuYmhaw">
> <eAnnotations xmi:id="_6wTfMP2MEeK7ttZiuYmhaw"
> source="uml2.extensions">
> <details xmi:id="_6wTfMf2MEeK7ttZiuYmhaw"
> key="addedInVersion" value="205"/>
> </eAnnotations>
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Package"/>
> </ownedAttribute>
> </packagedElement>
> ...
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_xnWWoP2MEeK7ttZiuYmhaw" name="Package_EECDataModel"
> memberEnd="_xnW9sP2MEeK7ttZiuYmhaw _xnYL0P2MEeK7ttZiuYmhaw">
> <eAnnotations xmi:id="_6wUGQv2MEeK7ttZiuYmhaw"
> source="uml2.extensions">
> <details xmi:id="_6wUGQ_2MEeK7ttZiuYmhaw" key="addedInVersion"
> value="205"/>
> </eAnnotations>
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_xnW9sP2MEeK7ttZiuYmhaw" name="extension_EECDataModel"
> type="_QhZAwPQoEeK4sawTC9jIzA" aggregation="composite"
> association="_xnWWoP2MEeK7ttZiuYmhaw">
> <eAnnotations xmi:id="_6wUGRP2MEeK7ttZiuYmhaw"
> source="uml2.extensions">
> <details xmi:id="_6wUGRf2MEeK7ttZiuYmhaw"
> key="addedInVersion" value="205"/>
> </eAnnotations>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_xnXkwP2MEeK7ttZiuYmhaw" value="1">
> <eAnnotations xmi:id="_6wUGRv2MEeK7ttZiuYmhaw"
> source="uml2.extensions">
> <details xmi:id="_6wUGR_2MEeK7ttZiuYmhaw"
> key="addedInVersion" value="205"/>
> </eAnnotations>
> </lowerValue>
> </ownedEnd>
> </packagedElement>
>
> Is there a work around to add a support for such associations? It's
> very strange that it works in RSA... I think it use Eclipse OCL too.
Re: uml:Extension support [message #1274403 is a reply to message #1274393] Fri, 21 March 2014 12:24 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 59
Registered: August 2013
Member
Eclipse OCL and UML from latest Luna milestone.

RSA 7.5, 8.5, 9.

The model is here: https://github.com/AresEkb/uml2xsd/tree/master/model

EECProfile.profile.uml - profile
TTDataModel.uml - model
Re: uml:Extension support [message #1274548 is a reply to message #1274403] Fri, 21 March 2014 16:19 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4086
Registered: July 2009
Senior Member
Hi

OK. I've got the model (and no-EMFText errors), but no idea how to
reproduce your problem. You didn't even tell me where the invariant is.

I presume some form of interactive validate/evaluation would demonstrate
the issue.

Have another read of: https://wiki.eclipse.org/OCL/ForumNetiquette

Regards

Ed Willink


On 21/03/2014 12:24, Denis Nikiforov wrote:
> Eclipse OCL and UML from latest Luna milestone.
>
> RSA 7.5, 8.5, 9.
>
> The model is here: https://github.com/AresEkb/uml2xsd/tree/master/model
>
> EECProfile.profile.uml - profile
> TTDataModel.uml - model
Re: uml:Extension support [message #1274583 is a reply to message #1274548] Fri, 21 March 2014 17:19 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 59
Registered: August 2013
Member
Hi

Excuse me for non-netiquette. To reproduce the error you can
1) open TTDataModel.uml in Eclipse (with UML Model Editor),
2) select any object with a EECDataModel stereotype (for example first package owned by the Model - BusinessAreas)
3) open OCL console (Context Menu -> OCL -> Show OCL Console)
4) copy/paste/execute the OCL-constraint:
let standardId : String = getValue(getAppliedStereotype('EECProfile::EECDataModel'), 'standardId').oclAsType(String) in
let ss : Package = allOwningPackages()->any(getAppliedStereotype('EECProfile::NamespaceSubset') <> null) in
standardId <> null and standardId.size() > 0 and ss <> null
implies
standardId.substring(1, 8) = ss.oclAsType(Package).extension_EECDataModel.standardId.concat('-')


After that I get the error:
Unrecognized variable: (extension_EECDataModel)


Also you can try to run uml2xsd package as a Java Application from Eclipse. It will try to validate the constraints programmatically and will show the same error. uml2xsd depends on https://github.com/AresEkb/EMFTextXPath2 . I think EMFText itself isn't needed.


The constraint is owned by a EECDataModel stereotype in EECProfile.profile.uml. The name of the owned rule is EEC702.
Re: uml:Extension support [message #1275779 is a reply to message #1274583] Sun, 23 March 2014 16:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4086
Registered: July 2009
Senior Member
Hi

Thanks for the repro. Long overdue for something horribly complicated
that isn't UML itself.

---

A problem for Pivot OCL is that you reuse TTDataModel as a fourth level
package inside a first level package.

This is probably illegal but certainly poor practice. Once UML and OCL
WFRs have been refined it may be more than probably.

The Pivot OCL merges same-NsURI packages, and in the absence of NsURIs
merges same-named packages.

---

Beyond that I suspect that the problem is that Eclipse UML 5.0.0 with
UML 2.5 support has changed some namespaces. I'm investigating.

Regards

Ed Willink

On 21/03/2014 17:19, Denis Nikiforov wrote:
> Hi
>
> Excuse me for non-netiquette. To reproduce the error you can
> 1) open TTDataModel.uml in Eclipse (with UML Model Editor),
> 2) select any object with a EECDataModel stereotype (for example first
> package owned by the Model - BusinessAreas)
> 3) open OCL console (Context Menu -> OCL -> Show OCL Console)
> 4) copy/paste/execute the OCL-constraint:
> let standardId : String =
> getValue(getAppliedStereotype('EECProfile::EECDataModel'),
> 'standardId').oclAsType(String) in
> let ss : Package =
> allOwningPackages()->any(getAppliedStereotype('EECProfile::NamespaceSubset')
> <> null) in
> standardId <> null and standardId.size() > 0 and ss <> null
> implies
> standardId.substring(1, 8) =
> ss.oclAsType(Package).extension_EECDataModel.standardId.concat('-')
>
> After that I get the error:
> Unrecognized variable: (extension_EECDataModel)
>
>
> Also you can try to run uml2xsd package as a Java Application from
> Eclipse. It will try to validate the constraints programmatically and
> will show the same error. uml2xsd depends on
> https://github.com/AresEkb/EMFTextXPath2 . I think EMFText itself
> isn't needed.
>
>
> The constraint is owned by a EECDataModel stereotype in
> EECProfile.profile.uml. The name of the owned rule is EEC702.
Re: uml:Extension support [message #1275790 is a reply to message #1274390] Sun, 23 March 2014 16:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4086
Registered: July 2009
Senior Member
Hi

I think you are getting your metalevels confused.

On 21/03/2014 12:01, Denis Nikiforov wrote:
> There is an OCL invariant in my profile:
> ... ss.oclAsType(Package).extension_EECDataModel
>
> It works fine in Rational Software Architect. But Eclipse OCL parsers
> says:
> Unrecognized variable: (extension_EECDataModel)
>
> extension_EECDataModel is an association between uml:Package and
> EECDataModel (uml:Stereotype):

No it's an Extension to the BusinessAreas type whose (meta)type is Package.

On 21/03/2014 17:19, Denis Nikiforov wrote:
>
> 1) open TTDataModel.uml in Eclipse (with UML Model Editor),
> 2) select any object with a EECDataModel stereotype (for example first
> package owned by the Model - BusinessAreas)
which is a Package not a BusinessAreas
> 3) open OCL console (Context Menu -> OCL -> Show OCL Console)
> 4) copy/paste/execute the OCL-constraint:
> let standardId : String =
> getValue(getAppliedStereotype('EECProfile::EECDataModel'),
> 'standardId').oclAsType(String) in
> let ss : Package =
> allOwningPackages()->any(getAppliedStereotype('EECProfile::NamespaceSubset')
> <> null) in
> standardId <> null and standardId.size() > 0 and ss <> null
> implies
> standardId.substring(1, 8) =
> ss.oclAsType(Package).extension_EECDataModel.standardId.concat('-')
>
> After that I get the error:
> Unrecognized variable: (extension_EECDataModel)
Since this is an extension to BusinessAreas not to Package.

Regards

Ed Willink
Re: uml:Extension support [message #1276189 is a reply to message #1275790] Mon, 24 March 2014 07:57 Go to previous message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 59
Registered: August 2013
Member
Thanks!

I've renamed TTDataModel package to distinguish it from the model itself. And it works in OCL 4.1.1.v20140210-1137 and UML 4.1.2.v20140202-2055!

(I don't insist on this point, but I don't think that it's wrong to have multiple same-named packages within one model. It's only wrong to have multiple indistinguishable objects within one namespace (same-named packages owned by one package, same-named properties owned by one class, ...). Maybe packages must be merged by a fully qualified names?)

But it still doesn't work in OCL and UML 5.

Is it wrong to use extension_EECDataModel or is there something broken in UML and OCL 5? What is a right way to access the extension? According to your last message uml:Package doesn't have an extension_EECDataModel association and instead of
pkg.extension_EECDataModel.standardId
I should write:
pkg.getValue(getAppliedStereotype('EECProfile::EECDataModel'), 'standardId').oclAsType(String)

But the former works in UML/OCL 4 and also here is an example of an extension_* usage (lines 2397, 2404, ...):
http://www1.unece.org/cefact/platform/download/attachments/44204303/Specification_UMM_Base_Module_V2.0_TechnicalSpecification.pdf

And also I think that once extension_EECDataModel is defined in a model it should be accessible somehow.
Previous Topic:OCL binding for UML-like metamodel
Next Topic:mdt/ocl or emf query/ocl?
Goto Forum:
  


Current Time: Mon Oct 20 13:15:02 GMT 2014

Powered by FUDForum. Page generated in 0.05977 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software