public static ArrayList query(AGModel model, String queryString, String... objects) {
        ArrayList resultList = new ArrayList();

        AGQuery query = AGQueryFactory.create(queryString);
        QueryExecution qe = AGQueryExecutionFactory.create(query, model);

        try {
            ResultSet rs = qe.execSelect();
            while (rs.hasNext()) {
                HashMap rm = new HashMap();
                QuerySolution row = rs.next();

                if (null != objects) {
                    for (int i=0;i<objects.length;i++) {
                        RDFNode node = row.get(objects[i]);
                        rm.put(objects[i], node);
                    }
                }

                resultList.add(rm);
            }
        } finally {
            qe.close();
        }

        return resultList;
    }