OCL Query format [message #494775] |
Mon, 02 November 2009 15:42 |
|
Hi,
This is a query which gives number of classes in a model:
getModel().allOwnedElements()->select(oclIsTypeOf(Class))->size()
Now I want to write this query in another format
context uml::Model::findClass()
body{
allOwnedElements()->select(oclIsTypeOf(Class))->size()
}
is this a right way to write above query, or any one has any other solution for this.
Thanks in advance,
pkojo
|
|
|
|
Re: OCL Query format [message #494943 is a reply to message #494897] |
Tue, 03 November 2009 10:51 |
|
Hi Ed,
I tried query on OCL Interpreter Console, to count classes using
getModel().allOwnedElements()->select(oclIsTypeOf(Class))->size()
This works fine, when I use this query with context key word it gives me errors. I am very new to OCL and trying to understand how it works, I havent found any documentation which gives me hint where I use OCL query with context key word and where not.
In OCL documentation all queries are defined with context key word, if I tried same on OCL interpreter it does not work and it complains about the context key word.
Therefore I tried to compare my above query in context format like this:
context uml::Model::findClass()
body{
allOwnedElements()->select(oclIsTypeOf(Class))->size()
}
It will definitely complain about context keyword on OCL console.
Please little bit explain or refer me any material which explains where we can use context and where we cant.
I am sorry, I am beginner and my question is very basic, I hope you do not mind.
regards,
pokojo
|
|
|
Powered by
FUDForum. Page generated in 0.01974 seconds