ArrayList<Query> requirements = new ArrayList<Query>();
q.obtainAllOf(RequirementQuery.class, requirements);
ArrayList<Query> terms = new ArrayList<Query>();
for(Query g : requirements)
{
RequirementQuery r = (RequirementQuery)g;
if (! r.getRequired())
r.obtainAllOf(SingleTermQuery.class, terms);
}
HashSet<String> rtr = new HashSet<String>(terms.size());
for(Query g : terms)
{
SingleTermQuery queryTerm = (SingleTermQuery)g;