org.intermine.web.LogMe.log("i", "running: " + q);
    private static Iterator findCollections(ObjectStore os, Class parentClass, Class childClass,                                            String refField)        throws ObjectStoreException {        Query q = new Query();        q.setDistinct(false);        QueryClass qcParent = new QueryClass(parentClass);        q.addFrom(qcParent);        q.addToSelect(qcParent);        q.addToOrderBy(qcParent);        QueryClass qcChild = new QueryClass(childClass);        q.addFrom(qcChild);        q.addToSelect(qcChild);        QueryClass qcLoc = new QueryClass(Location.class);        q.addFrom(qcLoc);        q.addToSelect(qcLoc);        QueryClass qcLocObject = new QueryClass(BioEntity.class);        q.addFrom(qcLocObject);        q.addToSelect(qcLocObject);        ConstraintSet cs = new ConstraintSet(ConstraintOp.AND);        QueryObjectReference ref1 = new QueryObjectReference(qcLoc, "object");        ContainsConstraint cc1 = new ContainsConstraint(ref1, ConstraintOp.CONTAINS, qcLocObject);        cs.addConstraint(cc1);        QueryObjectReference ref2 = new QueryObjectReference(qcLoc, "subject");        ContainsConstraint cc2 = new ContainsConstraint(ref2, ConstraintOp.CONTAINS, qcChild);        cs.addConstraint(cc2);        QueryCollectionReference ref3 = new QueryCollectionReference(qcParent, refField);        ContainsConstraint cc3 = new ContainsConstraint(ref3, ConstraintOp.CONTAINS, qcChild);        cs.addConstraint(cc3);        q.setConstraint(cs);        org.intermine.web.LogMe.log("i", "running: " + q);        Results res = new Results(q, os, os.getSequence());        res.setBatchSize(20000);        return res.iterator();    }