code: func (c *Compiler) GetRules(ref Ref) (rules []*Rule) {
  
  	set := map[*Rule]struct{}{}
  
  	for _, rule := range c.GetRulesForVirtualDocument(ref) {
  		set[rule] = struct{}{}
  	}
  
  	for _, rule := range c.GetRulesWithPrefix(ref) {
  		set[rule] = struct{}{}
  	}
  
  	for rule := range set {
  		rules = append(rules, rule)
  	}
  
  	return rules
  }
docs: // GetRules returns a slice of rules that are referred to by ref.
  //
  // E.g., given the following module:
  //
  //  package a.b.c
  //
  //  p[x] = y { q[x] = y; ... } # rule1
  //  q[x] = y { ... }           # rule2
  //
  // The following calls yield the rules on the right.
  //
  //  GetRules("data.a.b.c.p")	=> [rule1]
  //  GetRules("data.a.b.c.p.x")	=> [rule1]
  //  GetRules("data.a.b.c.q")	=> [rule2]
  //  GetRules("data.a.b.c")		=> [rule1, rule2]
  //  GetRules("data.a.b.d")		=> nil