Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL expression not evaluated(oclIsUndefined works in a loop but not in ->select(exp) or exists->select(exp) )
OCL expression not evaluated [message #1841901] Wed, 02 June 2021 14:57 Go to next message
Thomas Barth is currently offline Thomas BarthFriend
Messages: 22
Registered: March 2021
Junior Member

I want to use OCL in Acceleo.

I have an OrderedSet of an EClass called OutputSection.
OutputSection has an Feature called Memory.

If I iterate trough the OrderedSet I am able to use oclIsUndefined
[for (os : OutputSection | OutputSections())]
	[if (os.Memory.oclIsUndefined())]
		- Outputsection [] is not associated with memory

If I use oclIsUndefined in a select or exists statement, it is ignored. Exists always returns false.

I use the same approach a lot in the same project and never experienced this behavior.

OCL versions:

For now I solved this issue by passing the OrderedSet to Java:
[query public Consistency_OsWoMem(rootModel : MulticoreRootModel) : Boolean = 	invoke('ReportGen.requests.generationServices', 'Consistency_OsWoMem(java.util.List)', Sequence{OutputSections()->asSequence()}) /]

	public boolean Consistency_OsWoMem(java.util.List<safetySystem.Linkage.OutputSection> ListOs)
		for (safetySystem.Linkage.OutputSection outputSection : ListOs) {
				return true;
		return false;
  • Attachment: OCL_v.JPG
    (Size: 30.57KB, Downloaded 247 times)

[Updated on: Wed, 02 June 2021 15:38]

Report message to a moderator

Re: OCL expression not evaluated [message #1841913 is a reply to message #1841901] Wed, 02 June 2021 21:03 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7663
Registered: July 2009
Senior Member

2018 is a bit old, but since Acceleo re-uses the Classic OCL which is pretty stable it is unlikely to make a difference,

When I evaluate


in my workspace the result is 1 as I would expect. This suggests that null is working consistently.

Perhaps the Acceleo wrapping is malfunctionality.

More likely you are not actually doing what you think you are. Unless you can empathize the bug you will need to use a debugger.

In the absence of a repro, my best guess is that OutputSections() does not return what you expect and that your plumbing via invoke has performed a corrective conversion.


Ed Willink

[Updated on: Wed, 02 June 2021 21:04]

Report message to a moderator

Previous Topic:Issue with mdt-ocl-Update sites
Next Topic:Calling an EMF Java function from OCL constraint
Goto Forum:

Current Time: Sun Jul 14 02:21:40 GMT 2024

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

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

Back to the top