Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Query to return Classes that use a given Enumeration
icon5.gif  Query to return Classes that use a given Enumeration [message #1753303] Fri, 03 February 2017 15:42 Go to next message
James Clark is currently offline James ClarkFriend
Messages: 7
Registered: December 2016
Junior Member
I have a UML model developed with Rational Software Architect v9.1.2. I have a BIRT report in which I would like to return all Classes in a diagram which have one or more attributes typed as a given Enumeration. I'm thinking the use of OCL might be the best bet, but my knowledge of OCL is not good enough to solve my problem. I'm using this provided API call within a BIRT data set row query:
Collection<EObject> oclQuery (xpath, boolean_ocl_expression)

This function takes an XPath expression and a Boolean-valued OCL query expression, and returns the subset of elements from the XPath expression for which the OCL query returns true.

The two parameters provided to the BIRT data set row query are:
$diagramURI - the URI of the UML class diagram.
$enumerationURI - the URI of the Enumeration that I'd like to know which Classes in the diagram have an attribute typed as.
I have partially completed the query (I know the XPath to the Classes in the diagram), but I'm struggling with the OCL part of oclQuery call:
oclQuery(resolveURI($diagramURI)/children[getXMIType(element) = "uml:Class"]/element, "<Boolean OCL Expression>")

Can anyone please help me out? Many thanks in advance!
Re: Query to return Classes that use a given Enumeration [message #1753316 is a reply to message #1753303] Fri, 03 February 2017 17:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5845
Registered: July 2009
Senior Member
Hi

Use the OCL Console to practice your OCL. See the OCL tutorials. AFAIAA RSA uses a very old and partial Eclipse OCL release. You may needto use a real version of Eclipse to get the benefits of the Eclipse UI that RSA ignores. Since RSA deviates from Eclipse OCL you should look to IBM and your support contract for answers.

Regards

Ed Willink
icon3.gif  Re: Query to return Classes that use a given Enumeration [message #1753548 is a reply to message #1753316] Tue, 07 February 2017 16:03 Go to previous message
James Clark is currently offline James ClarkFriend
Messages: 7
Registered: December 2016
Junior Member
Never mind. I ended up solving this with XPath alone with the following query:
resolveURI($diagramURI)/children[getXMIType(element) = "uml:Class"]/element/ownedAttribute[getXMIID(type) = $enumerationID]/..
Previous Topic:Problem in navigating references
Next Topic:Xtext and OCL references
Goto Forum:
  


Current Time: Fri Apr 27 08:32:50 GMT 2018

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

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