From: <jen...@us...> - 2011-11-01 18:59:41
|
Revision: 3353 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3353&view=rev Author: jenslehmann Date: 2011-11-01 18:59:35 +0000 (Tue, 01 Nov 2011) Log Message: ----------- wrote unit test to reproduce and narrow down bug in NLP2RDF example Modified Paths: -------------- trunk/examples/father.conf trunk/examples/nlp2rdf/reuters_gold_vs_copper/learn.conf Added Paths: ----------- trunk/components-core/src/test/java/org/dllearner/test/junit/ReasonerTest.java Added: trunk/components-core/src/test/java/org/dllearner/test/junit/ReasonerTest.java =================================================================== --- trunk/components-core/src/test/java/org/dllearner/test/junit/ReasonerTest.java (rev 0) +++ trunk/components-core/src/test/java/org/dllearner/test/junit/ReasonerTest.java 2011-11-01 18:59:35 UTC (rev 3353) @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2007-2011, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.dllearner.test.junit; + +import static org.junit.Assert.*; + +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.Thing; +import org.dllearner.kb.OWLFile; +import org.dllearner.reasoning.FastInstanceChecker; +import org.junit.Test; + +/** + * + * @author Jens Lehmann + * + */ +public class ReasonerTest { + + @Test + public void nlp2rdfTest() throws ComponentInitException { + // read file into reasoner + OWLFile file = new OWLFile("../examples/nlp2rdf/reuters_gold_vs_copper/positives.owl"); + file.init(); + FastInstanceChecker fic = new FastInstanceChecker(); + fic.setSources(file); + fic.init(); + + NamedClass doc = new NamedClass("http://nlp2rdf.lod2.eu/schema/string/Document"); + ObjectProperty op = new ObjectProperty("http://nlp2rdf.lod2.eu/schema/string/subStringTrans"); + ObjectSomeRestriction osr = new ObjectSomeRestriction(op,Thing.instance); + Intersection is = new Intersection(doc,osr); + + Individual ind = new Individual("http://nlp2rdf.org/POS/2/offset_0_763_COPPER+STUDY+GROUP+C"); + + // there should be several subStringTrans relations + assertFalse(fic.getRelatedIndividuals(ind, op).isEmpty()); + // individual should be member of this expression (required to learn the correct concept) + assertTrue(fic.hasType(is, ind)); + + // TODO: once this works, we need to make sure that "positives.owl" is in a "stable" directory + + } + +} Modified: trunk/examples/father.conf =================================================================== --- trunk/examples/father.conf 2011-11-01 16:01:42 UTC (rev 3352) +++ trunk/examples/father.conf 2011-11-01 18:59:35 UTC (rev 3353) @@ -16,7 +16,7 @@ // reasoner reasoner.type = "fast instance checker" -reasoner.sources = { ks } +reasoner.sources = { ks2 } // learning problem lp.type = "posNegStandard" @@ -25,3 +25,4 @@ // create learning algorithm to run alg.type = "ocel" + Modified: trunk/examples/nlp2rdf/reuters_gold_vs_copper/learn.conf =================================================================== --- trunk/examples/nlp2rdf/reuters_gold_vs_copper/learn.conf 2011-11-01 16:01:42 UTC (rev 3352) +++ trunk/examples/nlp2rdf/reuters_gold_vs_copper/learn.conf 2011-11-01 18:59:35 UTC (rev 3353) @@ -1,5 +1,10 @@ lp.positiveExamples = { -"http://nlp2rdf.org/POS/4/offset_0_837_TOTAL+U.S.+COPPER+ST","http://nlp2rdf.org/POS/6/offset_0_763_U.S.+REFINERY+COPPER","http://nlp2rdf.org/POS/3/offset_0_201_MAGMA+LOWERS+COPPER+","http://nlp2rdf.org/POS/2/offset_0_763_COPPER+STUDY+GROUP+C","http://nlp2rdf.org/POS/1/offset_0_840_COPPER+STOCKS+OUTSID","http://nlp2rdf.org/POS/5/offset_0_690_U.S.+BRASS+MILL+COPP" +"http://nlp2rdf.org/POS/4/offset_0_837_TOTAL+U.S.+COPPER+ST", +"http://nlp2rdf.org/POS/6/offset_0_763_U.S.+REFINERY+COPPER", +"http://nlp2rdf.org/POS/3/offset_0_201_MAGMA+LOWERS+COPPER+", +"http://nlp2rdf.org/POS/2/offset_0_763_COPPER+STUDY+GROUP+C", +"http://nlp2rdf.org/POS/1/offset_0_840_COPPER+STOCKS+OUTSID", +"http://nlp2rdf.org/POS/5/offset_0_690_U.S.+BRASS+MILL+COPP" } lp.negativeExamples = { "http://nlp2rdf.org/NEG/7/offset_0_691_CURRENCIES+COULD+INF","http://nlp2rdf.org/NEG/10/offset_0_847_REAGAN%27S+REMARKS+HEL","http://nlp2rdf.org/NEG/2/offset_0_1254_BELGIAN+ECU+COIN+ISS","http://nlp2rdf.org/NEG/6/offset_0_1657_CONSOLIDATED+TVX+TO+","http://nlp2rdf.org/NEG/9/offset_0_592_MORE+GOLD+DETECTED+A","http://nlp2rdf.org/NEG/3/offset_0_1754_BHP+TO+FLOAT+GOLD+UN","http://nlp2rdf.org/NEG/4/offset_0_1280_BLACK+MINERS+SUPPORT","http://nlp2rdf.org/NEG/1/offset_0_587_AMAX+%3CAMX%3E+IN+GOLD%2C+","http://nlp2rdf.org/NEG/8/offset_0_624_LAC+%3CLAC%3E+INTERSECTS","http://nlp2rdf.org/NEG/5/offset_0_621_CHINA%27S+HEILONGJIANG" @@ -28,4 +33,11 @@ op.useStringDatatypes = true //op.frequencyThreshold = 1 alg.type = "celoe" +alg.writeSearchTree = true +alg.replaceSearchTree = true +alg.maxExecutionTimeInSeconds = 100 +alg.maxNrOfResults = 100 + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |