| Home » Modeling » GMF (Graphical Modeling Framework) » Some OCL constraints are not evaluated
 Goto Forum:| 
| Some OCL constraints are not evaluated [message #60562] | Sat, 07 October 2006 22:34  |  | 
| Eclipse User  |  |  |  |  | Hi everybody, 
 I have problems with some of the OCL Audit Rules added to my gmfmap file.
 
 I am trying to asure that all the XNodes in my model have different names.
 In my meta-model I have an abstract class Node, and two different subclasses
 of Node called XNode (wich adds the attribute "name" to those inherited from
 Node), and YNode (wich doesn't have "name"). I can access all the Nodes of
 my model but not only those belonging to the XNode class. Thus, in order to
 check that all XNodes have different names, I need to use the "allInstances"
 method, i.e.:
 
 XNode.allInstances() -> forAll ( n1, n2 | n1.name <> n2.name)
 XNode.allInstances() -> select ( n1, n2 | n1.name = n2.name ) ->
 isEmpty()
 
 Other OCL expressions I have tried using the container of all Nodes as the
 Domain Element Target are:
 
 self.hasNodes( ) -> select ( n | n.oclIsTypeOf (XNode) ) -> forAll (n1,
 n2 | n1.name<>n2.name)
 
 but this expression fails since the forAll operation expects n1, n2 to be
 Nodes instead of XNodes, and not all Nodes have a "name" attribute (i.e. the
 previous select hasn't the effect I expected).
 
 Anyway, the first two expressions seem to work fine (the are valid and I can
 generate de gmfgen from the gmfmap) but, when I build a model and validate
 it, I get the following message in the "Problems tab".
 
 "IRJA0030I The constraint ... is disabled.  It will not be evaluated."
 
 I have read a post written by other user and the recommendation was to check
 if the 'org.eclipse.emf.validation.ui' plug-in was correctly installed.
 I have already checked it, and it is there... so it doesn't seem to be the
 problem.
 
 The problem seems to be related to the use of  "allInstances" however, I
 need this operation to access only the XNodes in my model.
 
 Any clue??
 
 Thanks in advance for any help :-)
 
 Cristina
 |  |  |  |  | 
| Re: Some OCL constraints are not evaluated [message #60574 is a reply to message #60562] | Sun, 08 October 2006 09:35   |  | 
| Eclipse User  |  |  |  |  | Hi, 
 I never tried allInstances and I doubt there is efficient way to execute it.
 However, I believe that
 self.hasNodes( ) -> select ( n | n.oclIsTypeOf (XNode) )
 -> forAll (n1, n2 |
 n1.oclIsTypeOf(XNode)
 and n2.oclIsTypeOf(XNode)
 and n1.oclAsType(XNode).name<>n2.oclAsType(XNode).name
 )
 
 will do the work, at least assuming that self.hasNodes() returns collection
 of nodes, not the boolean that someone may expect from its name :)
 
 Regards,
 Michael
 
 "Cristina" <Cristina.Vicente@upct.es> wrote in message
 news:eg9o4e$9p0$1@utils.eclipse.org...
 > Hi everybody,
 >
 > I have problems with some of the OCL Audit Rules added to my gmfmap file.
 >
 > I am trying to asure that all the XNodes in my model have different names.
 > In my meta-model I have an abstract class Node, and two different
 > subclasses of Node called XNode (wich adds the attribute "name" to those
 > inherited from Node), and YNode (wich doesn't have "name"). I can access
 > all the Nodes of my model but not only those belonging to the XNode class.
 > Thus, in order to check that all XNodes have different names, I need to
 > use the "allInstances" method, i.e.:
 >
 >    XNode.allInstances() -> forAll ( n1, n2 | n1.name <> n2.name)
 >    XNode.allInstances() -> select ( n1, n2 | n1.name = n2.name ) ->
 > isEmpty()
 >
 > Other OCL expressions I have tried using the container of all Nodes as the
 > Domain Element Target are:
 >
 >    self.hasNodes( ) -> select ( n | n.oclIsTypeOf (XNode) ) -> forAll (n1,
 > n2 | n1.name<>n2.name)
 >
 > but this expression fails since the forAll operation expects n1, n2 to be
 > Nodes instead of XNodes, and not all Nodes have a "name" attribute (i.e.
 > the previous select hasn't the effect I expected).
 >
 > Anyway, the first two expressions seem to work fine (the are valid and I
 > can generate de gmfgen from the gmfmap) but, when I build a model and
 > validate it, I get the following message in the "Problems tab".
 >
 > "IRJA0030I The constraint ... is disabled.  It will not be evaluated."
 >
 > I have read a post written by other user and the recommendation was to
 > check if the 'org.eclipse.emf.validation.ui' plug-in was correctly
 > installed.
 > I have already checked it, and it is there... so it doesn't seem to be the
 > problem.
 >
 > The problem seems to be related to the use of  "allInstances" however, I
 > need this operation to access only the XNodes in my model.
 >
 > Any clue??
 >
 > Thanks in advance for any help :-)
 >
 > Cristina
 >
 |  |  |  |  |  |  | 
| Re: Some OCL constraints are not evaluated [message #60588 is a reply to message #60562] | Mon, 09 October 2006 07:35  |  | 
| Eclipse User  |  |  |  |  | Hi Cristina, 
 You probably use GMF 1.0. This release has dependency on EMF OCL build
 1.0.0RC6, which
 had https://bugs.eclipse.org/bugs/show_bug.cgi?id=146378, fixed in 1.0.1.
 
 In general, EMFT OCL supports  'allInstances()' operation on EClasses. The
 default implementation
 returns all instances contained in the root container of the evalutation
 context object.
 
 Yet another hint, try using qualified name for XNode eClass.
 
 /Radek
 
 
 "Cristina" <Cristina.Vicente@upct.es> wrote in message
 news:eg9o4e$9p0$1@utils.eclipse.org...
 > Hi everybody,
 >
 > I have problems with some of the OCL Audit Rules added to my gmfmap file.
 >
 > I am trying to asure that all the XNodes in my model have different names.
 > In my meta-model I have an abstract class Node, and two different
 > subclasses of Node called XNode (wich adds the attribute "name" to those
 > inherited from Node), and YNode (wich doesn't have "name"). I can access
 > all the Nodes of my model but not only those belonging to the XNode class.
 > Thus, in order to check that all XNodes have different names, I need to
 > use the "allInstances" method, i.e.:
 >
 >    XNode.allInstances() -> forAll ( n1, n2 | n1.name <> n2.name)
 >    XNode.allInstances() -> select ( n1, n2 | n1.name = n2.name ) ->
 > isEmpty()
 >
 > Other OCL expressions I have tried using the container of all Nodes as the
 > Domain Element Target are:
 >
 >    self.hasNodes( ) -> select ( n | n.oclIsTypeOf (XNode) ) -> forAll (n1,
 > n2 | n1.name<>n2.name)
 >
 > but this expression fails since the forAll operation expects n1, n2 to be
 > Nodes instead of XNodes, and not all Nodes have a "name" attribute (i.e.
 > the previous select hasn't the effect I expected).
 >
 > Anyway, the first two expressions seem to work fine (the are valid and I
 > can generate de gmfgen from the gmfmap) but, when I build a model and
 > validate it, I get the following message in the "Problems tab".
 >
 > "IRJA0030I The constraint ... is disabled.  It will not be evaluated."
 >
 > I have read a post written by other user and the recommendation was to
 > check if the 'org.eclipse.emf.validation.ui' plug-in was correctly
 > installed.
 > I have already checked it, and it is there... so it doesn't seem to be the
 > problem.
 >
 > The problem seems to be related to the use of  "allInstances" however, I
 > need this operation to access only the XNodes in my model.
 >
 > Any clue??
 >
 > Thanks in advance for any help :-)
 >
 > Cristina
 >
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 01:50:26 EDT 2025 
 Powered by FUDForum . Page generated in 0.03480 seconds |