Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

select(p:Type|p) not working, isTypeOf works for some queries #56

Open
agarciadom opened this issue Nov 7, 2017 · 0 comments
Open

select(p:Type|p) not working, isTypeOf works for some queries #56

agarciadom opened this issue Nov 7, 2017 · 0 comments
Labels

Comments

@agarciadom
Copy link
Member

agarciadom commented Nov 7, 2017

This query had to be rewritten from using select(p:Type|xyz) to using select(p|p.isTypeOf(Type)):

var components = Component.all; return components.collect(c|c.countClasses()).sum() / components.size;

@cached
operation Component countClasses() {
  return self.OwnedElement.select(c|c.isTypeOf(Class)).size + 
    self.OwnedElement.select(p|p.isTypeOf(Package)).collect(p|p.countClasses()).sum() + 
    self.OwnedElement.select(subc|subc.isTypeOf(Component)).collect(subc|subc.countClasses()).sum();
}

@cached
operation Package countClasses() {
  return self.OwnedElement.select(c|c.isTypeOf(Class)).size +
    self.OwnedElement.select(p|p.isTypeOf(Package)).collect(p|p.countClasses()).sum();
}
@agarciadom agarciadom added the bug label Nov 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant