From: <lor...@us...> - 2012-07-25 10:34:00
|
Revision: 3804 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3804&view=rev Author: lorenz_b Date: 2012-07-25 10:33:43 +0000 (Wed, 25 Jul 2012) Log Message: ----------- Changed default log level to DEBUG. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java 2012-07-23 14:25:40 UTC (rev 3803) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner2.java 2012-07-25 10:33:43 UTC (rev 3804) @@ -65,7 +65,6 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.SparqlQueryLearningAlgorithm; import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.Thing; @@ -76,7 +75,6 @@ import org.dllearner.reasoning.SPARQLReasoner; import org.ini4j.InvalidFileFormatException; import org.ini4j.Options; -import org.semanticweb.HermiT.Configuration.DirectBlockingType; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; @@ -84,7 +82,6 @@ import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.shared.UnknownPropertyException; import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; import com.hp.hpl.jena.vocabulary.RDFS; import com.jamonapi.Monitor; @@ -92,7 +89,6 @@ public class SPARQLTemplateBasedLearner2 implements SparqlQueryLearningAlgorithm{ - enum Mode{ BEST_QUERY, BEST_NON_EMPTY_QUERY } @@ -383,7 +379,7 @@ public void learnSPARQLQueries() throws NoTemplateFoundException{ reset(); //generate SPARQL query templates - logger.info("Generating SPARQL query templates..."); + logger.debug("Generating SPARQL query templates..."); templateMon.start(); if(multiThreaded){ templates = templateGenerator.buildTemplatesMultiThreaded(question); @@ -391,15 +387,15 @@ templates = templateGenerator.buildTemplates(question); } templateMon.stop(); - logger.info("Done in " + templateMon.getLastValue() + "ms."); + logger.debug("Done in " + templateMon.getLastValue() + "ms."); relevantKeywords.addAll(templateGenerator.getUnknownWords()); if(templates.isEmpty()){ throw new NoTemplateFoundException(); } - logger.info("Templates:"); + logger.debug("Templates:"); for(Template t : templates){ - logger.info(t); + logger.debug(t); } //get the weighted query candidates @@ -407,7 +403,7 @@ sparqlQueryCandidates = new ArrayList<WeightedQuery>(); int i = 0; for(WeightedQuery wQ : generatedQueries){ - System.out.println(wQ.explain()); + logger.debug(wQ.explain()); sparqlQueryCandidates.add(wQ); if(i == maxTestedQueries){ break; @@ -506,7 +502,7 @@ } private SortedSet<WeightedQuery> getWeightedSPARQLQueries(Set<Template> templates){ - logger.info("Generating SPARQL query candidates..."); + logger.debug("Generating SPARQL query candidates..."); Map<Slot, Set<Allocation>> slot2Allocations = new TreeMap<Slot, Set<Allocation>>(new Comparator<Slot>() { @@ -527,7 +523,7 @@ Set<Allocation> allocations; for(Template t : templates){ - logger.info("Processing template:\n" + t.toString()); + logger.debug("Processing template:\n" + t.toString()); allocations = new TreeSet<Allocation>(); boolean containsRegex = t.getQuery().toString().toLowerCase().contains("(regex("); @@ -541,9 +537,7 @@ Callable<Map<Slot, SortedSet<Allocation>>> worker = new SlotProcessor(slot); Future<Map<Slot, SortedSet<Allocation>>> submit = executor.submit(worker); list.add(submit); - } else { - System.out.println("CACHE HIT"); - } + } } for (Future<Map<Slot, SortedSet<Allocation>>> future : list) { @@ -582,7 +576,7 @@ } allocations.addAll(tmp); }*/ - System.out.println("Time needed: " + (System.currentTimeMillis() - startTime) + "ms"); + logger.debug("Time needed: " + (System.currentTimeMillis() - startTime) + "ms"); Set<WeightedQuery> queries = new HashSet<WeightedQuery>(); Query cleanQuery = t.getQuery(); @@ -794,10 +788,8 @@ List<SPARQL_Triple> typeTriples = wQ.getQuery().getRDFTypeTriples(typeVar); for(SPARQL_Triple typeTriple : typeTriples){ String typeURI = typeTriple.getValue().getName().replace("<", "").replace(">", ""); - System.out.println(typeURI + "---" + resourceURI); List<Entry<String, Integer>> mostFrequentProperties = UnknownPropertyHelper.getMostFrequentProperties(endpoint, cache, typeURI, resourceURI, direction); for(Entry<String, Integer> property : mostFrequentProperties){ - System.out.println(property); wQ.getQuery().replaceVarWithURI(slot.getAnchor(), property.getKey()); wQ.setScore(wQ.getScore() + 0.1); } @@ -859,7 +851,7 @@ } template2Queries.put(t, qList); } - logger.info("...done in "); + logger.debug("...done in "); return allQueries; } @@ -993,14 +985,14 @@ } private void validate(Collection<WeightedQuery> queries, SPARQL_QueryType queryType){ - logger.info("Testing candidate SPARQL queries on remote endpoint..."); + logger.debug("Testing candidate SPARQL queries on remote endpoint..."); sparqlMon.start(); if(queryType == SPARQL_QueryType.SELECT){ for(WeightedQuery query : queries){ learnedPos++; List<String> results; try { - logger.info("Testing query:\n" + query); + logger.debug("Testing query:\n" + query); com.hp.hpl.jena.query.Query q = QueryFactory.create(query.getQuery().toString(), Syntax.syntaxARQ); q.setLimit(1); ResultSet rs = executeSelect(q.toString()); @@ -1033,7 +1025,7 @@ return; } } - logger.info("Result: " + results); + logger.debug("Result: " + results); } } catch (Exception e) { e.printStackTrace(); @@ -1043,7 +1035,7 @@ } else if(queryType == SPARQL_QueryType.ASK){ for(WeightedQuery query : queries){ learnedPos++; - logger.info("Testing query:\n" + query); + logger.debug("Testing query:\n" + query); boolean result = executeAskQuery(query.getQuery().toString()); learnedSPARQLQueries.add(query); // if(stopIfQueryResultNotEmpty && result){ @@ -1052,12 +1044,12 @@ if(stopIfQueryResultNotEmpty){ return; } - logger.info("Result: " + result); + logger.debug("Result: " + result); } } sparqlMon.stop(); - logger.info("Done in " + sparqlMon.getLastValue() + "ms."); + logger.debug("Done in " + sparqlMon.getLastValue() + "ms."); } private boolean executeAskQuery(String query){ @@ -1154,7 +1146,7 @@ } private SortedSet<Allocation> computeAllocations(Slot slot){ - logger.info("Computing allocations for slot: " + slot); + logger.debug("Computing allocations for slot: " + slot); SortedSet<Allocation> allocations = new TreeSet<Allocation>(); Index index = getIndexBySlotType(slot); @@ -1210,7 +1202,7 @@ normProminenceValues(allocations); computeScore(allocations); - logger.info("Found " + allocations.size() + " allocations for slot " + slot); + logger.debug("Found " + allocations.size() + " allocations for slot " + slot); return new TreeSet<Allocation>(allocations); } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java 2012-07-23 14:25:40 UTC (rev 3803) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java 2012-07-25 10:33:43 UTC (rev 3804) @@ -145,7 +145,7 @@ internalParseMultiThreaded(parseGrammar.getDPInitTrees(), n); } - if (VERBOSE) logger.trace("Constructed " + derivationTrees.size() + " derivation trees.\n"); + if (VERBOSE) logger.debug("Constructed " + derivationTrees.size() + " derivation trees.\n"); return derivationTrees; } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2012-07-23 14:25:40 UTC (rev 3803) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2012-07-25 10:33:43 UTC (rev 3804) @@ -102,67 +102,67 @@ m = compAdjPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJR"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/JJR"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/JJR"); } // m = superAdjPattern.matcher(condensedstring); // while (m.find()) { -// logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJS"); +// logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/JJS"); // condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/JJS"); // } m = howManyPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by how/WLEX many/WLEX"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by how/WLEX many/WLEX"); condensedstring = condensedstring.replaceFirst(m.group(1),"how/WLEX many/WLEX"); } m = howAdjPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJH"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/JJH"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/JJH"); } m = thesameasPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/NNSAME"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/NNSAME"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/NNSAME"); } m = nprepPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/NPREP"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/NPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/NPREP"); } m = didPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by \"\""); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by \"\""); condensedstring = condensedstring.replaceFirst(m.group(1),""); } m = prepfrontPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by \"\""); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by \"\""); condensedstring = condensedstring.replaceFirst(m.group(1),""); } m = passivePattern1a.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(6)+"/PASSIVE"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(6)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(6)+"/PASSIVE"); } m = passivePattern1b.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(6)+m.group(7)+"/PASSIVE"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(6)+m.group(7)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(6) + m.group(7)+"/PASSIVE"); } m = passivePattern2a.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+"/PASSIVE"); } m = pseudopassPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/VPREP"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(7)+"/VPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+"/VPREP"); } m = pseudopwhPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+m.group(8)+"/VPREP"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(7)+m.group(8)+"/VPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+" "+m.group(8)+"/VPREP"); } m = saveIsThere.matcher(condensedstring); @@ -171,64 +171,64 @@ } m = passivePattern2b.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+"/PASSIVE"); } m = passpartPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/PASSPART"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/PASSPART"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/PASSPART"); } m = vpassPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASS"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASS"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/VPASS"); } m = vpassinPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASSIN"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASSIN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/VPASSIN"); } m = gerundinPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/GERUNDIN"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/GERUNDIN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/GERUNDIN"); } m = vprepPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPREP"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"/VPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/VPREP"); } m = whenPattern.matcher(condensedstring); while (m.find()) { if (m.group(4).equals("VPREP")) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHENPREP"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHENPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2) + m.group(3)+"/WHENPREP"); } else { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHEN"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHEN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2) + m.group(3)+"/WHEN"); } } m = wherePattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHERE"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHERE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2) + m.group(3)+"/WHERE"); } m = adjsPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJ"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJ"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/JJ"); } m = adjnounPattern.matcher(condensedstring); while (m.find()) { // if (!m.group(4).startsWith("NNP")) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNN"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/JJNN "); // } } m = adjnprepPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/NPREP"); + if (VERBOSE) logger.debug("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/NPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/NPREP"); } @@ -291,7 +291,7 @@ List<String> namedentities = ner.getNamedEntitites(untagged); List<String> usefulnamedentities = new ArrayList<String>(); - if (VERBOSE) logger.trace("Proposed NEs: " + namedentities); + if (VERBOSE) logger.debug("Proposed NEs: " + namedentities); // keep only longest matches (e.g. keep 'World of Warcraft' and forget about 'Warcraft') // containing at least one upper case letter (in order to filter out errors like 'software') @@ -309,7 +309,7 @@ } } - if (VERBOSE) logger.trace("Accepted NEs: " + usefulnamedentities); + if (VERBOSE) logger.debug("Accepted NEs: " + usefulnamedentities); // replace POS tags accordingly for (String ne : usefulnamedentities) { Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2012-07-23 14:25:40 UTC (rev 3803) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2012-07-25 10:33:43 UTC (rev 3804) @@ -164,7 +164,7 @@ if (UNTAGGED_INPUT) { s = pp.normalize(s); tagged = tagger.tag(s); - if (VERBOSE) logger.trace("Tagged input: " + tagged); + logger.debug("Tagged input: " + tagged); } else { tagged = s; @@ -178,7 +178,7 @@ else newtagged = pp.condenseNominals(tagged); newtagged = pp.condense(newtagged); - if (VERBOSE) logger.trace("Preprocessed: " + newtagged); + logger.debug("Preprocessed: " + newtagged); parser.parse(newtagged,g); @@ -219,10 +219,10 @@ if (!containsModuloRenaming(drses,drs)) { // // DEBUG if (VERBOSE) { - System.out.println(">>> DUDE:\n" + dude.toString()); - System.out.println("\n>>> DRS:\n"+ drs.toString()); + logger.debug(">>> DUDE:\n" + dude.toString()); + logger.debug("\n>>> DRS:\n"+ drs.toString()); for (Slot sl : slots) { - System.out.println(sl.toString()); + logger.debug(sl.toString()); } } // // @@ -310,7 +310,7 @@ if (UNTAGGED_INPUT) { s = pp.normalize(s); tagged = tagger.tag(s); - if (VERBOSE) logger.trace("Tagged input: " + tagged); + logger.debug("Tagged input: " + tagged); } else { tagged = s; @@ -324,20 +324,20 @@ else newtagged = pp.condenseNominals(tagged); newtagged = pp.condense(newtagged); - if (VERBOSE) logger.trace("Preprocessed: " + newtagged); + logger.debug("Preprocessed: " + newtagged); parser.parseMultiThreaded(newtagged,g); if (parser.getDerivationTrees().isEmpty()) { parser.clear(g,parser.getTemps()); clearAgain = false; - if (VERBOSE) logger.error("[Templator.java] '" + s + "' could not be parsed."); + logger.error("[Templator.java] '" + s + "' could not be parsed."); } else { try { parser.buildDerivedTreesMultiThreaded(g); } catch (ParseException e) { - if (VERBOSE) logger.error("[Templator.java] ParseException at '" + e.getMessage() + "'", e); + logger.error("[Templator.java] ParseException at '" + e.getMessage() + "'", e); } } @@ -372,13 +372,11 @@ if (!containsModuloRenaming(drses,drs)) { // // DEBUG - if (VERBOSE) { - System.out.println(dude); - System.out.println(drs); + logger.debug(dude); + logger.debug(drs); for (Slot sl : slots) { - System.out.println(sl.toString()); + logger.debug(sl.toString()); } - } // // drses.add(drs); @@ -546,10 +544,10 @@ if (!containsModuloRenaming(drses,drs)) { // // DEBUG if (VERBOSE) { - System.out.println(dude); - System.out.println(drs); + logger.debug(dude); + logger.debug(drs); for (Slot sl : slots) { - System.out.println(sl.toString()); + logger.debug(sl.toString()); } } // // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |