private String constructQualificationQuery(String table, String regExp,
			String[][] tags, String[][] attributes, String[] columns,
			String[][] values, String[] doubleColumns, Double[][] doubleValues,
			double[][] range) throws MobbedException {
		String qry = "";
		String closer = "";
		String[] keys = keyMap.get(table);
		if (tags != null || attributes != null) {
			qry = " WHERE " + keys[0] + " IN (";
			closer = ")";
		}
		if (tags != null)
			qry += constructTagAttributesQuery(regExp, "Tags", tags);
		if (attributes != null) {
			if (tags != null)
				qry += " INTERSECT ";
			qry += constructTagAttributesQuery(regExp, "Attributes", attributes);
		}
		if (!isEmpty(columns) || !isEmpty(doubleColumns)) {
			if (tags != null || attributes != null)
				qry += " INTERSECT SELECT " + keys[0] + " FROM " + table
						+ " WHERE ";
			else
				qry += " WHERE ";
			qry += constructTableQuery(regExp, columns, values, doubleColumns,
					doubleValues, range);
		}
		qry += closer;
		return qry;
	}