From: <lor...@us...> - 2012-08-22 13:41:14
|
Revision: 3828 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3828&view=rev Author: lorenz_b Date: 2012-08-22 13:41:04 +0000 (Wed, 22 Aug 2012) Log Message: ----------- Added missing init method in UNIT test. Modified Paths: -------------- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner3Test.java Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner3Test.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner3Test.java 2012-08-22 13:40:11 UTC (rev 3827) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner3Test.java 2012-08-22 13:41:04 UTC (rev 3828) @@ -178,10 +178,12 @@ { // see http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/rdf/model/Model.html#read%28java.io.InputStream,%20java.lang.String,%20java.lang.String%29 String ending = s.substring(s.lastIndexOf('.')+1, s.length()); - String type = (ending.equals("ttl")||ending.equals("nt"))?"N3":ending.equals("owl")?"RDF/XML":String.valueOf(Integer.valueOf("filetype "+ending+" not handled.")); + String type = (ending.equals("ttl")||ending.equals("nt"))?"TURTLE":ending.equals("owl")?"RDF/XML":String.valueOf(Integer.valueOf("filetype "+ending+" not handled.")); // switch(type) {case "ttl":type="TURTLE";break;case "owl":type="RDF/XML";break;default:throw new RuntimeException("filetype "+ending+" not handled.");} // no Java 1.7 :-( - try{m.read(getClass().getClassLoader().getResourceAsStream("oxford/"+s),null, type);} - catch(RuntimeException e) {throw new RuntimeException("Could not read into model: "+s,e);} + try{ +// m.read(new FileInputStream(new File("/home/lorenz/arbeit/papers/question-answering-iswc-2012/data/"+s)), null, type);}catch (FileNotFoundException e) {} + m.read(getClass().getClassLoader().getResourceAsStream("oxford/"+s),null, type);} + catch(RuntimeException e) {throw new RuntimeException("Could not read into model: "+s,e);} } // test("Oxford evaluation questions", new File(getClass().getClassLoader().getResource("tbsl/evaluation/qald2-dbpedia-train-tagged(ideal).xml").getFile()), // SparqlEndpoint.getEndpointDBpediaLiveAKSW(),dbpediaLiveCache); @@ -994,6 +996,11 @@ ); learner = new SPARQLTemplateBasedLearner2(model,mappingIndex,pretagged?null:POSTaggerHolder.posTagger); + try { + learner.init(); + } catch (ComponentInitException e) { + e.printStackTrace(); + } } @@ -1024,7 +1031,7 @@ } catch(Exception e) { - logger.error(String.format("Exception for question \"%s\": %s",question,e.getLocalizedMessage())); + logger.error(String.format("Exception for question %d \"%s\": %s",id, question,e.getLocalizedMessage())); e.printStackTrace(); return LearnStatus.exceptionStatus(e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |