As the roles and profiles paradigm is becoming quite standard in the Puppet world, see for example https://puppet.com/docs/pe/2017.3/overview/pe_user_guide.html , we should simplify the way to query roles and profiles in the PuppetDB backend.
The proposed solution is to expand the current PuppetDB backend grammar to add P (for profiles) and O (for roles, as R is already taken for resources) so that they can be queried via shortcuts with O:Module::Name for roles and P:Module::Name for profiles.
The special syntax for fields (@field) and parameters (%param) will also be supported. When querying for P:Module::Name%param = value, the query will automatically include two subqueries in AND between them, one for the class title and the other for the class parameter.