Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » [CompleteOCL] getValue of property direction of FlowPort
[CompleteOCL] getValue of property direction of FlowPort [message #1066767] Thu, 04 July 2013 09:42 Go to next message
Ba sti is currently offline Ba stiFriend
Messages: 18
Registered: February 2013
Junior Member
Hi,

i´m trying to validate a UML-model with a completeOCL-file and i need to group all FlowPorts that are owned by one Class in order of their direction. Therefore i need to compare the value of the property "direction" with each other, but when i call
self.getValue(self.getAppliedStereotype('SysML::PortAndFlows::FlowPort'),'direction').oclIsUndefined()

i always get true as the result. But changing this code to
self.getValue(self.getAppliedStereotype('SysML::PortAndFlows::FlowPort'),'base_Port').oclIsUndefined()

or to any other name of a property of flowport, i get false as the result..

so what is so special about the property "direction"?

for the validation i´m using the CompleteOCLEObjectValidator in Kepler release.
so here is my ocl-file for testing the getValue-method:
import uml: 'http://www.eclipse.org/uml2/4.0.0/UML#/'
import 'http://www.eclipse.org/papyrus/0.7.0/SysML#/'

context uml::Port

inv test ('blub'):
let stereo: Stereotype = self.getAppliedStereotype('SysML::PortAndFlows::FlowPort')
in not stereo.oclIsUndefined() implies not self.getValue(stereo,'direction').oclIsUndefined()

and here is the initialization of my Validator:
		CompleteOCLEObjectValidator val = new TestValidator(UMLPackage.eINSTANCE,ocluri);
		EValidator.Registry.INSTANCE.put(UMLPackage.eINSTANCE,val);
		EValidator.Registry.INSTANCE.put(SysmlPackage.eINSTANCE,val);
		EValidator.Registry.INSTANCE.put(EcorePackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(BlocksPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(PortandflowsPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(ModelelementsPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(ConstraintsPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(ActivitiesPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(AllocationsPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(RequirementsPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(UsecasesPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(StatemachinesPackage.eINSTANCE, val);
		EValidator.Registry.INSTANCE.put(InteractionsPackage.eINSTANCE, val);
		Diagnostic diag = Diagnostician.INSTANCE.validate(m);


best regards,
Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1066773 is a reply to message #1066767] Thu, 04 July 2013 10:17 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
HI

getValue() and getAppliedStereotype() are part of the Java API and so
they lose type information. In particular getValue() return an Object
that causes trouble when the return is a Collection.

CompleteOCLEObjectValidator tells me that you are using the new Pivot
support that allows modeled access to stereotypes.

Have you tried

self.extension_FlowPort.direction

Regards

Ed Willink

On 04/07/2013 10:42, Ba sti wrote:
> Hi,
>
> i´m trying to validate a UML-model with a completeOCL-file and i need
> to group all FlowPorts that are owned by one Class in order of their
> direction. Therefore i need to compare the value of the property
> "direction" with each other, but when i call
> self.getValue(self.getAppliedStereotype('SysML::PortAndFlows::FlowPort'),'direction').oclIsUndefined()
>
> i always get true as the result. But changing this code to
>
> self.getValue(self.getAppliedStereotype('SysML::PortAndFlows::FlowPort'),'base_Port').oclIsUndefined()
>
>
> or to any other name of a property of flowport, i get false as the
> result..
>
> so what is so special about the property "direction"?
>
> for the validation i´m using the CompleteOCLEObjectValidator in Kepler
> release.
> so here is my ocl-file for testing the getValue-method:
>
> import uml: 'http://www.eclipse.org/uml2/4.0.0/UML#/'
> import 'http://www.eclipse.org/papyrus/0.7.0/SysML#/'
>
> context uml::Port
>
> inv test ('blub'):
> let stereo: Stereotype =
> self.getAppliedStereotype('SysML::PortAndFlows::FlowPort')
> in not stereo.oclIsUndefined() implies not
> self.getValue(stereo,'direction').oclIsUndefined()
>
> and here is the initialization of my Validator:
>
> CompleteOCLEObjectValidator val = new
> TestValidator(UMLPackage.eINSTANCE,ocluri);
> EValidator.Registry.INSTANCE.put(UMLPackage.eINSTANCE,val);
> EValidator.Registry.INSTANCE.put(SysmlPackage.eINSTANCE,val);
> EValidator.Registry.INSTANCE.put(EcorePackage.eINSTANCE, val);
> EValidator.Registry.INSTANCE.put(BlocksPackage.eINSTANCE, val);
>
> EValidator.Registry.INSTANCE.put(PortandflowsPackage.eINSTANCE, val);
>
> EValidator.Registry.INSTANCE.put(ModelelementsPackage.eINSTANCE, val);
> EValidator.Registry.INSTANCE.put(ConstraintsPackage.eINSTANCE,
> val);
> EValidator.Registry.INSTANCE.put(ActivitiesPackage.eINSTANCE,
> val);
> EValidator.Registry.INSTANCE.put(AllocationsPackage.eINSTANCE,
> val);
>
> EValidator.Registry.INSTANCE.put(RequirementsPackage.eINSTANCE, val);
> EValidator.Registry.INSTANCE.put(UsecasesPackage.eINSTANCE, val);
>
> EValidator.Registry.INSTANCE.put(StatemachinesPackage.eINSTANCE, val);
>
> EValidator.Registry.INSTANCE.put(InteractionsPackage.eINSTANCE, val);
> Diagnostic diag = Diagnostician.INSTANCE.validate(m);
>
>
> best regards,
> Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1066832 is a reply to message #1066773] Thu, 04 July 2013 14:47 Go to previous messageGo to next message
Ba sti is currently offline Ba stiFriend
Messages: 18
Registered: February 2013
Junior Member
hi,

thanks for your answer.

i´m not able to perform this extension-method at the moment..
the method seems to be not declared for uml::Port

what changes are necessary to be able to use this special pivot methods?
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1066833 is a reply to message #1066832] Thu, 04 July 2013 14:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The extension_ properties are declared whenever stereotypes exist. It
should just work.

Post a zipped project.

Regards

Ed Willink

On 04/07/2013 15:47, Ba sti wrote:
> hi,
>
> thanks for your answer.
>
> i´m not able to perform this extension-method at the moment..
> the method seems to be not declared for uml::Port
>
> what changes are necessary to be able to use this special pivot methods?
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1067575 is a reply to message #1066833] Tue, 09 July 2013 11:59 Go to previous messageGo to next message
Ba sti is currently offline Ba stiFriend
Messages: 18
Registered: February 2013
Junior Member
hi,

here is my zipped project with an example model and ocl-file

thanks for your help!

Regards,
Basti
  • Attachment: example.zip
    (Size: 11.67KB, Downloaded 233 times)
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1067788 is a reply to message #1067575] Wed, 10 July 2013 15:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Thanks. extension_FlowPort doesn't work because the Ecore models in use
do not have the required stereotype applications.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=412680 raised.

Thanks again. The evaluation of 'direction' is special, in that it
partially succeeds, but uses a Java enumeration that is statically types
as EJavaObject for which the type rediscovery code has a missing case
resulting in an UnsupportedOperationException.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=412685 raised.

Regards

Ed Willink

On 09/07/2013 12:59, Ba sti wrote:
> hi,
>
> here is my zipped project with an example model and ocl-file
>
> thanks for your help!
>
> Regards,
> Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1243087 is a reply to message #1067788] Mon, 10 February 2014 13:54 Go to previous messageGo to next message
Ba sti is currently offline Ba stiFriend
Messages: 18
Registered: February 2013
Junior Member
Hi,

as I can see, one of theses bugs has been resolved so far. But for me it´s still not possible to access the value of this Property. I got the following Exception:
Exception in thread "main" org.eclipse.ocl.examples.domain.values.impl.InvalidValueException: Unknown enumeration out
	at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOfEnumerator(AbstractIdResolver.java:372)
	at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:308)
	at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:325)
	at org.eclipse.ocl.examples.pivot.library.EInvokeOperation.getResultValue(EInvokeOperation.java:117)
	at org.eclipse.ocl.examples.pivot.library.EInvokeOperation.evaluate(EInvokeOperation.java:101)
	at org.eclipse.ocl.examples.domain.library.AbstractPolyOperation.evaluate(AbstractPolyOperation.java:39)
	at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitOperationCallExp(EvaluationVisitorImpl.java:744)
	at org.eclipse.ocl.examples.pivot.internal.impl.OperationCallExpImpl.accept(OperationCallExpImpl.java:433)
	at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitOperationCallExp(EvaluationVisitorImpl.java:643)
	at org.eclipse.ocl.examples.pivot.internal.impl.OperationCallExpImpl.accept(OperationCallExpImpl.java:433)
	at org.eclipse.ocl.examples.pivot.utilities.QueryImpl.evaluate(QueryImpl.java:197)
	at Example.doWork(Example.java:103)
	at Example.main(Example.java:79)

I´m using Kepler 4.3.1 with the latest nightly build of the ocl part.

I have added a small example that represents my problem.

best Regards,
Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1243319 is a reply to message #1243087] Mon, 10 February 2014 20:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your example project has numerous compilation errors.

Regards

Ed Willink


On 10/02/2014 13:54, Ba sti wrote:
> Hi,
>
> as I can see, one of theses bugs has been resolved so far. But for me it´s still not possible to access the value of this Property. I got the following Exception:
> Exception in thread "main" org.eclipse.ocl.examples.domain.values.impl.InvalidValueException: Unknown enumeration out
> at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOfEnumerator(AbstractIdResolver.java:372)
> at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:308)
> at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:325)
> at org.eclipse.ocl.examples.pivot.library.EInvokeOperation.getResultValue(EInvokeOperation.java:117)
> at org.eclipse.ocl.examples.pivot.library.EInvokeOperation.evaluate(EInvokeOperation.java:101)
> at org.eclipse.ocl.examples.domain.library.AbstractPolyOperation.evaluate(AbstractPolyOperation.java:39)
> at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitOperationCallExp(EvaluationVisitorImpl.java:744)
> at org.eclipse.ocl.examples.pivot.internal.impl.OperationCallExpImpl.accept(OperationCallExpImpl.java:433)
> at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitOperationCallExp(EvaluationVisitorImpl.java:643)
> at org.eclipse.ocl.examples.pivot.internal.impl.OperationCallExpImpl.accept(OperationCallExpImpl.java:433)
> at org.eclipse.ocl.examples.pivot.utilities.QueryImpl.evaluate(QueryImpl.java:197)
> at Example.doWork(Example.java:103)
> at Example.main(Example.java:79)
> I´m using Kepler 4.3.1 with the latest nightly build of the ocl part.
>
> I have added a small example that represents my problem.
>
> best Regards,
> Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1243603 is a reply to message #1243319] Tue, 11 February 2014 07:25 Go to previous messageGo to next message
Ba sti is currently offline Ba stiFriend
Messages: 18
Registered: February 2013
Junior Member
hi,

several compilation errors?
I´m sorry, there are no erros in my workbench.
Could it be that these errors are some unresolved jar-files?
I´m using the newest jar-files for ocl stuff. Otherwise i have no idea what´s the problem.
Should I post this example again with the normal kepler 4.3.1 jars?

regards,

Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1243631 is a reply to message #1243603] Tue, 11 February 2014 08:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There is no MANIFEST.MF!

Regards

Ed Willink

On 11/02/2014 07:25, Ba sti wrote:
> hi,
>
> several compilation errors?
> I´m sorry, there are no erros in my workbench.
> Could it be that these errors are some unresolved jar-files?
> I´m using the newest jar-files for ocl stuff. Otherwise i have no idea
> what´s the problem.
> Should I post this example again with the normal kepler 4.3.1 jars?
>
> regards,
>
> Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1243662 is a reply to message #1243631] Tue, 11 February 2014 09:17 Go to previous messageGo to next message
Ba sti is currently offline Ba stiFriend
Messages: 18
Registered: February 2013
Junior Member
hi,

sorry, I didn´t know that it´s necessary to have a Manifest.mf for a java project.
The last time i posted an example, it had worked without it.

So I´ve added it now, but it includes only one line, so i don´t know if this is better.
If not please tell me what i should do.

regards,
Basti


edit---------
added generated Manifest.mf from export runnable jar

[Updated on: Tue, 11 February 2014 10:00]

Report message to a moderator

Re: [CompleteOCL] getValue of property direction of FlowPort [message #1244486 is a reply to message #1243662] Wed, 12 February 2014 12:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

An empty manifest doesn't help.

If you use a manifest for an Eclipse plugin, Eclipse computes the class
path automaticalkly, so that I don't have to correct the details in your
..classpath file.

The manifest just needs to specify

Require-Bundle: org.eclipse.papyrus.sysml,
org.eclipse.ocl.examples.xtext.oclstdlib,
org.eclipse.ocl.examples.xtext.completeocl,
org.eclipse.ocl.examples.xtext.oclinecore,
org.eclipse.emf.mapping.ecore2xml,
org.eclipse.uml2.uml.resources

and the .classpath shrinks to

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

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

The problem is that

self.getValue(self.getAppliedStereotype('SysML::PortAndFlows::FlowPort'), 'direction')

uses SysML without ever actually using SysML until an Enumerator needs
processing. Enumerator are an over-optimized EMF feature, since they
have no container to identify their Enumeration, consequently converting
them to a rational world requires an index all enumerators in the world
approach, and the world does not include SysML.

A trivial solution might be to just have a dummy query that explicitly
uses a SysML class.

More sensible would be to use a typed navigation such as

self.extension_FlowPort.direction

However the SysML model seems to be resisting my attempts to load it, so
await a further reply.

Regards

Ed Willink



On 11/02/2014 09:17, Ba sti wrote:
> hi,
>
> sorry, I didn´t know that it´s necessary to have a Manifest.mf for a java project.
> The last time i posted an example, it had worked without it.
>
> So I´ve added it now, but it includes only one line, so i don´t know if this is better.
> If not please tell me what i should do.
>
> regards,
> Basti
Re: [CompleteOCL] getValue of property direction of FlowPort [message #1244494 is a reply to message #1244486] Wed, 12 February 2014 12:19 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It's bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=411614.

I'll try and have a look next week.

Regards

Ed Willink


On 12/02/2014 12:04, Ed Willink wrote:
> However the SysML model seems to be resisting my attempts to load it,
> so await a further reply.
>
Previous Topic:Imact Analyzer + Code Generation
Next Topic:ecore & ocl generated classes: ExceptionInInitializerError
Goto Forum:
  


Current Time: Thu Apr 25 11:31:21 GMT 2024

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

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

Back to the top