Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Invariant both passes and fails ??(Same invariants both pass and fail on the same model at the same time)
Invariant both passes and fails ?? [message #1860416] Thu, 03 August 2023 17:30 Go to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
If I understand correctly what I'm seeing (see attached screenshots), the same invariant is both succeeding and failing.

It appears that the invariant succeeds/passes in those cases where it is not prefixed by the OCL filename where it is defined and fails in those cases where it is prefixed by the OCL filename.

In the ValidityView screenshot, you can see both the successes and failures. In the other two screenshots, you can the success and failure details.

I've also attached the OCL files where these invariants are defined.

What is going on? Is there something I'm doing wrong here? These invariants should pass. What is causing the failures? Is it possible that the problem is that an invariant in one file is referencing a def in a different file? I would think that the `includes` would take care of that.

I should also note: This fail/success behavior does not occur for all invariants. I have some that pass both with the filename prepended and without. (That does raise the question: 'Why are they displayed twice - once with the filename prepended and once without?')

Background:
I'm using OCL-> Load Document to load an OCL file. That OCL file includes others, which also include others, etc. The original OCL file is in one project / package based on one XText grammar/metamodel (named Omodel). Some of the included OCL files are based on other XText grammars/metamodels that are 'base' grammars/metamodels to Omodel (Omodel builds on Privacy which builds on FACE which builds on UDDL).

[Updated on: Thu, 03 August 2023 17:43]

Report message to a moderator

Re: Invariant both passes and fails ?? [message #1860417 is a reply to message #1860416] Thu, 03 August 2023 19:08 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7665
Registered: July 2009
Senior Member
Hi Steve

I have no idea what is going on because I have no idea what is going on. You need to provide one/two zipped repro projects with clear commands that show how to demonstrate what you find disappointing and why.

The file name prefix as such is very unlikely to be the problem. I see mention of 'invalid' so my first guess would be a file load failure due to a bad path.

Whatever the underlying problem, this is probably a useful real world example where the diagnostics are inadequate and merit improvement. I often turn these into regression test cases, so please attach your repro project(s) to a new Bugzilla, identify them as your work and give permission for their use.

Regards

Ed Willink
Re: Invariant both passes and fails ?? [message #1860420 is a reply to message #1860417] Thu, 03 August 2023 21:52 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
I saw this in a test model that is rather large. I'll need to reduce this to the smallest reproducible version I can. That may take a few days.

[Updated on: Thu, 03 August 2023 21:53]

Report message to a moderator

Re: Invariant both passes and fails ?? [message #1860436 is a reply to message #1860420] Fri, 04 August 2023 19:29 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
Your comment was the key. While attempting to reduce the model, I realized the following:
1) I have OCL based on 4 different XText / Ecore metamodels. OCL that depends on a particular metamodel is in a directory in the project that also contains that metamodel.
2) I had been using a mix of relative path names when one OCL file includes another within the same plugin, `platform:/resource/...` URLs when including a file from a different plugin, and `http` URLs for the ecore metamodels themselves.
3) I was loading an OCL file at the top of that 4 metamodel stack which transitively included OCL files from each of the 3 other layers. I used OCL -> Load Document -> Browse File System to load all the OCL files into an second Eclipse to test the XText languages.
4) I had not included the projects containing the OCL in the workspace with the models I'm loading the OCL against (although all the plugins generated by these projects are part of the 2nd Eclipse runtime)

The net result of all of this is that when the selected document was loaded, Eclipse couldn't figure out where the included OCL files were in some cases. So, naturally, those didn't get loaded. And that broke things in the ones that did.

Once I changed all the includes to use 'platform:/resource' and included the projects that contain both the Ecore metamodels and the OCL in the 2nd Eclipse' runtime workspace (so that they were resources known to that 2nd Eclipse), the problem disappeared.

Net result: I don't know that you need to change anything. Maybe this note will be sufficient to help others past problems like this.

[Updated on: Fri, 04 August 2023 19:32]

Report message to a moderator

Re: Invariant both passes and fails ?? [message #1860448 is a reply to message #1860436] Sun, 06 August 2023 17:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7665
Registered: July 2009
Senior Member
Thanks for getting back, but it would seem better if there had been some over 'cannot find XXX' which needs a repro to debug.

Overall the Eclipse Modeling Project badly needs a modelspace browser that will show all models visible in some context accompanied by help search wrt what is accessible. And a larger search of everything that could be in your workspace. Some parts of Modisco do some of this, but sadly EMF Search never prospered and I'm not sure how extensible OOOPMH search is.

Re: Invariant both passes and fails ?? [message #1860462 is a reply to message #1860448] Mon, 07 August 2023 21:31 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
And as a final followup: using `platform:/plugin` (instead of `platform:/resource`) has the additional advantage that the files included that way can be any registered plugin and, thus, don't have to be included as resources in the workspace - a cleaner approach.

As a response to your comment about EMF Search, Lorenzo Bettini's Xtext/XTend book has sample code that may address that. I'm attaching a generalized version of that code that I use (in both XTend and the generated Java). It doesn't have an associated UI (yet) but it should be a starting point. LMK if this is the kind of thing you were thinking about. If so, then give me a list of requirements and I'll see if I can get it done.
Re: Invariant both passes and fails ?? [message #1860597 is a reply to message #1860462] Sun, 20 August 2023 16:05 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7665
Registered: July 2009
Senior Member
Sure there is plenty of code to do searching. I have probably written a form of EMF search many hundreds of times.

It is the UI that is missing. In particular the power-UI that helps you with a miss rather than just re-iterates the hit that you know.
Previous Topic:OCL with Xtext Artifacts
Next Topic:Calling out from OCL to Java
Goto Forum:
  


Current Time: Fri Jul 19 21:47:02 GMT 2024

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

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

Back to the top