I was trying to do some workaround, and at the end I saw what was making me noise all the time.
In fact, this is what I can't understand:
[for (a : Association | class.getAssociations() )]
[numberOfRelations(a, class.name)/]
[if (numberOfRelations(a, class.name)>0)]
inside
[/if]
[/for]
where:
[query public numberOfRelations(a : Association, sourceClass : String) : Integer = a.ownedElement->asSequence().oclAsType(Property)->select(type.name.equalsIgnoreCase(sourceClass))->upper.oclAsType(Integer) /]
and this is the output:
So, I have to believe that my query "numberOfRelations" is returning some integer (1,1,2) but if I what to use the result as a number... I can't!, so this operation fails: if (numberOfRelations(a, class.name)>0)]
And If I try:
[query public numberOfRelations(a : Association, sourceClass : String) : Integer = 2 /]
then this is the output:
2
inside
2
inside
2
inside
so, Why this can't be treated as an Integer?:
[query public [B]numberOfRelations[/B](a : Association, sourceClass : String) : Integer = a.ownedElement->asSequence().oclAsType(Property)->select(type.name.equalsIgnoreCase(sourceClass))->upper/]
Thank you!!!]]>