Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » getStereotype() always return "invariant"
getStereotype() always return "invariant" [message #1125521] Fri, 04 October 2013 12:00 Go to next message
John Guerson is currently offline John Guerson
Messages: 46
Registered: August 2011
Member
Hi,
From what I have tested (kepler and the OCL 4.2.0 build) the method PivotUtil.getStereotype(constraint) is always returning "invariant".

OCL Document:
context RoadTrafficAccident::fatalvictims:Integer
derive: self.victims->select(d|d.oclIsKindOf(DeceasedPerson))->size()

getStereotype():
public static String getStereotype(@NonNull Constraint object) 
{
    EStructuralFeature eContainingFeature = object.eContainingFeature();
    System.out.println(eContainingFeature);
    if (eContainingFeature == PivotPackage.Literals.TYPE__OWNED_INVARIANT) return UMLReflection.INVARIANT;
    else if (eContainingFeature == PivotPackage.Literals.PROPERTY__DEFAULT_EXPRESSION) return UMLReflection.DERIVATION;
    ...
}

Constraint.toString():
context fatalvictims : ecore::EInt invariant: self.victims->select(d : EA_Model::Victim[?] | d.oclIsKindOf(EA_Model::DeceasedPerson))->size()

eContainingFeature:
org.eclipse.emf.ecore.impl.EReferenceImpl@244d9d89 (name: ownedInvariant) (ordered: false, unique: true, lowerBound: 0, upperBound: -1) 
(changeable: true, volatile: false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) (containment: true, resolveProxies: false)


Someone already came across with that?

Regards,
John
Re: getStereotype() always return "invariant" [message #1125533 is a reply to message #1125521] Fri, 04 October 2013 12:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3446
Registered: July 2009
Senior Member
Hi

I am sorry, but I do not have time to try to turn your hints into a
repro. If you want help you need to provide a small zipped project.

Regards

Ed Willink

On 04/10/2013 12:00, John Guerson wrote:
> Hi,
> From what I have tested (kepler and the OCL 4.2.0 build) the method
> PivotUtil.getStereotype(constraint) is always returning "invariant".
>
> OCL Document:
>
> context RoadTrafficAccident::fatalvictims:Integer
> derive: self.victims->select(d|d.oclIsKindOf(DeceasedPerson))->size()
>
> getStereotype():
>
> public static String getStereotype(@NonNull Constraint object) {
> EStructuralFeature eContainingFeature = object.eContainingFeature();
> System.out.println(eContainingFeature);
> if (eContainingFeature ==
> PivotPackage.Literals.TYPE__OWNED_INVARIANT) return
> UMLReflection.INVARIANT;
> else if (eContainingFeature ==
> PivotPackage.Literals.PROPERTY__DEFAULT_EXPRESSION) return
> UMLReflection.DERIVATION;
> ...
> }
>
> Constraint.toString():
>
> context fatalvictims : ecore::EInt invariant: self.victims->select(d :
> EA_Model::Victim[?] | d.oclIsKindOf(EA_Model::DeceasedPerson))->size()
>
> eContainingFeature:
>
> org.eclipse.emf.ecore.impl.EReferenceImpl@244d9d89 (name:
> ownedInvariant) (ordered: false, unique: true, lowerBound: 0,
> upperBound: -1) (changeable: true, volatile: false, transient: false,
> defaultValueLiteral: null, unsettable: false, derived: false)
> (containment: true, resolveProxies: false)
>
>
> Someone already came across with that?
>
> Regards,
> John
>
Re: getStereotype() always return "invariant" [message #1125659 is a reply to message #1125533] Fri, 04 October 2013 15:10 Go to previous message
John Guerson is currently offline John Guerson
Messages: 46
Registered: August 2011
Member
No Message Body
Previous Topic:OCL Pivot validation bug
Next Topic:Forum Netiquette
Goto Forum:
  


Current Time: Mon Oct 07 10:09:40 EDT 2013

Powered by FUDForum. Page generated in 0.01417 seconds