-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David R. Allen Sent: Tuesday, March 08, 2005 8:57 AM To: Chad Brandon; [email protected] Subject: Re: [Andromda-user] OCL/HQL questions
On Tuesday 08 March 2005 09:51 am, Chad Brandon wrote: > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of David R. > Allen > Sent: Tuesday, March 08, 2005 7:42 AM > To: [email protected] > Subject: [Andromda-user] OCL/HQL questions > > My environment uses MagicDraw 9.0 which only checks syntax on OCL 2.0 > expressions. With that in mind, I have a couple questions: > > 1. Was "body" something from an earlier OCL version? It is not something > in > OCL 2.0. I was able to construct a valid expression following the specs on > OCL 2.0 for defining operations (mostly with the post: subexpression). > > [CB] Actually Magic Draw does not check OCL 2.0 (its still on an earlier > version), OCL 2.0 has the body expression as well as a few others that have > been introduced: therefore MD will complain on valid OCL 2.0 expressions. [DRA] The OCL 2.0 spec does not have "body" as a keyword. Just things like def,pre,post,let,... The section on defining operations never refers to "body". What spec are you using? I am looking at one from August, 2003 from OMG. [CB] Do a search on "body": http://www.omg.org/docs/ptc/03-10-14.pdf (this is the final OCL 2.0 specification). Also, MagicDraw does not recognize "body" either in its syntax checking. However, by using the following from the OCL 2.0 specs, everything is OK in MD: context <class>.<method-sig> post: result = allInstances() -> select (...) So should I be using this undocumented "body" construct and just ignore the MD errors on parsing? Note that the above 2.0 expression is actually generating the H-QL, but oddly without the second conditional inside the select function > > 2. I used an <<Enumeration>> as the type of a member for a Hibernate > <<Entity>>, and I need to express in a query method that that member is not > equal to a specific enumerated value. Is that possible since stereotypes > are > used rather than the datatype enumeration? > > [CB] How are you specifying it? [DRA] I had just used "= EnumType.value" when I was doing equality. This resulted in "= EnumType.value" in the HQL literally, but Hibernate does not really know anything about the enumerations generated from AndroMDA (maybe due to the way I set it up). [CB] Hmm I haven't tried using that type of comparison, maybe you can send me the OCL you're trying to execute. When I changed the expression to "<> 'value' ", I always get an exception which I can reproduce and send if you like. It really didn't say much other than it couldn't handle the OCL expression. [CB] File a JIRA issue with the query you're attempting to perform and I'll fix it. > > 3. Most of the given OCL expression is now translated to HQL, but it left > off > the part about that member not being equal to a particular value (I used > the > > string value as it would appear in the DB). When I used to have "body" > (removed it to get MD9 to help w/syntax), I was getting exceptions for > having > "<>" or "!=" in the expression. Is "<>" parsed as 'not equals'? > > Thanks, -- David Allen [EMAIL PROTECTED] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user
