public StrategyQueryBuilder(String topicsFile, boolean timesKey) throws MalformedURLException, DocumentException { queryProcessors = new ArrayList<QueryProcessor>(); topics = Dom4jUtil.parse(new File(topicsFile)); XPath xPath = topics.createXPath("//topic"); List<Element> topicsElems = xPath.selectNodes(topics); for (Element topic : topicsElems) { QueryParser queryParser = new QueryParser(topic); QueryProcessor queryProcessor = new QueryProcessor(queryParser.getQuery(), timesKey); queryProcessors.add(queryProcessor); } }
public static void main(String[] args) throws Exception { if (args.length != 0) { CONFIG_FILE = args[0]; } Configuration config = new JSONConfiguration(CONFIG_FILE); _params = new Parametizer(DEFAULTS, config); _queryParser = new QueryParser(config); // _queryManager = new QueryManager(config, _queryParser); int nbGroup = 1; File[] files = new File[nbGroup]; FileWriter[] writers = new FileWriter[nbGroup]; for (int i = 0; i < files.length; i++) { files[i] = new File(_params.getString("filename") + "_" + i + ".csv"); files[i].createNewFile(); writers[i] = new FileWriter(files[i]); } try { for (int i = _params.getInt("nbOut"); i > 0; i--) { for (int j = 0; j < files.length; j++) { writers[j].write(_queryParser.getQuery() + ";\n"); } } for (int j = 0; j < files.length; j++) { writers[j].flush(); writers[j].close(); } } finally { } /*Statable[] statables = {_queryManager}; _stats = new StatRecorder(config.get("stats"), statables); // Launch the stats and then tell the query manager to just run _stats.start(); _queryManager.start(); _stats.stop();*/ }