If you require 'n1.package = n2.package', then 'and' it with your exists
Your search will go quicker if you do Package.allInstances, then
do subloops of the package classifiers thereby rendering the same
package test redundant and excluding interpackage explorations from
the search domain.
On 02/06/2010 16:26, pkojo wrote:
> I am trying to find duplicate classes in a package, when I run my query
> it provides all duplicate classes from all packages of the model.
> My question is how can I find duplicate classes in a single package.
> right now I am running following query by selecting Packages as a
> context in eclipse OCL Interpreter console.
> Class.allInstances()->select(n1|Class.allInstances()->exists(n2|n1 <>n2
> and n1.name = n2.name))->asSet()->select(oclIsTypeOf(Class))
> Thanks in advance,