CapableObjects forum



Custom OCL operations in modlr and design mode

Posted By Peter Buchmann 2011-05-19 00:32:00
Add to Favorites1
Author Message
RickWeyrauch
 Posted 2011-05-23 17:09:20
Supreme Being

Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)

Group: Forum Members
Last Active: 2012-04-18 18:57:58
Posts: 249, Visits: 7 773
Worked for Modlr model check but not the one in the Persistence Mapper. After I added a custom op called Even which takes and Integer and returns a Boolean, Modlr is quite happy but in my PM Validate Model I get error(s). The top is when I use ".Even()" botoom is for ".Even" - Modlr is happy either way. Either way I get a runtime error that matches PM Validate Model.

Info: Model errors:
MVE209 Invalid DerivationOCL: Sett.FirstIsFirst:Exception - 33:Undefined operation: Even. Expression: "self.Match.Setts->indexOf0(self).Even()" [Sett.FirstIsFirst]

or

Info: Model errors:
MVE209 Invalid DerivationOCL: Sett.FirstIsFirst:Exception - 33:Attributes can not have members (tried System.Int32.Even). Expression: "self.Match.Setts->indexOf0(self).Even" [Sett.FirstIsFirst]



Rick Weyrauch
RickWeyrauch
 Posted 2011-05-23 17:11:04
Supreme Being

Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)

Group: Forum Members
Last Active: 2012-04-18 18:57:58
Posts: 249, Visits: 7 773
Maybe my Custom Operation is bad:

class OclEven : OclOperationBase

{

protected override void Init()

{

InternalInit("Even", new [] {Support.IntegerType}, Support.BooleanType );

}

public override void Evaluate(IOclOperationParameters oclParameters)

{

Support.MakeNewBoolean(oclParameters.Result, (Support.GetAsInteger(oclParameters.Values[0]) & 1) == 0);

}

}



Rick Weyrauch
RickWeyrauch
 Posted 2011-05-24 15:49:35
Supreme Being

Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)

Group: Forum Members
Last Active: 2012-04-18 18:57:58
Posts: 249, Visits: 7 773
I determined that I was causing my problems - This thread is about what you need to do to make a Modlr plugin, in addition to that, you must also register your custom Ocl class at runtime. Adding [EcoOclOperation(typeof(OclEven), true)] to my EcoSpace solved my problems.

But, then this got me thinking. My model is what is dependant on this custom Ocl class, not my EcoSpace. I have 2 EcoSpaces, one for runtime that connects to a database, and one for Unit Tests that utilizes memory. Why should I have to attribute both of these classes? In a perfect OO world, I should attribute my model shouldn't I? Then, each of my EcoSpaces would pick it up because the connect to the same model.

Rick Weyrauch

Peter Buchmann
 Posted 2011-09-15 10:04:19
Supreme Being

Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)Supreme Being - (1 020 reputation)

Group: Forum Members
Last Active: 2 days ago @ 16:47:33
Posts: 158, Visits: 734
I've implemented the ModlrPlugin and the model checks OK with no errors. All custom OCLs are installed and expressions are green in the OCL editor.

BUT: When I try to prototype and test the model, I still get the errors that my custom OCL operations are unknown. Can you please check this?

My current version: 6.0.0.5648

RickWeyrauch
 Posted 2011-09-15 16:31:38
Supreme Being

Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)Supreme Being - (1 665 reputation)

Group: Forum Members
Last Active: 2012-04-18 18:57:58
Posts: 249, Visits: 7 773
I just tried latest daily and it is still there for me too - see error picture attached to this post

Rick Weyrauch
 Error.png (9 views, 22,74 KB)

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top