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 |
Ba sti 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 |
Ed Willink Messages: 7670 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 #1244486 is a reply to message #1243662] |
Wed, 12 February 2014 12:04 |
Ed Willink Messages: 7670 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
|
|
| |
Goto Forum:
Current Time: Thu Sep 26 10:51:11 GMT 2024
Powered by FUDForum. Page generated in 0.06112 seconds
|