|
From: <ku...@us...> - 2008-08-29 18:29:15
|
Revision: 1136
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1136&view=rev
Author: kurzum
Date: 2008-08-29 18:29:12 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
AutomaticExampleFinder + java interface for learning
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/ReasoningService.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/Sample.java
trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java
trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java
trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java
trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java
trunk/src/dl-learner/org/dllearner/utilities/learn/ConfWriter.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java
trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java
trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnConfiguration.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFileConfiguration.java
trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java
Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -27,17 +27,19 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.log4j.Logger;
import org.dllearner.core.owl.DataRange;
import org.dllearner.core.owl.DatatypeProperty;
import org.dllearner.core.owl.DatatypePropertyHierarchy;
-import org.dllearner.core.owl.NamedClass;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Individual;
+import org.dllearner.core.owl.NamedClass;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectPropertyHierarchy;
import org.dllearner.core.owl.SubsumptionHierarchy;
import org.dllearner.reasoning.ReasonerType;
import org.dllearner.utilities.datastructures.SortedSetTuple;
+import org.dllearner.utilities.owl.OWLVocabulary;
/**
* The reasoning service is the interface to the used reasoner. Basically,
@@ -50,6 +52,8 @@
*
*/
public class ReasoningService {
+
+ public static Logger logger = Logger.getLogger(ReasoningService.class);
// statistische Daten
private long instanceCheckReasoningTimeNs = 0;
@@ -150,7 +154,7 @@
public SortedSet<Individual> retrieval(Description concept) {
// Test, ob tatsächlich keine doppelten Retrievals ausgeführt werden
// retrievals.add(concept);
-
+
reasoningStartTimeTmp = System.nanoTime();
SortedSet<Individual> result;
try {
@@ -377,6 +381,10 @@
public SubsumptionHierarchy getSubsumptionHierarchy() {
try {
+ if(reasoner.getSubsumptionHierarchy() == null){
+ this.prepareSubsumptionHierarchy();
+ }
+
nrOfSubsumptionHierarchyQueries++;
return reasoner.getSubsumptionHierarchy();
} catch (ReasoningMethodUnsupportedException e) {
@@ -592,6 +600,24 @@
atomicConceptsList = new LinkedList<NamedClass>(getNamedClasses());
return atomicConceptsList;
}
+
+ public List<NamedClass> getAtomicConceptsList(boolean removeOWLThing) {
+ if(!removeOWLThing) {
+ return getAtomicConceptsList();
+ }else {
+ List<NamedClass> l = new LinkedList<NamedClass>();
+ for (NamedClass class1 : getAtomicConceptsList()) {
+ if(class1.compareTo(new NamedClass(OWLVocabulary.OWL_NOTHING)) == 0 ||
+ class1.compareTo(new NamedClass(OWLVocabulary.OWL_THING)) == 0 ){
+ ;//do nothing
+ }else{
+ l.add(class1);
+ }
+ }
+ return l;
+ }
+
+ }
public List<ObjectProperty> getAtomicRolesList() {
if(atomicRolesList == null)
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -80,7 +80,7 @@
static int recursionDepthDefault = 1;
//RBC
- static final boolean debug = false;
+ static final boolean debug = true;
static final boolean debugUseImprovedTupleAquisitor = debug && false; //switches tupleaquisitor
static final boolean debugExitAfterExtraction = debug && false; //switches sysex und rdf generation
static final boolean debugAdditionallyGenerateRDF = debug && true;
Modified: trunk/src/dl-learner/org/dllearner/scripts/Sample.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/Sample.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/scripts/Sample.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -124,6 +124,7 @@
// reasoner
ReasonerComponent r = cm.reasoner(FastInstanceChecker.class, ks);
ReasoningService rs = cm.reasoningService(r);
+
// learning problem
LearningProblem lp = cm.learningProblem(PosNegDefinitionLP.class, rs);
Added: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,351 @@
+/**
+ * Copyright (C) 2007-2008, 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.scripts;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.core.EvaluatedDescription;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.owl.Individual;
+import org.dllearner.core.owl.NamedClass;
+import org.dllearner.kb.extraction.ExtractionAlgorithm;
+import org.dllearner.kb.extraction.Manager;
+import org.dllearner.kb.sparql.Cache;
+import org.dllearner.kb.sparql.SparqlKnowledgeSource;
+import org.dllearner.kb.sparql.SparqlQuery;
+import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.reasoning.OWLAPIReasoner;
+import org.dllearner.utilities.datastructures.SetManipulation;
+import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderOWL;
+import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL;
+import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderOWL;
+import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL;
+import org.dllearner.utilities.learn.ConfWriter;
+import org.dllearner.utilities.learn.LearnOWLFile;
+import org.dllearner.utilities.learn.LearnOWLFileConfiguration;
+import org.dllearner.utilities.learn.LearnSPARQLConfiguration;
+import org.dllearner.utilities.owl.ReasoningServiceFactory;
+import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
+import org.dllearner.utilities.statistics.SimpleClock;
+
+public class SemanticBible {
+
+ private static ReasoningService reasoningService;
+
+ private static Logger logger = Logger.getRootLogger();
+
+ // size of randomly choosen negative examples compared to positives
+ public static double NEGFACTOR = 3.0;
+
+ // different negative Ex (randomizes) each run, if set to false
+ private static final boolean DEVELOP = true;
+
+ public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl";
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ SimpleClock sc = new SimpleClock();
+ initLogger();
+ logger.info("Start");
+
+ //String fileURL = new File(ontologyFile).toURI().toString();
+
+ reasoningService = ReasoningServiceFactory.getReasoningService(
+ ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
+ // SortedSet<NamedClass> classesToRelearn = new
+ // TreeSet<NamedClass>(rs.getAtomicConceptsList(true));
+ // for (NamedClass target : classesToRelearn) {
+ // System.out.println("classesToRelearn.add(new
+ // NamedClass(\""+target.toString()+"\"));");
+
+ // }
+
+ SortedSet<NamedClass> classesToRelearn = getClassesToRelearn(true);
+ SortedSet<Individual> positiveEx = new TreeSet<Individual>();
+ SortedSet<Individual> negativeEx = new TreeSet<Individual>();
+
+ for (NamedClass target : classesToRelearn) {
+ positiveEx.clear();
+ negativeEx.clear();
+
+ AutomaticPositiveExampleFinderOWL ape = new AutomaticPositiveExampleFinderOWL(
+ reasoningService);
+ ape.makePositiveExamplesFromConcept(target);
+ positiveEx = ape.getPosExamples();
+
+ AutomaticNegativeExampleFinderOWL ane = new AutomaticNegativeExampleFinderOWL(
+ positiveEx, reasoningService);
+ ane.makeNegativeExamplesFromSuperClasses(target);
+ ane.makeNegativeExamplesFromAllOtherInstances();
+ //double correct = ()
+ // System.out.println((positiveEx.size()*NEGFACTOR));
+ negativeEx = ane.getNegativeExamples(
+ (int) (positiveEx.size() * NEGFACTOR), DEVELOP);
+
+ // reasoningService.prepareSubsumptionHierarchy();
+ // System.out.println(reasoningService.getMoreGeneralConcepts(target));
+
+ // for every class execute the learning algorithm
+ learnOriginal(target, positiveEx, negativeEx);
+
+ }
+
+ sc.printAndSet("Finished");
+ // JamonMonitorLogger.printAllSortedByLabel();
+
+ }
+
+ private static void learnOriginal(NamedClass target, SortedSet<Individual> posExamples, SortedSet<Individual> negExamples) {
+ List<EvaluatedDescription> conceptresults = new ArrayList<EvaluatedDescription>();
+ System.out.println("Starting to learn original");
+ //System.out.println(ConfWriter.listExamples(true, posExamples));
+ //System.out.println(ConfWriter.listExamples(false, negExamples));
+ //System.exit(0);
+ LearnOWLFile learner = new LearnOWLFile(getConfForOriginal(target));
+ LearningAlgorithm la = null;
+ try{
+ la = learner.learn(
+ SetManipulation.indToString(posExamples),
+ SetManipulation.indToString(negExamples),
+ FastInstanceChecker.class);
+ }catch (Exception e) {
+ // TODO: handle exception
+ }
+ la.start();
+ System.out.println(la.getCurrentlyBestDescription());
+ }
+
+ private static LearnSPARQLConfiguration getConfForSparql(NamedClass c) {
+ LearnSPARQLConfiguration lsc = new LearnSPARQLConfiguration();
+ // lsc.sparqlEndpoint = sparqlTasks.getSparqlEndpoint();
+
+
+ lsc.recursiondepth = 2;
+ lsc.closeAfterRecursion = true;
+ lsc.ignoredConcepts.add(c.toString());
+
+ lsc.noisePercentage = 20;
+ lsc.guaranteeXgoodDescriptions = 100;
+ lsc.maxExecutionTimeInSeconds = 50;
+
+ // lsc.searchTreeFile = "log/WikipediaCleaner.txt";
+
+ return lsc;
+
+ }
+
+ private static LearnOWLFileConfiguration getConfForOriginal(NamedClass c) {
+ LearnOWLFileConfiguration loc = new LearnOWLFileConfiguration();
+
+
+ loc.setOWLFileURL(ontologyPath);
+
+
+ //loc.ignoredConcepts.add(c.toString());
+
+
+ loc.noisePercentage = 0;
+ // loc.guaranteeXgoodDescriptions = 100;
+ loc.maxExecutionTimeInSeconds = 20;
+ loc.writeSearchTree = true;
+ loc.replaceSearchTree = true;
+ loc.searchTreeFile = "log/treeSemanticBible.txt";
+
+ return loc;
+
+ }
+
+ private static void initLogger() {
+
+ SimpleLayout layout = new SimpleLayout();
+ // create logger (a simple logger which outputs
+ // its messages to the console)
+ FileAppender fileAppender = null;
+ try {
+ fileAppender = new FileAppender(layout, "log/semBibleLog.txt",
+ false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ logger.removeAllAppenders();
+ logger.addAppender(consoleAppender);
+ logger.addAppender(fileAppender);
+ logger.setLevel(Level.DEBUG);
+ Logger.getLogger(Manager.class).setLevel(Level.INFO);
+ Level lwarn = Level.DEBUG;
+ Logger.getLogger(KnowledgeSource.class).setLevel(lwarn);
+ Logger.getLogger(SparqlKnowledgeSource.class).setLevel(lwarn);
+
+ Logger.getLogger(ExtractionAlgorithm.class).setLevel(lwarn);
+ Logger.getLogger(AutomaticNegativeExampleFinderSPARQL.class).setLevel(
+ lwarn);
+ Logger.getLogger(AutomaticPositiveExampleFinderSPARQL.class).setLevel(
+ lwarn);
+ Logger.getLogger(ExampleBasedROLComponent.class).setLevel(lwarn);
+ Logger.getLogger(SparqlQuery.class).setLevel(lwarn);
+ Logger.getLogger(Cache.class).setLevel(lwarn);
+ Logger.getLogger(AutomaticPositiveExampleFinderOWL.class).setLevel(
+ lwarn);
+
+ }
+
+ public static SortedSet<NamedClass> getClassesToRelearn(boolean firstOnly) {
+
+ SortedSet<NamedClass> classesToRelearn = new TreeSet<NamedClass>();
+ if (firstOnly) {
+ //classesToRelearn.add(new NamedClass(
+ // "http://semanticbible.org/ns/2006/NTNames#Angel"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Woman"));
+
+ } else {
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Agent"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Angel"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#BeliefGroup"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#BeliefSystem"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Character"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#CitizenshipAttribute"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#City"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#CognitiveAgent"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#ContentBearingObject"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#EthnicGroup"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#EthnicityAttribute"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#EvilSupernaturalBeing"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#FixedHoliday"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#FreshWaterArea"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#GeographicArea"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#GeographicLocation"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#GeopoliticalArea"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#God"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Group"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#GroupOfPeople"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Human"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#HumanAttribute"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Island"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#LandArea"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Man"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Mountain"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Nation"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#NaturalLanguage"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Object"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Organization"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#PoliticalAttribute"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#PoliticalBeliefSystem"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#PoliticalOrganization"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Region"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#ReligiousBelief"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#ReligiousBeliefSystem"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#ReligiousOrganization"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#ResidenceGroup"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#ResidencyAttribute"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#SaltWaterArea"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Series"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#SonOfGod"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#StateOrProvince"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#SupernaturalBeing"));
+ classesToRelearn
+ .add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#SupernaturalRegion"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Tribe"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#WaterArea"));
+ classesToRelearn.add(new NamedClass(
+ "http://semanticbible.org/ns/2006/NTNames#Woman"));
+ }
+ return classesToRelearn;
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -226,7 +226,7 @@
lsc.noisePercentage = 20;
lsc.guaranteeXgoodDescriptions = 100;
lsc.maxExecutionTimeInSeconds = 50;
- lsc.logLevel = "TRACE";
+
// lsc.searchTreeFile = "log/WikipediaCleaner.txt";
return lsc;
Modified: trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -26,8 +26,10 @@
import java.util.TreeSet;
import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.cli.Start;
import org.dllearner.kb.extraction.ExtractionAlgorithm;
import org.dllearner.kb.manipulator.Manipulator;
+import org.dllearner.kb.manipulator.TypeFilterRule;
import org.dllearner.kb.sparql.Cache;
import org.dllearner.kb.sparql.SparqlQuery;
@@ -116,14 +118,14 @@
retval= "Extraction:";
} else if (clazz == Manipulator.class) {
retval= "Extraction:";
+ } else if (clazz == Start.class) {
+ retval= "Init:";
+ } else if (clazz == TypeFilterRule.class) {
+ retval= "Extraction:";
} else if (clazz == SparqlQuery.class) {
retval= "sparql:";
} else if (clazz == SparqlQuery.class) {
retval= "sparql:";
- } else if (clazz == SparqlQuery.class) {
- retval= "sparql:";
- } else if (clazz == SparqlQuery.class) {
- retval= "sparql:";
} else if (clazz == ExampleBasedROLComponent.class) {
retval= "Learning:";
} else if (clazz == SparqlQuery.class) {
Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -41,7 +41,38 @@
}
return ret;
}
+
+ /**
+ * shrinks a set to the limit fuzzy here means the elements will be randomly
+ * picked
+ *
+ * @param set
+ * @param limit
+ * @return
+ */
+ public static SortedSet<Individual> fuzzyShrinkInd(SortedSet<Individual> set, int limit) {
+ if (set.size() <= limit) {
+ return set;
+ }
+ SortedSet<Individual> ret = new TreeSet<Individual>();
+ Random r = new Random();
+ double treshold = ((double) limit) / set.size();
+ // System.out.println("treshold"+howmany);
+ // System.out.println("treshold"+allRetrieved.size());
+ // System.out.println("treshold"+treshold);
+ while (ret.size() < limit) {
+ for (Individual oneInd : set) {
+ if (r.nextDouble() < treshold) {
+ ret.add(oneInd);
+ if (ret.size() >= limit)
+ break;
+ }
+ }
+ }
+ return ret;
+ }
+
/**
* shrinks a set to the limit takes the first elements up to limit
*
@@ -65,7 +96,31 @@
return ret;
}
+
+ /**
+ * shrinks a set to the limit takes the first elements up to limit
+ *
+ * @param set
+ * @param limit
+ * @return
+ */
+ public static SortedSet<Individual> stableShrinkInd(SortedSet<Individual> set,
+ int limit) {
+ if (set.size() <= limit) {
+ return set;
+ }
+ SortedSet<Individual> ret = new TreeSet<Individual>();
+ for (Individual oneInd : set) {
+ ret.add(oneInd);
+ if (ret.size() >= limit)
+ break;
+
+ }
+
+ return ret;
+ }
+
/**
* XXX
* getFirst n Elements from list.
@@ -90,6 +145,14 @@
return ret;
}
+ public static SortedSet<String>indToString(SortedSet<Individual> set) {
+ SortedSet<String> ret = new TreeSet<String>();
+ for (Individual ind : set) {
+ ret.add(ind.toString());
+ }
+ return ret;
+ }
+
public static void printSet(String s, SortedSet set, Logger logger) {
if(logger.getLevel().equals(Level.DEBUG)){
logger.info(s +" ["+ set.size()+"]: "+set);
Added: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,268 @@
+/**
+ * Copyright (C) 2007, 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.utilities.examples;
+
+import java.util.Collection;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.log4j.Logger;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.owl.Description;
+import org.dllearner.core.owl.Individual;
+import org.dllearner.core.owl.NamedClass;
+import org.dllearner.core.owl.ObjectProperty;
+import org.dllearner.utilities.datastructures.SetManipulation;
+
+public class AutomaticNegativeExampleFinderOWL {
+
+ // LOGGER: ComponentManager
+ private static Logger logger = Logger.getLogger(ComponentManager.class);
+
+ private ReasoningService reasoningService;
+
+ private SortedSet<Individual> fullPositiveSet;
+
+ private SortedSet<Individual> fromRelated = new TreeSet<Individual>();
+ private SortedSet<Individual> fromSuperclasses = new TreeSet<Individual>();
+ private SortedSet<Individual> fromParallelClasses = new TreeSet<Individual>();
+ private SortedSet<Individual> fromAllOther = new TreeSet<Individual>();
+ private SortedSet<Individual> fromDomain = new TreeSet<Individual>();
+ private SortedSet<Individual> fromRange = new TreeSet<Individual>();
+
+ static int poslimit = 10;
+ static int neglimit = 20;
+
+
+ /**
+ *
+ * takes as input a full positive set to make sure no negatives are added as positives
+ *
+ * @param fullPositiveSet
+ * @param reasoningService
+ */
+ public AutomaticNegativeExampleFinderOWL(
+ SortedSet<Individual> fullPositiveSet,
+ ReasoningService reasoningService) {
+ super();
+ this.fullPositiveSet = new TreeSet<Individual>();
+ this.fullPositiveSet.addAll(fullPositiveSet);
+ this.reasoningService = reasoningService;
+
+ }
+
+ /**
+ * see <code> getNegativeExamples(int neglimit, boolean stable )</code>
+ * @param neglimit
+ * @return
+ */
+ public SortedSet<Individual> getNegativeExamples(int neglimit ) {
+ return getNegativeExamples(neglimit, false);
+ }
+
+ /**
+ * aggregates all collected neg examples
+ * CAVE: it is necessary to call one of the make functions before calling this
+ * OTHERWISE it will choose random examples
+ *
+ * @param neglimit size of negative Example set, 0 means all, which can be quite large
+ * @param stable decides whether neg Examples are randomly picked, default false, faster for developing, since the cache can be used
+ * @return
+ */
+ public SortedSet<Individual> getNegativeExamples(int neglimit, boolean stable ) {
+ SortedSet<Individual> negatives = new TreeSet<Individual>();
+ negatives.addAll(fromParallelClasses);
+ negatives.addAll(fromRelated);
+ negatives.addAll(fromSuperclasses);
+ if(negatives.isEmpty()) {
+ negatives.addAll(fromAllOther);
+ }
+ if(neglimit<=0){
+ logger.debug("neg Example size NO shrinking: " + negatives.size());
+ return negatives;
+ }
+
+
+ logger.debug("neg Example size before shrinking: " + negatives.size());
+ if (stable ) {
+ negatives = SetManipulation.stableShrinkInd(negatives,neglimit);
+ }
+ else {
+ negatives = SetManipulation.fuzzyShrinkInd(negatives,neglimit);
+ }
+ logger.debug("neg Example size after shrinking: " + negatives.size());
+ return negatives;
+ }
+
+
+ /**
+ * just takes all other instances from the ontology, except the ones
+ * in the fullPositiveSet (see Constructor)
+ */
+ public void makeNegativeExamplesFromAllOtherInstances() {
+ logger.debug("making random examples ");
+ fromAllOther = reasoningService.getIndividuals();
+ fromAllOther.removeAll(fullPositiveSet);
+ logger.debug("|-negExample size from random: " + fromAllOther.size());
+ }
+
+ /**
+ * NOT IMPLEMENTED YET, DO NOT USE
+ * makes neg ex from related instances, that take part in a role R(pos,neg)
+ * filters all objects, that don't use the given namespace
+ * @param instances
+ * @param objectNamespace
+ */
+ public void makeNegativeExamplesFromRelatedInstances(SortedSet<Individual> instances,
+ String objectNamespace) {
+ logger.debug("making examples from related instances");
+ for (Individual oneInstance : instances) {
+ makeNegativeExamplesFromRelatedInstances(oneInstance, objectNamespace);
+ }
+ logger.debug("|-negExample size from related: " + fromRelated.size());
+ }
+
+ /**
+ * NOT IMPLEMENTED YET, DO NOT USE
+ * @param oneInstance
+ * @param objectnamespace
+ */
+ private void makeNegativeExamplesFromRelatedInstances(Individual oneInstance, String objectnamespace) {
+ // SortedSet<String> result = new TreeSet<String>();
+
+ //reasoningService.getRoleMembers(atomicRole)
+
+ //fromRelated.removeAll(fullPositiveSet);
+ throw new RuntimeException("method makeNegativeExamplesFromRelatedInstances not implemented yet");
+ }
+
+
+
+ /**
+ * NOT IMPLEMENTED YET, DO NOT USE
+ * makes negEx from classes, the posEx belong to.
+ * Gets all Classes from PosEx, gets Instances from these Classes, returns all
+ * @param positiveSet
+ */
+ public void makeNegativeExamplesFromParallelClasses(SortedSet<Individual> positiveSet){
+ makeNegativeExamplesFromClassesOfInstances(positiveSet);
+ }
+
+ /**
+ * NOT IMPLEMENTED YET, DO NOT USE
+ * see <code> makeNegativeExamplesFromParallelClasses</code>
+ * @param positiveSet
+ */
+ @SuppressWarnings("unused")
+ private void makeNegativeExamplesFromClassesOfInstances(SortedSet<Individual> positiveSet) {
+ logger.debug("making neg Examples from parallel classes");
+ SortedSet<Description> classes = new TreeSet<Description>();
+
+
+ for (Individual instance : positiveSet) {
+ try{
+ // realization is not implemented in reasoningservice
+ //classes.addAll(reasoningService.realize()
+ }catch (Exception e) {
+ logger.warn("not implemented in "+this.getClass());
+ }
+ }
+ logger.debug("getting negExamples from " + classes.size() + " parallel classes");
+ for (Description oneClass : classes) {
+ logger.debug(oneClass);
+ // rsc = new
+ // JenaResultSetConvenience(queryConcept("\""+oneClass+"\"",limit));
+ try{
+ this.fromParallelClasses.addAll(reasoningService.retrieval(oneClass));
+ }catch (Exception e) {
+ logger.warn("not implemented in "+this.getClass());
+ }
+ }
+
+ fromParallelClasses.removeAll(fullPositiveSet);
+ logger.debug("|-neg Example size from parallelclass: " + fromParallelClasses.size());
+ throw new RuntimeException("not implemented in "+ this.getClass()+"method makeNegativeExamplesFromParallelClasses");
+ }
+
+
+
+
+
+ /**
+ * if pos ex derive from one class, then neg ex are taken from a superclass
+ * @param concept
+ */
+ public void makeNegativeExamplesFromSuperClasses(NamedClass concept) {
+ makeNegativeExamplesFromSuperClasses( concept, 0);
+ }
+
+ /**
+ * if pos ex derive from one class, then neg ex are taken from a superclass
+ * CURRENTLY SAME METHOD AS makeNegativeExamplesFromSuperClasses(NamedClass concept)
+ * but works quite often
+ * @param concept
+ * @param depth PARAMETER CURRENTLY NOT USED, ONLY DIRECT SUPERCLASSES
+ */
+ public void makeNegativeExamplesFromSuperClasses(NamedClass concept, int depth) {
+
+
+ SortedSet<Description> superClasses = reasoningService.getMoreGeneralConcepts(concept);
+ logger.debug("making neg Examples from " + superClasses.size() + " superclasses");
+
+ for (Description oneSuperClass : superClasses) {
+ logger.debug(oneSuperClass);
+ fromSuperclasses.addAll(reasoningService.retrieval(oneSuperClass));
+ }
+ this.fromSuperclasses.removeAll(fullPositiveSet);
+ logger.debug("|-neg Example from superclass: " + fromSuperclasses.size());
+ }
+
+ /**
+ * misleading method name,
+ * examples are all instances from the a-Part of the atomicRole(a,b)
+ * it has nothing to do with the actual Domain class
+ * @param atomicRole
+ */
+
+ public void makeNegativeExamplesFromDomain(ObjectProperty atomicRole){
+ logger.debug("making Negative Examples from Domain of : "+atomicRole);
+ fromDomain.addAll(reasoningService.getRoleMembers(atomicRole).keySet());
+ fromDomain.removeAll(fullPositiveSet);
+ logger.debug("|-neg Example size from Domain: "+this.fromDomain.size());
+ }
+
+ /**
+ * misleading method name,
+ * examples are all instances from the b-Part of the atomicRole(a,b)
+ * it has nothing to do with the actual Range class
+ * @param atomicRole
+ */
+
+ public void makeNegativeExamplesFromRange(ObjectProperty atomicRole){
+ logger.debug("making Negative Examples from Range of : "+atomicRole);
+ Collection<SortedSet<Individual>> tmp = reasoningService.getRoleMembers(atomicRole).values();
+ for (SortedSet<Individual> set : tmp) {
+ fromRange.addAll(set);
+ }
+ fromRange.removeAll(fullPositiveSet);
+ logger.debug("|-neg Example size from Range: "+fromRange.size());
+ }
+}
Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -60,11 +60,19 @@
SortedSet<String> fullPositiveSet,
SPARQLTasks st) {
super();
- this.fullPositiveSet = fullPositiveSet;
+ this.fullPositiveSet = new TreeSet<String>();
+ this.fullPositiveSet.addAll(fullPositiveSet);
this.sparqltasks = st;
}
+
+
+ /**
+ * see <code> getNegativeExamples(int neglimit, boolean stable )</code>
+ * @param neglimit
+ * @return
+ */
public SortedSet<String> getNegativeExamples(int neglimit ) {
return getNegativeExamples(neglimit, false);
}
@@ -72,8 +80,9 @@
/**
* aggregates all collected neg examples
* CAVE: it is necessary to call one of the make functions before calling this
+ * OTHERWISE it will choose random examples
*
- * @param neglimit size of negative Example set
+ * @param neglimit size of negative Example set, 0 means all, which can be quite large several thousands
* @param stable decides whether neg Examples are randomly picked, default false, faster for developing, since the cache can be used
* @return
*/
@@ -85,6 +94,11 @@
if(negatives.isEmpty()) {
negatives.addAll(fromRandom);
}
+ if(neglimit<=0){
+ logger.debug("neg Example size NO shrinking: " + negatives.size());
+ return negatives;
+ }
+
logger.debug("neg Example size before shrinking: " + negatives.size());
if (stable) {
negatives = SetManipulation.stableShrink(negatives,neglimit);
@@ -106,7 +120,7 @@
fromRandom = sparqltasks.queryAsSet(sparqlQueryString, variable);
fromRandom.removeAll(fullPositiveSet);
- logger.debug("|-negExample size from related: " + fromRelated.size());
+ logger.debug("|-negExample size from random: " + fromRandom.size());
}
/**
Added: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,45 @@
+package org.dllearner.utilities.examples;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.log4j.Logger;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.owl.Description;
+import org.dllearner.core.owl.Individual;
+
+public class AutomaticPositiveExampleFinderOWL {
+
+ // LOGGER: ComponentManager
+ private static Logger logger = Logger
+ .getLogger(AutomaticPositiveExampleFinderOWL.class);
+
+
+ private ReasoningService reasoningService;
+
+ private SortedSet<Individual> posExamples;
+
+ public AutomaticPositiveExampleFinderOWL(ReasoningService reasoningService) {
+
+ this.posExamples = new TreeSet<Individual>();
+ this.reasoningService = reasoningService;
+ }
+
+ //QUALITY resultsize is not accounted for
+ public void makePositiveExamplesFromConcept(Description concept){
+ logger.debug("making Positive Examples from Concept: "+concept);
+ this.posExamples = reasoningService.retrieval(concept);
+ //this.posExamples = sparqltasks.retrieveInstancesForClassDescription(conceptKBSyntax, 0);
+ logger.debug("pos Example size: "+posExamples.size());
+ }
+
+
+ public SortedSet<Individual> getPosExamples() {
+ return posExamples;
+ }
+
+
+
+
+
+}
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/ConfWriter.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/ConfWriter.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/ConfWriter.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -150,6 +150,18 @@
}
return ret;
}
+
+
+ public static String listExamples (boolean posOrNeg, SortedSet<Individual> s ){
+ StringBuffer sbuf = new StringBuffer();
+ String sign = (posOrNeg)?"+":"-";
+ for (Individual individual : s) {
+ sbuf.append(sign+"\""+individual+"\"\n");
+ }
+
+ return sbuf.toString();
+ }
+
public void addToStats(String add) {
stats.append(add);
Added: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnConfiguration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnConfiguration.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnConfiguration.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,63 @@
+package org.dllearner.utilities.learn;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.ReasoningService;
+
+public class LearnConfiguration {
+
+ public double noisePercentage = 0;
+ public int maxExecutionTimeInSeconds = 0;
+ public int minExecutionTimeInSeconds = 0;
+ public int guaranteeXgoodDescriptions = 1;
+
+ public SortedSet<String> ignoredConcepts = new TreeSet<String>();
+
+ public boolean useAllConstructor = false;
+ public boolean useExistsConstructor = true;
+ public boolean useCardinalityRestrictions = false;
+ public boolean useNegation = false;
+
+ public boolean writeSearchTree = false;
+ public String searchTreeFile = "log/searchTree.txt";
+ public boolean replaceSearchTree = true;
+
+
+ public void applyConfigEntries(ComponentManager cm, KnowledgeSource ks, LearningProblem lp, ReasoningService rs, LearningAlgorithm la) {
+ try {
+
+ // LEARNINGALGORITHM
+ cm.applyConfigEntry(la, "useAllConstructor", useAllConstructor);
+ cm.applyConfigEntry(la, "useExistsConstructor", useExistsConstructor);
+ cm.applyConfigEntry(la, "useCardinalityRestrictions", useCardinalityRestrictions);
+ cm.applyConfigEntry(la, "useNegation", useNegation);
+
+ cm.applyConfigEntry(la, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
+ cm.applyConfigEntry(la, "maxExecutionTimeInSeconds",
+ maxExecutionTimeInSeconds);
+ cm.applyConfigEntry(la, "guaranteeXgoodDescriptions",
+ guaranteeXgoodDescriptions);
+
+ cm.applyConfigEntry(la, "writeSearchTree", writeSearchTree);
+ cm.applyConfigEntry(la, "searchTreeFile", searchTreeFile);
+ cm.applyConfigEntry(la, "replaceSearchTree", replaceSearchTree);
+
+ cm.applyConfigEntry(la, "noisePercentage", noisePercentage);
+
+ if(ignoredConcepts.size()>0) {
+ cm.applyConfigEntry(la,"ignoredConcepts",ignoredConcepts);
+ }
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // return null;
+
+ }
+}
Added: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,95 @@
+/**
+ * Copyright (C) 2007-2008, 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.utilities.learn;
+
+import java.util.SortedSet;
+
+import org.apache.log4j.Logger;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.core.ComponentInitException;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasonerComponent;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.kb.OWLFile;
+import org.dllearner.learningproblems.PosNegDefinitionLP;
+
+/**
+ *
+ *
+ * @author Sebastian Hellmann
+ *
+ *
+ */
+public class LearnOWLFile {
+
+ private static Logger logger = Logger.getLogger(LearnOWLFile.class);
+
+ public LearnOWLFileConfiguration configuration;
+
+ public LearnOWLFile (LearnOWLFileConfiguration configuration){
+ this.configuration = configuration;
+ }
+
+ //return will be replaced by List Description
+ public LearningAlgorithm learn( SortedSet<String> posExamples,
+ SortedSet<String> negExamples, Class<? extends ReasonerComponent> Reasoner) throws ComponentInitException,
+ LearningProblemUnsupportedException {
+
+ logger.info("Start Learning with");
+ logger.info("positive examples: \t" + posExamples.size());
+ logger.info("negative examples: \t" + negExamples.size());
+
+ // the component manager is the central object to create
+ // and configure components
+ ComponentManager cm = ComponentManager.getInstance();
+
+ // knowledge source
+ KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
+
+ // reasoner
+ ReasonerComponent r = cm.reasoner(Reasoner, ks);
+ ReasoningService rs = cm.reasoningService(r);
+
+
+ // learning problem
+ LearningProblem lp = cm.learningProblem(PosNegDefinitionLP.class, rs);
+ cm.applyConfigEntry(lp, "positiveExamples", posExamples);
+ cm.applyConfigEntry(lp, "negativeExamples", negExamples);
+
+ // learning algorithm
+ LearningAlgorithm la = cm.learningAlgorithm(ExampleBasedROLComponent.class, lp, rs);
+
+
+ configuration.applyConfigEntries(cm, ks, lp, rs, la);
+
+
+ // all components need to be initialised before they can be used
+ ks.init();
+ r.init();
+ lp.init();
+ la.init();
+
+ return la;
+
+ }
+
+}
Added: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFileConfiguration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFileConfiguration.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFileConfiguration.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,38 @@
+package org.dllearner.utilities.learn;
+
+import java.io.File;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.ReasoningService;
+
+public class LearnOWLFileConfiguration extends LearnConfiguration {
+
+
+
+ // SparqlKnowledgeSource
+ public String OWLFileURL = "";
+
+
+ public void setOWLFileURL(String ontologyPath){
+ OWLFileURL = new File(ontologyPath).toURI().toString();
+
+ }
+
+ @Override
+ public void applyConfigEntries(ComponentManager cm, KnowledgeSource ks, LearningProblem lp, ReasoningService rs, LearningAlgorithm la) {
+ try {
+ super.applyConfigEntries(cm, ks, lp, rs, la);
+ // KNOWLEDGESOURCE
+ cm.applyConfigEntry(ks, "url", OWLFileURL);
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // return null;
+
+ }
+}
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -8,7 +8,7 @@
import org.dllearner.kb.sparql.Cache;
import org.dllearner.kb.sparql.SparqlEndpoint;
-public class LearnSPARQLConfiguration {
+public class LearnSPARQLConfiguration extends LearnConfiguration {
@@ -19,27 +19,11 @@
public boolean randomizeCache = false;
public String predefinedFilter = "YAGO";
-
- public double noisePercentage = 15;
- public int maxExecutionTimeInSeconds = 30;
- public int minExecutionTimeInSeconds = 0;
- public int guaranteeXgoodDescriptions = 40;
-
- public boolean useAllConstructor = false;
- public boolean useExistsConstructor = true;
- public boolean useCardinalityRestrictions = false;
- public boolean useNegation = false;
-
- public boolean writeSearchTree = false;
- public String searchTreeFile = "log/searchTree.txt";
- public boolean replaceSearchTree = true;
- public String logLevel = "TRACE";
-
-
-
+
+ @Override
public void applyConfigEntries(ComponentManager cm, KnowledgeSource ks, LearningProblem lp, ReasoningService rs, LearningAlgorithm la) {
try {
-
+ super.applyConfigEntries(cm, ks, lp, rs, la);
// KNOWLEDGESOURCE
cm.applyConfigEntry(ks, "url", sparqlEndpoint.getURL().toString());
cm.applyConfigEntry(ks, "predefinedEndpoint", "DBPEDIA");
@@ -52,32 +36,8 @@
else {
cm.applyConfigEntry(ks, "cacheDir", Cache.getDefaultCacheDir());
}
-
-
- // LEARNINGALGORITHM
- cm.applyConfigEntry(la, "useAllConstructor", useAllConstructor);
- cm.applyConfigEntry(la, "useExistsConstructor", useExistsConstructor);
- cm.applyConfigEntry(la, "useCardinalityRestrictions", useCardinalityRestrictions);
- cm.applyConfigEntry(la, "useNegation", useNegation);
-
- cm.applyConfigEntry(la, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
- cm.applyConfigEntry(la, "maxExecutionTimeInSeconds",
- maxExecutionTimeInSeconds);
- cm.applyConfigEntry(la, "guaranteeXgoodDescriptions",
- guaranteeXgoodDescriptions);
-
- cm.applyConfigEntry(la, "writeSearchTree", writeSearchTree);
- cm.applyConfigEntry(la, "searchTreeFile", searchTreeFile);
- cm.applyConfigEntry(la, "replaceSearchTree", replaceSearchTree);
-
- cm.applyConfigEntry(la, "noisePercentage", noisePercentage);
- cm.applyConfigEntry(la, "logLevel", logLevel);
- /*
- * if(ignoredConcepts.size()>0)
- * cm.applyConfigEntry(la,"ignoredConcepts",ignoredConcepts);
- */
-
-
+
+
} catch (Exception e) {
e.printStackTrace();
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-29 18:26:42 UTC (rev 1135)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -34,6 +34,8 @@
public static final String OWL_SUBCLASS_OF = "http://www.w3.org/2002/07/owl#subClassOf";
public static final String OWL_THING = "http://www.w3.org/2002/07/owl#Thing";
+ public static final String OWL_NOTHING = "http://www.w3.org/2002/07/owl#Nothing";
+
//OWL2 Namespace: http://www.w3.org/2006/12/owl2#
public static boolean isStringClassVocab (String possClass){
Added: trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java 2008-08-29 18:29:12 UTC (rev 1136)
@@ -0,0 +1,107 @@
+/**
+ * Copyright (C) 2008, 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.utilities.owl;
+
+import java.io.File;
+import java.util.List;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.ReasonerComponent;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.owl.NamedClass;
+import org.dllearner.kb.OWLFile;
+import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.reasoning.OWLAPIReasoner;
+
+/**
+ * This class should maybe be included in ReasoningService
+ *
+ * @author Sebastian Hellmann
+ *
+ */
+public class ReasoningServiceFactory {
+
+ public enum AvailableReasoners {FASTINSTANCECHECKER, OWLAPIREASONERPELLET, OWLAPIREASONERFACT};
+
+ public static void main(String[] args) {
+ String ontologyURL = "examples/arch/arch.owl";
+ System.out.println(ontologyURL);
+
+ ReasoningService rs;
+ for (AvailableReasoners r : AvailableReasoners.values()) {
+ System.out.println(r);
+ rs = getReasoningService(ontologyURL, r);
+ List<NamedClass> l = rs.getAtomicConceptsList();
+ System.out.println(l);
+ l = rs.getAtomicConceptsList(true);
+
+ System.out.println(l);
+ }
+
+
+ }
+
+ public static ReasoningService getReasoningService (String ontologyFile, AvailableReasoners r ){
+ ReasoningService rs = null;
+ try{
+ // the component manager is the central object to create
+ // and configure components
+ ComponentManager cm = ComponentManager.getInstance();
+
+ // knowledge source
+ KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
+ String fileURL = new File(ontologyFile).toURI().toString();
+ cm.applyConfigEntry(ks, "url", fileURL);
+ ks.init();
+
+ // reasoner
+ ReasonerComponent rc;
+ switch (r) {
+ case FASTINSTANCECHECKER:
+ rc = cm.reasoner(FastInstanceChecker.class, ks);
+ break;
+ case OWLAPIREASONERFACT:
+ rc = cm.reasoner(OWLAPIReasoner.class, ks);
+ ((OWLAPIReasoner)rc).setReasonerType("fact");
+ break;
+ case OWLAPIREASONERPELLET:
+ rc = cm.reasoner(OWLAPIReasoner.class, ks);
+ ((OWLAPIReasoner)rc).setReasonerType("pellet");
+ break;
+ default:
+ rc = cm.reasoner(FastInstanceChecker.class, ks);
+ break;
+ }
+
+
+ rs = cm.reasoningService(rc);
+ rc.init();
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ return rs;
+ }
+
+
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-29 20:03:16
|
Revision: 1143
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1143&view=rev
Author: kurzum
Date: 2008-08-29 20:03:14 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
server commit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java 2008-08-29 19:50:57 UTC (rev 1142)
+++ trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java 2008-08-29 20:03:14 UTC (rev 1143)
@@ -58,7 +58,9 @@
@SuppressWarnings("unchecked")
public SortedSet<Description> getMoreSpecialConcepts(Description concept) {
- return (TreeSet<Description>) subsumptionHierarchyDown.get(concept).clone();
+ if(subsumptionHierarchyDown==null) return new TreeSet<Description>();
+ else if( subsumptionHierarchyDown.get(concept)==null) return new TreeSet<Description>();
+ else return (TreeSet<Description>) subsumptionHierarchyDown.get(concept).clone();
}
public void improveSubsumptionHierarchy() {
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 19:50:57 UTC (rev 1142)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 20:03:14 UTC (rev 1143)
@@ -147,7 +147,11 @@
// System.out.println(reasoningService.getMoreGeneralConcepts(target));
// for every class execute the learning algorithm
+ try{
learnOriginal(target, positiveEx, negativeEx);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
waitForInput();
}
@@ -170,10 +174,12 @@
SetManipulation.indToString(posExamples),
SetManipulation.indToString(negExamples),
usedReasoner);
+ la.start();
}catch (Exception e) {
+ System.out.println("ignoring the error "+e.toString());
// TODO: handle exception
}
- la.start();
+
EvaluatedDescription d = la.getCurrentlyBestEvaluatedDescription();
//for (EvaluatedDescription description : conceptresults) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-29 20:15:00
|
Revision: 1145
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1145&view=rev
Author: kurzum
Date: 2008-08-29 20:14:57 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
server commit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java 2008-08-29 20:10:50 UTC (rev 1144)
+++ trunk/src/dl-learner/org/dllearner/core/owl/SubsumptionHierarchy.java 2008-08-29 20:14:57 UTC (rev 1145)
@@ -58,9 +58,9 @@
@SuppressWarnings("unchecked")
public SortedSet<Description> getMoreSpecialConcepts(Description concept) {
- if(subsumptionHierarchyDown==null) return new TreeSet<Description>();
- else if( subsumptionHierarchyDown.get(concept)==null) return new TreeSet<Description>();
- else return (TreeSet<Description>) subsumptionHierarchyDown.get(concept).clone();
+ if(subsumptionHierarchyDown==null) { return new TreeSet<Description>();}
+ else if( subsumptionHierarchyDown.get(concept)==null){ return new TreeSet<Description>();}
+ else {return (TreeSet<Description>) subsumptionHierarchyDown.get(concept).clone();}
}
public void improveSubsumptionHierarchy() {
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 20:10:50 UTC (rev 1144)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 20:14:57 UTC (rev 1145)
@@ -131,8 +131,8 @@
AutomaticNegativeExampleFinderOWL ane = new AutomaticNegativeExampleFinderOWL(
positiveEx, reasoningService);
//ane.makeNegativeExamplesFromSuperClasses(target);
- if(RANDOMNEGATIVES)ane.makeNegativeExamplesFromAllOtherInstances();
- else ane.makeNegativeExamplesFromSuperClasses(target);
+ if(RANDOMNEGATIVES){ane.makeNegativeExamplesFromAllOtherInstances();}
+ else{ ane.makeNegativeExamplesFromSuperClasses(target);}
//double correct = ()
// System.out.println((positiveEx.size()*NEGFACTOR));
negativeEx = ane.getNegativeExamples(
@@ -404,9 +404,10 @@
byte[] b = new byte[100];
try{
- if(WAITFORINPUT)
+ if(WAITFORINPUT){
System.out.println("PRESS ENTER TO CONTINUE");
System.in.read(b);
+ }
}catch (Exception e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-29 20:24:38
|
Revision: 1146
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1146&view=rev
Author: kurzum
Date: 2008-08-29 20:24:35 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
server commit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
trunk/src/dl-learner/org/dllearner/utilities/Files.java
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 20:14:57 UTC (rev 1145)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 20:24:35 UTC (rev 1146)
@@ -82,7 +82,7 @@
SimpleClock sc = new SimpleClock();
initLogger();
logger.info("Start");
-
+ Files.clearFile(file);
Files.appendFile(file, "neg Ex random: "+RANDOMNEGATIVES+"\n");
Files.appendFile(file, "negfactor : "+NEGFACTOR+"\n");
@@ -117,7 +117,7 @@
for (NamedClass target : classesToRelearn) {
- System.out.println("now learning: "+target);
+ Files.appendFile(file,"now learning: "+target+"\n");
waitForInput();
positiveEx.clear();
@@ -141,7 +141,7 @@
if(negativeEx.size()<=3) {
System.out.println(target);
waitForInput();
- Files.appendFile(file, "SKIPPED "+target + "\n\t\t negEX "+negativeEx+"\n");
+ Files.appendFile(file, "\tSKIPPED negEX "+negativeEx+"\n");
continue;
}
// reasoningService.prepareSubsumptionHierarchy();
@@ -154,7 +154,8 @@
e.printStackTrace();
}
waitForInput();
-
+ Files.appendFile(file, "*************\n");
+
}
sc.printAndSet("Finished");
@@ -181,12 +182,13 @@
// TODO: handle exception
}
-
- EvaluatedDescription d = la.getCurrentlyBestEvaluatedDescription();
- //for (EvaluatedDescription description : conceptresults) {
- // System.out.println(description);
- //}
- Files.appendFile(file, target +"\n\t\t"+ d+"\n" );
+
+ conceptresults = la.getCurrentlyBestEvaluatedDescriptions(5);
+ for (EvaluatedDescription description : conceptresults) {
+ Files.appendFile(file,"\t"+ description+"\n" );
+ }
+
+
}
private static LearnSPARQLConfiguration getConfForSparql(NamedClass c) {
Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-08-29 20:14:57 UTC (rev 1145)
+++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-08-29 20:24:35 UTC (rev 1146)
@@ -97,7 +97,11 @@
}
public static void clearFile(File file) {
+ try{
createFile(file, "");
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-29 21:33:37
|
Revision: 1147
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1147&view=rev
Author: kurzum
Date: 2008-08-29 21:33:35 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
servercommit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java
trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 20:24:35 UTC (rev 1146)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 21:33:35 UTC (rev 1147)
@@ -63,7 +63,7 @@
private static Logger logger = Logger.getRootLogger();
// size of randomly choosen negative examples compared to positives
- public static double NEGFACTOR = 200.0;
+ public static double NEGFACTOR = 1.0;
// different negative Ex (randomizes) each run, if set to false
private static final boolean DEVELOP = true;
@@ -126,7 +126,7 @@
AutomaticPositiveExampleFinderOWL ape = new AutomaticPositiveExampleFinderOWL(
reasoningService);
ape.makePositiveExamplesFromConcept(target);
- positiveEx = ape.getPosExamples();
+ positiveEx.addAll(ape.getPosExamples());
AutomaticNegativeExampleFinderOWL ane = new AutomaticNegativeExampleFinderOWL(
positiveEx, reasoningService);
@@ -135,10 +135,10 @@
else{ ane.makeNegativeExamplesFromSuperClasses(target);}
//double correct = ()
// System.out.println((positiveEx.size()*NEGFACTOR));
- negativeEx = ane.getNegativeExamples(
- (int) (positiveEx.size() * NEGFACTOR), DEVELOP);
+ negativeEx.addAll(ane.getNegativeExamples(
+ (int) (positiveEx.size() * NEGFACTOR), DEVELOP));
- if(negativeEx.size()<=3) {
+ if(negativeEx.size()<0) {
System.out.println(target);
waitForInput();
Files.appendFile(file, "\tSKIPPED negEX "+negativeEx+"\n");
Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 20:24:35 UTC (rev 1146)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 21:33:35 UTC (rev 1147)
@@ -122,7 +122,8 @@
*/
public void makeNegativeExamplesFromAllOtherInstances() {
logger.debug("making random examples ");
- fromAllOther = reasoningService.getIndividuals();
+ fromAllOther.clear();
+ fromAllOther.addAll(reasoningService.getIndividuals());
fromAllOther.removeAll(fullPositiveSet);
logger.debug("|-negExample size from random: " + fromAllOther.size());
}
@@ -178,8 +179,8 @@
private void makeNegativeExamplesFromClassesOfInstances(SortedSet<Individual> positiveSet) {
logger.debug("making neg Examples from parallel classes");
SortedSet<Description> classes = new TreeSet<Description>();
+ this.fromParallelClasses.clear();
-
for (Individual instance : positiveSet) {
try{
// realization is not implemented in reasoningservice
@@ -226,7 +227,7 @@
*/
public void makeNegativeExamplesFromSuperClasses(NamedClass concept, int depth) {
-
+ fromSuperclasses.clear();
SortedSet<Description> superClasses = reasoningService.getMoreGeneralConcepts(concept);
logger.debug("making neg Examples from " + superClasses.size() + " superclasses");
@@ -246,6 +247,7 @@
*/
public void makeNegativeExamplesFromDomain(ObjectProperty atomicRole){
+ fromDomain.clear();
logger.debug("making Negative Examples from Domain of : "+atomicRole);
fromDomain.addAll(reasoningService.getRoleMembers(atomicRole).keySet());
fromDomain.removeAll(fullPositiveSet);
@@ -260,6 +262,7 @@
*/
public void makeNegativeExamplesFromRange(ObjectProperty atomicRole){
+ fromRange.clear();
logger.debug("making Negative Examples from Range of : "+atomicRole);
Collection<SortedSet<Individual>> tmp = reasoningService.getRoleMembers(atomicRole).values();
for (SortedSet<Individual> set : tmp) {
Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java 2008-08-29 20:24:35 UTC (rev 1146)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticPositiveExampleFinderOWL.java 2008-08-29 21:33:35 UTC (rev 1147)
@@ -28,7 +28,8 @@
//QUALITY resultsize is not accounted for
public void makePositiveExamplesFromConcept(Description concept){
logger.debug("making Positive Examples from Concept: "+concept);
- this.posExamples = reasoningService.retrieval(concept);
+ this.posExamples.clear();
+ this.posExamples.addAll(reasoningService.retrieval(concept));
//this.posExamples = sparqltasks.retrieveInstancesForClassDescription(conceptKBSyntax, 0);
logger.debug("pos Example size: "+posExamples.size());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-29 21:51:24
|
Revision: 1149
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1149&view=rev
Author: kurzum
Date: 2008-08-29 21:51:22 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
server commit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 21:36:31 UTC (rev 1148)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 21:51:22 UTC (rev 1149)
@@ -69,6 +69,7 @@
private static final boolean DEVELOP = true;
private static final boolean WAITFORINPUT = false;
private static final boolean RANDOMNEGATIVES = false;
+ private static final boolean FORCESIZEOFNEG = true;
static File file = new File("sembib.txt");
public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl";
@@ -136,7 +137,7 @@
//double correct = ()
// System.out.println((positiveEx.size()*NEGFACTOR));
negativeEx.addAll(ane.getNegativeExamples(
- (int) (positiveEx.size() * NEGFACTOR), DEVELOP));
+ (int) (positiveEx.size() * NEGFACTOR), DEVELOP, FORCESIZEOFNEG));
if(negativeEx.size()<0) {
System.out.println(target);
Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 21:36:31 UTC (rev 1148)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 21:51:22 UTC (rev 1149)
@@ -74,8 +74,8 @@
* @param neglimit
* @return
*/
- public SortedSet<Individual> getNegativeExamples(int neglimit ) {
- return getNegativeExamples(neglimit, false);
+ public SortedSet<Individual> getNegativeExamples(int neglimit, boolean forceNegLimit ) {
+ return getNegativeExamples(neglimit, false, forceNegLimit);
}
/**
@@ -85,19 +85,22 @@
*
* @param neglimit size of negative Example set, 0 means all, which can be quite large
* @param stable decides whether neg Examples are randomly picked, default false, faster for developing, since the cache can be used
+ * @param forceNegLimit forces that exactly neglimit instances are returned by adding more instances
* @return
*/
- public SortedSet<Individual> getNegativeExamples(int neglimit, boolean stable ) {
+ public SortedSet<Individual> getNegativeExamples(int neglimit, boolean stable, boolean forceNegLimit ) {
SortedSet<Individual> negatives = new TreeSet<Individual>();
negatives.addAll(fromParallelClasses);
negatives.addAll(fromRelated);
negatives.addAll(fromSuperclasses);
- if(negatives.isEmpty()){
+ if(negatives.size()< neglimit){
makeNegativeExamplesFromAllOtherInstances();
+
+ negatives.addAll(SetManipulation.stableShrinkInd(fromAllOther, neglimit-negatives.size()));
}
- negatives.addAll(fromAllOther);
+
if(neglimit<=0){
logger.debug("neg Example size NO shrinking: " + negatives.size());
return negatives;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-30 01:29:42
|
Revision: 1151
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1151&view=rev
Author: kurzum
Date: 2008-08-30 01:29:38 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/utilities/Files.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java
Added: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-08-30 01:29:38 UTC (rev 1151)
@@ -0,0 +1,281 @@
+/**
+ * Copyright (C) 2007-2008, 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.scripts;
+
+import java.io.File;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.EvaluatedDescription;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.owl.Individual;
+import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.utilities.Files;
+import org.dllearner.utilities.datastructures.SetManipulation;
+import org.dllearner.utilities.learn.ConfWriter;
+import org.dllearner.utilities.learn.LearnOWLFile;
+import org.dllearner.utilities.learn.LearnOWLFileConfiguration;
+import org.dllearner.utilities.owl.ReasoningServiceFactory;
+import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
+
+public class DumbLPFinder {
+
+ private static Logger logger = Logger.getRootLogger();
+
+ private static ReasoningService reasoningService;
+
+ public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl";
+
+ private static Class usedReasoner = FastInstanceChecker.class;
+ //private static Class usedReasoner = OWLAPIReasoner.class;
+ private static boolean allOrExists = true;
+ private static boolean tenORthirty = true;
+ //private static boolean allOrExists = true;
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ initLogger();
+ //String fileURL = new File(ontologyFile).toURI().toString();
+
+ reasoningService = ReasoningServiceFactory.getReasoningService(
+ ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
+
+ String baseDir = "sembib/";
+ Files.mkdir(baseDir);
+ String baseDirSparql = baseDir+ "sparql/";
+ Files.mkdir(baseDirSparql);
+ String baseDirNormal = baseDir+"normal/";
+ Files.mkdir(baseDirNormal);
+
+ SortedSet<Individual> allIndividuals = new TreeSet<Individual>();
+ allIndividuals.addAll( reasoningService.getIndividuals());
+
+ reasoningService = null;
+
+ int count = 1;
+ while(count<10000){
+
+ if((count%5)==0){
+ //System.out.println(count+" "+allOrExists+"::"+tenORthirty);
+
+ if(allOrExists && !tenORthirty){
+ allOrExists = true;
+ tenORthirty = true;
+ }else if(!allOrExists && tenORthirty){
+ allOrExists = true;
+ tenORthirty = false;
+ }else if(!allOrExists && !tenORthirty){
+ allOrExists = false;
+ tenORthirty = true;
+ }else if(allOrExists && tenORthirty){
+ allOrExists = false;
+ tenORthirty = false;
+ }
+ //System.out.println(count+" "+allOrExists+"::"+tenORthirty);
+
+ }
+
+ int exampleSize = (tenORthirty)?10:30;
+ int half = (tenORthirty)?5:15;
+
+ String filename ="";
+ filename += (allOrExists)?"all_":"exists_";
+ filename += (tenORthirty)?"ten_":"thirty_";
+
+
+ try{
+
+ SortedSet<Individual> tmp = SetManipulation.fuzzyShrinkInd(allIndividuals, exampleSize);
+
+ SortedSet<Individual> positiveEx = new TreeSet<Individual>();
+ SortedSet<Individual> negativeEx = new TreeSet<Individual>();
+
+ for (Individual individual : tmp) {
+ if(positiveEx.size()< half){
+ positiveEx.add(individual);
+ }else{
+ negativeEx.add(individual);
+ }
+
+ }
+
+
+ EvaluatedDescription d = learnOriginal( positiveEx, negativeEx);
+
+
+
+ String div = (System.currentTimeMillis()%10000)+"";
+ filename+=(d.getDescriptionLength()<10)?"0"+d.getDescriptionLength():d.getDescriptionLength()+"";
+ if(d.getAccuracy()>=0.99){
+ filename +="_99+";
+ }else if(d.getAccuracy()>=0.75){
+ filename +="_75+";
+ }else if(d.getAccuracy()>=0.50){
+ filename +="_50+";
+ }else {
+ filename +="_50-";
+ }
+ filename += "_"+div+".conf";
+
+ String content = fileString(true, d, positiveEx, negativeEx);
+ Files.createFile(new File(baseDirSparql+filename), content);
+ content = fileString(false, d, positiveEx, negativeEx);
+ Files.createFile(new File(baseDirNormal+filename), content);
+
+
+
+ }catch (Exception e) {
+ e.printStackTrace();
+ }finally{
+ ComponentManager.getInstance().freeAllComponents();
+ }
+ //System.out.println(count);
+ count++;
+ }
+
+
+ }
+
+ public static String accString(EvaluatedDescription d){
+
+ String acc = (d.getAccuracy())+"";
+ try { acc = acc.substring(2,6);
+ acc= acc.substring(0,2)+"."+acc.substring(3)+"%";}catch (Exception e) { }
+
+ return acc;
+ }
+
+ public static String fileString(boolean sparql, EvaluatedDescription d, SortedSet<Individual> p, SortedSet<Individual> n){
+
+ String str = "/**\n" +
+ d.getDescription().toKBSyntaxString() + "\n"+
+ d + "\n"+
+ "\n"+
+ "**/\n"+
+ "\n\n";
+ if(sparql){
+ str+="sparql.instances = {\n";
+ for (Individual individual : p) {
+ str+="\""+individual+"\",\n";
+ }
+ for (Individual individual : n) {
+ str+="\""+individual+"\",\n";
+ }
+ str = str.substring(0, str.length()-2);
+ str+="};\n";
+
+ }
+
+ str+="\n"+
+ "/**EXAMPLES**/\n"+
+ ConfWriter.listExamples(true, p)+"\n"+
+ ConfWriter.listExamples(false, n)+"\n";
+
+ return str;
+ }
+
+ private static EvaluatedDescription learnOriginal( SortedSet<Individual> posExamples, SortedSet<Individual> negExamples) {
+
+ LearnOWLFile learner = new LearnOWLFile(getConfForOriginal());
+ LearningAlgorithm la = null;
+ try{
+ la = learner.learn(
+ SetManipulation.indToString(posExamples),
+ SetManipulation.indToString(negExamples),
+ usedReasoner);
+ la.start();
+ }catch (Exception e) {
+ System.out.println("ignoring the error "+e.toString());
+
+ }
+
+ EvaluatedDescription d = la.getCurrentlyBestEvaluatedDescription();
+
+ return d;
+
+
+ }
+
+
+
+ private static LearnOWLFileConfiguration getConfForOriginal() {
+ LearnOWLFileConfiguration lc = new LearnOWLFileConfiguration();
+
+
+ lc.setOWLFileURL(ontologyPath);
+
+ lc.noisePercentage = 0;
+ lc.guaranteeXgoodDescriptions = 1;
+ if(allOrExists){
+ lc.useAllConstructor = true;
+ lc.useCardinalityRestrictions = true;
+ lc.useExistsConstructor =true;
+ lc.useNegation = true;
+ }else {
+ lc.useAllConstructor = false;
+ lc.useCardinalityRestrictions = false;
+ lc.useExistsConstructor =true;
+ lc.useNegation = false;
+ }
+
+
+ Class tmp = FastInstanceChecker.class;
+ if(usedReasoner.equals(tmp)){
+ lc.maxExecutionTimeInSeconds = 30;
+ }else{
+ lc.maxExecutionTimeInSeconds = 200;
+ }
+ return lc;
+
+ }
+
+
+ private static void initLogger() {
+
+ SimpleLayout layout = new SimpleLayout();
+ // create logger (a simple logger which outputs
+ // its messages to the console)
+ FileAppender fileAppender = null;
+ try {
+ fileAppender = new FileAppender(layout, "log/semBibleLog.txt",
+ false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+ logger.removeAllAppenders();
+ //ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ //logger.addAppender(consoleAppender);
+ logger.addAppender(fileAppender);
+ logger.setLevel(Level.INFO);
+
+
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-08-29 21:54:39 UTC (rev 1150)
+++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-08-30 01:29:38 UTC (rev 1151)
@@ -103,5 +103,16 @@
e.printStackTrace();
}
}
+
+ public static void mkdir(String dir){
+ if (!new File(dir).exists()) {
+ try{
+ new File(dir).mkdir();
+ }catch (Exception e) {
+ e.printStackTrace();
+ // this should not be a show stopper
+ }
+ }
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java 2008-08-29 21:54:39 UTC (rev 1150)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java 2008-08-30 01:29:38 UTC (rev 1151)
@@ -45,6 +45,8 @@
public LearnOWLFileConfiguration configuration;
+ public ComponentManager cm ;
+
public LearnOWLFile (LearnOWLFileConfiguration configuration){
this.configuration = configuration;
}
@@ -60,7 +62,7 @@
// the component manager is the central object to create
// and configure components
- ComponentManager cm = ComponentManager.getInstance();
+ cm = ComponentManager.getInstance();
// knowledge source
KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-30 14:31:29
|
Revision: 1153
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1153&view=rev
Author: kurzum
Date: 2008-08-30 14:31:26 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java
trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-30 13:52:08 UTC (rev 1152)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-30 14:31:26 UTC (rev 1153)
@@ -80,7 +80,7 @@
static int recursionDepthDefault = 1;
//RBC
- static final boolean debug = true;
+ static final boolean debug = false;
static final boolean debugUseImprovedTupleAquisitor = debug && false; //switches tupleaquisitor
static final boolean debugExitAfterExtraction = debug && false; //switches sysex und rdf generation
static final boolean debugAdditionallyGenerateRDF = debug && true;
Modified: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-08-30 13:52:08 UTC (rev 1152)
+++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-08-30 14:31:26 UTC (rev 1153)
@@ -23,6 +23,7 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -33,11 +34,14 @@
import org.dllearner.core.ReasoningService;
import org.dllearner.core.owl.Individual;
import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.reasoning.OWLAPIReasoner;
import org.dllearner.utilities.Files;
import org.dllearner.utilities.datastructures.SetManipulation;
import org.dllearner.utilities.learn.ConfWriter;
import org.dllearner.utilities.learn.LearnOWLFile;
import org.dllearner.utilities.learn.LearnOWLFileConfiguration;
+import org.dllearner.utilities.learn.LearnSPARQLConfiguration;
+import org.dllearner.utilities.learn.LearnSparql;
import org.dllearner.utilities.owl.ReasoningServiceFactory;
import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
@@ -49,10 +53,14 @@
public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl";
- private static Class usedReasoner = FastInstanceChecker.class;
- //private static Class usedReasoner = OWLAPIReasoner.class;
+ //private static Class usedReasoner = FastInstanceChecker.class;
+ private static Class usedReasoner = OWLAPIReasoner.class;
private static boolean allOrExists = false;
private static boolean tenORthirty = false;
+
+ private static boolean sparql = true;
+
+ private static boolean DEBUG = false;
//private static boolean allOrExists = true;
/**
@@ -60,6 +68,7 @@
*/
public static void main(String[] args) {
initLogger();
+ logger.info("started");
//String fileURL = new File(ontologyFile).toURI().toString();
reasoningService = ReasoningServiceFactory.getReasoningService(
@@ -124,8 +133,12 @@
}
-
- EvaluatedDescription d = learnOriginal( positiveEx, negativeEx);
+ EvaluatedDescription d;
+ if(sparql){
+ d = learnSPARQL( positiveEx, negativeEx);
+ }else {
+ d = learnOriginal( positiveEx, negativeEx);
+ }
@@ -133,12 +146,12 @@
filename+=(d.getDescriptionLength()<10)?"0"+d.getDescriptionLength():d.getDescriptionLength()+"";
if(d.getAccuracy()>=0.99){
filename +="_99+";
- }else if(d.getAccuracy()>=0.75){
- filename +="_75+";
- }else if(d.getAccuracy()>=0.50){
- filename +="_50+";
+ }else if(d.getAccuracy()>=0.80){
+ filename +="_80+";
+ }else if(d.getAccuracy()>=0.60){
+ filename +="_60+";
}else {
- filename +="_50-";
+ filename +="_60-";
}
filename += "_"+div+".conf";
@@ -220,6 +233,28 @@
}
+
+ private static EvaluatedDescription learnSPARQL( SortedSet<Individual> posExamples, SortedSet<Individual> negExamples) {
+
+ LearnSparql learner = new LearnSparql(getConfForSparql());
+ LearningAlgorithm la = null;
+ try{
+ la = learner.learn(
+ SetManipulation.indToString(posExamples),
+ SetManipulation.indToString(negExamples),
+ usedReasoner);
+ la.start();
+ }catch (Exception e) {
+ System.out.println("ignoring the error "+e.toString());
+
+ }
+
+ EvaluatedDescription d = la.getCurrentlyBestEvaluatedDescription();
+
+ return d;
+
+
+ }
@@ -254,7 +289,41 @@
}
+ private static LearnSPARQLConfiguration getConfForSparql() {
+ LearnSPARQLConfiguration lc = new LearnSPARQLConfiguration();
+ // lsc.sparqlEndpoint = sparqlTasks.getSparqlEndpoint();
+
+
+ lc.recursiondepth = 2;
+ lc.closeAfterRecursion = true;
+ lc.useLits = true;
+ lc.predefinedEndpoint = "LOCALJOSEKIBIBLE";
+
+ lc.noisePercentage = 0;
+ lc.guaranteeXgoodDescriptions = 1;
+ lc.maxExecutionTimeInSeconds = 30;
+
+
+
+ if(allOrExists){
+ lc.useAllConstructor = true;
+ lc.useCardinalityRestrictions = true;
+ lc.useExistsConstructor =true;
+ lc.useNegation = true;
+ }else {
+ lc.useAllConstructor = false;
+ lc.useCardinalityRestrictions = false;
+ lc.useExistsConstructor =true;
+ lc.useNegation = false;
+ }
+
+ // lsc.searchTreeFile = "log/WikipediaCleaner.txt";
+
+ return lc;
+
+ }
+
private static void initLogger() {
SimpleLayout layout = new SimpleLayout();
@@ -270,11 +339,16 @@
logger.removeAllAppenders();
- //ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- //logger.addAppender(consoleAppender);
+ if(DEBUG){
+ logger.setLevel(Level.DEBUG);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ logger.addAppender(consoleAppender);
+ }else{
+ logger.setLevel(Level.INFO);
+ }
logger.addAppender(fileAppender);
- logger.setLevel(Level.INFO);
+
}
Modified: trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java 2008-08-30 13:52:08 UTC (rev 1152)
+++ trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java 2008-08-30 14:31:26 UTC (rev 1153)
@@ -43,6 +43,7 @@
import org.dllearner.kb.sparql.SparqlEndpoint;
import org.dllearner.kb.sparql.SparqlKnowledgeSource;
import org.dllearner.kb.sparql.SparqlQuery;
+import org.dllearner.reasoning.FastInstanceChecker;
import org.dllearner.scripts.improveWikipedia.ConceptSPARQLReEvaluator;
import org.dllearner.scripts.improveWikipedia.ConceptSelector;
import org.dllearner.scripts.improveWikipedia.WikipediaCategoryTasks;
@@ -208,7 +209,7 @@
LearnSparql learner = new LearnSparql(getConfToRelearn());
LearningAlgorithm la = null;
try {
- la = learner.learn(posExamples, negExamples);
+ la = learner.learn(posExamples, negExamples, FastInstanceChecker.class);
} catch (Exception e) {
e.printStackTrace();
}
@@ -221,6 +222,7 @@
private static LearnSPARQLConfiguration getConfToFindWrongIndividuals() {
LearnSPARQLConfiguration lsc = new LearnSPARQLConfiguration();
lsc.sparqlEndpoint = sparqlTasks.getSparqlEndpoint();
+ lsc.predefinedEndpoint = "DBPEDIA";
lsc.recursiondepth = 1;
lsc.noisePercentage = 20;
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java 2008-08-30 13:52:08 UTC (rev 1152)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java 2008-08-30 14:31:26 UTC (rev 1153)
@@ -14,10 +14,12 @@
// SparqlKnowledgeSource
public SparqlEndpoint sparqlEndpoint = SparqlEndpoint.getEndpointDBpedia();
+ public String predefinedEndpoint = null;
public int recursiondepth = 1;
public boolean closeAfterRecursion = true;
+ public boolean useLits = false;
public boolean randomizeCache = false;
- public String predefinedFilter = "YAGO";
+ public String predefinedFilter = null;
@Override
@@ -25,11 +27,21 @@
try {
super.applyConfigEntries(cm, ks, lp, rs, la);
// KNOWLEDGESOURCE
- cm.applyConfigEntry(ks, "url", sparqlEndpoint.getURL().toString());
- cm.applyConfigEntry(ks, "predefinedEndpoint", "DBPEDIA");
+ if(predefinedEndpoint ==null){
+ cm.applyConfigEntry(ks, "url", sparqlEndpoint.getURL().toString());
+ }else {
+ cm.applyConfigEntry(ks, "predefinedEndpoint", predefinedEndpoint);
+ }
+ if(predefinedFilter==null){
+ //todo manual
+ }else{
+ cm.applyConfigEntry(ks, "predefinedFilter", predefinedFilter);
+ }
+
+ cm.applyConfigEntry(ks, "useLits", useLits);
cm.applyConfigEntry(ks, "recursionDepth", recursiondepth);
cm.applyConfigEntry(ks, "closeAfterRecursion", closeAfterRecursion);
- cm.applyConfigEntry(ks, "predefinedFilter", predefinedFilter);
+
if (randomizeCache)
cm.applyConfigEntry(ks, "cacheDir", "cache/"
+ System.currentTimeMillis() + "");
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java 2008-08-30 13:52:08 UTC (rev 1152)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java 2008-08-30 14:31:26 UTC (rev 1153)
@@ -53,7 +53,7 @@
//return will be replaced by List Description
public LearningAlgorithm learn( SortedSet<String> posExamples,
- SortedSet<String> negExamples) throws ComponentInitException,
+ SortedSet<String> negExamples, Class<? extends ReasonerComponent> Reasoner) throws ComponentInitException,
LearningProblemUnsupportedException {
logger.info("Start Learning with");
@@ -72,7 +72,7 @@
cm.applyConfigEntry(ks, "instances", instances);
// reasoner
- ReasonerComponent r = cm.reasoner(FastInstanceChecker.class, ks);
+ ReasonerComponent r = cm.reasoner(Reasoner, ks);
ReasoningService rs = cm.reasoningService(r);
// learning problem
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-30 16:09:10
|
Revision: 1154
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1154&view=rev
Author: kurzum
Date: 2008-08-30 16:09:06 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java
Modified: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-08-30 14:31:26 UTC (rev 1153)
+++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-08-30 16:09:06 UTC (rev 1154)
@@ -55,8 +55,8 @@
//private static Class usedReasoner = FastInstanceChecker.class;
private static Class usedReasoner = OWLAPIReasoner.class;
- private static boolean allOrExists = false;
- private static boolean tenORthirty = false;
+ private static boolean allOrExists = true;
+ private static boolean tenORthirty = true;
private static boolean sparql = true;
@@ -89,7 +89,7 @@
int count = 1;
while(count<10000){
- if((count%5)==0){
+ /*if((count%5)==0){
//System.out.println(count+" "+allOrExists+"::"+tenORthirty);
if(allOrExists && !tenORthirty){
@@ -107,7 +107,7 @@
}
//System.out.println(count+" "+allOrExists+"::"+tenORthirty);
- }
+ }*/
int exampleSize = (tenORthirty)?10:30;
int half = (tenORthirty)?5:15;
@@ -143,16 +143,21 @@
String div = (System.currentTimeMillis()%10000)+"";
- filename+=(d.getDescriptionLength()<10)?"0"+d.getDescriptionLength():d.getDescriptionLength()+"";
if(d.getAccuracy()>=0.99){
- filename +="_99+";
+ filename +="99+";
+ }else if(d.getAccuracy()>=0.90){
+ filename +="90+";
}else if(d.getAccuracy()>=0.80){
- filename +="_80+";
- }else if(d.getAccuracy()>=0.60){
- filename +="_60+";
+ filename +="80+";
+ }else if(d.getAccuracy()>=0.70){
+ filename +="70+";
+ }else if(d.getAccuracy()>0.50){
+ filename +="50+";
}else {
- filename +="_60-";
+ filename +="50-";
}
+ filename+="_";
+ filename+=(d.getDescriptionLength()<10)?"0"+d.getDescriptionLength():d.getDescriptionLength()+"";
filename += "_"+div+".conf";
String content = fileString(true, d, positiveEx, negativeEx);
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java 2008-08-30 14:31:26 UTC (rev 1153)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSPARQLConfiguration.java 2008-08-30 16:09:06 UTC (rev 1154)
@@ -17,6 +17,7 @@
public String predefinedEndpoint = null;
public int recursiondepth = 1;
public boolean closeAfterRecursion = true;
+ public boolean getAllSuperClasses = true;
public boolean useLits = false;
public boolean randomizeCache = false;
public String predefinedFilter = null;
@@ -41,7 +42,9 @@
cm.applyConfigEntry(ks, "useLits", useLits);
cm.applyConfigEntry(ks, "recursionDepth", recursiondepth);
cm.applyConfigEntry(ks, "closeAfterRecursion", closeAfterRecursion);
+ cm.applyConfigEntry(ks, "getAllSuperClasses", getAllSuperClasses);
+
if (randomizeCache)
cm.applyConfigEntry(ks, "cacheDir", "cache/"
+ System.currentTimeMillis() + "");
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java 2008-08-30 14:31:26 UTC (rev 1153)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnSparql.java 2008-08-30 16:09:06 UTC (rev 1154)
@@ -32,7 +32,6 @@
import org.dllearner.core.ReasoningService;
import org.dllearner.kb.sparql.SparqlKnowledgeSource;
import org.dllearner.learningproblems.PosNegDefinitionLP;
-import org.dllearner.reasoning.FastInstanceChecker;
/**
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-30 16:43:14
|
Revision: 1155
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1155&view=rev
Author: kurzum
Date: 2008-08-30 16:43:11 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/ComponentManager.java
trunk/src/dl-learner/org/dllearner/core/ComponentPool.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-08-30 16:09:06 UTC (rev 1154)
+++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-08-30 16:43:11 UTC (rev 1155)
@@ -686,5 +686,9 @@
public List<Class<? extends LearningAlgorithm>> getLearningAlgorithms() {
return new LinkedList<Class<? extends LearningAlgorithm>>(learningAlgorithms);
}
+
+ public List<Component> getLiveComponents(){
+ return pool.getComponents();
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/core/ComponentPool.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ComponentPool.java 2008-08-30 16:09:06 UTC (rev 1154)
+++ trunk/src/dl-learner/org/dllearner/core/ComponentPool.java 2008-08-30 16:43:11 UTC (rev 1155)
@@ -113,5 +113,12 @@
lastValidConfigValue = new HashMap<Component, Map<ConfigOption<?>, Object>>();
configEntryHistory = new HashMap<Component, List<ConfigEntry<?>>>();
}
+
+ /**
+ * @return
+ */
+ public List<Component> getComponents(){
+ return components;
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-30 16:09:06 UTC (rev 1154)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-30 16:43:11 UTC (rev 1155)
@@ -30,7 +30,10 @@
import org.apache.log4j.SimpleLayout;
import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
import org.dllearner.cli.Start;
+import org.dllearner.core.Component;
+import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.ReasoningService;
import org.dllearner.kb.extraction.ExtractionAlgorithm;
import org.dllearner.kb.extraction.Manager;
@@ -60,9 +63,9 @@
public static String tmpFilename = dir + "tmp.conf";
- private static Class usedReasoner = FastInstanceChecker.class;
+ //private static Class usedReasoner = FastInstanceChecker.class;
- private static boolean useSPARQL = false;
+ private static boolean useSPARQL = true;
/**
* @param args
@@ -73,9 +76,10 @@
logger.info("Start");
File tmpFile = new File(tmpFilename);
- List<File> confs = getFilesContaining(useSPARQL,"thirty","exists", "75+");
+ List<File> confs = getFilesContaining(useSPARQL,"ten","all", "99+");
+ System.out.println(confs);
+ //reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
- //reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
try{
for (File file : confs) {
System.out.println(file.getAbsolutePath());
@@ -85,9 +89,22 @@
//System.out.println(tmpFile.getCanonicalPath());
Start.main(new String[] { tmpFilename });
+ ComponentManager cm =ComponentManager.getInstance();
+ List<Component> comp = cm.getLiveComponents();
+ for (Component component : comp) {
+ System.out.println(component.getClass().getCanonicalName());
+ if(component instanceof LearningAlgorithm){
+ System.out.println("yyyy");
+ System.exit(0);
+ }
+
+ }
+
+
Cache.getDefaultCache().clearCache();
+ cm.freeAllComponents();
System.exit(0);
- }
+ }//end for
}catch (Exception e) {
e.printStackTrace();
}
@@ -98,9 +115,12 @@
List<File> ret = new ArrayList<File>();
try{
String actualDir = (sparql)?sparqldir:normaldir;
+ System.out.println(actualDir);
File f = new File(actualDir);
String[] files = f.list();
+
for (int i = 0; i < files.length; i++) {
+ System.out.println(files[i]);
if(
files[i].contains(numExamples)
&& files[i].contains(allOrEx)
@@ -130,9 +150,10 @@
"refexamples.useNegation = true;\n"+
"refexamples.useCardinalityRestrictions = true;\n"+
"refexamples.guaranteeXgoodDescriptions = 1;\n"+
+ "refexamples.maxExecutionTimeInSeconds = 1;\n"+
"\n"+
- //"reasoner = owlAPI;\n"+
- "reasoner = fastInstanceChecker;\n"+
+ "reasoner = owlAPI;\n"+
+ //"reasoner = fastInstanceChecker;\n"+
//"owlAPIReasoner.reasonerType = pellet;\n\n";
"";
return s;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-31 15:04:23
|
Revision: 1156
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1156&view=rev
Author: kurzum
Date: 2008-08-31 15:04:13 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-30 16:43:11 UTC (rev 1155)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-31 15:04:13 UTC (rev 1156)
@@ -83,8 +83,8 @@
static final boolean debug = false;
static final boolean debugUseImprovedTupleAquisitor = debug && false; //switches tupleaquisitor
static final boolean debugExitAfterExtraction = debug && false; //switches sysex und rdf generation
- static final boolean debugAdditionallyGenerateRDF = debug && true;
+
private boolean useCache=true;
// ConfigOptions
public URL url;
@@ -100,6 +100,7 @@
// private Set<String> classList;
private String format = "N-TRIPLES";
private boolean dumpToFile = true;
+ private boolean convertNT2RDF = true ;
private boolean useLits = false;
private boolean getAllSuperClasses = true;
private boolean closeAfterRecursion = true;
@@ -172,6 +173,11 @@
"dumpToFile",
"Specifies whether the extracted ontology is written to a file or not.",
true));
+ options
+ .add(new BooleanConfigOption(
+ "convertNT2RDF",
+ "Specifies whether the extracted NTriples are converted to RDF and deleted.",
+ true));
options.add(new BooleanConfigOption("useLits",
"use Literals in SPARQL query"));
options
@@ -250,6 +256,8 @@
format = (String) entry.getValue();
} else if (option.equals("dumpToFile")) {
dumpToFile = (Boolean) entry.getValue();
+ } else if (option.equals("convertNT2RDF")) {
+ convertNT2RDF = (Boolean) entry.getValue();
} else if (option.equals("useLits")) {
useLits = (Boolean) entry.getValue();
} else if (option.equals("useCache")) {
@@ -329,16 +337,21 @@
new File(basedir).mkdir();
}
+ File dump = new File(basedir + filename);
+
FileWriter fw = new FileWriter(
- new File(basedir + filename), true);
+ dump , true);
fw.write(ont);
fw.flush();
fw.close();
- dumpFile = (new File(basedir + filename)).toURI().toURL();
- if(debugAdditionallyGenerateRDF){
- NT2RDF.convertNT2RDF(basedir + filename);
- //System.exit(0);
+
+ dumpFile = (dump).toURI().toURL();
+
+
+ if(convertNT2RDF){
+ NT2RDF.convertNT2RDF(dump.getAbsolutePath());
+
}
} catch (Exception e) {
e.printStackTrace();
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-30 16:43:11 UTC (rev 1155)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 15:04:13 UTC (rev 1156)
@@ -20,35 +20,34 @@
package org.dllearner.scripts;
import java.io.File;
-import java.util.ArrayList;
import java.util.List;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
-import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
import org.dllearner.cli.Start;
import org.dllearner.core.Component;
import org.dllearner.core.ComponentManager;
-import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.ReasoningService;
-import org.dllearner.kb.extraction.ExtractionAlgorithm;
-import org.dllearner.kb.extraction.Manager;
-import org.dllearner.kb.sparql.Cache;
-import org.dllearner.kb.sparql.SparqlKnowledgeSource;
-import org.dllearner.kb.sparql.SparqlQuery;
-import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.core.owl.Description;
+import org.dllearner.core.owl.Individual;
import org.dllearner.utilities.Files;
-import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL;
-import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderOWL;
-import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL;
+import org.dllearner.utilities.JamonMonitorLogger;
+import org.dllearner.utilities.StringFormatter;
+import org.dllearner.utilities.datastructures.SetManipulation;
import org.dllearner.utilities.owl.ReasoningServiceFactory;
import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
import org.dllearner.utilities.statistics.SimpleClock;
+import com.jamonapi.Monitor;
+
public class SemanticBible2 {
private static ReasoningService reasoningService;
@@ -62,7 +61,9 @@
public static String normaldir = dir+"normal/";
public static String tmpFilename = dir + "tmp.conf";
+ static File log = new File(dir+"results.txt");
+
//private static Class usedReasoner = FastInstanceChecker.class;
private static boolean useSPARQL = true;
@@ -71,90 +72,191 @@
* @param args
*/
public static void main(String[] args) {
- SimpleClock sc = new SimpleClock();
+
initLogger();
logger.info("Start");
File tmpFile = new File(tmpFilename);
+ String del="\t";
+ String cr="\n";
+ int max = 100;
+ SortedSet<String> confs = getFilesContaining(useSPARQL,"ten","all", "99+");
+ analyzeFiles(confs);
+ Files.createFile(log, "accOnFragment"+del+"accOnOnt"+del+"timeFragme"+del+"timeWhole"+cr);
- List<File> confs = getFilesContaining(useSPARQL,"ten","all", "99+");
- System.out.println(confs);
- //reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
+ reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
+ ComponentManager cm =ComponentManager.getInstance();
try{
- for (File file : confs) {
- System.out.println(file.getAbsolutePath());
- StringBuffer sbuf = new StringBuffer(Files.readFile( file));
+ int i=0;
+ for (String fileContent : confs) {
+ if(i>= max) {break;}i++;
+ String logLine ="";
+ SortedSet<Individual> posEx = SetManipulation.stringToInd(getIndividuals(fileContent, true));
+ SortedSet<Individual> negEx = SetManipulation.stringToInd(getIndividuals(fileContent, false));
+
+
+ StringBuffer sbuf = new StringBuffer(fileContent);
sbuf.insert(0, (useSPARQL)?sparqlOptions():normalOptions());
Files.createFile(tmpFile, sbuf.toString());
//System.out.println(tmpFile.getCanonicalPath());
+ Monitor m = JamonMonitorLogger.getTimeMonitor(SemanticBible2.class, "learn on fragment").start();
Start.main(new String[] { tmpFilename });
- ComponentManager cm =ComponentManager.getInstance();
- List<Component> comp = cm.getLiveComponents();
- for (Component component : comp) {
- System.out.println(component.getClass().getCanonicalName());
- if(component instanceof LearningAlgorithm){
- System.out.println("yyyy");
- System.exit(0);
- }
-
- }
+ m.stop();
+ LearningAlgorithm la = getLearningAlgorithm();
-
- Cache.getDefaultCache().clearCache();
+ EvaluatedDescription onFragment =(la.getCurrentlyBestEvaluatedDescription());
+ logLine += StringFormatter.doubleToPercent(onFragment.getAccuracy())+del;
+ SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription());
+ EvaluatedDescription onOnto = reEvaluateDescription(
+ onFragment.getDescription(), retrieved, posEx, negEx);
+ logLine += StringFormatter.doubleToPercent(onOnto.getAccuracy())+del;
+ logLine += m.getTotal()+del+"missing instead size of retrieve: "+retrieved.size()+cr;
+ Files.appendFile(log, logLine);
+ //Cache.getDefaultCache().clearCache();
cm.freeAllComponents();
System.exit(0);
}//end for
}catch (Exception e) {
e.printStackTrace();
}
- logger.info("finished");
+ logger.info("Finished");
}
- public static List<File> getFilesContaining(boolean sparql, String numExamples, String allOrEx, String acc) {
- List<File> ret = new ArrayList<File>();
- try{
+ public static EvaluatedDescription reEvaluateDescription(Description d, SortedSet<Individual> retrieved ,SortedSet<Individual> posEx ,SortedSet<Individual> negEx ){
+ SortedSet<Individual> PosAsPos = new TreeSet<Individual>();
+ SortedSet<Individual> PosAsNeg = new TreeSet<Individual>();
+ SortedSet<Individual> NegAsPos = new TreeSet<Individual>();
+ SortedSet<Individual> NegAsNeg = new TreeSet<Individual>();
+
+ // PosAsPos
+ PosAsPos.addAll(posEx);
+ PosAsPos.retainAll(retrieved);
+
+ // PosAsNeg
+ PosAsNeg.addAll(posEx);
+ PosAsNeg.removeAll(retrieved);
+
+ // NegAsPos
+ NegAsPos.addAll(negEx);
+ NegAsPos.retainAll(retrieved);
+
+ // PosAsNeg
+ NegAsNeg.addAll(negEx);
+ NegAsNeg.removeAll(retrieved);
+
+ return new EvaluatedDescription(d, PosAsPos, PosAsNeg, NegAsPos,NegAsNeg);
+
+ }
+
+ public static LearningAlgorithm getLearningAlgorithm(){
+ ComponentManager cm =ComponentManager.getInstance();
+
+ List<Component> comp = cm.getLiveComponents();
+ for (Component component : comp) {
+ if(component instanceof LearningAlgorithm){
+ return (LearningAlgorithm) component;
+ }
+
+ }
+ return null;
+ }
+
+ public static SortedSet<String> getFilesContaining(boolean sparql, String numExamples, String allOrEx, String acc) {
+ //List<File> ret = new ArrayList<File>();
+ SortedSet<String> ret = new TreeSet<String>();
+
String actualDir = (sparql)?sparqldir:normaldir;
- System.out.println(actualDir);
+ logger.info(actualDir);
File f = new File(actualDir);
String[] files = f.list();
-
+ int consistent = 0;
+ try{
for (int i = 0; i < files.length; i++) {
- System.out.println(files[i]);
- if(
- files[i].contains(numExamples)
+
+ if( files[i].contains(numExamples)
&& files[i].contains(allOrEx)
&& files[i].contains(acc)
){
- ret.add(new File(actualDir+files[i]));
+ consistent++;
+ ret.add(Files.readFile(new File(actualDir+files[i])));
+ if(ret.size() != consistent){
+ logger.info("double file: "+files[i]);
+ }
}
}
}catch (Exception e) {
- logger.warn("deleting cache failed");
+
e.printStackTrace();
}
+ if(consistent != ret.size()){
+ logger.info("double files"+consistent+"::"+ret.size());
+ System.exit(0);
+ }else{
+ logger.info("all files different");
+ }
return ret;
}
+ public static void analyzeFiles(SortedSet<String> l){
+ SortedSet<String> differentIndividuals = new TreeSet<String>();
+ for (String content : l) {
+ differentIndividuals.addAll(getIndividuals(content, true));
+ differentIndividuals.addAll(getIndividuals(content, false));
+
+ }
+ System.out.println("found diff inds "+differentIndividuals.size());
+
+ }
+ public static SortedSet<String> getIndividuals(String target, boolean posOrNeg){
+ if(posOrNeg){
+ return getAllStringsBetween(target, "+\"", "\"");
+ }else{
+ return getAllStringsBetween(target, "-\"", "\"");
+ }
+
+ }
+
+ public static SortedSet<String> getAllStringsBetween(String target, String start, String end){
+ SortedSet<String> ret = new TreeSet<String>();
+ StringTokenizer st = new StringTokenizer(target,"\n");
+ while(st.hasMoreElements()){
+ String line = st.nextToken();
+ if(line.contains(start)){
+ line = line.substring(line.indexOf(start)+start.length());
+ String current = line.substring(0,line.indexOf(end));
+ ret.add(current);
+ }
+ }
+
+ return ret;
+ }
+
+ public static String getCombinedOptions(){
+ String s="\n"+
+ "algorithm = refexamples;\n"+
+ "refexamples.useAllConstructor = true;\n"+
+ "refexamples.useNegation = true;\n"+
+ "refexamples.useCardinalityRestrictions = true;\n"+
+ "refexamples.guaranteeXgoodDescriptions = 1;\n"+
+ "refexamples.maxExecutionTimeInSeconds = 100;\n"+
+ "\n"+
+ "reasoner = owlAPI;\n"+
+ //"reasoner = fastInstanceChecker;\n"+
+ "owlAPIReasoner.reasonerType = pellet;\n\n"+
+ "";
+ return s;
+ }
+
public static String sparqlOptions (){
String s="// SPARQL options\n"+
"sparql.recursionDepth = 3;\n"+
"sparql.useLits = true;\n"+
"sparql.predefinedEndpoint = \"LOCALJOSEKIBIBLE\";\n"+
"import(\"lalala\",\"SPARQL\");\n"+
-
- "algorithm = refexamples;\n"+
- "refexamples.useAllConstructor = true;\n"+
- "refexamples.useNegation = true;\n"+
- "refexamples.useCardinalityRestrictions = true;\n"+
- "refexamples.guaranteeXgoodDescriptions = 1;\n"+
- "refexamples.maxExecutionTimeInSeconds = 1;\n"+
- "\n"+
- "reasoner = owlAPI;\n"+
- //"reasoner = fastInstanceChecker;\n"+
- //"owlAPIReasoner.reasonerType = pellet;\n\n";
+ getCombinedOptions()+
"";
return s;
}
@@ -162,15 +264,7 @@
public static String normalOptions (){
String s="\n"+
"import(\"NTNcombined.owl\");\n"+
- "algorithm = refexamples;\n"+
- "refexamples.useAllConstructor = true;\n"+
- "refexamples.useNegation = true;\n"+
- "refexamples.useCardinalityRestrictions = true;\n"+
- "refexamples.guaranteeXgoodDescriptions = 1;\n"+
- "\n"+
- "reasoner = owlAPI;\n"+
- //"reasoner = fastInstanceChecker;\n"+
- //"owlAPIReasoner.reasonerType = pellet;\n\n";
+ getCombinedOptions()+
"";
return s;
}
@@ -191,9 +285,9 @@
ConsoleAppender consoleAppender = new ConsoleAppender(layout);
logger.removeAllAppenders();
- logger.addAppender(consoleAppender);
+ //logger.addAppender(consoleAppender);
logger.addAppender(fileAppender);
- logger.setLevel(Level.DEBUG);
+ logger.setLevel(Level.INFO);
}
Added: trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java 2008-08-31 15:04:13 UTC (rev 1156)
@@ -0,0 +1,26 @@
+package org.dllearner.utilities;
+
+
+public class StringFormatter {
+
+
+ /**
+ * formats a double value between 0 and 100 to a percentage
+ * ex: 0.7854684 will be return 78.5%
+ * @param d
+ * @return
+ */
+ public static String doubleToPercent(double d){
+ if(d>1.0 || d<0.0)return "bad format: "+d;
+ else if(d == 1.0){
+ return "100.0%";
+ }else if(d == 0.0 ){
+ return "0.0%";
+ }else {
+ String acc = (d*100)+"";
+ acc = acc.substring(0,"55.5".length());
+ return acc+"%";
+ }
+
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-31 15:20:09
|
Revision: 1159
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1159&view=rev
Author: kurzum
Date: 2008-08-31 15:20:00 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2008-08-31 15:15:00 UTC (rev 1158)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2008-08-31 15:20:00 UTC (rev 1159)
@@ -183,7 +183,7 @@
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
- }
+ }
// TODO: we need to check whether the query is correct
// (may not always be the case due to md5 hashing)
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 15:15:00 UTC (rev 1158)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 15:20:00 UTC (rev 1159)
@@ -113,13 +113,13 @@
logLine += StringFormatter.doubleToPercent(onOnto.getAccuracy())+del;
logLine += m.getTotal()+del+"missing instead size of retrieve: "+retrieved.size()+cr;
Files.appendFile(log, logLine);
- Cache.getDefaultCache().clearCache();
+ //Cache.getDefaultCache().clearCache();
cm.freeAllComponents();
}//end for
}catch (Exception e) {
e.printStackTrace();
- System.exit(0);
+
}
logger.info("Finished");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-31 16:58:12
|
Revision: 1160
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1160&view=rev
Author: kurzum
Date: 2008-08-31 16:58:06 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
sc
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
trunk/src/dl-learner/org/dllearner/utilities/Files.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2008-08-31 15:20:00 UTC (rev 1159)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2008-08-31 16:58:06 UTC (rev 1160)
@@ -31,6 +31,7 @@
import java.util.LinkedList;
import org.apache.log4j.Logger;
+import org.dllearner.utilities.Files;
import org.dllearner.utilities.JamonMonitorLogger;
import com.jamonapi.Monitor;
@@ -121,9 +122,8 @@
this.cacheDir = cacheDir + File.separator;
if (!new File(cacheDir).exists()) {
- logger
- .info("Created directory: " + cacheDir + " : " + new File(cacheDir).mkdir()
- + ".");
+ Files.mkdir(cacheDir);
+ logger.info("Created directory: " + cacheDir + ".");
}
}
@@ -179,10 +179,13 @@
FileInputStream fos = new FileInputStream(filename);
ObjectInputStream o = new ObjectInputStream(fos);
entry = (LinkedList<Object>) o.readObject();
+ o.close();
} catch (IOException e) {
e.printStackTrace();
+ if(Files.debug){System.exit(0);}
} catch (ClassNotFoundException e) {
e.printStackTrace();
+ if(Files.debug){System.exit(0);}
}
// TODO: we need to check whether the query is correct
@@ -297,17 +300,12 @@
* and can thus still be used without creating a new Cache Object
*/
public void clearCache() {
- try{
+
File f = new File(cacheDir);
String[] files = f.list();
for (int i = 0; i < files.length; i++) {
- new File(cacheDir+"/"+files[i]).delete();
- }
- }catch (Exception e) {
- logger.warn("deleting cache failed");
- e.printStackTrace();
- }
-
+ Files.deleteFile(new File(cacheDir+"/"+files[i]));
+ }
}
/**
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2008-08-31 15:20:00 UTC (rev 1159)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2008-08-31 16:58:06 UTC (rev 1160)
@@ -21,13 +21,14 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.FileWriter;
+import java.io.File;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import javax.xml.ws.http.HTTPException;
import org.apache.log4j.Logger;
+import org.dllearner.utilities.Files;
import org.dllearner.utilities.JamonMonitorLogger;
import com.hp.hpl.jena.query.ResultSet;
@@ -240,7 +241,15 @@
* @param s the String to log
*/
public static void writeToSparqlLog(String s) {
- try {
+
+ if(!logDeletedOnStart){
+ Files.createFile(new File("log/sparql.txt"),s+"\n");
+ logDeletedOnStart = true;
+ }else{
+ Files.appendFile(new File("log/sparql.txt"), s+"\n");
+ }
+
+ /*try {
FileWriter fw = new FileWriter("log/sparql.txt", logDeletedOnStart);
logDeletedOnStart = true;
@@ -252,7 +261,7 @@
// make the e object more special FileNotFound??
//new File("log").mkdir();
//writeToSparqlLog(s);
- }
+ }*/
}
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 15:20:00 UTC (rev 1159)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 16:58:06 UTC (rev 1160)
@@ -116,6 +116,7 @@
//Cache.getDefaultCache().clearCache();
cm.freeAllComponents();
+
}//end for
}catch (Exception e) {
e.printStackTrace();
Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-08-31 15:20:00 UTC (rev 1159)
+++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-08-31 16:58:06 UTC (rev 1160)
@@ -31,6 +31,7 @@
*
*/
public class Files {
+ public static boolean debug = true;
/**
* Reads in a file.
@@ -40,15 +41,20 @@
* @return Content of the file.
*/
public static String readFile(File file) throws FileNotFoundException, IOException {
+
+
BufferedReader br = new BufferedReader(new FileReader(file));
+ StringBuffer content = new StringBuffer();
+ try{
String line;
- StringBuffer content = new StringBuffer();
+
while ((line = br.readLine()) != null) {
content.append(line);
content.append(System.getProperty("line.separator"));
}
- br.close();
+ }finally{br.close();}
return content.toString();
+
}
/**
@@ -61,16 +67,17 @@
* Content of the file.
*/
public static void createFile(File file, String content) {
+
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(content.getBytes());
- fos.close();
+
} catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ if(debug){System.exit(0);}
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ if(debug){System.exit(0);}
}
}
@@ -88,11 +95,11 @@
fos.write(content.getBytes());
fos.close();
} catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ if(debug){System.exit(0);}
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ if(debug){System.exit(0);}
}
}
@@ -101,15 +108,27 @@
createFile(file, "");
}catch (Exception e) {
e.printStackTrace();
+ if(debug){System.exit(0);}
}
}
+ public static void deleteFile(File file) {
+
+ try{
+ file.delete();
+ }catch (Exception e) {
+ e.printStackTrace();
+ if(debug){System.exit(0);}
+ }
+ }
+
public static void mkdir(String dir){
if (!new File(dir).exists()) {
try{
new File(dir).mkdir();
}catch (Exception e) {
e.printStackTrace();
+ if(debug){System.exit(0);}
// this should not be a show stopper
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-31 17:18:36
|
Revision: 1161
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1161&view=rev
Author: kurzum
Date: 2008-08-31 17:18:32 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-31 16:58:06 UTC (rev 1160)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-31 17:18:32 UTC (rev 1161)
@@ -100,7 +100,7 @@
// private Set<String> classList;
private String format = "N-TRIPLES";
private boolean dumpToFile = true;
- private boolean convertNT2RDF = true ;
+ private boolean convertNT2RDF = false ;
private boolean useLits = false;
private boolean getAllSuperClasses = true;
private boolean closeAfterRecursion = true;
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 16:58:06 UTC (rev 1160)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 17:18:32 UTC (rev 1161)
@@ -45,6 +45,7 @@
import org.dllearner.utilities.datastructures.SetManipulation;
import org.dllearner.utilities.owl.ReasoningServiceFactory;
import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
+import org.dllearner.utilities.statistics.SimpleClock;
import com.jamonapi.Monitor;
@@ -81,7 +82,13 @@
int max = 100;
SortedSet<String> confs = getFilesContaining(useSPARQL,"ten","all", "99+");
analyzeFiles(confs);
- Files.createFile(log, "accOnFragment"+del+"accOnOnt"+del+"timeFragme"+del+"timeWhole"+cr);
+ Files.createFile(log,
+ "accOnFragment"+del+
+ "accOnOnt"+del+
+ "timeFragme"+del+
+ "coveredPos"+del+
+ "coveredNeg"+del+
+ "timeWhole"+cr);
reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
@@ -101,7 +108,9 @@
//System.out.println(tmpFile.getCanonicalPath());
Monitor m = JamonMonitorLogger.getTimeMonitor(SemanticBible2.class, "learn on fragment").start();
+ SimpleClock sc = new SimpleClock();
Start.main(new String[] { tmpFilename });
+ long time = sc.getTime();
m.stop();
LearningAlgorithm la = getLearningAlgorithm();
@@ -110,10 +119,16 @@
SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription());
EvaluatedDescription onOnto = reEvaluateDescription(
onFragment.getDescription(), retrieved, posEx, negEx);
+ if(onOnto.getAccuracy()!=1.0){
+ Files.appendFile(log, onOnto.toString()+"\n");
+ }
logLine += StringFormatter.doubleToPercent(onOnto.getAccuracy())+del;
- logLine += m.getTotal()+del+"missing instead size of retrieve: "+retrieved.size()+cr;
- Files.appendFile(log, logLine);
- //Cache.getDefaultCache().clearCache();
+ logLine += time+del;
+ logLine += StringFormatter.doubleToPercent((double)(onOnto.getCoveredPositives().size()/5))+del;
+ logLine += StringFormatter.doubleToPercent((double)((5-onOnto.getCoveredNegatives().size())/5))+del;
+ logLine += " size of retrieve: "+retrieved.size();
+ Files.appendFile(log, logLine+cr);
+ Cache.getDefaultCache().clearCache();
cm.freeAllComponents();
@@ -122,7 +137,9 @@
e.printStackTrace();
}
+
logger.info("Finished");
+
}
public static EvaluatedDescription reEvaluateDescription(Description d, SortedSet<Individual> retrieved ,SortedSet<Individual> posEx ,SortedSet<Individual> negEx ){
@@ -243,7 +260,7 @@
"refexamples.useNegation = true;\n"+
"refexamples.useCardinalityRestrictions = true;\n"+
"refexamples.guaranteeXgoodDescriptions = 1;\n"+
- "refexamples.maxExecutionTimeInSeconds = 100;\n"+
+
"\n"+
"reasoner = owlAPI;\n"+
//"reasoner = fastInstanceChecker;\n"+
@@ -266,6 +283,7 @@
public static String normalOptions (){
String s="\n"+
"import(\"NTNcombined.owl\");\n"+
+ "refexamples.maxExecutionTimeInSeconds = 1800;\n"+
getCombinedOptions()+
"";
return s;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-08-31 19:54:35
|
Revision: 1163
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1163&view=rev
Author: kurzum
Date: 2008-08-31 19:54:28 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/learningproblems/ScoreTwoValued.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ScoreTwoValued.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/learningproblems/ScoreTwoValued.java 2008-08-31 19:09:56 UTC (rev 1162)
+++ trunk/src/dl-learner/org/dllearner/learningproblems/ScoreTwoValued.java 2008-08-31 19:54:28 UTC (rev 1163)
@@ -50,7 +50,7 @@
private double percentPerLengthUnit;
public ScoreTwoValued(Set<Individual> posAsPos, Set<Individual> posAsNeg, Set<Individual> negAsPos, Set<Individual> negAsNeg) {
- this(0,0,posAsPos,posAsNeg,negAsPos,posAsPos);
+ this(0,0,posAsPos,posAsNeg,negAsPos,negAsNeg);
}
public ScoreTwoValued(int conceptLength, double percentPerLengthUnit, Set<Individual> posAsPos, Set<Individual> posAsNeg, Set<Individual> negAsPos, Set<Individual> negAsNeg) {
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 19:09:56 UTC (rev 1162)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 19:54:28 UTC (rev 1163)
@@ -75,9 +75,9 @@
* @param args
*/
public static void main(String[] args) {
-
+ SimpleClock total = new SimpleClock();
initLogger();
- logger.info("Start");
+ logger.warn("Start");
File tmpFile = new File(tmpFilename);
String del="\t";
String cr="\n";
@@ -123,23 +123,32 @@
SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription());
EvaluatedDescription onOnto = reEvaluateDescription(
onFragment.getDescription(), retrieved, posEx, negEx);
- if(onOnto.getAccuracy()!=1.0){
+ /*if(onOnto.getAccuracy()!=1.0){
Files.appendFile(log, onOnto.toString()+"\n");
System.out.println(onOnto.toString());
+
System.out.println(onOnto.getCoveredPositives());
- System.out.println(onOnto.getCoveredNegatives());
+ System.out.println(onOnto.getCoveredNegatives().size());
+
System.out.println(onOnto.getNotCoveredPositives());
System.out.println(onOnto.getNotCoveredNegatives());
+ System.out.println("p then n");
System.out.println(posEx);
System.out.println(negEx);
System.out.println(retrieved);
+ System.out.println((5-onOnto.getCoveredNegatives().size())+"");
+ double n = (double) (5-onOnto.getCoveredNegatives().size());
+ System.out.println();
+ System.out.println((n/5.0));
System.exit(0);
- }
+ }*/
logLine += StringFormatter.doubleToPercent(onOnto.getAccuracy())+del;
logLine += time+del;
logLine += StringFormatter.doubleToPercent((double)(onOnto.getCoveredPositives().size()/5))+del;
- logLine += StringFormatter.doubleToPercent((double)((5-onOnto.getCoveredNegatives().size())/5))+del;
- logLine += " size of retrieve: "+retrieved.size();
+ double n = (double) (5-onOnto.getCoveredNegatives().size());
+ logLine += StringFormatter.doubleToPercent(n/5.0)+del;
+ logLine += " size of retrieve: "+retrieved.size()+del;
+ logLine += f.toString();
Files.appendFile(log, logLine+cr);
Cache.getDefaultCache().clearCache();
cm.freeAllComponents();
@@ -151,7 +160,7 @@
}
- logger.info("Finished");
+ logger.warn("Finished");
}
@@ -165,18 +174,27 @@
PosAsPos.addAll(posEx);
PosAsPos.retainAll(retrieved);
+ //System.out.println(PosAsPos);
+
// PosAsNeg
PosAsNeg.addAll(posEx);
PosAsNeg.removeAll(retrieved);
+ //System.out.println(PosAsNeg);
+
// NegAsPos
NegAsPos.addAll(negEx);
NegAsPos.retainAll(retrieved);
+
+ //System.out.println(NegAsPos);
// PosAsNeg
NegAsNeg.addAll(negEx);
NegAsNeg.removeAll(retrieved);
+ //System.out.println(NegAsNeg);
+
+
return new EvaluatedDescription(d, PosAsPos, PosAsNeg, NegAsPos,NegAsNeg);
}
@@ -199,7 +217,7 @@
//SortedSet<File> ret = new TreeSet<File>();
String actualDir = (sparql)?sparqldir:normaldir;
- logger.info(actualDir);
+ logger.warn(actualDir);
File f = new File(actualDir);
String[] files = f.list();
Arrays.sort(files);
@@ -214,7 +232,7 @@
consistent++;
ret.add(new File(actualDir+files[i]));
if(ret.size() != consistent){
- logger.info("double file: "+files[i]);
+ logger.warn("double file: "+files[i]);
}
}
@@ -224,10 +242,10 @@
e.printStackTrace();
}
if(consistent != ret.size()){
- logger.info("double files"+consistent+"::"+ret.size());
+ logger.warn("double files"+consistent+"::"+ret.size());
System.exit(0);
}else{
- logger.info("all files different");
+ logger.warn("all files different");
}
return ret;
}
@@ -320,9 +338,9 @@
ConsoleAppender consoleAppender = new ConsoleAppender(layout);
logger.removeAllAppenders();
- //logger.addAppender(consoleAppender);
+ logger.addAppender(consoleAppender);
logger.addAppender(fileAppender);
- logger.setLevel(Level.INFO);
+ logger.setLevel(Level.WARN);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-09-01 00:00:23
|
Revision: 1165
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1165&view=rev
Author: kurzum
Date: 2008-09-01 00:00:09 +0000 (Mon, 01 Sep 2008)
Log Message:
-----------
servercommit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/ComponentManager.java
trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java
Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-08-31 19:55:38 UTC (rev 1164)
+++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-09-01 00:00:09 UTC (rev 1165)
@@ -28,6 +28,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
@@ -687,8 +688,43 @@
return new LinkedList<Class<? extends LearningAlgorithm>>(learningAlgorithms);
}
+
+ /**
+ * Retuns a list of all instanciated and registered Components
+ * @return
+ */
public List<Component> getLiveComponents(){
return pool.getComponents();
}
+
+ /**
+ * Retuns a list of all instanciated and registered LearningAlgorithm
+ * @return
+ */
+ public List<LearningAlgorithm> getLiveLearningAlgorithms(){
+ List<LearningAlgorithm> list = new ArrayList<LearningAlgorithm>();
+ for (Component component : cm.getLiveComponents()) {
+ if(component instanceof LearningAlgorithm){
+ list.add((LearningAlgorithm) component);
+ }
+
+ }
+ return list;
+ }
+
+ /**
+ * Retuns a list of all instanciated and registered KnowledgeSource
+ * @return
+ */
+ public List<KnowledgeSource> getLiveKnowledgeSources(){
+ List<KnowledgeSource> list = new ArrayList<KnowledgeSource>();
+ for (Component component : cm.getLiveComponents()) {
+ if(component instanceof KnowledgeSource){
+ list.add((KnowledgeSource) component);
+ }
+
+ }
+ return list;
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-31 19:55:38 UTC (rev 1164)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-01 00:00:09 UTC (rev 1165)
@@ -35,6 +35,7 @@
private Configuration configuration;
private ExtractionAlgorithm extractionAlgorithm;
+ private int nrOfExtractedTriples = 0;
private static Logger logger = Logger
.getLogger(Manager.class);
@@ -85,6 +86,7 @@
logger.info("Finished extracting, start conversion");
StringBuffer nt = new StringBuffer(100000);
Object[] arr = tripleCollector.toArray();
+ nrOfExtractedTriples = arr.length;
for (int i = 0; i < arr.length; i++) {
nt.append((String) arr[i] + "\n");
if (i % 1000 == 0)
@@ -105,4 +107,8 @@
return configuration;
}
+ public int getNrOfExtractedTriples() {
+ return nrOfExtractedTriples;
+ }
+
}
\ No newline at end of file
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-08-31 19:55:38 UTC (rev 1164)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-01 00:00:09 UTC (rev 1165)
@@ -129,6 +129,9 @@
// received ontology as KB, the internal format
private KB kb;
+ //mainly used for statistic
+ private int nrOfExtractedTriples = 0;
+
public static String getName() {
return "SPARQL Endpoint";
}
@@ -368,6 +371,7 @@
} catch (Exception e) {
e.printStackTrace();
}
+ nrOfExtractedTriples = m.getNrOfExtractedTriples();
logger.info("SparqlModul: ****Finished " + totalTime.getAndSet("") );
if(debugExitAfterExtraction){
@@ -505,6 +509,10 @@
return cacheDir;
}
+ public int getNrOfExtractedTriples() {
+ return nrOfExtractedTriples;
+ }
+
/*public static void main(String[] args) throws MalformedURLException {
String query = "SELECT ?pred ?obj\n"
+ "WHERE {<http://dbpedia.org/resource/Leipzig> ?pred ?obj}";
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-08-31 19:55:38 UTC (rev 1164)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-01 00:00:09 UTC (rev 1165)
@@ -20,9 +20,12 @@
package org.dllearner.scripts;
import java.io.File;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
@@ -36,20 +39,23 @@
import org.dllearner.core.Component;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.EvaluatedDescription;
+import org.dllearner.core.KnowledgeSource;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.ReasoningService;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Individual;
import org.dllearner.kb.sparql.Cache;
+import org.dllearner.kb.sparql.SparqlKnowledgeSource;
import org.dllearner.utilities.Files;
import org.dllearner.utilities.JamonMonitorLogger;
-import org.dllearner.utilities.StringFormatter;
import org.dllearner.utilities.datastructures.SetManipulation;
+import org.dllearner.utilities.learn.ConfWriter;
import org.dllearner.utilities.owl.ReasoningServiceFactory;
import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
import org.dllearner.utilities.statistics.SimpleClock;
+import org.dllearner.utilities.statistics.Stat;
-import com.jamonapi.Monitor;
+import com.jamonapi.MonitorFactory;
public class SemanticBible2 {
@@ -66,7 +72,26 @@
public static String tmpFilename = dir + "tmp.conf";
static File log = new File(dir+"results.txt");
+ private static Stat accFragment = new Stat();
+ private static Stat accOnOnto = new Stat();
+ private static Stat accPosExOnOnto = new Stat();
+ private static Stat accNegExOnOnto = new Stat();
+ private static Stat timeFragment = new Stat();
+ private static Stat nrOfExtractedTriples = new Stat();
+ private static Stat dLengthFragment = new Stat();
+ private static Stat dDepthFragment = new Stat();
+ private static Stat timeWhole = new Stat();
+ private static Stat accWhole = new Stat();
+ private static Stat dLengthWhole = new Stat();
+ private static Stat dDepthWhole = new Stat();
+
+ private static int normalNoisePercentage = 0;
+ private static int normalMaxExecution = 500;
+ private static int sparqllMaxExecution = 250;
+
+
+
//private static Class usedReasoner = FastInstanceChecker.class;
private static boolean useSPARQL = true;
@@ -76,6 +101,7 @@
*/
public static void main(String[] args) {
SimpleClock total = new SimpleClock();
+
initLogger();
logger.warn("Start");
File tmpFile = new File(tmpFilename);
@@ -84,86 +110,123 @@
List<File> confs = getFilesContaining(useSPARQL,"ten","all", "99+");
//analyzeFiles(confs);
- Files.createFile(log,
- "accOnFragment"+del+
- "accOnOnt"+del+
- "timeFragme"+del+
- "coveredPos"+del+
- "coveredNeg"+del+
- "timeWhole"+cr);
+
reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET);
ComponentManager cm =ComponentManager.getInstance();
try{
for (File f : confs) {
+ Cache.getDefaultCache().clearCache();
String fileContent = Files.readFile(f);
-
- String logLine ="";
SortedSet<Individual> posEx = SetManipulation.stringToInd(getIndividuals(fileContent, true));
SortedSet<Individual> negEx = SetManipulation.stringToInd(getIndividuals(fileContent, false));
StringBuffer sbuf = new StringBuffer(fileContent);
- sbuf.insert(0, (useSPARQL)?sparqlOptions():normalOptions());
+ sbuf.insert(0, sparqlOptions());
Files.createFile(tmpFile, sbuf.toString());
- //System.out.println(tmpFile.getCanonicalPath());
- Monitor m = JamonMonitorLogger.getTimeMonitor(SemanticBible2.class, "learn on fragment").start();
SimpleClock sc = new SimpleClock();
Start.main(new String[] { tmpFilename });
- long time = sc.getTime();
- m.stop();
- LearningAlgorithm la = getLearningAlgorithm();
+ timeFragment.addNumber((double) sc.getTime());
+
+ LearningAlgorithm la = cm.getLiveLearningAlgorithms().remove(0);
EvaluatedDescription onFragment =(la.getCurrentlyBestEvaluatedDescription());
- logLine += StringFormatter.doubleToPercent(onFragment.getAccuracy())+del;
+ accFragment.addNumber(onFragment.getAccuracy());
+ dDepthFragment.addNumber((double)onFragment.getDescriptionDepth());
+ dLengthFragment.addNumber((double)onFragment.getDescriptionLength());
+
SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription());
EvaluatedDescription onOnto = reEvaluateDescription(
onFragment.getDescription(), retrieved, posEx, negEx);
- /*if(onOnto.getAccuracy()!=1.0){
- Files.appendFile(log, onOnto.toString()+"\n");
- System.out.println(onOnto.toString());
-
- System.out.println(onOnto.getCoveredPositives());
- System.out.println(onOnto.getCoveredNegatives().size());
-
- System.out.println(onOnto.getNotCoveredPositives());
- System.out.println(onOnto.getNotCoveredNegatives());
- System.out.println("p then n");
- System.out.println(posEx);
- System.out.println(negEx);
- System.out.println(retrieved);
- System.out.println((5-onOnto.getCoveredNegatives().size())+"");
- double n = (double) (5-onOnto.getCoveredNegatives().size());
- System.out.println();
- System.out.println((n/5.0));
- System.exit(0);
- }*/
- logLine += StringFormatter.doubleToPercent(onOnto.getAccuracy())+del;
- logLine += time+del;
- logLine += StringFormatter.doubleToPercent((double)(onOnto.getCoveredPositives().size()/5))+del;
+ double reachedAccuracy = onOnto.getAccuracy();
+ accOnOnto.addNumber(onOnto.getAccuracy());
+
+ int tmp = (int)(Math.floor(onOnto.getAccuracy()*100));
+ normalNoisePercentage = 100-tmp;
+ accPosExOnOnto.addNumber((double)(onOnto.getCoveredPositives().size()/5));
double n = (double) (5-onOnto.getCoveredNegatives().size());
- logLine += StringFormatter.doubleToPercent(n/5.0)+del;
- logLine += " size of retrieve: "+retrieved.size()+del;
- logLine += f.toString();
- Files.appendFile(log, logLine+cr);
- Cache.getDefaultCache().clearCache();
+ accNegExOnOnto.addNumber(n/5.0);
+ SparqlKnowledgeSource s=null;
+ for(KnowledgeSource ks : cm.getLiveKnowledgeSources()){
+ if (ks instanceof SparqlKnowledgeSource) {
+ s = (SparqlKnowledgeSource) ks;
+ }
+ }
+
+ double nrtrip = (double)(s.getNrOfExtractedTriples());
+ nrOfExtractedTriples.addNumber(nrtrip);
+
+
+
cm.freeAllComponents();
+ /*************comp**/
+ logger.warn("learning normal");
+
+ StringBuffer sbufNormal = new StringBuffer();
+ sbufNormal.append(normalOptions());
+ sbufNormal.append(ConfWriter.listExamples(true, posEx));
+ sbufNormal.append(ConfWriter.listExamples(false, negEx));
+ //sbufNormal.append(ConfWriter.)
+ Files.createFile(tmpFile, sbufNormal.toString());
+ SimpleClock scNormal = new SimpleClock();
+ Start.main(new String[] { tmpFilename });
+ timeWhole.addNumber((double) scNormal.getTime());
+
+ la = cm.getLiveLearningAlgorithms().remove(0);
+
+ EvaluatedDescription normalOnOnto =(la.getCurrentlyBestEvaluatedDescription());
+ accWhole.addNumber(normalOnOnto.getAccuracy());
+ dDepthWhole.addNumber((double)normalOnOnto.getDescriptionDepth());
+ dLengthWhole.addNumber((double)normalOnOnto.getDescriptionLength());
+
+ cm.freeAllComponents();
+
+ //writeLog();
+ //System.exit(0);
}//end for
}catch (Exception e) {
e.printStackTrace();
}
+ writeLog();
total.printAndSet("Finished");
//logger.warn("Finished");
}
+ public static void writeLog(){
+ String l = "a";
+ l +=
+
+ l+="accFragment\t\t"+accFragment.getMeanAsPercentage()+" +-"+accFragment.getStandardDeviation()+"\n";
+ l+="accOnOnto\t\t"+accOnOnto.getMeanAsPercentage()+" +-"+accOnOnto.getStandardDeviation()+"\n";
+ l+="accPosExOnOnto\t\t"+accPosExOnOnto.getMeanAsPercentage()+" +-"+accPosExOnOnto.getStandardDeviation()+"\n";
+ l+="accNegExOnOnto\t\t"+accNegExOnOnto.getMeanAsPercentage()+" +-"+accNegExOnOnto.getStandardDeviation()+"\n";
+ l+="timeFragment\t\t"+timeFragment.getMean()+" +-"+timeFragment.getStandardDeviation()+"\n";
+ l+="nrOfExtractedTriples\t\t"+nrOfExtractedTriples.getMean()+" +-"+nrOfExtractedTriples.getStandardDeviation()+"\n";
+ l+="dLengthFragment\t\t"+dLengthFragment.getMean()+" +-"+dLengthFragment.getStandardDeviation()+"\n";
+ l+="dDepthFragment\t\t"+dDepthFragment.getMean()+" +-"+dDepthFragment.getStandardDeviation()+"\n";
+
+ l+="timeWhole\t\t"+timeWhole.getMean()+" +-"+timeWhole.getStandardDeviation()+"\n";
+ l+="accWhole\t\t"+accWhole.getMeanAsPercentage()+" +-"+accWhole.getStandardDeviation()+"\n";
+ l+="dLengthWhole\t\t"+dLengthWhole.getMean()+" +-"+dLengthWhole.getStandardDeviation()+"\n";
+ l+="dDepthWhole\t\t"+dDepthWhole.getMean()+" +-"+dDepthWhole.getStandardDeviation()+"\n";
+
+ Files.createFile(log, l);
+
+// write JaMON report in HTML file
+ File jamonlog = new File("sembib/jamon.html");
+ Files.createFile(jamonlog, MonitorFactory.getReport());
+ Files.appendFile(jamonlog, "<xmp>\n"+JamonMonitorLogger.getStringForAllSortedByLabel());
+ }
+
public static EvaluatedDescription reEvaluateDescription(Description d, SortedSet<Individual> retrieved ,SortedSet<Individual> posEx ,SortedSet<Individual> negEx ){
SortedSet<Individual> PosAsPos = new TreeSet<Individual>();
SortedSet<Individual> PosAsNeg = new TreeSet<Individual>();
@@ -304,7 +367,7 @@
public static String sparqlOptions (){
String s="// SPARQL options\n"+
- "sparql.recursionDepth = 3;\n"+
+ "sparql.recursionDepth = 2;\n"+
"sparql.useLits = true;\n"+
"sparql.predefinedEndpoint = \"LOCALJOSEKIBIBLE\";\n"+
"import(\"lalala\",\"SPARQL\");\n"+
@@ -316,7 +379,9 @@
public static String normalOptions (){
String s="\n"+
"import(\"NTNcombined.owl\");\n"+
- "refexamples.maxExecutionTimeInSeconds = 1800;\n"+
+ "refexamples.maxExecutionTimeInSeconds = "+normalMaxExecution+";\n";
+
+ s+="refexamples.noisePercentage = "+normalNoisePercentage+";\n"+
getCombinedOptions()+
"";
return s;
Modified: trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java 2008-08-31 19:55:38 UTC (rev 1164)
+++ trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java 2008-09-01 00:00:09 UTC (rev 1165)
@@ -20,6 +20,8 @@
package org.dllearner.utilities.statistics;
+import java.text.DecimalFormat;
+
/**
* Utility class for calculating the mean and standard deviation of a given set
* of numbers.
@@ -34,6 +36,8 @@
private double squareSum = 0;
private double min = Double.MAX_VALUE;
private double max = Double.MIN_NORMAL;
+ //used to give a good percentage output
+ private DecimalFormat df = new DecimalFormat( ".00%" );
/**
* Add a number to this object.
@@ -77,6 +81,15 @@
public double getMean() {
return sum / count;
}
+
+ /**
+ * Gets the mean of all numbers as percentage
+ * *100 so 0.5678 -> "56.78%"
+ * @return
+ */
+ public String getMeanAsPercentage(){
+ return df.format(getMean());
+ }
/**
* Gets the standard deviation of all numbers.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-09-01 10:50:13
|
Revision: 1167
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1167&view=rev
Author: kurzum
Date: 2008-09-01 10:50:00 +0000 (Mon, 01 Sep 2008)
Log Message:
-----------
added additional option to get property information
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java
trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java
trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java
trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java
trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -40,6 +40,7 @@
private int recursiondepth;
private boolean getAllSuperClasses = true;
private boolean closeAfterRecursion = true;
+ private boolean getPropertyInformation = false;
private int breakSuperClassesAfter = 200;
@@ -49,6 +50,7 @@
int recursiondepth,
boolean getAllSuperClasses,
boolean closeAfterRecursion,
+ boolean getPropertyInformation,
int breakSuperClassesAfter) {
this.tupelAquisitor = tupelAquisitor;
@@ -56,6 +58,7 @@
this.recursiondepth = recursiondepth;
this.getAllSuperClasses = getAllSuperClasses;
this.closeAfterRecursion = closeAfterRecursion;
+ this.getPropertyInformation = getPropertyInformation;
this.breakSuperClassesAfter = breakSuperClassesAfter;
@@ -97,6 +100,11 @@
}
+ public boolean isGetPropertyInformation() {
+ return getPropertyInformation;
+ }
+
+
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -71,11 +71,11 @@
* @param typedSparqlQuery
* @return
*/
- public Node expandNode(String uri, TupleAquisitor tupelAquisitor) {
+ public Node expandNode(String uri, TupleAquisitor tupleAquisitor) {
SimpleClock sc = new SimpleClock();
- if(tupelAquisitor instanceof SparqlTupleAquisitorImproved){
- ((SparqlTupleAquisitorImproved)tupelAquisitor).removeFromCache(uri);
+ if(tupleAquisitor instanceof SparqlTupleAquisitorImproved){
+ ((SparqlTupleAquisitorImproved)tupleAquisitor).removeFromCache(uri);
}
Node seedNode = getFirstNode(uri);
@@ -97,8 +97,8 @@
logger.info("Expanding " + nextNode);
// these are the new not expanded nodes
// the others are saved in connection with the original node
- tupelAquisitor.setNextTaskToNormal();
- tmp.addAll(nextNode.expand(tupelAquisitor,
+ tupleAquisitor.setNextTaskToNormal();
+ tmp.addAll(nextNode.expand(tupleAquisitor,
configuration.getManipulator()));
//System.out.println(tmpVec);
@@ -116,20 +116,29 @@
Monitor m = JamonMonitorLogger.getTimeMonitor(ExtractionAlgorithm.class, "TimeCloseAfterRecursion").start();
List<InstanceNode> l = getInstanceNodes(newNodes);
logger.info("Getting classes for remaining instances: "+l.size() + " instances");
- tupelAquisitor.setNextTaskToClassesForInstances();
- collectNodes.addAll(expandCloseAfterRecursion(l, tupelAquisitor));
+ tupleAquisitor.setNextTaskToClassesForInstances();
+ collectNodes.addAll(expandCloseAfterRecursion(l, tupleAquisitor));
m.stop();
}
// gets All Class Nodes and expands them further
if (configuration.isGetAllSuperClasses()) {
Monitor m = JamonMonitorLogger.getTimeMonitor(ExtractionAlgorithm.class, "TimeGetAllSuperClasses").start();
List<ClassNode> allClassNodes = getClassNodes(collectNodes);
- tupelAquisitor.setNextTaskToClassInformation();
+ tupleAquisitor.setNextTaskToClassInformation();
logger.info("Get all superclasses for "+allClassNodes.size() + " classes");
- expandAllSuperClassesOfANode(allClassNodes, tupelAquisitor);
+ expandAllSuperClassesOfANode(allClassNodes, tupleAquisitor);
m.stop();
}
+
+ if(configuration.isGetPropertyInformation() ){
+
+ List<ObjectPropertyNode> l = getObjectPropertyNodes(collectNodes);
+ for (ObjectPropertyNode node : l) {
+ node.expandProperties(tupleAquisitor, configuration.getManipulator());
+ }
+ }
+
return seedNode;
}
@@ -216,5 +225,17 @@
}
return retList;
}
+
+ public static List<ObjectPropertyNode> getObjectPropertyNodes(List<Node> l ){
+ List<ObjectPropertyNode> properties = new ArrayList<ObjectPropertyNode>();
+ for (Node node : l) {
+ if (node instanceof InstanceNode) {
+ properties.addAll(( (InstanceNode) node).getObjectProperties());
+
+ }
+
+ }
+ return properties;
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -133,6 +133,12 @@
return returnSet;
}
+ public List<ObjectPropertyNode> getObjectProperties() {
+ return objectProperties;
+ }
+
+
+
}
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -23,11 +23,14 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.log4j.Logger;
import org.dllearner.kb.aquisitors.TupleAquisitor;
import org.dllearner.kb.manipulator.Manipulator;
import org.dllearner.utilities.datastructures.RDFNodeTuple;
import org.dllearner.utilities.owl.OWLVocabulary;
+
+
/**
* Property node, has connection to a and b part
*
@@ -37,18 +40,22 @@
public class ObjectPropertyNode extends Node {
+ public static Logger logger = Logger.getLogger(ObjectPropertyNode.class);
+
// the a and b part of a property
private Node a;
private Node b;
// specialtypes like owl:symmetricproperty
- private SortedSet<String> specialTypes;
+ private SortedSet<String> specialTypes = new TreeSet<String>();
+ @SuppressWarnings("unused")
+ private SortedSet<RDFNodeTuple> propertyInformation = new TreeSet<RDFNodeTuple>();
public ObjectPropertyNode(String uri, Node a, Node b) {
super(uri);
// this.type = "property";
this.a = a;
this.b = b;
- this.specialTypes = new TreeSet<String>();
+
}
// Property Nodes are normally not expanded,
@@ -65,11 +72,16 @@
SortedSet<RDFNodeTuple> newTypes = tupelAquisitor.getTupelForResource(uri);
for (RDFNodeTuple tuple : newTypes) {
try {
- if (tuple.a.equals(OWLVocabulary.RDF_TYPE)) {
+ if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)) {
specialTypes.add(tuple.b.toString());
+ }else if(tuple.b.isAnon()){
+ logger.warn("blanknodes currently not implemented in this tuple aquisitor");
+ }else{
+ propertyInformation.add(tuple);
+
}
} catch (Exception e) {
- System.out.println(tuple);
+ logger.warn("resource "+uri+" with "+ tuple);
e.printStackTrace();
}
}
@@ -96,6 +108,10 @@
s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><"
+ one + ">.");
}
+
+ for (RDFNodeTuple one : propertyInformation) {
+ s.add(one.getNTriple(uri));
+ }
return s;
}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -104,6 +104,7 @@
private boolean useLits = false;
private boolean getAllSuperClasses = true;
private boolean closeAfterRecursion = true;
+ private boolean getPropertyInformation = true;
private int breakSuperClassRetrievalAfter = 1000;
private String cacheDir = "cache";
// private boolean learnDomain = false;
@@ -197,8 +198,6 @@
"learns the Range for a Role"));
options.add(new StringConfigOption("role",
"role to learn Domain/Range from"));
- options.add(new StringConfigOption("blankNodeIdentifier",
- "used to identify blanknodes in Tripels"));
options.add(new StringTupleListConfigOption("example", "example"));
options.add(new StringTupleListConfigOption("replacePredicate",
"rule for replacing predicates"));
@@ -210,6 +209,8 @@
"numberOfInstancesUsedForRoleLearning", ""));
options.add(new BooleanConfigOption("closeAfterRecursion",
"gets all classes for all instances"));
+ options.add(new BooleanConfigOption("getPropertyInformation",
+ "gets all types for extracted ObjectProperties"));
options.add(CommonConfigOptions.getVerbosityOption());
options.add(new StringSetConfigOption("defaultGraphURIs",
@@ -267,7 +268,9 @@
useCache = (Boolean) entry.getValue();
}else if (option.equals("getAllSuperClasses")) {
getAllSuperClasses = (Boolean) entry.getValue();
- } else if (option.equals("example")) {
+ }else if (option.equals("getPropertyInformation")) {
+ getPropertyInformation = (Boolean) entry.getValue();
+ }else if (option.equals("example")) {
// System.out.println(entry.getValue());
} else if (option.equals("replacePredicate")) {
replacePredicate = (LinkedList) entry.getValue();
@@ -317,6 +320,7 @@
recursionDepth,
getAllSuperClasses,
closeAfterRecursion,
+ getPropertyInformation,
breakSuperClassRetrievalAfter);
// give everything to the manager
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -20,12 +20,9 @@
package org.dllearner.scripts;
import java.io.File;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Locale;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
@@ -70,7 +67,7 @@
public static String normaldir = dir+"normal/";
public static String tmpFilename = dir + "tmp.conf";
- static File log = new File(dir+"results.txt");
+ static File log = new File(dir+"results+prop.txt");
private static Stat accFragment = new Stat();
private static Stat accOnOnto = new Stat();
@@ -116,9 +113,8 @@
initLogger();
logger.warn("Start");
File tmpFile = new File(tmpFilename);
- String del="\t";
- String cr="\n";
+
List<File> confs = getFilesContaining(useSPARQL,"ten","all", "99+");
//analyzeFiles(confs);
@@ -161,7 +157,7 @@
SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription());
EvaluatedDescription onOnto = reEvaluateDescription(
onFragment.getDescription(), retrieved, posEx, negEx);
- double reachedAccuracy = onOnto.getAccuracy();
+
accOnOnto.addNumber(onOnto.getAccuracy());
int tmp = (int)(Math.floor(onOnto.getAccuracy()*100));
@@ -212,6 +208,7 @@
cm.freeAllComponents();
writeLog();
+
}//end for
}catch (Exception e) {
e.printStackTrace();
@@ -226,8 +223,8 @@
public static void writeLog(){
String l = "\n\n\n*********************\n";
l +="COUNT: "+accFragment.getCount()+"\n";
- l +="ALL: "+fragHasAll+" BOOL: "+fragHasBooleanData+" NOT: "+fragHasNot+" <>=: "+fragHasNrRes+"\n";
- l +="ALL: "+wholeHasAll+" BOOL: "+wholeHasBooleanData+" NOT: "+wholeHasNot+" <>=: "+wholeHasNrRes+"\n";
+ l +="FRAGMENT: ALL: "+fragHasAll+" BOOL: "+fragHasBooleanData+" NOT: "+fragHasNot+" <>=: "+fragHasNrRes+"\n";
+ l +="WHOLE: ALL: "+wholeHasAll+" BOOL: "+wholeHasBooleanData+" NOT: "+wholeHasNot+" <>=: "+wholeHasNrRes+"\n";
l+="accFragment\t\t"+accFragment.getMeanAsPercentage()+" +-"+accFragment.getStandardDeviation()+"\n";
@@ -395,6 +392,8 @@
"sparql.recursionDepth = 2;\n"+
"sparql.useLits = true;\n"+
"sparql.predefinedEndpoint = \"LOCALJOSEKIBIBLE\";\n"+
+ "sparql.getPropertyInformation = true;\n"+
+ "refexamples.maxExecutionTimeInSeconds = "+sparqllMaxExecution+";\n"+
"import(\"lalala\",\"SPARQL\");\n"+
getCombinedOptions()+
"";
Modified: trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -72,6 +72,7 @@
recursionDepth,
true,
true,
+ false,
200
);
m.useConfiguration(conf);
Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java 2008-09-01 00:30:08 UTC (rev 1166)
+++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java 2008-09-01 10:50:00 UTC (rev 1167)
@@ -19,6 +19,8 @@
*/
package org.dllearner.utilities.datastructures;
+import org.dllearner.kb.extraction.LiteralNode;
+
import com.hp.hpl.jena.rdf.model.RDFNode;
/**
@@ -59,5 +61,18 @@
public boolean bPartContains(String partOf) {
return b.toString().contains(partOf);
}
+
+ public String getNTriple (String subject){
+ String ret = "<"+subject+"> ";
+ ret+="<"+a.toString()+"> ";
+ if(b.isLiteral()){
+ ret+=new LiteralNode(b).getNTripleForm();
+
+ }else{
+ ret+="<"+b.toString()+"> ";
+ }
+ ret+=".";
+ return ret;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-09-02 21:09:13
|
Revision: 1168
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1168&view=rev
Author: kurzum
Date: 2008-09-02 21:08:59 +0000 (Tue, 02 Sep 2008)
Log Message:
-----------
latest changes
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java
trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-01 10:50:00 UTC (rev 1167)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-02 21:08:59 UTC (rev 1168)
@@ -399,9 +399,7 @@
// we record when a more accurate node is found and log it
if (bestNodeStable.getCovPosMinusCovNeg() < candidatesStable.last()
.getCovPosMinusCovNeg()) {
- String acc = (candidatesStable.last().getAccuracy(nrOfPositiveExamples, nrOfNegativeExamples))+"";
- try { acc = acc.substring(2,6);
- acc= acc.substring(0,2)+"."+acc.substring(3)+"%";}catch (Exception e) { }
+ String acc = new DecimalFormat( ".00%" ).format((candidatesStable.last().getAccuracy(nrOfPositiveExamples, nrOfNegativeExamples)));
// no handling needed, it will just look ugly in the output
logger.info("more accurate ("+acc+") node found: " + candidatesStable.last());
bestNodeStable = candidatesStable.last();
Added: trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java 2008-09-02 21:08:59 UTC (rev 1168)
@@ -0,0 +1,84 @@
+/**
+ * Copyright (C) 2007-2008, 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.scripts;
+import java.io.File;
+import java.io.PrintStream;
+public class RDF2NT {
+
+
+ public static void main(String[] args) {
+
+ //String ontopath=args[0];
+ String ontopath = "examples/semantic_bible/NTNcombined.owl";
+ convertRDF2NT(ontopath);
+
+
+ }
+
+
+ /**
+ * converts .nt file to rdf, same file name, different ending
+ * @param ontopath path to nt file
+ */
+ public static void convertRDF2NT(String inputOntopath){
+
+ try {
+ //URI inputURI = new File(inputOntopath).toURI();
+ String outputOntopath="";
+// outputURI
+ String ending = inputOntopath.substring(inputOntopath.lastIndexOf(".") + 1);
+ outputOntopath = inputOntopath.replace("." + ending, ".nt" );
+ //URI outputURI = new File(ontopath).toURI();
+ /*
+ java jena.rdfcat (options|input)*
+ where options are:
+ -out N3 (aliases n, n3, ttl)
+ -out N-TRIPLE (aliases t, ntriple)
+ -out RDF/XML (aliases x, rdf, xml, rdfxml)
+ -out RDF/XML-ABBREV (default)
+ -in N3 (aliases n, n3, ttl)
+ -in N-TRIPLE (aliases t, ntriple)
+ -in RDF/XML (aliases x, rdf, xml, rdfxml)
+ -include
+ -noinclude (default)
+
+ input is one of:
+ -n <filename> for n3 input (aliases -n3, -N3, -ttl)
+ -x <filename> for rdf/xml input (aliases -rdf, -xml, -rdfxml)
+ -t <filename> for n-triple input (aliases -ntriple)
+ or just a URL, a filename, or - for the standard input.
+
+ */
+ PrintStream p = new PrintStream(new File(outputOntopath));
+ System.setOut(p);
+ jena.rdfcat.main(new String[]{"-x", inputOntopath,"-out", "ntriple"});
+ p.flush();
+ p.close();
+
+
+ }
+ catch (Exception e) {
+ System.out.println("The ontology could not be created: " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+
+
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-01 10:50:00 UTC (rev 1167)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-02 21:08:59 UTC (rev 1168)
@@ -46,6 +46,7 @@
import org.dllearner.utilities.Files;
import org.dllearner.utilities.JamonMonitorLogger;
import org.dllearner.utilities.datastructures.SetManipulation;
+import org.dllearner.utilities.examples.ExampleContainer;
import org.dllearner.utilities.learn.ConfWriter;
import org.dllearner.utilities.owl.ReasoningServiceFactory;
import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
@@ -124,6 +125,7 @@
ComponentManager cm =ComponentManager.getInstance();
try{
+
for (File f : confs) {
Cache.getDefaultCache().clearCache();
String fileContent = Files.readFile(f);
@@ -143,6 +145,7 @@
LearningAlgorithm la = cm.getLiveLearningAlgorithms().remove(0);
EvaluatedDescription onFragment =(la.getCurrentlyBestEvaluatedDescription());
+
accFragment.addNumber(onFragment.getAccuracy());
dDepthFragment.addNumber((double)onFragment.getDescriptionDepth());
dLengthFragment.addNumber((double)onFragment.getDescriptionLength());
Added: trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java 2008-09-02 21:08:59 UTC (rev 1168)
@@ -0,0 +1,85 @@
+/**
+ * Copyright (C) 2007, 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.utilities.examples;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.dllearner.core.owl.Individual;
+
+public class ExampleContainer implements Comparable<ExampleContainer>{
+
+
+ private static SortedSet<ExampleContainer> exampleSets = new TreeSet<ExampleContainer>();
+
+ private SortedSet<Individual> positiveExamples = new TreeSet<Individual>();
+ private SortedSet<Individual> negativeExamples = new TreeSet<Individual>();
+
+
+ public ExampleContainer(SortedSet<Individual> positiveExamples, SortedSet<Individual> negativeExamples) {
+ super();
+ this.positiveExamples = positiveExamples;
+ this.negativeExamples = negativeExamples;
+ }
+
+
+ public static boolean add(ExampleContainer e){
+ return exampleSets.add(e);
+ }
+
+ public int compareTo(ExampleContainer e){
+
+ if(getNegativeExamples().equals(e.getNegativeExamples())
+ &&
+ getPositiveExamples().equals(e.getPositiveExamples())){
+ return 0;
+ }
+
+ boolean equalPosSize = false;
+ boolean equalNegSize = false;
+
+ if(getPositiveExamples().size() == e.getPositiveExamples().size()){
+ equalPosSize = true;
+ }
+ if(getNegativeExamples().size() == e.getNegativeExamples().size()){
+ equalNegSize = true;
+ }
+
+
+ if(equalPosSize && !equalNegSize)return 1;
+ if(equalNegSize && !equalPosSize)return -1;
+ if(!equalPosSize && !equalPosSize)return 1;
+
+
+ return 1;
+
+ }
+
+ public SortedSet<Individual> getNegativeExamples() {
+ return negativeExamples;
+ }
+ public SortedSet<Individual> getPositiveExamples() {
+ return positiveExamples;
+ }
+
+
+
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-09-03 19:29:57
|
Revision: 1169
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1169&view=rev
Author: kurzum
Date: 2008-09-03 19:29:41 +0000 (Wed, 03 Sep 2008)
Log Message:
-----------
started implementing genering java interface
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/Component.java
trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java
trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/AutoDetectFilter.java
trunk/src/dl-learner/org/dllearner/scripts/Sample.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
trunk/src/dl-learner/org/dllearner/utilities/Files.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/core/configuration/
trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
Modified: trunk/src/dl-learner/org/dllearner/core/Component.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/Component.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/Component.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -24,6 +24,7 @@
import org.dllearner.core.config.ConfigEntry;
import org.dllearner.core.config.ConfigOption;
+import org.dllearner.core.config.DoubleConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
/**
@@ -34,6 +35,12 @@
*/
public abstract class Component {
+//protected Configurator configurator;
+
+ //public Configurator<? extends Configurator> getConfigurator(){
+ //return configurator;
+ //}
+
/**
* Returns the name of this component. By default, "unnamed
* component" is returned, but all implementations of components
Modified: trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -19,20 +19,38 @@
*/
package org.dllearner.core.config;
+
/**
* @author Jens Lehmann
*
*/
public class BooleanConfigOption extends ConfigOption<Boolean> {
+
+
+ public BooleanConfigOption(String name, String description, Boolean defaultValue, Tags... tags) {
+ super(name, description, defaultValue, tags);
+
+ }
+
+ public BooleanConfigOption(String name, String description, Boolean defaultValue) {
+ super(name, description, defaultValue);
+
+ }
+
public BooleanConfigOption(String name, String description) {
super(name, description);
+
}
- public BooleanConfigOption(String name, String description, boolean defaultValue) {
- super(name, description, defaultValue);
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
+ */
+ @Override
+ public String getValueTypeAsJavaString(){
+ return "boolean";
}
-
+
/*
* (non-Javadoc)
*
Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -19,6 +19,9 @@
*/
package org.dllearner.core.config;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
/**
* This class represents a configuration option (without a value for the
* option).
@@ -38,16 +41,44 @@
protected String description;
protected T defaultValue;
+
+ public enum Tags {NORMAL, MANDATORY, REINIT}
+
+ protected boolean mandatory = false;
+ protected boolean reinitNecessary = false;
public ConfigOption(String name, String description) {
this(name, description, null);
}
-
- public ConfigOption(String name, String description, T defaultValue) {
+
+ public ConfigOption(String name, String description, T defaultValue, Tags ...tags ) {
this.name = name;
this.description = description;
this.defaultValue = defaultValue;
+ boolean normal = false;
+ for(Tags t:tags){
+ if (t.equals(Tags.NORMAL)){
+ normal =true;
+ }
+ }
+ for(Tags t:tags){
+ if(normal){
+ ;//DO Nothing
+ }
+ else if (t.equals(Tags.MANDATORY)){
+ this.mandatory = true;
+ } else if (t.equals(Tags.REINIT)){
+ this.reinitNecessary = true;
+ }
+ }
+
}
+
+ public ConfigOption(String name, String description, T defaultValue ) {
+ this.name = name;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ }
public String getName() {
return name;
@@ -63,6 +94,37 @@
public T getDefaultValue() {
return defaultValue;
}
+
+ /**
+ * @return the defaultValue
+ */
+ public String getDefaultValueInJava() {
+ return defaultValue+"";
+ }
+
+ /**
+ * says, if this option is mandatory for the component
+ * @return
+ */
+ public boolean isMandatory() {
+ return mandatory;
+ }
+
+ /**
+ * says, if this option requires that the componnent is reinitialized with init()
+ * @return
+ */
+ public boolean isReinitNecessary() {
+ return reinitNecessary;
+ }
+
+ /**
+ * gets java imports
+ * @return
+ */
+ public SortedSet<String> getJavaImports() {
+ return new TreeSet<String>();
+ }
/**
* Checks whether the object has the correct type to be used as a value for
@@ -76,6 +138,8 @@
public abstract boolean checkType(Object object);
public abstract boolean isValidValue(T value);
+
+ public abstract String getValueTypeAsJavaString();
//TODO maybe change the function getClass in the options to get simpleName
public String getAllowedValuesDescription() {
Modified: trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -19,6 +19,8 @@
*/
package org.dllearner.core.config;
+import org.dllearner.core.config.ConfigOption.Tags;
+
/**
* Represents a configuration option with values of type value. Similar to the
* integer option a minimum and a maximum value can specified.
@@ -31,14 +33,32 @@
private double lowerLimit = Double.MIN_VALUE;
private double upperLimit = Double.MAX_VALUE;
+
+
+
+ public DoubleConfigOption(String name, String description, Double defaultValue, Tags... tags) {
+ super(name, description, defaultValue, tags);
+
+ }
+
+ public DoubleConfigOption(String name, String description, Double defaultValue) {
+ super(name, description, defaultValue);
+
+ }
+
public DoubleConfigOption(String name, String description) {
super(name, description);
+
}
- public DoubleConfigOption(String name, String description, double defaultValue) {
- super(name, description, defaultValue);
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
+ */
+ @Override
+ public String getValueTypeAsJavaString(){
+ return "double";
}
-
+
/*
* (non-Javadoc)
*
Modified: trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -19,6 +19,8 @@
*/
package org.dllearner.core.config;
+import org.dllearner.core.config.ConfigOption.Tags;
+
/**
* A configuration option, which allows values of type integer. A minimum and
* maximum value of the argument can optionally be specified.
@@ -31,14 +33,31 @@
private int lowerLimit = Integer.MIN_VALUE;
private int upperLimit = Integer.MAX_VALUE;
+
+
+ public IntegerConfigOption(String name, String description, Integer defaultValue, Tags... tags) {
+ super(name, description, defaultValue, tags);
+
+ }
+
+ public IntegerConfigOption(String name, String description, Integer defaultValue) {
+ super(name, description, defaultValue);
+
+ }
+
public IntegerConfigOption(String name, String description) {
super(name, description);
+
}
- public IntegerConfigOption(String name, String description, int defaultValue) {
- super(name, description, defaultValue);
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
+ */
+ @Override
+ public String getValueTypeAsJavaString(){
+ return "int";
}
-
+
/*
* (non-Javadoc)
*
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -23,6 +23,8 @@
import java.util.Set;
import java.util.TreeSet;
+import org.dllearner.core.config.ConfigOption.Tags;
+
/**
* A configuration option, which allows values of type String. Optionally a set
* of allowed strings can be set. By default all strings are allowed.
@@ -32,16 +34,43 @@
*/
public class StringConfigOption extends ConfigOption<String> {
- private Set<String> allowedValues = new TreeSet<String>();;
+ private Set<String> allowedValues = new TreeSet<String>();
- public StringConfigOption(String name, String description) {
- super(name, description);
+
+
+
+
+ public StringConfigOption(String name, String description, String defaultValue, Tags... tags) {
+ super(name, description, defaultValue, tags);
+
}
public StringConfigOption(String name, String description, String defaultValue) {
super(name, description, defaultValue);
+
}
+ public StringConfigOption(String name, String description) {
+ super(name, description);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getDefaultValue()
+ */
+ @Override
+ public String getDefaultValueInJava() {
+ return (defaultValue == null)?null:"\""+defaultValue+"\"";
+ }
+
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
+ */
+ @Override
+ public String getValueTypeAsJavaString(){
+ return "String";
+ }
+
/*
* (non-Javadoc)
*
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -20,6 +20,8 @@
package org.dllearner.core.config;
import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
/**
* A set of strings.
@@ -29,10 +31,42 @@
*/
public class StringSetConfigOption extends ConfigOption<Set<String>> {
+
+
+ public StringSetConfigOption(String name, String description, Set<String> defaultValue, Tags... tags) {
+ super(name, description, defaultValue, tags);
+
+ }
+
+ public StringSetConfigOption(String name, String description, Set<String> defaultValue) {
+ super(name, description, defaultValue);
+
+ }
+
public StringSetConfigOption(String name, String description) {
super(name, description);
+
}
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
+ */
+ @Override
+ public String getValueTypeAsJavaString(){
+ return "Set<String>";
+ }
+
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getJavaImports()
+ */
+ @Override
+ public SortedSet<String> getJavaImports() {
+ SortedSet<String> ret = new TreeSet<String>();
+ ret.add("java.util.Set");
+ return ret;
+
+ }
+
/*
* (non-Javadoc)
*
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -20,6 +20,8 @@
package org.dllearner.core.config;
import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
import org.dllearner.utilities.datastructures.StringTuple;
@@ -40,6 +42,25 @@
super(name, description, defaultValue);
}
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
+ */
+ @Override
+ public String getValueTypeAsJavaString(){
+ return "List<StringTuple>";
+ }
+
+ /* (non-Javadoc)
+ * @see org.dllearner.core.config.ConfigOption#getJavaImports()
+ */
+ @Override
+ public SortedSet<String> getJavaImports() {
+ SortedSet<String> ret = new TreeSet<String>();
+ ret.add("java.util.List");
+ ret.add("org.dllearner.utilities.datastructures.StringTuple");
+ return ret;
+ }
+
/*
* (non-Javadoc)
*
Added: trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import java.util.Set;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.configuration.OWLFileConfigurator;
+import org.dllearner.core.configuration.SparqlKnowledgeSourceConfigurator;
+import org.dllearner.kb.OWLFile;
+import org.dllearner.kb.sparql.SparqlKnowledgeSource;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class Configurator {
+
+/**
+URL pointing to the OWL file
+**/
+public static OWLFile getOWLFile (ComponentManager cm, String url ) {
+return OWLFileConfigurator.getOWLFile(cm, url);
+}
+
+/**
+relevant instances e.g. positive and negative examples in a learning problem
+**/
+public static SparqlKnowledgeSource getSparqlKnowledgeSource (ComponentManager cm, Set<String> instances ) {
+return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(cm, instances);
+}
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -0,0 +1,81 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+import org.dllearner.kb.OWLFile;
+
+
+/**
+* automatically generated, do not edit manually
+**/
+public class OWLFileConfigurator extends Configurator {
+
+OWLFile OWLFile;
+private String url = null;
+
+
+/**
+URL pointing to the OWL file
+**/
+public void setMandatoryOptions (String url ) {
+this.url = url;
+}
+/**
+URL pointing to the OWL file
+**/
+public static OWLFile getOWLFile (ComponentManager cm, String url ) {
+OWLFile component = cm.knowledgeSource(OWLFile.class);
+cm.applyConfigEntry(component, "url", url);
+return component;
+}
+
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if (optionName.equals(url)){
+url = (String) entry.getValue();
+}
+}
+
+
+/**
+* URL pointing to the OWL file
+**/
+public void setUrl (String url) {
+this.url = url;
+}
+
+
+
+/**
+* URL pointing to the OWL file
+*
+**/
+public String getUrl ( ) {
+return this.url;
+}
+
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -0,0 +1,498 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import java.util.List;
+import java.util.Set;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+import org.dllearner.kb.sparql.SparqlKnowledgeSource;
+import org.dllearner.utilities.datastructures.StringTuple;
+
+
+/**
+* automatically generated, do not edit manually
+**/
+public class SparqlKnowledgeSourceConfigurator extends Configurator {
+
+SparqlKnowledgeSource SparqlKnowledgeSource;
+private String url = null;
+private String cacheDir = null;
+private Set<String> instances = null;
+private int recursionDepth = 1;
+private String predefinedFilter = null;
+private String predefinedEndpoint = null;
+private String predefinedManipulator = null;
+private Set<String> predList = null;
+private Set<String> objList = null;
+private Set<String> classList = null;
+private String format = "N-TRIPLES";
+private boolean dumpToFile = true;
+private boolean convertNT2RDF = true;
+private boolean useLits = true;
+private boolean getAllSuperClasses = true;
+private boolean useCache = true;
+private List<StringTuple> replacePredicate = null;
+private List<StringTuple> replaceObject = null;
+private int breakSuperClassRetrievalAfter = 1000;
+private boolean closeAfterRecursion = true;
+private boolean getPropertyInformation = false;
+private String verbosity = "warning";
+private Set<String> defaultGraphURIs = null;
+private Set<String> namedGraphURIs = null;
+
+
+/**
+relevant instances e.g. positive and negative examples in a learning problem
+**/
+public void setMandatoryOptions (Set<String> instances ) {
+this.instances = instances;
+}
+/**
+relevant instances e.g. positive and negative examples in a learning problem
+**/
+public static SparqlKnowledgeSource getSparqlKnowledgeSource (ComponentManager cm, Set<String> instances ) {
+SparqlKnowledgeSource component = cm.knowledgeSource(SparqlKnowledgeSource.class);
+cm.applyConfigEntry(component, "instances", instances);
+return component;
+}
+
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if (optionName.equals(url)){
+url = (String) entry.getValue();
+}else if (optionName.equals(cacheDir)){
+cacheDir = (String) entry.getValue();
+}else if (optionName.equals(instances)){
+instances = (Set<String>) entry.getValue();
+}else if (optionName.equals(recursionDepth)){
+recursionDepth = (Integer) entry.getValue();
+}else if (optionName.equals(predefinedFilter)){
+predefinedFilter = (String) entry.getValue();
+}else if (optionName.equals(predefinedEndpoint)){
+predefinedEndpoint = (String) entry.getValue();
+}else if (optionName.equals(predefinedManipulator)){
+predefinedManipulator = (String) entry.getValue();
+}else if (optionName.equals(predList)){
+predList = (Set<String>) entry.getValue();
+}else if (optionName.equals(objList)){
+objList = (Set<String>) entry.getValue();
+}else if (optionName.equals(classList)){
+classList = (Set<String>) entry.getValue();
+}else if (optionName.equals(format)){
+format = (String) entry.getValue();
+}else if (optionName.equals(dumpToFile)){
+dumpToFile = (Boolean) entry.getValue();
+}else if (optionName.equals(convertNT2RDF)){
+convertNT2RDF = (Boolean) entry.getValue();
+}else if (optionName.equals(useLits)){
+useLits = (Boolean) entry.getValue();
+}else if (optionName.equals(getAllSuperClasses)){
+getAllSuperClasses = (Boolean) entry.getValue();
+}else if (optionName.equals(useCache)){
+useCache = (Boolean) entry.getValue();
+}else if (optionName.equals(replacePredicate)){
+replacePredicate = (List<StringTuple>) entry.getValue();
+}else if (optionName.equals(replaceObject)){
+replaceObject = (List<StringTuple>) entry.getValue();
+}else if (optionName.equals(breakSuperClassRetrievalAfter)){
+breakSuperClassRetrievalAfter = (Integer) entry.getValue();
+}else if (optionName.equals(closeAfterRecursion)){
+closeAfterRecursion = (Boolean) entry.getValue();
+}else if (optionName.equals(getPropertyInformation)){
+getPropertyInformation = (Boolean) entry.getValue();
+}else if (optionName.equals(verbosity)){
+verbosity = (String) entry.getValue();
+}else if (optionName.equals(defaultGraphURIs)){
+defaultGraphURIs = (Set<String>) entry.getValue();
+}else if (optionName.equals(namedGraphURIs)){
+namedGraphURIs = (Set<String>) entry.getValue();
+}
+}
+
+
+/**
+* URL of SPARQL Endpoint
+**/
+public void setUrl (String url) {
+this.url = url;
+}
+
+/**
+* dir of cache
+**/
+public void setCacheDir (String cacheDir) {
+this.cacheDir = cacheDir;
+}
+
+/**
+* relevant instances e.g. positive and negative examples in a learning problem
+**/
+public void setInstances (Set<String> instances) {
+this.instances = instances;
+}
+
+/**
+* recursion depth of KB fragment selection
+**/
+public void setRecursionDepth (int recursionDepth) {
+this.recursionDepth = recursionDepth;
+}
+
+/**
+* the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST
+**/
+public void setPredefinedFilter (String predefinedFilter) {
+this.predefinedFilter = predefinedFilter;
+}
+
+/**
+* the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK
+**/
+public void setPredefinedEndpoint (String predefinedEndpoint) {
+this.predefinedEndpoint = predefinedEndpoint;
+}
+
+/**
+* the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR
+**/
+public void setPredefinedManipulator (String predefinedManipulator) {
+this.predefinedManipulator = predefinedManipulator;
+}
+
+/**
+* list of all ignored roles
+**/
+public void setPredList (Set<String> predList) {
+this.predList = predList;
+}
+
+/**
+* list of all ignored objects
+**/
+public void setObjList (Set<String> objList) {
+this.objList = objList;
+}
+
+/**
+* list of all ignored classes
+**/
+public void setClassList (Set<String> classList) {
+this.classList = classList;
+}
+
+/**
+* N-TRIPLES or KB format
+**/
+public void setFormat (String format) {
+this.format = format;
+}
+
+/**
+* Specifies whether the extracted ontology is written to a file or not.
+**/
+public void setDumpToFile (boolean dumpToFile) {
+this.dumpToFile = dumpToFile;
+}
+
+/**
+* Specifies whether the extracted NTriples are converted to RDF and deleted.
+**/
+public void setConvertNT2RDF (boolean convertNT2RDF) {
+this.convertNT2RDF = convertNT2RDF;
+}
+
+/**
+* use Literals in SPARQL query
+**/
+public void setUseLits (boolean useLits) {
+this.useLits = useLits;
+}
+
+/**
+* If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.
+**/
+public void setGetAllSuperClasses (boolean getAllSuperClasses) {
+this.getAllSuperClasses = getAllSuperClasses;
+}
+
+/**
+* If true a Cache is used
+**/
+public void setUseCache (boolean useCache) {
+this.useCache = useCache;
+}
+
+/**
+* rule for replacing predicates
+**/
+public void setReplacePredicate (List<StringTuple> replacePredicate) {
+this.replacePredicate = replacePredicate;
+}
+
+/**
+* rule for replacing predicates
+**/
+public void setReplaceObject (List<StringTuple> replaceObject) {
+this.replaceObject = replaceObject;
+}
+
+/**
+* stops a cyclic hierarchy after specified number of classes
+**/
+public void setBreakSuperClassRetrievalAfter (int breakSuperClassRetrievalAfter) {
+this.breakSuperClassRetrievalAfter = breakSuperClassRetrievalAfter;
+}
+
+/**
+* gets all classes for all instances
+**/
+public void setCloseAfterRecursion (boolean closeAfterRecursion) {
+this.closeAfterRecursion = closeAfterRecursion;
+}
+
+/**
+* gets all types for extracted ObjectProperties
+**/
+public void setGetPropertyInformation (boolean getPropertyInformation) {
+this.getPropertyInformation = getPropertyInformation;
+}
+
+/**
+* control verbosity of output for this component
+**/
+public void setVerbosity (String verbosity) {
+this.verbosity = verbosity;
+}
+
+/**
+* a list of all default Graph URIs
+**/
+public void setDefaultGraphURIs (Set<String> defaultGraphURIs) {
+this.defaultGraphURIs = defaultGraphURIs;
+}
+
+/**
+* a list of all named Graph URIs
+**/
+public void setNamedGraphURIs (Set<String> namedGraphURIs) {
+this.namedGraphURIs = namedGraphURIs;
+}
+
+
+
+/**
+* URL of SPARQL Endpoint
+*
+**/
+public String getUrl ( ) {
+return this.url;
+}
+
+/**
+* dir of cache
+*
+**/
+public String getCacheDir ( ) {
+return this.cacheDir;
+}
+
+/**
+* relevant instances e.g. positive and negative examples in a learning problem
+*
+**/
+public Set<String> getInstances ( ) {
+return this.instances;
+}
+
+/**
+* recursion depth of KB fragment selection
+*
+**/
+public int getRecursionDepth ( ) {
+return this.recursionDepth;
+}
+
+/**
+* the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST
+*
+**/
+public String getPredefinedFilter ( ) {
+return this.predefinedFilter;
+}
+
+/**
+* the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK
+*
+**/
+public String getPredefinedEndpoint ( ) {
+return this.predefinedEndpoint;
+}
+
+/**
+* the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR
+*
+**/
+public String getPredefinedManipulator ( ) {
+return this.predefinedManipulator;
+}
+
+/**
+* list of all ignored roles
+*
+**/
+public Set<String> getPredList ( ) {
+return this.predList;
+}
+
+/**
+* list of all ignored objects
+*
+**/
+public Set<String> getObjList ( ) {
+return this.objList;
+}
+
+/**
+* list of all ignored classes
+*
+**/
+public Set<String> getClassList ( ) {
+return this.classList;
+}
+
+/**
+* N-TRIPLES or KB format
+*
+**/
+public String getFormat ( ) {
+return this.format;
+}
+
+/**
+* Specifies whether the extracted ontology is written to a file or not.
+*
+**/
+public boolean getDumpToFile ( ) {
+return this.dumpToFile;
+}
+
+/**
+* Specifies whether the extracted NTriples are converted to RDF and deleted.
+*
+**/
+public boolean getConvertNT2RDF ( ) {
+return this.convertNT2RDF;
+}
+
+/**
+* use Literals in SPARQL query
+*
+**/
+public boolean getUseLits ( ) {
+return this.useLits;
+}
+
+/**
+* If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.
+*
+**/
+public boolean getGetAllSuperClasses ( ) {
+return this.getAllSuperClasses;
+}
+
+/**
+* If true a Cache is used
+*
+**/
+public boolean getUseCache ( ) {
+return this.useCache;
+}
+
+/**
+* rule for replacing predicates
+*
+**/
+public List<StringTuple> getReplacePredicate ( ) {
+return this.replacePredicate;
+}
+
+/**
+* rule for replacing predicates
+*
+**/
+public List<StringTuple> getReplaceObject ( ) {
+return this.replaceObject;
+}
+
+/**
+* stops a cyclic hierarchy after specified number of classes
+*
+**/
+public int getBreakSuperClassRetrievalAfter ( ) {
+return this.breakSuperClassRetrievalAfter;
+}
+
+/**
+* gets all classes for all instances
+*
+**/
+public boolean getCloseAfterRecursion ( ) {
+return this.closeAfterRecursion;
+}
+
+/**
+* gets all types for extracted ObjectProperties
+*
+**/
+public boolean getGetPropertyInformation ( ) {
+return this.getPropertyInformation;
+}
+
+/**
+* control verbosity of output for this component
+*
+**/
+public String getVerbosity ( ) {
+return this.verbosity;
+}
+
+/**
+* a list of all default Graph URIs
+*
+**/
+public Set<String> getDefaultGraphURIs ( ) {
+return this.defaultGraphURIs;
+}
+
+/**
+* a list of all named Graph URIs
+*
+**/
+public Set<String> getNamedGraphURIs ( ) {
+return this.namedGraphURIs;
+}
+
+
+
+}
Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -33,6 +33,8 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
+import org.dllearner.core.config.ConfigOption.Tags;
+import org.dllearner.core.configuration.OWLFileConfigurator;
import org.dllearner.core.owl.KB;
import org.dllearner.reasoning.OWLAPIDIGConverter;
@@ -43,6 +45,10 @@
public class OWLFile extends KnowledgeSource {
private URL url;
+ private OWLFileConfigurator configurator = new OWLFileConfigurator();
+ public OWLFileConfigurator getOWLFileConfigurator(){
+ return configurator;
+ }
public static String getName() {
return "OWL file";
@@ -52,7 +58,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new StringConfigOption("url", "URL pointing to the OWL file"));
+ options.add(new StringConfigOption("url", "URL pointing to the OWL file", null, Tags.MANDATORY ));
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -72,27 +72,8 @@
public String toString(){
return getHTTPRequest();
}
- /*public static SparqlEndpoint getEndpointByNumber(int i) {
-
- switch (i) {
- case 0:break;
- //should not be filled
- case 1:
- return dbpediaEndpoint();
- case 2:
- return localJoseki();
- case 3:
- return govTrack();
- case 4:
- return revyu();
- case 5:
- return myopenlink();
- case 6:
- return worldFactBook();
- }
- return null;
- }*/
+
public static SparqlEndpoint getEndpointByName(String name) {
name = name.toUpperCase();
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -45,6 +45,9 @@
import org.dllearner.core.config.StringConfigOption;
import org.dllearner.core.config.StringSetConfigOption;
import org.dllearner.core.config.StringTupleListConfigOption;
+import org.dllearner.core.config.ConfigOption.Tags;
+import org.dllearner.core.configuration.OWLFileConfigurator;
+import org.dllearner.core.configuration.SparqlKnowledgeSourceConfigurator;
import org.dllearner.core.owl.KB;
import org.dllearner.kb.aquisitors.SparqlTupleAquisitor;
import org.dllearner.kb.aquisitors.SparqlTupleAquisitorImproved;
@@ -76,14 +79,16 @@
public class SparqlKnowledgeSource extends KnowledgeSource {
- //DEFAULTS
- static int recursionDepthDefault = 1;
//RBC
static final boolean debug = false;
static final boolean debugUseImprovedTupleAquisitor = debug && false; //switches tupleaquisitor
static final boolean debugExitAfterExtraction = debug && false; //switches sysex und rdf generation
+ private SparqlKnowledgeSourceConfigurator configurator = new SparqlKnowledgeSourceConfigurator();
+ public SparqlKnowledgeSourceConfigurator getSparqlKnowledgeSourceConfigurator(){
+ return configurator;
+ }
private boolean useCache=true;
// ConfigOptions
@@ -91,7 +96,7 @@
// String host;
private Set<String> instances = new HashSet<String>();;
private URL dumpFile;
- private int recursionDepth = recursionDepthDefault;
+ private int recursionDepth = 1;
private String predefinedFilter = null;
private String predefinedEndpoint = null;
private String predefinedManipulator = null;
@@ -155,9 +160,9 @@
// Endpoint"));
options
.add(new StringSetConfigOption("instances",
- "relevant instances e.g. positive and negative examples in a learning problem"));
+ "relevant instances e.g. positive and negative examples in a learning problem",null,Tags.MANDATORY));
options.add(new IntegerConfigOption("recursionDepth",
- "recursion depth of KB fragment selection", recursionDepthDefault));
+ "recursion depth of KB fragment selection", 1, Tags.NORMAL));
options.add(new StringConfigOption("predefinedFilter",
"the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST"));
options.add(new StringConfigOption("predefinedEndpoint",
@@ -183,34 +188,34 @@
"Specifies whether the extracted NTriples are converted to RDF and deleted.",
true));
options.add(new BooleanConfigOption("useLits",
- "use Literals in SPARQL query"));
+ "use Literals in SPARQL query", true, Tags.NORMAL));
options
.add(new BooleanConfigOption(
"getAllSuperClasses",
"If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.",
- true));
+ true, Tags.NORMAL));
- options.add(new BooleanConfigOption("learnDomain",
- "learns the Domain for a Role"));
+ //options.add(new BooleanConfigOption("learnDomain",
+ // "learns the Domain for a Role"));
options.add(new BooleanConfigOption("useCache",
- "If true a Cache is used"));
- options.add(new BooleanConfigOption("learnRange",
- "learns the Range for a Role"));
- options.add(new StringConfigOption("role",
- "role to learn Domain/Range from"));
- options.add(new StringTupleListConfigOption("example", "example"));
+ "If true a Cache is used",true, Tags.NORMAL));
+ //options.add(new BooleanConfigOption("learnRange",
+ // "learns the Range for a Role"));
+ //options.add(new StringConfigOption("role",
+ // "role to learn Domain/Range from"));
+ //options.add(new StringTupleListConfigOption("example", "example"));
options.add(new StringTupleListConfigOption("replacePredicate",
"rule for replacing predicates"));
options.add(new StringTupleListConfigOption("replaceObject",
"rule for replacing predicates"));
options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter",
- "stops a cyclic hierarchy after specified number of classes"));
- options.add(new IntegerConfigOption(
- "numberOfInstancesUsedForRoleLearning", ""));
+ "stops a cyclic hierarchy after specified number of classes", 1000));
+ //options.add(new IntegerConfigOption(
+ // "numberOfInstancesUsedForRoleLearning", ""));
options.add(new BooleanConfigOption("closeAfterRecursion",
- "gets all classes for all instances"));
+ "gets all classes for all instances", true));
options.add(new BooleanConfigOption("getPropertyInformation",
- "gets all types for extracted ObjectProperties"));
+ "gets all types for extracted ObjectProperties", false));
options.add(CommonConfigOptions.getVerbosityOption());
options.add(new StringSetConfigOption("defaultGraphURIs",
@@ -228,6 +233,7 @@
public <T> void applyConfigEntry(ConfigEntry<T> entry)
throws InvalidConfigOptionValueException {
String option = entry.getOptionName();
+
if (option.equals("url")) {
String s = (String) entry.getValue();
try {
Modified: trunk/src/dl-learner/org/dllearner/scripts/AutoDetectFilter.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/AutoDetectFilter.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/scripts/AutoDetectFilter.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -1,4 +1,3 @@
-
/**
* Copyright (C) 2007-2008, Jens Lehmann
*
@@ -15,7 +14,9 @@
* 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.scripts;
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+package org.dllearner.scripts;
import java.util.SortedSet;
import java.util.TreeSet;
Added: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -0,0 +1,313 @@
+/**
+ * Copyright (C) 2007, 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.scripts;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.config.ConfigOption;
+import org.dllearner.core.configuration.Configurator;
+import org.dllearner.utilities.Files;
+
+
+/**
+ * Collects information about all used configuration options and writes them
+ * into a file. This way the documentation is always in sync with the source
+ * code.
+ *
+ * @author Jens Lehmann
+ *
+ */
+public class ConfigJavaGenerator {
+
+ private static final String TARGET_DIR = "src/dl-learner/org/dllearner/core/configuration";
+
+ private static final String HEADER_FILE = "doc/header.txt";
+
+ private static final String HEADER = getHeader();
+
+ private static final String TEMPLATE_DIR = "doc/template/";
+
+ private static final String CLASSADDITION = "Configurator";
+
+ private static final SortedSet<String> configuratorImports = new TreeSet<String>();
+ private static final SortedSet<String> configuratorMethods = new TreeSet<String>();
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ Files.deleteDir(TARGET_DIR);
+
+ ComponentManager cm = ComponentManager.getInstance();
+ configuratorImports.add(ComponentManager.class.getCanonicalName());
+
+
+ for (Class<? extends KnowledgeSource> component : cm
+ .getKnowledgeSources()) {
+ String componentType = "knowledgeSource";
+
+ if (component.getSimpleName().equalsIgnoreCase(
+ "OWLFile")) {
+ configuratorImports.add(component.getCanonicalName());
+ configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CLASSADDITION);
+ make (component, componentType);
+ }if (component.getSimpleName().equalsIgnoreCase(
+ "SparqlKnowledgeSource")) {
+ configuratorImports.add(component.getCanonicalName());
+ configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CLASSADDITION);
+ make (component, componentType);
+ }
+
+
+ }
+
+ makeConfiguratorSuperClass();
+
+ System.out.println("Done");
+ }
+
+ public static void makeConfiguratorSuperClass(){
+ StringBuffer current = new StringBuffer();
+ current.append(HEADER+"\n");
+ current.append("package org.dllearner.core.configuration;\n\n");
+ for (String string : configuratorImports) {
+ current.append("import "+string+";\n");
+ }
+ current.append("\n"+getClassComment());
+ current.append("public class "+CLASSADDITION+" {\n\n");
+ for (String string : configuratorMethods) {
+ current.append(string+"\n");
+ }
+ current.append("}\n");
+ Files.createFile(new File(TARGET_DIR + "/" + CLASSADDITION + ".java"), current.toString());
+ }
+
+ public static void make(Class<? extends KnowledgeSource> component, String componentType){
+ StringBuffer current = new StringBuffer();
+ StringBuffer vars = new StringBuffer();
+ StringBuffer setters = new StringBuffer();
+ StringBuffer getters = new StringBuffer();
+ SortedSet<String> imports = new TreeSet<String>();
+ String className = component.getSimpleName();
+ List<ConfigOption<?>> mandatoryOptions = new LinkedList<ConfigOption<?>>();
+
+ imports.add(component.getCanonicalName());
+ imports.add(ComponentManager.class.getCanonicalName());
+ imports.add(Configurator.class.getCanonicalName());
+ imports.add(ConfigEntry.class.getCanonicalName());
+ //imports.add("import "+ConfigOption.class.getCanonicalName()+";");
+
+ vars.append(className+" "+ className+";\n");
+ current.append(HEADER + "\n");
+ current.append("package org.dllearner.core.configuration;\n\n");
+
+
+ for (ConfigOption<?> option : ComponentManager
+ .getConfigOptions(component)) {
+ if(option.isMandatory()){
+ mandatoryOptions.add(option);
+ configuratorImports.addAll(option.getJavaImports());
+ }
+
+ imports.addAll(option.getJavaImports());
+ vars.append(getVarDef(option));
+ setters.append(getSetter(option));
+ getters.append(getGetter(option));
+ // System.out.println(option);
+ // componentOptions.get(component)) {
+
+ }
+ for (String string : imports) {
+ current.append("import "+string+";\n");
+ }
+ current.append("\n\n");
+ current.append(getClassDefinition(className));
+ current.append(vars);
+ current.append("\n\n");
+ current.append(getMandatoryFunctions(className, componentType, mandatoryOptions));
+ current.append("\n\n");
+ current.append(makeApplyConfigEntry(ComponentManager.getConfigOptions(component)));
+ current.append("\n\n");
+ current.append(setters+"\n\n"+getters+"\n\n");
+ current.append("}\n");
+
+ configuratorMethods.add(getSuperClassFunction(className, componentType, mandatoryOptions));
+
+ Files.createFile(new File(TARGET_DIR + "/" + className
+ + CLASSADDITION + ".java"), current.toString());
+ }
+
+ private static String getConstructor(String className){
+ return "";
+ }
+
+ public static String makeApplyConfigEntry(List<ConfigOption<?>> options){
+ String ret ="@SuppressWarnings({ \"unchecked\" })\n" +
+ "public <T> void applyConfigEntry(ConfigEntry<T> entry){\n";
+ ret+="String optionName = entry.getOptionName();\n";
+ //ret+="ConfigOption<T> option = entry.getOption();\n";
+ if(!options.isEmpty()){
+ ConfigOption<?> first = options.remove(0);
+ ret+="if (optionName.equals("+first.getName()+")){\n" +
+ ""+first.getName()+" = ("+rightType(first.getValueTypeAsJavaString())+") " +
+ " entry.getValue();\n";
+ }
+ for (ConfigOption<?> option : options) {
+ ret+="}else if (optionName.equals("+option.getName()+")){\n";
+ ret+=""+option.getName()+" = ("+rightType(option.getValueTypeAsJavaString())+") " +
+ " entry.getValue();\n";
+
+ }
+ ret+="}\n}\n";
+ return ret;
+ }
+
+ public static String rightType(String type){
+ if(type.equals("int"))return "Integer";
+ else if(type.equals("boolean"))return "Boolean";
+ else return type;
+
+ }
+
+ private static String getMandatoryFunctionComment(List<ConfigOption<?>> options){
+ String ret = "/**\n";
+ for (ConfigOption<?> option : options) {
+ ret+=option.getDescription()+"\n";
+ }
+ ret+="**/\n";
+ return ret;
+ }
+
+ private static String getMandatoryFunctions(String className, String componentType, List<ConfigOption<?>> options){
+ String mandParametersWithType = getMandatoryParameters(options, true);
+ //String mandParametersNoType = getMandatoryParameters(options, false);
+ String mandFunctionBody = mandatoryFunctionBody(options);
+ String ret= getMandatoryFunctionComment(options);
+ ret += "public void setMandatoryOptions ("+mandParametersWithType+" ) {\n" +
+ ""+mandFunctionBody+"}\n";
+
+ ret+= getMandatoryFunctionComment(options);
+ ret+= "public static "+className+" get"+className+" (ComponentManager cm, "+mandParametersWithType+" ) {\n" +
+ className+" component = cm."+componentType+"("+className+".class);\n";
+ for (ConfigOption<?> option : options) {
+ ret+="cm.applyConfigEntry(component, \""+option.getName()+"\", "+option.getName()+");\n";
+ }
+
+ ret+="return component;\n}\n";
+ return ret;
+ }
+
+ private static String getSuperClassFunction(String className, String componentType, List<ConfigOption<?>> options){
+ String mandParametersWithType = getMandatoryParameters(options, true);
+ String mandParametersNoType = getMandatoryParameters(options, false);
+ //String mandFunctionBody = mandatoryFunctionBody(options);
+ String ret = getMandatoryFunctionComment(options);
+ ret += "public static "+className+" get"+className+" (ComponentManager cm, "+mandParametersWithType+" ) {\n" +
+ "return "+ className+CLASSADDITION+".get"+className+"(cm, "+mandParametersNoType+");\n}\n";
+ return ret;
+ }
+
+ public static String getMandatoryParameters (List<ConfigOption<?>> options, boolean includeType){
+ if(options.isEmpty())return "";
+ String ret = "";
+ String type = "";
+ for (ConfigOption<?> option : options) {
+ type = (includeType)?option.getValueTypeAsJavaString():"";
+ ret += type + " " + option.getName()+", ";
+ }
+ ret = ret.substring(0,ret.length()-2);
+ return ret;
+ }
+
+ private static String mandatoryFunctionBody(List<ConfigOption<?>> options){
+ String ret = "";
+ for (ConfigOption<?> option : options) {
+ ret += "this."+option.getName()+" = "+option.getName()+";\n";
+ }
+ return ret;
+ }
+
+
+ private static String getVarDef(ConfigOption<?> option) {
+ return "private " + option.getValueTypeAsJavaString() + " "
+ + option.getName() + " = " + option.getDefaultValueInJava()
+ + ";\n";
+
+ }
+
+ private static String getSetter(ConfigOption<?> option) {
+ String s = option.getName().substring(0, 1);
+ s = s.toUpperCase() + option.getName().substring(1);
+ String comment = "/**\n" +
+ "* "+option.getDescription()+"\n" +
+ "**/\n";
+
+ return comment + "public void set" + s + " (" + option.getValueTypeAsJavaString()
+ + " "+option.getName()+") {\n" +
+ "this." + option.getName()+" = "+ option.getName()+
+ ";\n" +
+ "}\n\n";
+
+ }
+
+ private static String getGetter(ConfigOption<?> option) {
+ String s = option.getName().substring(0, 1);
+ s = s.toUpperCase() + option.getName().substring(1);
+ String comment = "/**\n" +
+ "* "+option.getDescription()+"\n" +
+ "* \n" +
+ "**/\n";
+
+ return comment + "public "+option.getValueTypeAsJavaString()+" get" + s + " ( ) {\n" +
+ "return this." + option.getName()+";\n" +
+ "}\n\n";
+
+ }
+
+ private static String getClassDefinition(String className) {
+ String ret = getClassComment()
+ + "public class " + className + CLASSADDITION + " extends Configurator {\n" + "\n";
+ return ret;
+ }
+
+ private static String getClassComment(){
+ return "" + "/**\n"
+ + "* automatically generated, do not edit manually\n" + "**/\n";
+
+ }
+
+ private static String getHeader() {
+ try {
+ return Files.readFile(new File(HEADER_FILE));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/scripts/Sample.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/Sample.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/scripts/Sample.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -39,6 +39,7 @@
import org.dllearner.core.LearningProblemUnsupportedException;
import org.dllearner.core.ReasonerComponent;
import org.dllearner.core.ReasoningService;
+import org.dllearner.core.configuration.Configurator;
import org.dllearner.kb.OWLFile;
import org.dllearner.learningproblems.PosNegDefinitionLP;
import org.dllearner.reasoning.FastInstanceChecker;
@@ -117,9 +118,11 @@
ComponentManager cm = ComponentManager.getInstance();
// knowledge source
- KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
+ //KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
+
String fileURL = new File(owlFile).toURI().toString();
- cm.applyConfigEntry(ks, "url", fileURL);
+ OWLFile ks = Configurator.getOWLFile(cm, fileURL);
+ //cm.applyConfigEntry(ks, "url", fileURL);
// reasoner
ReasonerComponent r = cm.reasoner(FastInstanceChecker.class, ks);
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -166,6 +166,7 @@
}
+ @SuppressWarnings("unchecked")
private static void learnOriginal(NamedClass target, SortedSet<Individual> posExamples, SortedSet<Individual> negExamples) {
List<EvaluatedDescription> conceptresults = new ArrayList<EvaluatedDescription>();
System.out.println("Starting to learn original");
@@ -194,7 +195,7 @@
}
- private static LearnSPARQLConfiguration getConfForSparql(NamedClass c) {
+ public static LearnSPARQLConfiguration getConfForSparql(NamedClass c) {
LearnSPARQLConfiguration lc = new LearnSPARQLConfiguration();
// lsc.sparqlEndpoint = sparqlTasks.getSparqlEndpoint();
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -46,7 +46,6 @@
import org.dllearner.utilities.Files;
import org.dllearner.utilities.JamonMonitorLogger;
import org.dllearner.utilities.datastructures.SetManipulation;
-import org.dllearner.utilities.examples.ExampleContainer;
import org.dllearner.utilities.learn.ConfWriter;
import org.dllearner.utilities.owl.ReasoningServiceFactory;
import org.dllearner.utilities.owl.ReasoningServiceFactory.AvailableReasoners;
Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -31,7 +31,7 @@
*
*/
public class Files {
- public static boolean debug = true;
+ public static boolean debug = false;
/**
* Reads in a file.
@@ -133,5 +133,28 @@
}
}
}
+
+ /**
+ * deletes all Files in the dir, does not delete the dir itself
+ * no warning is issued, use with care, cannot undelete files
+ *
+ * @param dir without a separator e.g. tmp/dirtodelete
+ */
+ public static void deleteDir(String dir) {
+
+ File f = new File(dir);
+
+ if(debug){
+ System.out.println(dir);
+ System.exit(0);
+ }
+
+ String[] files = f.list();
+
+ for (int i = 0; i < files.length; i++) {
+
+ Files.deleteFile(new File(dir+File.separator+files[i]));
+ }
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java 2008-09-02 21:08:59 UTC (rev 1168)
+++ trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java 2008-09-03 19:29:41 UTC (rev 1169)
@@ -65,7 +65,7 @@
cm = ComponentManager.getInstance();
// knowledge source
- KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
+ OWLFile ks = cm.knowledgeSource(OWLFile.class);
// reasoner
ReasonerComponent r = cm.reasoner(Reasoner, ks);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-09-05 12:24:08
|
Revision: 1170
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1170&view=rev
Author: kurzum
Date: 2008-09-05 12:24:05 +0000 (Fri, 05 Sep 2008)
Log Message:
-----------
java interface
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java
trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
trunk/src/dl-learner/org/dllearner/scripts/Sample.java
trunk/src/dl-learner/org/dllearner/utilities/Files.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/core/configuration/FastInstanceCheckerConfigurator.java
trunk/src/dl-learner/org/dllearner/scripts/NewSample.java
Modified: trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -18,31 +18,44 @@
**/
package org.dllearner.core.configuration;
-
import java.util.Set;
import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.ReasonerComponent;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.configuration.FastInstanceCheckerConfigurator;
import org.dllearner.core.configuration.OWLFileConfigurator;
import org.dllearner.core.configuration.SparqlKnowledgeSourceConfigurator;
import org.dllearner.kb.OWLFile;
import org.dllearner.kb.sparql.SparqlKnowledgeSource;
+import org.dllearner.reasoning.FastInstanceChecker;
/**
* automatically generated, do not edit manually
**/
-public class Configurator {
+public class Configurator {
/**
-URL pointing to the OWL file
+* url: URL pointing to the OWL file
**/
public static OWLFile getOWLFile (ComponentManager cm, String url ) {
-return OWLFileConfigurator.getOWLFile(cm, url);
+return OWLFileConfigurator.getOWLFile(cm, url);
}
/**
-relevant instances e.g. positive and negative examples in a learning problem
+* instances: relevant instances e.g. positive and negative examples in a learning problem
**/
public static SparqlKnowledgeSource getSparqlKnowledgeSource (ComponentManager cm, Set<String> instances ) {
-return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(cm, instances);
+return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(cm, instances);
}
+/**
+**/
+public static FastInstanceChecker getFastInstanceChecker (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+return FastInstanceCheckerConfigurator.getFastInstanceChecker(cm, knowledgeSource);
}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configuration/FastInstanceCheckerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/FastInstanceCheckerConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/FastInstanceCheckerConfigurator.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+import org.dllearner.reasoning.FastInstanceChecker;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class FastInstanceCheckerConfigurator extends Configurator {
+
+FastInstanceChecker FastInstanceChecker;
+private String reasonerType = "pellet";
+
+public FastInstanceCheckerConfigurator (FastInstanceChecker FastInstanceChecker){
+this.FastInstanceChecker = FastInstanceChecker;
+}
+
+/**
+**/
+public static FastInstanceChecker getFastInstanceChecker (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+FastInstanceChecker component = cm.reasoner(FastInstanceChecker.class, knowledgeSource );
+return component;
+}
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if(false){//empty block
+}else if (optionName.equals("reasonerType")){
+reasonerType = (String) entry.getValue();
+}
+}
+
+/**
+reasonerType : FaCT++ or Pellet to dematerialize**/
+public String getReasonerType ( ) {
+return this.reasonerType;
+}
+
+/**
+reasonerType : FaCT++ or Pellet to dematerialize**/
+public void setReasonerType ( ComponentManager cm, String reasonerType) {
+cm.applyConfigEntry(FastInstanceChecker, "reasonerType", reasonerType);
+}
+
+
+}
Modified: trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -18,13 +18,11 @@
**/
package org.dllearner.core.configuration;
-
import org.dllearner.core.ComponentManager;
import org.dllearner.core.config.ConfigEntry;
import org.dllearner.core.configuration.Configurator;
import org.dllearner.kb.OWLFile;
-
/**
* automatically generated, do not edit manually
**/
@@ -33,49 +31,39 @@
OWLFile OWLFile;
private String url = null;
+public OWLFileConfigurator (OWLFile OWLFile){
+this.OWLFile = OWLFile;
+}
/**
-URL pointing to the OWL file
+* url: URL pointing to the OWL file
**/
-public void setMandatoryOptions (String url ) {
-this.url = url;
-}
-/**
-URL pointing to the OWL file
-**/
public static OWLFile getOWLFile (ComponentManager cm, String url ) {
-OWLFile component = cm.knowledgeSource(OWLFile.class);
+OWLFile component = cm.knowledgeSource(OWLFile.class );
cm.applyConfigEntry(component, "url", url);
return component;
}
-
@SuppressWarnings({ "unchecked" })
public <T> void applyConfigEntry(ConfigEntry<T> entry){
String optionName = entry.getOptionName();
-if (optionName.equals(url)){
+if(false){//empty block
+}else if (optionName.equals("url")){
url = (String) entry.getValue();
}
}
-
/**
-* URL pointing to the OWL file
-**/
-public void setUrl (String url) {
-this.url = url;
+url : URL pointing to the OWL file**/
+public String getUrl ( ) {
+return this.url;
}
-
-
/**
-* URL pointing to the OWL file
-*
-**/
-public String getUrl ( ) {
-return this.url;
+url : URL pointing to the OWL file**/
+public void setUrl ( ComponentManager cm, String url) {
+cm.applyConfigEntry(OWLFile, "url", url);
}
-
}
Modified: trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -18,7 +18,6 @@
**/
package org.dllearner.core.configuration;
-
import java.util.List;
import java.util.Set;
import org.dllearner.core.ComponentManager;
@@ -27,7 +26,6 @@
import org.dllearner.kb.sparql.SparqlKnowledgeSource;
import org.dllearner.utilities.datastructures.StringTuple;
-
/**
* automatically generated, do not edit manually
**/
@@ -59,440 +57,315 @@
private Set<String> defaultGraphURIs = null;
private Set<String> namedGraphURIs = null;
+public SparqlKnowledgeSourceConfigurator (SparqlKnowledgeSource SparqlKnowledgeSource){
+this.SparqlKnowledgeSource = SparqlKnowledgeSource;
+}
/**
-relevant instances e.g. positive and negative examples in a learning problem
+* instances: relevant instances e.g. positive and negative examples in a learning problem
**/
-public void setMandatoryOptions (Set<String> instances ) {
-this.instances = instances;
-}
-/**
-relevant instances e.g. positive and negative examples in a learning problem
-**/
public static SparqlKnowledgeSource getSparqlKnowledgeSource (ComponentManager cm, Set<String> instances ) {
-SparqlKnowledgeSource component = cm.knowledgeSource(SparqlKnowledgeSource.class);
+SparqlKnowledgeSource component = cm.knowledgeSource(SparqlKnowledgeSource.class );
cm.applyConfigEntry(component, "instances", instances);
return component;
}
-
@SuppressWarnings({ "unchecked" })
public <T> void applyConfigEntry(ConfigEntry<T> entry){
String optionName = entry.getOptionName();
-if (optionName.equals(url)){
+if(false){//empty block
+}else if (optionName.equals("url")){
url = (String) entry.getValue();
-}else if (optionName.equals(cacheDir)){
+}else if (optionName.equals("cacheDir")){
cacheDir = (String) entry.getValue();
-}else if (optionName.equals(instances)){
+}else if (optionName.equals("instances")){
instances = (Set<String>) entry.getValue();
-}else if (optionName.equals(recursionDepth)){
+}else if (optionName.equals("recursionDepth")){
recursionDepth = (Integer) entry.getValue();
-}else if (optionName.equals(predefinedFilter)){
+}else if (optionName.equals("predefinedFilter")){
predefinedFilter = (String) entry.getValue();
-}else if (optionName.equals(predefinedEndpoint)){
+}else if (optionName.equals("predefinedEndpoint")){
predefinedEndpoint = (String) entry.getValue();
-}else if (optionName.equals(predefinedManipulator)){
+}else if (optionName.equals("predefinedManipulator")){
predefinedManipulator = (String) entry.getValue();
-}else if (optionName.equals(predList)){
+}else if (optionName.equals("predList")){
predList = (Set<String>) entry.getValue();
-}else if (optionName.equals(objList)){
+}else if (optionName.equals("objList")){
objList = (Set<String>) entry.getValue();
-}else if (optionName.equals(classList)){
+}else if (optionName.equals("classList")){
classList = (Set<String>) entry.getValue();
-}else if (optionName.equals(format)){
+}else if (optionName.equals("format")){
format = (String) entry.getValue();
-}else if (optionName.equals(dumpToFile)){
+}else if (optionName.equals("dumpToFile")){
dumpToFile = (Boolean) entry.getValue();
-}else if (optionName.equals(convertNT2RDF)){
+}else if (optionName.equals("convertNT2RDF")){
convertNT2RDF = (Boolean) entry.getValue();
-}else if (optionName.equals(useLits)){
+}else if (optionName.equals("useLits")){
useLits = (Boolean) entry.getValue();
-}else if (optionName.equals(getAllSuperClasses)){
+}else if (optionName.equals("getAllSuperClasses")){
getAllSuperClasses = (Boolean) entry.getValue();
-}else if (optionName.equals(useCache)){
+}else if (optionName.equals("useCache")){
useCache = (Boolean) entry.getValue();
-}else if (optionName.equals(replacePredicate)){
+}else if (optionName.equals("replacePredicate")){
replacePredicate = (List<StringTuple>) entry.getValue();
-}else if (optionName.equals(replaceObject)){
+}else if (optionName.equals("replaceObject")){
replaceObject = (List<StringTuple>) entry.getValue();
-}else if (optionName.equals(breakSuperClassRetrievalAfter)){
+}else if (optionName.equals("breakSuperClassRetrievalAfter")){
breakSuperClassRetrievalAfter = (Integer) entry.getValue();
-}else if (optionName.equals(closeAfterRecursion)){
+}else if (optionName.equals("closeAfterRecursion")){
closeAfterRecursion = (Boolean) entry.getValue();
-}else if (optionName.equals(getPropertyInformation)){
+}else if (optionName.equals("getPropertyInformation")){
getPropertyInformation = (Boolean) entry.getValue();
-}else if (optionName.equals(verbosity)){
+}else if (optionName.equals("verbosity")){
verbosity = (String) entry.getValue();
-}else if (optionName.equals(defaultGraphURIs)){
+}else if (optionName.equals("defaultGraphURIs")){
defaultGraphURIs = (Set<String>) entry.getValue();
-}else if (optionName.equals(namedGraphURIs)){
+}else if (optionName.equals("namedGraphURIs")){
namedGraphURIs = (Set<String>) entry.getValue();
}
}
-
/**
-* URL of SPARQL Endpoint
-**/
-public void setUrl (String url) {
-this.url = url;
+url : URL of SPARQL Endpoint**/
+public String getUrl ( ) {
+return this.url;
}
-
/**
-* dir of cache
-**/
-public void setCacheDir (String cacheDir) {
-this.cacheDir = cacheDir;
+cacheDir : dir of cache**/
+public String getCacheDir ( ) {
+return this.cacheDir;
}
-
/**
-* relevant instances e.g. positive and negative examples in a learning problem
-**/
-public void setInstances (Set<String> instances) {
-this.instances = instances;
+instances : relevant instances e.g. positive and negative examples in a learning problem**/
+public Set<String> getInstances ( ) {
+return this.instances;
}
-
/**
-* recursion depth of KB fragment selection
-**/
-public void setRecursionDepth (int recursionDepth) {
-this.recursionDepth = recursionDepth;
+recursionDepth : recursion depth of KB fragment selection**/
+public int getRecursionDepth ( ) {
+return this.recursionDepth;
}
-
/**
-* the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST
-**/
-public void setPredefinedFilter (String predefinedFilter) {
-this.predefinedFilter = predefinedFilter;
+predefinedFilter : the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST**/
+public String getPredefinedFilter ( ) {
+return this.predefinedFilter;
}
-
/**
-* the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK
-**/
-public void setPredefinedEndpoint (String predefinedEndpoint) {
-this.predefinedEndpoint = predefinedEndpoint;
+predefinedEndpoint : the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK**/
+public String getPredefinedEndpoint ( ) {
+return this.predefinedEndpoint;
}
-
/**
-* the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR
-**/
-public void setPredefinedManipulator (String predefinedManipulator) {
-this.predefinedManipulator = predefinedManipulator;
+predefinedManipulator : the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR**/
+public String getPredefinedManipulator ( ) {
+return this.predefinedManipulator;
}
-
/**
-* list of all ignored roles
-**/
-public void setPredList (Set<String> predList) {
-this.predList = predList;
+predList : list of all ignored roles**/
+public Set<String> getPredList ( ) {
+return this.predList;
}
-
/**
-* list of all ignored objects
-**/
-public void setObjList (Set<String> objList) {
-this.objList = objList;
+objList : list of all ignored objects**/
+public Set<String> getObjList ( ) {
+return this.objList;
}
-
/**
-* list of all ignored classes
-**/
-public void setClassList (Set<String> classList) {
-this.classList = classList;
+classList : list of all ignored classes**/
+public Set<String> getClassList ( ) {
+return this.classList;
}
-
/**
-* N-TRIPLES or KB format
-**/
-public void setFormat (String format) {
-this.format = format;
+format : N-TRIPLES or KB format**/
+public String getFormat ( ) {
+return this.format;
}
-
/**
-* Specifies whether the extracted ontology is written to a file or not.
-**/
-public void setDumpToFile (boolean dumpToFile) {
-this.dumpToFile = dumpToFile;
+dumpToFile : Specifies whether the extracted ontology is written to a file or not.**/
+public boolean getDumpToFile ( ) {
+return this.dumpToFile;
}
-
/**
-* Specifies whether the extracted NTriples are converted to RDF and deleted.
-**/
-public void setConvertNT2RDF (boolean convertNT2RDF) {
-this.convertNT2RDF = convertNT2RDF;
+convertNT2RDF : Specifies whether the extracted NTriples are converted to RDF and deleted.**/
+public boolean getConvertNT2RDF ( ) {
+return this.convertNT2RDF;
}
-
/**
-* use Literals in SPARQL query
-**/
-public void setUseLits (boolean useLits) {
-this.useLits = useLits;
+useLits : use Literals in SPARQL query**/
+public boolean getUseLits ( ) {
+return this.useLits;
}
-
/**
-* If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.
-**/
-public void setGetAllSuperClasses (boolean getAllSuperClasses) {
-this.getAllSuperClasses = getAllSuperClasses;
+getAllSuperClasses : If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.**/
+public boolean getGetAllSuperClasses ( ) {
+return this.getAllSuperClasses;
}
-
/**
-* If true a Cache is used
-**/
-public void setUseCache (boolean useCache) {
-this.useCache = useCache;
+useCache : If true a Cache is used**/
+public boolean getUseCache ( ) {
+return this.useCache;
}
-
/**
-* rule for replacing predicates
-**/
-public void setReplacePredicate (List<StringTuple> replacePredicate) {
-this.replacePredicate = replacePredicate;
+replacePredicate : rule for replacing predicates**/
+public List<StringTuple> getReplacePredicate ( ) {
+return this.replacePredicate;
}
-
/**
-* rule for replacing predicates
-**/
-public void setReplaceObject (List<StringTuple> replaceObject) {
-this.replaceObject = replaceObject;
+replaceObject : rule for replacing predicates**/
+public List<StringTuple> getReplaceObject ( ) {
+return this.replaceObject;
}
-
/**
-* stops a cyclic hierarchy after specified number of classes
-**/
-public void setBreakSuperClassRetrievalAfter (int breakSuperClassRetrievalAfter) {
-this.breakSuperClassRetrievalAfter = breakSuperClassRetrievalAfter;
+breakSuperClassRetrievalAfter : stops a cyclic hierarchy after specified number of classes**/
+public int getBreakSuperClassRetrievalAfter ( ) {
+return this.breakSuperClassRetrievalAfter;
}
-
/**
-* gets all classes for all instances
-**/
-public void setCloseAfterRecursion (boolean closeAfterRecursion) {
-this.closeAfterRecursion = closeAfterRecursion;
+closeAfterRecursion : gets all classes for all instances**/
+public boolean getCloseAfterRecursion ( ) {
+return this.closeAfterRecursion;
}
-
/**
-* gets all types for extracted ObjectProperties
-**/
-public void setGetPropertyInformation (boolean getPropertyInformation) {
-this.getPropertyInformation = getPropertyInformation;
+getPropertyInformation : gets all types for extracted ObjectProperties**/
+public boolean getGetPropertyInformation ( ) {
+return this.getPropertyInformation;
}
-
/**
-* control verbosity of output for this component
-**/
-public void setVerbosity (String verbosity) {
-this.verbosity = verbosity;
+verbosity : control verbosity of output for this component**/
+public String getVerbosity ( ) {
+return this.verbosity;
}
-
/**
-* a list of all default Graph URIs
-**/
-public void setDefaultGraphURIs (Set<String> defaultGraphURIs) {
-this.defaultGraphURIs = defaultGraphURIs;
+defaultGraphURIs : a list of all default Graph URIs**/
+public Set<String> getDefaultGraphURIs ( ) {
+return this.defaultGraphURIs;
}
-
/**
-* a list of all named Graph URIs
-**/
-public void setNamedGraphURIs (Set<String> namedGraphURIs) {
-this.namedGraphURIs = namedGraphURIs;
+namedGraphURIs : a list of all named Graph URIs**/
+public Set<String> getNamedGraphURIs ( ) {
+return this.namedGraphURIs;
}
-
-
/**
-* URL of SPARQL Endpoint
-*
-**/
-public String getUrl ( ) {
-return this.url;
+url : URL of SPARQL Endpoint**/
+public void setUrl ( ComponentManager cm, String url) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "url", url);
}
-
/**
-* dir of cache
-*
-**/
-public String getCacheDir ( ) {
-return this.cacheDir;
+cacheDir : dir of cache**/
+public void setCacheDir ( ComponentManager cm, String cacheDir) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "cacheDir", cacheDir);
}
-
/**
-* relevant instances e.g. positive and negative examples in a learning problem
-*
-**/
-public Set<String> getInstances ( ) {
-return this.instances;
+instances : relevant instances e.g. positive and negative examples in a learning problem**/
+public void setInstances ( ComponentManager cm, Set<String> instances) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "instances", instances);
}
-
/**
-* recursion depth of KB fragment selection
-*
-**/
-public int getRecursionDepth ( ) {
-return this.recursionDepth;
+recursionDepth : recursion depth of KB fragment selection**/
+public void setRecursionDepth ( ComponentManager cm, int recursionDepth) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "recursionDepth", recursionDepth);
}
-
/**
-* the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST
-*
-**/
-public String getPredefinedFilter ( ) {
-return this.predefinedFilter;
+predefinedFilter : the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST**/
+public void setPredefinedFilter ( ComponentManager cm, String predefinedFilter) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "predefinedFilter", predefinedFilter);
}
-
/**
-* the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK
-*
-**/
-public String getPredefinedEndpoint ( ) {
-return this.predefinedEndpoint;
+predefinedEndpoint : the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK**/
+public void setPredefinedEndpoint ( ComponentManager cm, String predefinedEndpoint) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "predefinedEndpoint", predefinedEndpoint);
}
-
/**
-* the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR
-*
-**/
-public String getPredefinedManipulator ( ) {
-return this.predefinedManipulator;
+predefinedManipulator : the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR**/
+public void setPredefinedManipulator ( ComponentManager cm, String predefinedManipulator) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "predefinedManipulator", predefinedManipulator);
}
-
/**
-* list of all ignored roles
-*
-**/
-public Set<String> getPredList ( ) {
-return this.predList;
+predList : list of all ignored roles**/
+public void setPredList ( ComponentManager cm, Set<String> predList) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "predList", predList);
}
-
/**
-* list of all ignored objects
-*
-**/
-public Set<String> getObjList ( ) {
-return this.objList;
+objList : list of all ignored objects**/
+public void setObjList ( ComponentManager cm, Set<String> objList) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "objList", objList);
}
-
/**
-* list of all ignored classes
-*
-**/
-public Set<String> getClassList ( ) {
-return this.classList;
+classList : list of all ignored classes**/
+public void setClassList ( ComponentManager cm, Set<String> classList) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "classList", classList);
}
-
/**
-* N-TRIPLES or KB format
-*
-**/
-public String getFormat ( ) {
-return this.format;
+format : N-TRIPLES or KB format**/
+public void setFormat ( ComponentManager cm, String format) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "format", format);
}
-
/**
-* Specifies whether the extracted ontology is written to a file or not.
-*
-**/
-public boolean getDumpToFile ( ) {
-return this.dumpToFile;
+dumpToFile : Specifies whether the extracted ontology is written to a file or not.**/
+public void setDumpToFile ( ComponentManager cm, boolean dumpToFile) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "dumpToFile", dumpToFile);
}
-
/**
-* Specifies whether the extracted NTriples are converted to RDF and deleted.
-*
-**/
-public boolean getConvertNT2RDF ( ) {
-return this.convertNT2RDF;
+convertNT2RDF : Specifies whether the extracted NTriples are converted to RDF and deleted.**/
+public void setConvertNT2RDF ( ComponentManager cm, boolean convertNT2RDF) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "convertNT2RDF", convertNT2RDF);
}
-
/**
-* use Literals in SPARQL query
-*
-**/
-public boolean getUseLits ( ) {
-return this.useLits;
+useLits : use Literals in SPARQL query**/
+public void setUseLits ( ComponentManager cm, boolean useLits) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "useLits", useLits);
}
-
/**
-* If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.
-*
-**/
-public boolean getGetAllSuperClasses ( ) {
-return this.getAllSuperClasses;
+getAllSuperClasses : If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.**/
+public void setGetAllSuperClasses ( ComponentManager cm, boolean getAllSuperClasses) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "getAllSuperClasses", getAllSuperClasses);
}
-
/**
-* If true a Cache is used
-*
-**/
-public boolean getUseCache ( ) {
-return this.useCache;
+useCache : If true a Cache is used**/
+public void setUseCache ( ComponentManager cm, boolean useCache) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "useCache", useCache);
}
-
/**
-* rule for replacing predicates
-*
-**/
-public List<StringTuple> getReplacePredicate ( ) {
-return this.replacePredicate;
+replacePredicate : rule for replacing predicates**/
+public void setReplacePredicate ( ComponentManager cm, List<StringTuple> replacePredicate) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "replacePredicate", replacePredicate);
}
-
/**
-* rule for replacing predicates
-*
-**/
-public List<StringTuple> getReplaceObject ( ) {
-return this.replaceObject;
+replaceObject : rule for replacing predicates**/
+public void setReplaceObject ( ComponentManager cm, List<StringTuple> replaceObject) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "replaceObject", replaceObject);
}
-
/**
-* stops a cyclic hierarchy after specified number of classes
-*
-**/
-public int getBreakSuperClassRetrievalAfter ( ) {
-return this.breakSuperClassRetrievalAfter;
+breakSuperClassRetrievalAfter : stops a cyclic hierarchy after specified number of classes**/
+public void setBreakSuperClassRetrievalAfter ( ComponentManager cm, int breakSuperClassRetrievalAfter) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "breakSuperClassRetrievalAfter", breakSuperClassRetrievalAfter);
}
-
/**
-* gets all classes for all instances
-*
-**/
-public boolean getCloseAfterRecursion ( ) {
-return this.closeAfterRecursion;
+closeAfterRecursion : gets all classes for all instances**/
+public void setCloseAfterRecursion ( ComponentManager cm, boolean closeAfterRecursion) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "closeAfterRecursion", closeAfterRecursion);
}
-
/**
-* gets all types for extracted ObjectProperties
-*
-**/
-public boolean getGetPropertyInformation ( ) {
-return this.getPropertyInformation;
+getPropertyInformation : gets all types for extracted ObjectProperties**/
+public void setGetPropertyInformation ( ComponentManager cm, boolean getPropertyInformation) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "getPropertyInformation", getPropertyInformation);
}
-
/**
-* control verbosity of output for this component
-*
-**/
-public String getVerbosity ( ) {
-return this.verbosity;
+verbosity : control verbosity of output for this component**/
+public void setVerbosity ( ComponentManager cm, String verbosity) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "verbosity", verbosity);
}
-
/**
-* a list of all default Graph URIs
-*
-**/
-public Set<String> getDefaultGraphURIs ( ) {
-return this.defaultGraphURIs;
+defaultGraphURIs : a list of all default Graph URIs**/
+public void setDefaultGraphURIs ( ComponentManager cm, Set<String> defaultGraphURIs) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "defaultGraphURIs", defaultGraphURIs);
}
-
/**
-* a list of all named Graph URIs
-*
-**/
-public Set<String> getNamedGraphURIs ( ) {
-return this.namedGraphURIs;
+namedGraphURIs : a list of all named Graph URIs**/
+public void setNamedGraphURIs ( ComponentManager cm, Set<String> namedGraphURIs) {
+cm.applyConfigEntry(SparqlKnowledgeSource, "namedGraphURIs", namedGraphURIs);
}
-
}
Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -45,7 +45,7 @@
public class OWLFile extends KnowledgeSource {
private URL url;
- private OWLFileConfigurator configurator = new OWLFileConfigurator();
+ private OWLFileConfigurator configurator ;
public OWLFileConfigurator getOWLFileConfigurator(){
return configurator;
}
@@ -54,6 +54,9 @@
return "OWL file";
}
+ public OWLFile(){
+ configurator = new OWLFileConfigurator(this);
+ }
public static Collection<ConfigOption<?>> createConfigOptions() {
@@ -67,19 +70,24 @@
*/
@Override
public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException {
+ configurator.applyConfigEntry(entry);
+
+ //postprocessing
if (entry.getOptionName().equals("url")) {
- String s = (String) entry.getValue();
try {
- url = new URL(s);
- // File f = new File(url.toURI());
- //if(!f.canRead())
- // throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue());
+ url = new URL(configurator.getUrl());
} catch (MalformedURLException e) {
- throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(),"malformed URL " + s);
- } //catch (URISyntaxException e) {
- // TODO Auto-generated catch block
- //e.printStackTrace();
- //}
+ throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(),"malformed URL " + configurator.getUrl());
+ }
+
+// File f = new File(url.toURI());
+//if(!f.canRead())
+// throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue());
+// String s = (String) entry.getValue();
+//catch (URISyntaxException e) {
+//e.printStackTrace();
+//}
+
}
}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -46,7 +46,6 @@
import org.dllearner.core.config.StringSetConfigOption;
import org.dllearner.core.config.StringTupleListConfigOption;
import org.dllearner.core.config.ConfigOption.Tags;
-import org.dllearner.core.configuration.OWLFileConfigurator;
import org.dllearner.core.configuration.SparqlKnowledgeSourceConfigurator;
import org.dllearner.core.owl.KB;
import org.dllearner.kb.aquisitors.SparqlTupleAquisitor;
@@ -85,11 +84,16 @@
static final boolean debugUseImprovedTupleAquisitor = debug && false; //switches tupleaquisitor
static final boolean debugExitAfterExtraction = debug && false; //switches sysex und rdf generation
- private SparqlKnowledgeSourceConfigurator configurator = new SparqlKnowledgeSourceConfigurator();
+ private SparqlKnowledgeSourceConfigurator configurator;
+
public SparqlKnowledgeSourceConfigurator getSparqlKnowledgeSourceConfigurator(){
return configurator;
}
+/*public SparqlKnowledgeSource (){
+ this.configurator = new SparqlKnowledgeSourceConfigurator(this);
+ }
+*/
private boolean useCache=true;
// ConfigOptions
public URL url;
Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -20,13 +20,23 @@
package org.dllearner.scripts;
import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.commons.collections.map.LinkedMap;
+import org.dllearner.core.Component;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.ReasonerComponent;
+import org.dllearner.core.ReasoningService;
import org.dllearner.core.config.ConfigEntry;
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.configuration.Configurator;
@@ -51,256 +61,361 @@
private static final String TEMPLATE_DIR = "doc/template/";
- private static final String CLASSADDITION = "Configurator";
+ private static final String CONFIGURATOR = "Configurator";
private static final SortedSet<String> configuratorImports = new TreeSet<String>();
- private static final SortedSet<String> configuratorMethods = new TreeSet<String>();
+ private static final List<String> configuratorMethods = new ArrayList<String>();
+
+ Class<? extends Component> component;
+ String className;
+ String componentType;
+ List<String> body = new ArrayList<String>();
+ List<String> vars = new ArrayList<String>();
+ List<String> setters = new ArrayList<String>();
+ List<String> getters = new ArrayList<String>();
+ SortedSet<String> imports = new TreeSet<String>();
+ Map<String,String> additionalMandatoryVars = new LinkedHashMap<String, String>();
+ Map<String,String> mandatoryVars = new LinkedHashMap<String, String>();
+ Map<String,String> varMap = new LinkedHashMap<String, String>();
+
+ List<ConfigOption<?>> mandatoryOptions = new LinkedList<ConfigOption<?>>();
+
/**
* @param args
*/
public static void main(String[] args) {
+ Files.backupDirectory(TARGET_DIR);
+ //System.exit(0);
Files.deleteDir(TARGET_DIR);
-
+
ComponentManager cm = ComponentManager.getInstance();
configuratorImports.add(ComponentManager.class.getCanonicalName());
-
+ configuratorImports.add(KnowledgeSource.class.getCanonicalName());
+ configuratorImports.add(ReasonerComponent.class.getCanonicalName());
+ configuratorImports.add(ReasoningService.class.getCanonicalName());
+ configuratorImports.add(LearningProblem.class.getCanonicalName());
+ configuratorImports.add(LearningAlgorithm.class.getCanonicalName());
for (Class<? extends KnowledgeSource> component : cm
.getKnowledgeSources()) {
String componentType = "knowledgeSource";
+
+
if (component.getSimpleName().equalsIgnoreCase(
"OWLFile")) {
configuratorImports.add(component.getCanonicalName());
- configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CLASSADDITION);
- make (component, componentType);
+ configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CONFIGURATOR);
+ ConfigJavaGenerator c = new ConfigJavaGenerator(component, componentType);
+
+ c.makeSubclasses();
+
}if (component.getSimpleName().equalsIgnoreCase(
"SparqlKnowledgeSource")) {
configuratorImports.add(component.getCanonicalName());
- configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CLASSADDITION);
- make (component, componentType);
+ configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CONFIGURATOR);
+ ConfigJavaGenerator c = new ConfigJavaGenerator(component, componentType);
+ c.makeSubclasses();
}
}
+ for (Class<? extends ReasonerComponent> component : cm.getReasonerComponents()) {
+
+
+ if (component.getSimpleName().equalsIgnoreCase(
+ "FastInstanceChecker")) {
+ configuratorImports.add(component.getCanonicalName());
+ configuratorImports.add("org.dllearner.core.configuration."+component.getSimpleName()+CONFIGURATOR);
+
+ ConfigJavaGenerator c = new ConfigJavaGenerator(component, "reasoner");
+ c.imports.add("org.dllearner.core.KnowledgeSource");
+ c.additionalMandatoryVars.put("KnowledgeSource knowledgeSource","knowledgeSource");
+ c.makeSubclasses();
+
+ }
+
+
+ }
+
+
makeConfiguratorSuperClass();
System.out.println("Done");
}
- public static void makeConfiguratorSuperClass(){
- StringBuffer current = new StringBuffer();
- current.append(HEADER+"\n");
- current.append("package org.dllearner.core.configuration;\n\n");
- for (String string : configuratorImports) {
- current.append("import "+string+";\n");
- }
- current.append("\n"+getClassComment());
- current.append("public class "+CLASSADDITION+" {\n\n");
- for (String string : configuratorMethods) {
- current.append(string+"\n");
- }
- current.append("}\n");
- Files.createFile(new File(TARGET_DIR + "/" + CLASSADDITION + ".java"), current.toString());
- }
-
- public static void make(Class<? extends KnowledgeSource> component, String componentType){
- StringBuffer current = new StringBuffer();
- StringBuffer vars = new StringBuffer();
- StringBuffer setters = new StringBuffer();
- StringBuffer getters = new StringBuffer();
- SortedSet<String> imports = new TreeSet<String>();
- String className = component.getSimpleName();
- List<ConfigOption<?>> mandatoryOptions = new LinkedList<ConfigOption<?>>();
-
+ public ConfigJavaGenerator (Class<? extends Component> component, String componentType){
+ className = component.getSimpleName();
+ this.component = component;
+ this.componentType = componentType;
imports.add(component.getCanonicalName());
imports.add(ComponentManager.class.getCanonicalName());
imports.add(Configurator.class.getCanonicalName());
imports.add(ConfigEntry.class.getCanonicalName());
+
+ vars.add(className+" "+className+";\n");
+
+ }
+
+ public void makeSubclasses(){
+
+
+
//imports.add("import "+ConfigOption.class.getCanonicalName()+";");
+ //vars.put(key, value)
+ //vars.add(className+" "+ className+";\n");
- vars.append(className+" "+ className+";\n");
- current.append(HEADER + "\n");
- current.append("package org.dllearner.core.configuration;\n\n");
for (ConfigOption<?> option : ComponentManager
.getConfigOptions(component)) {
+
+ String type = option.getValueTypeAsJavaString();
+ String optionName = option.getName();
+ String defaultValue = option.getDefaultValueInJava();
+ String comment = option.getDescription();
+
if(option.isMandatory()){
+ mandatoryVars.put(type + " " + optionName , optionName);
mandatoryOptions.add(option);
configuratorImports.addAll(option.getJavaImports());
- }
+ }
imports.addAll(option.getJavaImports());
- vars.append(getVarDef(option));
- setters.append(getSetter(option));
- getters.append(getGetter(option));
+ vars.add(fillVariableDefTemplate(optionName, type, defaultValue));
+ setters.add(fillSetterTemplate(className, comment, optionName, type));
+ getters.add(fillGetterTemplate(comment, optionName, type));
// System.out.println(option);
// componentOptions.get(component)) {
}
- for (String string : imports) {
- current.append("import "+string+";\n");
- }
- current.append("\n\n");
- current.append(getClassDefinition(className));
- current.append(vars);
- current.append("\n\n");
- current.append(getMandatoryFunctions(className, componentType, mandatoryOptions));
- current.append("\n\n");
- current.append(makeApplyConfigEntry(ComponentManager.getConfigOptions(component)));
- current.append("\n\n");
- current.append(setters+"\n\n"+getters+"\n\n");
- current.append("}\n");
- configuratorMethods.add(getSuperClassFunction(className, componentType, mandatoryOptions));
+
+
+ body.add(expandCollection(vars, "", "", 0));
+ body.add(fillConstructorTemplate(className));
+
+ body.add(makeGetInstanceForSubclass(className, componentType,
+ getAllCommentsForOptionList(mandatoryOptions)));
+
+ body.add(makeApplyConfigEntryForOptionList(ComponentManager.getConfigOptions(component)));
+
+ body.add(expandCollection(getters, "", "", 0));
+ body.add(expandCollection(setters, "", "", 0));
+ String ret = fillClassTemplate(
+ "org.dllearner.core.configuration",
+ expandCollection(imports, "import ", ";\n", 0),
+ className+CONFIGURATOR,
+ CONFIGURATOR,
+ expandCollection(body, "", "\n", 0) );
+
+
+
+
+
+ //configuratorMethods.add((className, componentType, mandatoryOptions));
+
Files.createFile(new File(TARGET_DIR + "/" + className
- + CLASSADDITION + ".java"), current.toString());
+ + CONFIGURATOR + ".java"), ret);
+
+ configuratorMethods.add(
+ makeSuperConfiguratorMethods(
+ className,
+ componentType,
+ getAllCommentsForOptionList(mandatoryOptions)));
}
- private static String getConstructor(String className){
- return "";
- }
- public static String makeApplyConfigEntry(List<ConfigOption<?>> options){
+
+ public static String makeApplyConfigEntryForOptionList(List<ConfigOption<?>> options){
String ret ="@SuppressWarnings({ \"unchecked\" })\n" +
"public <T> void applyConfigEntry(ConfigEntry<T> entry){\n";
ret+="String optionName = entry.getOptionName();\n";
//ret+="ConfigOption<T> option = entry.getOption();\n";
- if(!options.isEmpty()){
- ConfigOption<?> first = options.remove(0);
- ret+="if (optionName.equals("+first.getName()+")){\n" +
- ""+first.getName()+" = ("+rightType(first.getValueTypeAsJavaString())+") " +
- " entry.getValue();\n";
- }
+ ret+="if(false){//empty block \n}";
+
for (ConfigOption<?> option : options) {
- ret+="}else if (optionName.equals("+option.getName()+")){\n";
+ ret+="else if (optionName.equals(\""+option.getName()+"\")){\n";
ret+=""+option.getName()+" = ("+rightType(option.getValueTypeAsJavaString())+") " +
- " entry.getValue();\n";
+ " entry.getValue();\n}";
}
- ret+="}\n}\n";
+ ret+="\n}\n";
return ret;
}
- public static String rightType(String type){
- if(type.equals("int"))return "Integer";
- else if(type.equals("boolean"))return "Boolean";
- else return type;
+
+ private static String getAllCommentsForOptionList(List<ConfigOption<?>> options){
+ String ret = "";
+ for (ConfigOption<?> option : options) {
+ ret+="* "+option.getName()+": "+option.getDescription()+"\n";
+ }
+ return fillJavaDocComment(ret);
}
- private static String getMandatoryFunctionComment(List<ConfigOption<?>> options){
- String ret = "/**\n";
- for (ConfigOption<?> option : options) {
- ret+=option.getDescription()+"\n";
+ private String makeGetInstanceForSubclass(String className, String componentType,
+ String comments){
+ Map<String, String> parametersWithType = new LinkedHashMap<String,String>();
+ Map<String, String> parametersNoType = new LinkedHashMap<String,String>();
+ String applyConf = "";
+ parametersWithType.put("ComponentManager cm", "cm");
+ parametersNoType.put(className+".class", className+".class");
+ for (String s : additionalMandatoryVars.keySet()) {
+ parametersWithType.put(s, additionalMandatoryVars.get(s));
+ parametersNoType.put(s, additionalMandatoryVars.get(s));
}
- ret+="**/\n";
+ for (String s : mandatoryVars.keySet()) {
+ parametersWithType.put(s, mandatoryVars.get(s));
+ applyConf += fillApplyConfigEntry("component", mandatoryVars.get(s))+"";
+ }
+
+ String parWithType = expandCollection(parametersWithType.keySet(), "", ", ", 2);
+
+ String par = expandCollection(parametersNoType.values(), "", ", ", 2);
+
+ //TODO
+ String ret = comments;
+ ret += "public static "+className+" get"+className+" ("+parWithType+" ) {\n";
+ ret += className+" component = cm."+componentType+"(" +par+" );\n";
+ ret += applyConf;
+
+ ret+="return component;\n}\n";
return ret;
}
- private static String getMandatoryFunctions(String className, String componentType, List<ConfigOption<?>> options){
- String mandParametersWithType = getMandatoryParameters(options, true);
- //String mandParametersNoType = getMandatoryParameters(options, false);
- String mandFunctionBody = mandatoryFunctionBody(options);
- String ret= getMandatoryFunctionComment(options);
- ret += "public void setMandatoryOptions ("+mandParametersWithType+" ) {\n" +
- ""+mandFunctionBody+"}\n";
+ private String makeSuperConfiguratorMethods(
+ String className, String componentType, String comments){
- ret+= getMandatoryFunctionComment(options);
- ret+= "public static "+className+" get"+className+" (ComponentManager cm, "+mandParametersWithType+" ) {\n" +
- className+" component = cm."+componentType+"("+className+".class);\n";
- for (ConfigOption<?> option : options) {
- ret+="cm.applyConfigEntry(component, \""+option.getName()+"\", "+option.getName()+");\n";
+ Map<String, String> parametersWithType = new LinkedHashMap<String,String>();
+ Map<String, String> parametersNoType = new LinkedHashMap<String,String>();
+ String applyConf = "";
+ parametersWithType.put("ComponentManager cm", "cm");
+ parametersNoType.put(className+".class", className+".class");
+ for (String s : additionalMandatoryVars.keySet()) {
+ parametersWithType.put(s, additionalMandatoryVars.get(s));
+ parametersNoType.put(s, additionalMandatoryVars.get(s));
}
+ for (String s : mandatoryVars.keySet()) {
+ parametersWithType.put(s, mandatoryVars.get(s));
+ applyConf += fillApplyConfigEntry("component", mandatoryVars.get(s))+"";
+ }
- ret+="return component;\n}\n";
+ String parWithType = expandCollection(parametersWithType.keySet(), "", ", ", 2);
+
+ String par = expandCollection(parametersWithType.values(), "", ", ", 2);
+
+ String ret = comments;
+ ret += "public static "+className+" get"+className+" ("+parWithType+" ) {\n" +
+ "return "+ className+CONFIGURATOR+".get"+className+"("+par+");\n}\n";
return ret;
}
- private static String getSuperClassFunction(String className, String componentType, List<ConfigOption<?>> options){
- String mandParametersWithType = getMandatoryParameters(options, true);
- String mandParametersNoType = getMandatoryParameters(options, false);
- //String mandFunctionBody = mandatoryFunctionBody(options);
- String ret = getMandatoryFunctionComment(options);
- ret += "public static "+className+" get"+className+" (ComponentManager cm, "+mandParametersWithType+" ) {\n" +
- "return "+ className+CLASSADDITION+".get"+className+"(cm, "+mandParametersNoType+");\n}\n";
- return ret;
+ public static void makeConfiguratorSuperClass(){
+ String ret=
+ fillClassTemplate(
+ "org.dllearner.core.configuration",
+ expandCollection(configuratorImports, "import ", ";\n",0),
+ CONFIGURATOR,
+ "",
+ expandCollection(configuratorMethods, "", "\n", 0)
+ );
+
+
+ Files.createFile(new File(TARGET_DIR + "/" + CONFIGURATOR + ".java"), ret);
}
- public static String getMandatoryParameters (List<ConfigOption<?>> options, boolean includeType){
- if(options.isEmpty())return "";
- String ret = "";
- String type = "";
- for (ConfigOption<?> option : options) {
- type = (includeType)?option.getValueTypeAsJavaString():"";
- ret += type + " " + option.getName()+", ";
- }
- ret = ret.substring(0,ret.length()-2);
- return ret;
+
+
+ private static String fillApplyConfigEntry(String className, String optionName){
+ return "cm.applyConfigEntry("+className+", \""+optionName+"\", "+optionName+");\n";
}
- private static String mandatoryFunctionBody(List<ConfigOption<?>> options){
- String ret = "";
- for (ConfigOption<?> option : options) {
- ret += "this."+option.getName()+" = "+option.getName()+";\n";
- }
- return ret;
+ private static String fillConstructorTemplate(String className){
+ return "public "+className+CONFIGURATOR+" ("+className+" "+className+"){\n" +
+ "this."+className+" = "+className+";\n" +
+ "}\n";
}
- private static String getVarDef(ConfigOption<?> option) {
- return "private " + option.getValueTypeAsJavaString() + " "
- + option.getName() + " = " + option.getDefaultValueInJava()
+ private static String fillVariableDefTemplate(String optionName, String type, String defaultValue) {
+ return "private " + type + " "
+ + optionName + " = " + defaultValue
+ ";\n";
}
+
+ private static String fillJavaDocComment(String lines){
+ return "/**\n"+lines+"**/\n";
+ }
- private static String getSetter(ConfigOption<?> option) {
- String s = option.getName().substring(0, 1);
- s = s.toUpperCase() + option.getName().substring(1);
- String comment = "/**\n" +
- "* "+option.getDescription()+"\n" +
- "**/\n";
+
+
+ private static String fillGetterTemplate( String comment, String optionName, String type) {
+ String ret = fillJavaDocComment (optionName+" : "+comment);
+ ret+= "public "+type+" get" + capitalize(optionName) + " ( ) {\n";
+ ret+= "return this." + optionName+";\n";
+ ret+= "}\n";
+ return ret;
+ }
+ private static String fillSetterTemplate(String className, String comment, String optionName, String type ){
+ String ret = fillJavaDocComment (optionName+" : "+comment);
+ ret += "public void set" + capitalize(optionName);
+ ret += " ( ComponentManager cm, " + type +" "+ optionName+") {\n";
+ ret += fillApplyConfigEntry(className, optionName);
+ ret += "}\n" ;
+ return ret;
+ }
+
+
+
+ private static String fillClassTemplate(String Package, String imports, String className, String Extends, String body){
+ String ret = HEADER +"\n";
+ ret += "package "+Package+";\n";
+ ret += imports+"\n";
+ ret += fillJavaDocComment("* automatically generated, do not edit manually\n");
+ ret += "public class "+className+" "+((Extends.length()>0)?"extends "+Extends:"")+" {\n\n";
+ ret += body+"\n";
+ ret +="}\n";
+ return ret;
- return comment + "public void set" + s + " (" + option.getValueTypeAsJavaString()
- + " "+option.getName()+") {\n" +
- "this." + option.getName()+" = "+ option.getName()+
- ";\n" +
- "}\n\n";
-
}
- private static String getGetter(ConfigOption<?> option) {
- String s = option.getName().substring(0, 1);
- s = s.toUpperCase() + option.getName().substring(1);
- String comment = "/**\n" +
- "* "+option.getDescription()+"\n" +
- "* \n" +
- "**/\n";
+
+
+ private static String expandCollection (Collection<String> col, String before, String after, int removeChars){
+ if(col.isEmpty())return "";
+ String ret ="";
+ for (String string : col) {
+ ret+= before+string+after;
+ }
+
+ if(removeChars==0){
+ return ret;
+ }else {
+ return ret.substring(0, ret.length()-removeChars);
+ }
+ }
- return comment + "public "+option.getValueTypeAsJavaString()+" get" + s + " ( ) {\n" +
- "return this." + option.getName()+";\n" +
- "}\n\n";
-
+
+
+ private static String capitalize(String s){
+ String tmp = s.substring(0, 1);
+ return tmp.toUpperCase() + s.substring(1);
}
-
- private static String getClassDefinition(String className) {
- String ret = getClassComment()
- + "public class " + className + CLASSADDITION + " extends Configurator {\n" + "\n";
- return ret;
+
+ public static String rightType(String type){
+ if(type.equals("int"))return "Integer";
+ else if(type.equals("boolean"))return "Boolean";
+ else return type;
+
}
- private static String getClassComment(){
- return "" + "/**\n"
- + "* automatically generated, do not edit manually\n" + "**/\n";
- }
-
private static String getHeader() {
try {
return Files.readFile(new File(HEADER_FILE));
Added: trunk/src/dl-learner/org/dllearner/scripts/NewSample.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/NewSample.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -0,0 +1,160 @@
+/**
+ * Copyright (C) 2007-2008, 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.scripts;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.core.ComponentInitException;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.EvaluatedDescription;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasonerComponent;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.configuration.Configurator;
+import org.dllearner.kb.OWLFile;
+import org.dllearner.learningproblems.PosNegDefinitionLP;
+import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.utilities.Files;
+
+import com.jamonapi.MonitorFactory;
+
+/**
+ * Sample script showing how to use DL-Learner. Provides an entry point for tool
+ * developers.
+ *
+ * @author Sebastian Hellmann
+ * @author Jens Lehmann
+ *
+ */
+public class NewSample {
+
+ private static Logger logger = Logger.getRootLogger();
+ private static DecimalFormat df = new DecimalFormat();
+
+ public static void main(String[] args) throws IOException, ComponentInitException,
+ LearningProblemUnsupportedException {
+
+ // create logger (configure this to your needs)
+ SimpleLayout layout = new SimpleLayout();
+ FileAppender fileAppender = new FileAppender(layout, "log/sample_log.txt", false);
+
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ logger.removeAllAppenders();
+ logger.addAppender(consoleAppender);
+ logger.addAppender(fileAppender);
+ logger.setLevel(Level.DEBUG);
+
+ // OWL file containing background knowledge
+ String owlFile = "examples/trains/trains.owl";
+
+ // examples
+ SortedSet<String> posExamples = new TreeSet<String>();
+ posExamples.add("http://example.com/foo#east1");
+ posExamples.add("http://example.com/foo#east2");
+ posExamples.add("http://example.com/foo#east3");
+ posExamples.add("http://example.com/foo#east4");
+ posExamples.add("http://example.com/foo#east5");
+
+ SortedSet<String> negExamples = new TreeSet<String>();
+ negExamples.add("http://example.com/foo#west6");
+ negExamples.add("http://example.com/foo#west7");
+ negExamples.add("http://example.com/foo#west8");
+ negExamples.add("http://example.com/foo#west9");
+ negExamples.add("http://example.com/foo#west10");
+
+ List<EvaluatedDescription> results = learn(owlFile, posExamples, negExamples, 5);
+ int x = 0;
+ for (EvaluatedDescription ed : results) {
+ System.out.println("solution: " + x);
+ System.out.println(" description: \t"
+ + ed.getDescription().toManchesterSyntaxString(null, null));
+ System.out.println(" accuracy: \t" + df.format(ed.getAccuracy() * 100) + "%");
+ System.out.println();
+ x++;
+ }
+
+ Files.createFile(new File("log/jamon_sample.html"), MonitorFactory.getReport());
+ }
+
+ public static List<EvaluatedDescription> learn(String owlFile, SortedSet<String> posExamples,
+ SortedSet<String> negExamples, int maxNrOfResults) throws ComponentInitException,
+ LearningProblemUnsupportedException {
+
+ logger.info("Start Learning with");
+ logger.info("positive examples: \t" + posExamples.size());
+ logger.info("negative examples: \t" + negExamples.size());
+
+ // the component manager is the central object to create
+ // and configure components
+ ComponentManager cm = ComponentManager.getInstance();
+
+ // knowledge source
+ //KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
+
+ String fileURL = new File(owlFile).toURI().toString();
+ OWLFile ks = Configurator.getOWLFile(cm, fileURL);
+
+
+ // reasoner
+ ReasonerComponent r = cm.reasoner(FastInstanceChecker.class, ks);
+ ReasoningService rs = cm.reasoningService(r);
+
+
+ // learning problem
+ LearningProblem lp = cm.learningProblem(PosNegDefinitionLP.class, rs);
+ cm.applyConfigEntry(lp, "positiveExamples", posExamples);
+ cm.applyConfigEntry(lp, "negativeExamples", negExamples);
+
+ // learning algorithm
+ LearningAlgorithm la = cm.learningAlgorithm(ExampleBasedROLComponent.class, lp, rs);
+ cm.applyConfigEntry(la, "useAllConstructor", false);
+ cm.applyConfigEntry(la, "useExistsConstructor", true);
+ cm.applyConfigEntry(la, "useCardinalityRestrictions", false);
+ cm.applyConfigEntry(la, "useNegation", false);
+ cm.applyConfigEntry(la, "writeSearchTree", false);
+ cm.applyConfigEntry(la, "searchTreeFile", "log/searchTree.txt");
+ cm.applyConfigEntry(la, "replaceSearchTree", true);
+ cm.applyConfigEntry(la, "noisePercentage", 0.0);
+
+ // all components need to be initialised before they can be used
+ ks.init();
+ r.init();
+ lp.init();
+ la.init();
+
+ // start learning algorithm
+ logger.debug("start learning");
+ la.start();
+
+ return la.getCurrentlyBestEvaluatedDescriptions(maxNrOfResults);
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/scripts/Sample.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/Sample.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/scripts/Sample.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -33,13 +33,11 @@
import org.dllearner.core.ComponentInitException;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.EvaluatedDescription;
-import org.dllearner.core.KnowledgeSource;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.LearningProblem;
import org.dllearner.core.LearningProblemUnsupportedException;
import org.dllearner.core.ReasonerComponent;
import org.dllearner.core.ReasoningService;
-import org.dllearner.core.configuration.Configurator;
import org.dllearner.kb.OWLFile;
import org.dllearner.learningproblems.PosNegDefinitionLP;
import org.dllearner.reasoning.FastInstanceChecker;
@@ -121,9 +119,10 @@
//KnowledgeSource ks = cm.knowledgeSource(OWLFile.class);
String fileURL = new File(owlFile).toURI().toString();
- OWLFile ks = Configurator.getOWLFile(cm, fileURL);
- //cm.applyConfigEntry(ks, "url", fileURL);
-
+ OWLFile ks = cm.knowledgeSource(OWLFile.class);
+ cm.applyConfigEntry(ks, "url", fileURL);
+
+
// reasoner
ReasonerComponent r = cm.reasoner(FastInstanceChecker.class, ks);
ReasoningService rs = cm.reasoningService(r);
Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-09-03 19:29:41 UTC (rev 1169)
+++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-09-05 12:24:05 UTC (rev 1170)
@@ -156,5 +156,30 @@
Files.deleteFile(new File(dir+File.separator+files[i]));
}
}
+
+ public static void backupDirect...
[truncated message content] |
|
From: <ku...@us...> - 2008-09-05 14:53:23
|
Revision: 1171
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1171&view=rev
Author: kurzum
Date: 2008-09-05 14:53:16 +0000 (Fri, 05 Sep 2008)
Log Message:
-----------
finished java interface for some components
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java
trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java
trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java
trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java
trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java
trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java
trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/FastInstanceCheckerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/OWLFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/SparqlKnowledgeSourceConfigurator.java
trunk/src/dl-learner/org/dllearner/kb/KBFile.java
trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java
trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java
trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java
trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java
trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
trunk/src/dl-learner/org/dllearner/scripts/NewSample.java
trunk/src/dl-learner/org/dllearner/utilities/learn/LearnOWLFile.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/core/configuration/BruteForceLearnerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/DBpediaNavigationSuggestorConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/DIGReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/ExampleBasedROLComponentConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/FastRetrievalReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/GPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/KBFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/OWLAPIReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/PosNegDefinitionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/PosNegInclusionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/PosOnlyDefinitionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/ROLearnerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configuration/RandomGuesserConfigurator.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -36,16 +36,17 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
+import org.dllearner.core.config.ConfigOption.Tags;
+import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Intersection;
-import org.dllearner.core.owl.Union;
-import org.dllearner.core.owl.ObjectAllRestriction;
import org.dllearner.core.owl.NamedClass;
+import org.dllearner.core.owl.Negation;
import org.dllearner.core.owl.Nothing;
-import org.dllearner.core.owl.Description;
+import org.dllearner.core.owl.ObjectAllRestriction;
+import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectSomeRestriction;
-import org.dllearner.core.owl.Negation;
-import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.Thing;
+import org.dllearner.core.owl.Union;
/**
* A brute force learning algorithm.
@@ -64,6 +65,7 @@
private Description bestDefinition;
private Score bestScore;
+ //changing this wont have any effect any more
private Integer maxLength = 7;
private String returnType;
@@ -90,7 +92,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new IntegerConfigOption("maxLength", "maximum length of generated concepts"));
+ options.add(new IntegerConfigOption("maxLength", "maximum length of generated concepts", 7, Tags.NORMAL));
options.add(CommonConfigOptions.getReturnType());
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -36,6 +36,7 @@
import org.dllearner.core.config.DoubleConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
+import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Description;
import org.dllearner.learningproblems.PosNegDefinitionLP;
import org.dllearner.learningproblems.PosNegLP;
@@ -118,7 +119,8 @@
options.add(CommonConfigOptions.minExecutionTimeInSeconds());
options.add(CommonConfigOptions.guaranteeXgoodDescriptions());
options.add(CommonConfigOptions.getLogLevel());
- DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples");
+ //TODO make a commonconfig Option out of this
+ DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",0.0,Tags.NORMAL);
noisePercentage.setLowerLimit(0);
noisePercentage.setUpperLimit(100);
options.add(noisePercentage);
Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -23,8 +23,8 @@
import java.util.LinkedList;
import org.apache.log4j.Logger;
+import org.dllearner.algorithms.gp.GPUtilities;
import org.dllearner.algorithms.gp.Program;
-import org.dllearner.algorithms.gp.GPUtilities;
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.LearningProblem;
@@ -34,6 +34,7 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
+import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Description;
public class RandomGuesser extends LearningAlgorithm {
@@ -65,8 +66,8 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new IntegerConfigOption("numberOfTrees", "number of randomly generated concepts/trees"));
- options.add(new IntegerConfigOption("maxDepth", "maximum depth of generated concepts/trees"));
+ options.add(new IntegerConfigOption("numberOfTrees", "number of randomly generated concepts/trees", 5, Tags.NORMAL));
+ options.add(new IntegerConfigOption("maxDepth", "maximum depth of generated concepts/trees", 5, Tags.NORMAL));
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -44,16 +44,18 @@
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
+import org.dllearner.core.config.ConfigOption.Tags;
+import org.dllearner.core.configuration.ExampleBasedROLComponentConfigurator;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.NamedClass;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.learningproblems.PosNegLP;
import org.dllearner.learningproblems.PosOnlyDefinitionLP;
import org.dllearner.learningproblems.PosOnlyLP;
+import org.dllearner.reasoning.ReasonerType;
import org.dllearner.refinementoperators.RhoDRDown;
import org.dllearner.utilities.Files;
import org.dllearner.utilities.Helper;
-import org.dllearner.reasoning.ReasonerType;
/**
* The DL-Learner learning algorithm component for the example
@@ -91,6 +93,13 @@
private ReasoningService rs;
private LearningProblem learningProblem;
+ private ExampleBasedROLComponentConfigurator configurator;
+ public ExampleBasedROLComponentConfigurator getConfigurator(){
+ return configurator;
+ }
+
+
+
// configuration options
private boolean writeSearchTree;
private File searchTreeFile;
@@ -116,10 +125,15 @@
private boolean useNegation = CommonConfigOptions.useNegationDefault;
private boolean useBooleanDatatypes = CommonConfigOptions.useBooleanDatatypesDefault;
private boolean useDoubleDatatypes = CommonConfigOptions.useDoubleDatatypesDefault;
- private double noisePercentage = 0.0;
+ private static double noisePercentageDefault = 0.0;
+ private double noisePercentage = noisePercentageDefault;
private NamedClass startClass = null;
- private boolean usePropernessChecks = false;
- private int maxPosOnlyExpansion = 4;
+ //refactor this
+ private static boolean usePropernessChecksDefault = false;
+ private boolean usePropernessChecks = usePropernessChecksDefault;
+ // refactor this
+ private static int maxPosOnlyExpansionDefault = 4;
+ private int maxPosOnlyExpansion = maxPosOnlyExpansionDefault;
//extended Options
//in seconds
private int maxExecutionTimeInSeconds = CommonConfigOptions.maxExecutionTimeInSecondsDefault;
@@ -141,11 +155,13 @@
public ExampleBasedROLComponent(PosNegLP learningProblem, ReasoningService rs) {
this.learningProblem = learningProblem;
this.rs = rs;
+ this.configurator = new ExampleBasedROLComponentConfigurator(this);
}
public ExampleBasedROLComponent(PosOnlyDefinitionLP learningProblem, ReasoningService rs) {
this.learningProblem = learningProblem;
this.rs = rs;
+ this.configurator = new ExampleBasedROLComponentConfigurator(this);
}
public static Collection<Class<? extends LearningProblem>> supportedLearningProblems() {
@@ -188,10 +204,10 @@
options.add(CommonConfigOptions.minExecutionTimeInSeconds());
options.add(CommonConfigOptions.guaranteeXgoodDescriptions());
options.add(CommonConfigOptions.getLogLevel());
- options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)"));
+ options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)",usePropernessChecksDefault,Tags.NORMAL));
options.add(new IntegerConfigOption("maxPosOnlyExpansion", "specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is" +
- " considered as solution candidate"));
- DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples");
+ " considered as solution candidate",maxPosOnlyExpansionDefault,Tags.NORMAL));
+ DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",noisePercentageDefault,Tags.NORMAL);
noisePercentage.setLowerLimit(0);
noisePercentage.setUpperLimit(100);
options.add(noisePercentage);
Modified: trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -19,7 +19,9 @@
*/
package org.dllearner.core.config;
+import org.dllearner.core.config.ConfigOption.Tags;
+
/**
* Contains methods for creating common configuration options, i.e. options
* which are or may be of use for several components.
@@ -57,7 +59,7 @@
}
public static DoubleConfigOption getPercentPerLenghtUnitOption(double defaultValue) {
- DoubleConfigOption option = new DoubleConfigOption("percentPerLenghtUnit", "describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one", defaultValue);
+ DoubleConfigOption option = new DoubleConfigOption("percentPerLenghtUnit", "describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one", defaultValue, Tags.NORMAL);
option.setLowerLimit(0.0);
option.setUpperLimit(1.0);
return option;
@@ -112,7 +114,7 @@
}
public static BooleanConfigOption useDoubleDatatypes() {
- return new BooleanConfigOption("useBooleanDatatypes", "specifies whether boolean datatypes are used in the learning algorothm",useDoubleDatatypesDefault);
+ return new BooleanConfigOption("useDoubleDatatypes", "specifies whether boolean datatypes are used in the learning algorothm",useDoubleDatatypesDefault);
}
public static IntegerConfigOption maxExecutionTimeInSeconds() {
Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -152,6 +152,14 @@
return "option name: " + name + "\ndescription: " + description + "\nvalues: "
+ getAllowedValuesDescription() + "\ndefault value: " + defaultValue + "\n";
}
+
+ public String getJavaDocString() {
+ String line = "* option name: " + name + "\n";
+ line += "* " + description + "\n";
+ //line += "* allowed values: "+ getAllowedValuesDescription() + "\n";
+ line += "* default value: " + defaultValue + "\n";
+ return line;
+ }
/**
* Get a formatted value to put into configuration file.
Modified: trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -19,7 +19,6 @@
*/
package org.dllearner.core.config;
-import org.dllearner.core.config.ConfigOption.Tags;
/**
* Represents a configuration option with values of type value. Similar to the
Modified: trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -19,7 +19,6 @@
*/
package org.dllearner.core.config;
-import org.dllearner.core.config.ConfigOption.Tags;
/**
* A configuration option, which allows values of type integer. A minimum and
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -23,8 +23,6 @@
import java.util.Set;
import java.util.TreeSet;
-import org.dllearner.core.config.ConfigOption.Tags;
-
/**
* A configuration option, which allows values of type String. Optionally a set
* of allowed strings can be set. By default all strings are allowed.
Added: trunk/src/dl-learner/org/dllearner/core/configuration/BruteForceLearnerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/BruteForceLearnerConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/BruteForceLearnerConfigurator.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -0,0 +1,102 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import org.dllearner.algorithms.BruteForceLearner;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+
+/**
+* automatically generated, do not edit manually
+**/
+@SuppressWarnings("unused")
+public class BruteForceLearnerConfigurator extends Configurator {
+
+private boolean reinitNecessary = false;
+private BruteForceLearner BruteForceLearner;
+private int maxLength = 7;
+private String returnType = null;
+
+public BruteForceLearnerConfigurator (BruteForceLearner BruteForceLearner){
+this.BruteForceLearner = BruteForceLearner;
+}
+
+/**
+**/
+public static BruteForceLearner getBruteForceLearner (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
+BruteForceLearner component = cm.learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService );
+return component;
+}
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if(false){//empty block
+}else if (optionName.equals("maxLength")){
+maxLength = (Integer) entry.getValue();
+}else if (optionName.equals("returnType")){
+returnType = (String) entry.getValue();
+}
+}
+
+/**
+* option name: maxLength
+* maximum length of generated concepts
+* default value: 7
+**/
+public int getMaxLength ( ) {
+return this.maxLength;
+}
+/**
+* option name: returnType
+* Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.
+* default value: null
+**/
+public String getReturnType ( ) {
+return this.returnType;
+}
+
+/**
+* option name: maxLength
+* maximum length of generated concepts
+* default value: 7
+**/
+public void setMaxLength ( ComponentManager cm, int maxLength) {
+cm.applyConfigEntry(BruteForceLearner, "maxLength", maxLength);
+}
+/**
+* option name: returnType
+* Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.
+* default value: null
+**/
+public void setReturnType ( ComponentManager cm, String returnType) {
+cm.applyConfigEntry(BruteForceLearner, "returnType", returnType);
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Modified: trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java 2008-09-05 12:24:05 UTC (rev 1170)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/Configurator.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -18,44 +18,156 @@
**/
package org.dllearner.core.configuration;
+
import java.util.Set;
+import org.dllearner.algorithms.BruteForceLearner;
+import org.dllearner.algorithms.DBpediaNavigationSuggestor;
+import org.dllearner.algorithms.RandomGuesser;
+import org.dllearner.algorithms.gp.GP;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.algorithms.refinement.ROLearner;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.LearningProblem;
-import org.dllearner.core.ReasonerComponent;
+import org.dllearner.core.LearningProblemUnsupportedException;
import org.dllearner.core.ReasoningService;
+import org.dllearner.core.configuration.BruteForceLearnerConfigurator;
+import org.dllearner.core.configuration.DBpediaNavigationSuggestorConfigurator;
+import org.dllearner.core.configuration.DIGReasonerConfigurator;
+import org.dllearner.core.configuration.ExampleBasedROLComponentConfigurator;
import org.dllearner.core.configuration.FastInstanceCheckerConfigurator;
+import org.dllearner.core.configuration.FastRetrievalReasonerConfigurator;
+import org.dllearner.core.configuration.GPConfigurator;
+import org.dllearner.core.configuration.KBFileConfigurator;
+import org.dllearner.core.configuration.OWLAPIReasonerConfigurator;
import org.dllearner.core.configuration.OWLFileConfigurator;
+import org.dllearner.core.configuration.PosNegDefinitionLPConfigurator;
+import org.dllearner.core.configuration.PosNegInclusionLPConfigurator;
+import org.dllearner.core.configuration.PosOnlyDefinitionLPConfigurator;
+import org.dllearner.core.configuration.ROLearnerConfigurator;
+import org.dllearner.core.configuration.RandomGuesserConfigurator;
import org.dllearner.core.configuration.SparqlKnowledgeSourceConfigurator;
+import org.dllearner.kb.KBFile;
import org.dllearner.kb.OWLFile;
import org.dllearner.kb.sparql.SparqlKnowledgeSource;
+import org.dllearner.learningproblems.PosNegDefinitionLP;
+import org.dllearner.learningproblems.PosNegInclusionLP;
+import org.dllearner.learningproblems.PosOnlyDefinitionLP;
+import org.dllearner.reasoning.DIGReasoner;
import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.reasoning.FastRetrievalReasoner;
+import org.dllearner.reasoning.OWLAPIReasoner;
/**
* automatically generated, do not edit manually
**/
+@SuppressWarnings("unused")
public class Configurator {
/**
-* url: URL pointing to the OWL file
+* @param filename pointer to the KB file on local file system
**/
-public static OWLFile getOWLFile (ComponentManager cm, String url ) {
+public static KBFile getKBFile (ComponentManager cm, String filename ) {
+return KBFileConfigurator.getKBFile(cm, filename);
+}
+
+/**
+* @param url URL pointing to the OWL file
+**/
+public static OWLFile getOWLFile (ComponentManager cm, String url ) {
return OWLFileConfigurator.getOWLFile(cm, url);
}
/**
-* instances: relevant instances e.g. positive and negative examples in a learning problem
+* @param instances relevant instances e.g. positive and negative examples in a learning problem
**/
-public static SparqlKnowledgeSource getSparqlKnowledgeSource (ComponentManager cm, Set<String> instances ) {
+public static SparqlKnowledgeSource getSparqlKnowledgeSource (ComponentManager cm, Set<String> instances ) {
return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(cm, instances);
}
/**
**/
-public static FastInstanceChecker getFastInstanceChecker (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+public static DIGReasoner getDIGReasoner (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+return DIGReasonerConfigurator.getDIGReasoner(cm, knowledgeSource);
+}
+
+/**
+**/
+public static FastInstanceChecker getFastInstanceChecker (ComponentManager cm, KnowledgeSource knowledgeSource ) {
return FastInstanceCheckerConfigurator.getFastInstanceChecker(cm, knowledgeSource);
}
+/**
+**/
+public static FastRetrievalReasoner getFastRetrievalReasoner (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(cm, knowledgeSource);
+}
+/**
+**/
+public static OWLAPIReasoner getOWLAPIReasoner (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+return OWLAPIReasonerConfigurator.getOWLAPIReasoner(cm, knowledgeSource);
}
+
+/**
+* @param positiveExamples positive examples
+* @param negativeExamples negative examples
+**/
+public static PosNegDefinitionLP getPosNegDefinitionLP (ComponentManager cm, ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) {
+return PosNegDefinitionLPConfigurator.getPosNegDefinitionLP(cm, reasoningService, positiveExamples, negativeExamples);
+}
+
+/**
+* @param positiveExamples positive examples
+* @param negativeExamples negative examples
+**/
+public static PosNegInclusionLP getPosNegInclusionLP (ComponentManager cm, ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) {
+return PosNegInclusionLPConfigurator.getPosNegInclusionLP(cm, reasoningService, positiveExamples, negativeExamples);
+}
+
+/**
+* @param positiveExamples positive examples
+**/
+public static PosOnlyDefinitionLP getPosOnlyDefinitionLP (ComponentManager cm, ReasoningService reasoningService, Set<String> positiveExamples ) {
+return PosOnlyDefinitionLPConfigurator.getPosOnlyDefinitionLP(cm, reasoningService, positiveExamples);
+}
+
+/**
+**/
+public static BruteForceLearner getBruteForceLearner (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return BruteForceLearnerConfigurator.getBruteForceLearner(cm, learningProblem, reasoningService);
+}
+
+/**
+**/
+public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return DBpediaNavigationSuggestorConfigurator.getDBpediaNavigationSuggestor(cm, learningProblem, reasoningService);
+}
+
+/**
+**/
+public static RandomGuesser getRandomGuesser (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return RandomGuesserConfigurator.getRandomGuesser(cm, learningProblem, reasoningService);
+}
+
+/**
+**/
+public static GP getGP (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return GPConfigurator.getGP(cm, learningProblem, reasoningService);
+}
+
+/**
+**/
+public static ExampleBasedROLComponent getExampleBasedROLComponent (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return ExampleBasedROLComponentConfigurator.getExampleBasedROLComponent(cm, learningProblem, reasoningService);
+}
+
+/**
+**/
+public static ROLearner getROLearner (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return ROLearnerConfigurator.getROLearner(cm, learningProblem, reasoningService);
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configuration/DBpediaNavigationSuggestorConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/DBpediaNavigationSuggestorConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/DBpediaNavigationSuggestorConfigurator.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -0,0 +1,559 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import java.util.Set;
+import org.dllearner.algorithms.DBpediaNavigationSuggestor;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+
+/**
+* automatically generated, do not edit manually
+**/
+@SuppressWarnings("unused")
+public class DBpediaNavigationSuggestorConfigurator extends Configurator {
+
+private boolean reinitNecessary = false;
+private DBpediaNavigationSuggestor DBpediaNavigationSuggestor;
+private boolean writeSearchTree = false;
+private String searchTreeFile = "log/searchTree.txt";
+private boolean replaceSearchTree = false;
+private String heuristic = "lexicographic";
+private boolean applyAllFilter = true;
+private boolean applyExistsFilter = true;
+private boolean useTooWeakList = true;
+private boolean useOverlyGeneralList = true;
+private boolean useShortConceptConstruction = true;
+private double horizontalExpansionFactor = 0.6;
+private boolean improveSubsumptionHierarchy = true;
+private Set<String> allowedConcepts = null;
+private Set<String> ignoredConcepts = null;
+private Set<String> allowedRoles = null;
+private Set<String> ignoredRoles = null;
+private boolean useAllConstructor = true;
+private boolean useExistsConstructor = true;
+private boolean useCardinalityRestrictions = true;
+private boolean useNegation = true;
+private boolean useBooleanDatatypes = true;
+private int maxExecutionTimeInSeconds = 0;
+private int minExecutionTimeInSeconds = 0;
+private int guaranteeXgoodDescriptions = 1;
+private String logLevel = "DEBUG";
+private double noisePercentage = 0.0;
+private String startClass = null;
+
+public DBpediaNavigationSuggestorConfigurator (DBpediaNavigationSuggestor DBpediaNavigationSuggestor){
+this.DBpediaNavigationSuggestor = DBpediaNavigationSuggestor;
+}
+
+/**
+**/
+public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
+DBpediaNavigationSuggestor component = cm.learningAlgorithm(DBpediaNavigationSuggestor.class, learningProblem, reasoningService );
+return component;
+}
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if(false){//empty block
+}else if (optionName.equals("writeSearchTree")){
+writeSearchTree = (Boolean) entry.getValue();
+}else if (optionName.equals("searchTreeFile")){
+searchTreeFile = (String) entry.getValue();
+}else if (optionName.equals("replaceSearchTree")){
+replaceSearchTree = (Boolean) entry.getValue();
+}else if (optionName.equals("heuristic")){
+heuristic = (String) entry.getValue();
+}else if (optionName.equals("applyAllFilter")){
+applyAllFilter = (Boolean) entry.getValue();
+}else if (optionName.equals("applyExistsFilter")){
+applyExistsFilter = (Boolean) entry.getValue();
+}else if (optionName.equals("useTooWeakList")){
+useTooWeakList = (Boolean) entry.getValue();
+}else if (optionName.equals("useOverlyGeneralList")){
+useOverlyGeneralList = (Boolean) entry.getValue();
+}else if (optionName.equals("useShortConceptConstruction")){
+useShortConceptConstruction = (Boolean) entry.getValue();
+}else if (optionName.equals("horizontalExpansionFactor")){
+horizontalExpansionFactor = (Double) entry.getValue();
+}else if (optionName.equals("improveSubsumptionHierarchy")){
+improveSubsumptionHierarchy = (Boolean) entry.getValue();
+}else if (optionName.equals("allowedConcepts")){
+allowedConcepts = (Set<String>) entry.getValue();
+}else if (optionName.equals("ignoredConcepts")){
+ignoredConcepts = (Set<String>) entry.getValue();
+}else if (optionName.equals("allowedRoles")){
+allowedRoles = (Set<String>) entry.getValue();
+}else if (optionName.equals("ignoredRoles")){
+ignoredRoles = (Set<String>) entry.getValue();
+}else if (optionName.equals("useAllConstructor")){
+useAllConstructor = (Boolean) entry.getValue();
+}else if (optionName.equals("useExistsConstructor")){
+useExistsConstructor = (Boolean) entry.getValue();
+}else if (optionName.equals("useCardinalityRestrictions")){
+useCardinalityRestrictions = (Boolean) entry.getValue();
+}else if (optionName.equals("useNegation")){
+useNegation = (Boolean) entry.getValue();
+}else if (optionName.equals("useBooleanDatatypes")){
+useBooleanDatatypes = (Boolean) entry.getValue();
+}else if (optionName.equals("maxExecutionTimeInSeconds")){
+maxExecutionTimeInSeconds = (Integer) entry.getValue();
+}else if (optionName.equals("minExecutionTimeInSeconds")){
+minExecutionTimeInSeconds = (Integer) entry.getValue();
+}else if (optionName.equals("guaranteeXgoodDescriptions")){
+guaranteeXgoodDescriptions = (Integer) entry.getValue();
+}else if (optionName.equals("logLevel")){
+logLevel = (String) entry.getValue();
+}else if (optionName.equals("noisePercentage")){
+noisePercentage = (Double) entry.getValue();
+}else if (optionName.equals("startClass")){
+startClass = (String) entry.getValue();
+}
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public boolean getWriteSearchTree ( ) {
+return this.writeSearchTree;
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public String getSearchTreeFile ( ) {
+return this.searchTreeFile;
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public boolean getReplaceSearchTree ( ) {
+return this.replaceSearchTree;
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public String getHeuristic ( ) {
+return this.heuristic;
+}
+/**
+* option name: applyAllFilter
+* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* default value: true
+**/
+public boolean getApplyAllFilter ( ) {
+return this.applyAllFilter;
+}
+/**
+* option name: applyExistsFilter
+* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* default value: true
+**/
+public boolean getApplyExistsFilter ( ) {
+return this.applyExistsFilter;
+}
+/**
+* option name: useTooWeakList
+* try to filter out too weak concepts without sending them to the reasoner
+* default value: true
+**/
+public boolean getUseTooWeakList ( ) {
+return this.useTooWeakList;
+}
+/**
+* option name: useOverlyGeneralList
+* try to find overly general concept without sending them to the reasoner
+* default value: true
+**/
+public boolean getUseOverlyGeneralList ( ) {
+return this.useOverlyGeneralList;
+}
+/**
+* option name: useShortConceptConstruction
+* shorten concept to see whether they already exist
+* default value: true
+**/
+public boolean getUseShortConceptConstruction ( ) {
+return this.useShortConceptConstruction;
+}
+/**
+* option name: horizontalExpansionFactor
+* horizontal expansion factor (see publication for description)
+* default value: 0.6
+**/
+public double getHorizontalExpansionFactor ( ) {
+return this.horizontalExpansionFactor;
+}
+/**
+* option name: improveSubsumptionHierarchy
+* simplify subsumption hierarchy to reduce search space (see publication for description)
+* default value: true
+**/
+public boolean getImproveSubsumptionHierarchy ( ) {
+return this.improveSubsumptionHierarchy;
+}
+/**
+* option name: allowedConcepts
+* concepts the algorithm is allowed to use
+* default value: null
+**/
+public Set<String> getAllowedConcepts ( ) {
+return this.allowedConcepts;
+}
+/**
+* option name: ignoredConcepts
+* concepts the algorithm must ignore
+* default value: null
+**/
+public Set<String> getIgnoredConcepts ( ) {
+return this.ignoredConcepts;
+}
+/**
+* option name: allowedRoles
+* roles the algorithm is allowed to use
+* default value: null
+**/
+public Set<String> getAllowedRoles ( ) {
+return this.allowedRoles;
+}
+/**
+* option name: ignoredRoles
+* roles the algorithm must ignore
+* default value: null
+**/
+public Set<String> getIgnoredRoles ( ) {
+return this.ignoredRoles;
+}
+/**
+* option name: useAllConstructor
+* specifies whether the universal concept constructor is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseAllConstructor ( ) {
+return this.useAllConstructor;
+}
+/**
+* option name: useExistsConstructor
+* specifies whether the existential concept constructor is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseExistsConstructor ( ) {
+return this.useExistsConstructor;
+}
+/**
+* option name: useCardinalityRestrictions
+* specifies whether CardinalityRestrictions is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseCardinalityRestrictions ( ) {
+return this.useCardinalityRestrictions;
+}
+/**
+* option name: useNegation
+* specifies whether negation is used in the learning algorothm
+* default value: true
+**/
+public boolean getUseNegation ( ) {
+return this.useNegation;
+}
+/**
+* option name: useBooleanDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public boolean getUseBooleanDatatypes ( ) {
+return this.useBooleanDatatypes;
+}
+/**
+* option name: maxExecutionTimeInSeconds
+* algorithm will stop after specified seconds
+* default value: 0
+**/
+public int getMaxExecutionTimeInSeconds ( ) {
+return this.maxExecutionTimeInSeconds;
+}
+/**
+* option name: minExecutionTimeInSeconds
+* algorithm will run at least specified seconds
+* default value: 0
+**/
+public int getMinExecutionTimeInSeconds ( ) {
+return this.minExecutionTimeInSeconds;
+}
+/**
+* option name: guaranteeXgoodDescriptions
+* algorithm will run until X good (100%) concept descritpions are found
+* default value: 1
+**/
+public int getGuaranteeXgoodDescriptions ( ) {
+return this.guaranteeXgoodDescriptions;
+}
+/**
+* option name: logLevel
+* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* default value: DEBUG
+**/
+public String getLogLevel ( ) {
+return this.logLevel;
+}
+/**
+* option name: noisePercentage
+* the (approximated) percentage of noise within the examples
+* default value: 0.0
+**/
+public double getNoisePercentage ( ) {
+return this.noisePercentage;
+}
+/**
+* option name: startClass
+* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* default value: null
+**/
+public String getStartClass ( ) {
+return this.startClass;
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public void setWriteSearchTree ( ComponentManager cm, boolean writeSearchTree) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "writeSearchTree", writeSearchTree);
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public void setSearchTreeFile ( ComponentManager cm, String searchTreeFile) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "searchTreeFile", searchTreeFile);
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public void setReplaceSearchTree ( ComponentManager cm, boolean replaceSearchTree) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "replaceSearchTree", replaceSearchTree);
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public void setHeuristic ( ComponentManager cm, String heuristic) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "heuristic", heuristic);
+}
+/**
+* option name: applyAllFilter
+* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* default value: true
+**/
+public void setApplyAllFilter ( ComponentManager cm, boolean applyAllFilter) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "applyAllFilter", applyAllFilter);
+}
+/**
+* option name: applyExistsFilter
+* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* default value: true
+**/
+public void setApplyExistsFilter ( ComponentManager cm, boolean applyExistsFilter) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "applyExistsFilter", applyExistsFilter);
+}
+/**
+* option name: useTooWeakList
+* try to filter out too weak concepts without sending them to the reasoner
+* default value: true
+**/
+public void setUseTooWeakList ( ComponentManager cm, boolean useTooWeakList) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useTooWeakList", useTooWeakList);
+}
+/**
+* option name: useOverlyGeneralList
+* try to find overly general concept without sending them to the reasoner
+* default value: true
+**/
+public void setUseOverlyGeneralList ( ComponentManager cm, boolean useOverlyGeneralList) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useOverlyGeneralList", useOverlyGeneralList);
+}
+/**
+* option name: useShortConceptConstruction
+* shorten concept to see whether they already exist
+* default value: true
+**/
+public void setUseShortConceptConstruction ( ComponentManager cm, boolean useShortConceptConstruction) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useShortConceptConstruction", useShortConceptConstruction);
+}
+/**
+* option name: horizontalExpansionFactor
+* horizontal expansion factor (see publication for description)
+* default value: 0.6
+**/
+public void setHorizontalExpansionFactor ( ComponentManager cm, double horizontalExpansionFactor) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "horizontalExpansionFactor", horizontalExpansionFactor);
+}
+/**
+* option name: improveSubsumptionHierarchy
+* simplify subsumption hierarchy to reduce search space (see publication for description)
+* default value: true
+**/
+public void setImproveSubsumptionHierarchy ( ComponentManager cm, boolean improveSubsumptionHierarchy) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy", improveSubsumptionHierarchy);
+}
+/**
+* option name: allowedConcepts
+* concepts the algorithm is allowed to use
+* default value: null
+**/
+public void setAllowedConcepts ( ComponentManager cm, Set<String> allowedConcepts) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "allowedConcepts", allowedConcepts);
+}
+/**
+* option name: ignoredConcepts
+* concepts the algorithm must ignore
+* default value: null
+**/
+public void setIgnoredConcepts ( ComponentManager cm, Set<String> ignoredConcepts) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "ignoredConcepts", ignoredConcepts);
+}
+/**
+* option name: allowedRoles
+* roles the algorithm is allowed to use
+* default value: null
+**/
+public void setAllowedRoles ( ComponentManager cm, Set<String> allowedRoles) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "allowedRoles", allowedRoles);
+}
+/**
+* option name: ignoredRoles
+* roles the algorithm must ignore
+* default value: null
+**/
+public void setIgnoredRoles ( ComponentManager cm, Set<String> ignoredRoles) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "ignoredRoles", ignoredRoles);
+}
+/**
+* option name: useAllConstructor
+* specifies whether the universal concept constructor is used in the learning algorithm
+* default value: true
+**/
+public void setUseAllConstructor ( ComponentManager cm, boolean useAllConstructor) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useAllConstructor", useAllConstructor);
+}
+/**
+* option name: useExistsConstructor
+* specifies whether the existential concept constructor is used in the learning algorithm
+* default value: true
+**/
+public void setUseExistsConstructor ( ComponentManager cm, boolean useExistsConstructor) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useExistsConstructor", useExistsConstructor);
+}
+/**
+* option name: useCardinalityRestrictions
+* specifies whether CardinalityRestrictions is used in the learning algorithm
+* default value: true
+**/
+public void setUseCardinalityRestrictions ( ComponentManager cm, boolean useCardinalityRestrictions) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useCardinalityRestrictions", useCardinalityRestrictions);
+}
+/**
+* option name: useNegation
+* specifies whether negation is used in the learning algorothm
+* default value: true
+**/
+public void setUseNegation ( ComponentManager cm, boolean useNegation) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useNegation", useNegation);
+}
+/**
+* option name: useBooleanDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public void setUseBooleanDatatypes ( ComponentManager cm, boolean useBooleanDatatypes) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "useBooleanDatatypes", useBooleanDatatypes);
+}
+/**
+* option name: maxExecutionTimeInSeconds
+* algorithm will stop after specified seconds
+* default value: 0
+**/
+public void setMaxExecutionTimeInSeconds ( ComponentManager cm, int maxExecutionTimeInSeconds) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds);
+}
+/**
+* option name: minExecutionTimeInSeconds
+* algorithm will run at least specified seconds
+* default value: 0
+**/
+public void setMinExecutionTimeInSeconds ( ComponentManager cm, int minExecutionTimeInSeconds) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
+}
+/**
+* option name: guaranteeXgoodDescriptions
+* algorithm will run until X good (100%) concept descritpions are found
+* default value: 1
+**/
+public void setGuaranteeXgoodDescriptions ( ComponentManager cm, int guaranteeXgoodDescriptions) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions);
+}
+/**
+* option name: logLevel
+* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* default value: DEBUG
+**/
+public void setLogLevel ( ComponentManager cm, String logLevel) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "logLevel", logLevel);
+}
+/**
+* option name: noisePercentage
+* the (approximated) percentage of noise within the examples
+* default value: 0.0
+**/
+public void setNoisePercentage ( ComponentManager cm, double noisePercentage) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "noisePercentage", noisePercentage);
+}
+/**
+* option name: startClass
+* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* default value: null
+**/
+public void setStartClass ( ComponentManager cm, String startClass) {
+cm.applyConfigEntry(DBpediaNavigationSuggestor, "startClass", startClass);
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configuration/DIGReasonerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/DIGReasonerConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/DIGReasonerConfigurator.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -0,0 +1,119 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+import org.dllearner.reasoning.DIGReasoner;
+
+/**
+* automatically generated, do not edit manually
+**/
+@SuppressWarnings("unused")
+public class DIGReasonerConfigurator extends Configurator {
+
+private boolean reinitNecessary = false;
+private DIGReasoner DIGReasoner;
+private String reasonerUrl = null;
+private boolean writeDIGProtocol = false;
+private String digProtocolFile = "log/digProtocol.txt";
+
+public DIGReasonerConfigurator (DIGReasoner DIGReasoner){
+this.DIGReasoner = DIGReasoner;
+}
+
+/**
+**/
+public static DIGReasoner getDIGReasoner (ComponentManager cm, KnowledgeSource knowledgeSource ) {
+DIGReasoner component = cm.reasoner(DIGReasoner.class, knowledgeSource );
+return component;
+}
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if(false){//empty block
+}else if (optionName.equals("reasonerUrl")){
+reasonerUrl = (String) entry.getValue();
+}else if (optionName.equals("writeDIGProtocol")){
+writeDIGProtocol = (Boolean) entry.getValue();
+}else if (optionName.equals("digProtocolFile")){
+digProtocolFile = (String) entry.getValue();
+}
+}
+
+/**
+* option name: reasonerUrl
+* URL of the DIG reasoner
+* default value: null
+**/
+public String getReasonerUrl ( ) {
+return this.reasonerUrl;
+}
+/**
+* option name: writeDIGProtocol
+* specifies whether or not to write a protocoll of send and received DIG requests
+* default value: false
+**/
+public boolean getWriteDIGProtocol ( ) {
+return this.writeDIGProtocol;
+}
+/**
+* option name: digProtocolFile
+* the file to store the DIG protocol
+* default value: log/digProtocol.txt
+**/
+public String getDigProtocolFile ( ) {
+return this.digProtocolFile;
+}
+
+/**
+* option name: reasonerUrl
+* URL of the DIG reasoner
+* default value: null
+**/
+public void setReasonerUrl ( ComponentManager cm, String reasonerUrl) {
+cm.applyConfigEntry(DIGReasoner, "reasonerUrl", reasonerUrl);
+}
+/**
+* option name: writeDIGProtocol
+* specifies whether or not to write a protocoll of send and received DIG requests
+* default value: false
+**/
+public void setWriteDIGProtocol ( ComponentManager cm, boolean writeDIGProtocol) {
+cm.applyConfigEntry(DIGReasoner, "writeDIGProtocol", writeDIGProtocol);
+}
+/**
+* option name: digProtocolFile
+* the file to store the DIG protocol
+* default value: log/digProtocol.txt
+**/
+public void setDigProtocolFile ( ComponentManager cm, String digProtocolFile) {
+cm.applyConfigEntry(DIGReasoner, "digProtocolFile", digProtocolFile);
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configuration/ExampleBasedROLComponentConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configuration/ExampleBasedROLComponentConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configuration/ExampleBasedROLComponentConfigurator.java 2008-09-05 14:53:16 UTC (rev 1171)
@@ -0,0 +1,616 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configuration;
+
+import java.util.Set;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.config.ConfigEntry;
+import org.dllearner.core.configuration.Configurator;
+
+/**
+* automatically generated, do not edit manually
+**/
+@SuppressWarnings("unused")
+public class ExampleBasedROLComponentConfigurator extends Configurator {
+
+private boolean reinitNecessary = false;
+private ExampleBasedROLComponent ExampleBasedROLComponent;
+private boolean writeSearchTree = false;
+private String searchTreeFile = "log/searchTree.txt";
+private boolean replaceSearchTree = false;
+private String heuristic = "lexicographic";
+private boolean applyAllFilter = true;
+private boolean applyExistsFilter = true;
+private boolean useTooWeakList = true;
+private boolean useOverlyGeneralList = true;
+private boolean useShortConceptConstruction = true;
+private double horizontalExpansionFactor = 0.6;
+private boolean improveSubsumptionHierarchy = true;
+private Set<String> allowedConcepts = null;
+private Set<String> ignoredConcepts = null;
+private Set<String> allowedRoles = null;
+private Set<String> ignoredRoles = null;
+private boolean useAllConstructor = true;
+private boolean useExistsConstructor = true;
+private boolean useCardinalityRestrictions = true;
+private boolean useNegation = true;
+private boolean useBooleanDatatypes = true;
+private boolean useDoubleDatatypes = true;
+private int maxExecutionTimeInSeconds = 0;
+private int minExecutionTimeInSeconds = 0;
+private int guaranteeXgoodDescriptions = 1;
+private String logLevel = "DEBUG";
+private boolean usePropernessChecks = false;
+private int maxPosOnlyExpansion = 4;
+private double noisePercentage = 0.0;
+private String startClass = null;
+
+public ExampleBasedROLComponentConfigurator (ExampleBasedROLComponent ExampleBasedROLComponent){
+this.ExampleBasedROLComponent = ExampleBasedROLComponent;
+}
+
+/**
+**/
+public static ExampleBasedROLComponent getExampleBasedROLComponent (ComponentManager cm, LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
+ExampleBasedROLComponent component = cm.learningAlgorithm(ExampleBasedROLComponent.class, learningProblem, reasoningService );
+return component;
+}
+
+@SuppressWarnings({ "unchecked" })
+public <T> void applyConfigEntry(ConfigEntry<T> entry){
+String optionName = entry.getOptionName();
+if(false){//empty block
+}else if (optionName.equals("writeSearchTree")){
+writeSearchTree = (Boolean) entry.getValue();
+}else if (optionName.equals("searchTreeFile")){
+searchTreeFile = (String) entry.getValue();
+}else if (optionName.equals("replaceSearchTree")){
+replaceSearchTree = (Boolean) entry.getValue();
+}else if (optionName.equals("heuristic")){
+heuristic = (String) entry.getValue();
+}else if (optionName.equals("applyAllFilter")){
+applyAllFilter = (Boolean) entry.getValue();
+}else if (optionName.equals("applyExistsFilter")){
+applyExistsFilter = (Boolean) entry.getValue();
+}else if (optionName.equals("useTooWeakList")){
+useTooWeakList = (Boolean) entry.getValue();
+}else if (optionName.equals("useOverlyGeneralList")){
+useOverlyGeneralList = (Boolean) entry.getValue();
+}else if (optionName.equals("useShortConceptConstruction")){
+useShortConceptConstruction = (Boolean) entry.getValue();
+}else if (optionName.equals("horizontalExpansionFactor")){
+horizontalExpansionFactor = (Double) entry.getValue();
+}else if (optionName.equals("improveSubsumptionHierarchy")){
+improveSubsumptionHierarchy = (Boolean) entry.getValue();
+}else if (optionName.equals("allowedConcepts")){
+allowedConcepts = (Set<String>) entry.getValue();
+}else if (optionName.equals("ignoredConcepts")){
+ignoredConcepts = (Set<String>) entry.getValue();
+}else if (optionName.equals("allowedRoles")){
+allowedRoles = (Set<String>) entry.getValue();
+}else if (optionName.equals("ignoredRoles")){
+ignoredRoles = (Set<String>) entry.getValue();
+}else if (optionName.equals("useAllConstructor")){
+useAllConstructor = (Boolean) entry.getValue();
+}else if (optionName.equals("useExistsConstructor")){
+useExistsConstructor = (Boolean) entry.getValue();
+}else if (optionName.equals("useCardinalityRestrictions")){
+useCardinalityRestrictions = (Boolean) entry.getValue();
+}else if (optionName.equals("useNegation")){
+useNegation = (Boolean) entry.getValue();
+}else if (optionName.equals("useBooleanDatatypes")){
+useBooleanDatatypes = (Boolean) entry.getValue();
+}else if (optionName.equals("useDoubleDatatypes")){
+useDoubleDatatypes = (Boolean) entry.getValue();
+}else if (optionName.equals("maxExecutionTimeInSeconds")){
+maxExecutionTimeInSeconds = (Integer) entry.getValue();
+}else if (optionName.equals("minExecutionTimeInSeconds")){
+minExecutionTimeInSeconds = (Integer) entry.getValue();
+}else if (optionName.equals("guaranteeXgoodDescriptions")){
+guaranteeXgoodDescriptions = (Integer) entry.getValue();
+}else if (optionName.equals("logLevel")){
+logLevel = (String) entry.getValue();
+}else if (optionName.equals("usePropernessChecks")){
+usePropernessChecks = (Boolean) entry.getValue();
+}else if (optionName.equals("maxPosOnlyExpansion")){
+maxPosOnlyExpansion = (Integer) entry.getValue();
+}else if (optionName.equals("noisePercentage")){
+noisePercentage = (Double) entry.getValue();
+}else if (optionName.equals("startClass")){
+startClass = (String) entry.getValue();
+}
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public boolean getWriteSearchTree ( ) {
+return this.writeSearchTree;
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public String getSearchTreeFile ( ) {
+return this.searchTreeFile;
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public boolean getReplaceSearchTree ( ) {
+return this.replaceSearchTree;
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public String getHeuristic ( ) {
+return this.heuristic;
+}
+/**
+* option name: applyAllFi...
[truncated message content] |
|
From: <jen...@us...> - 2008-09-08 09:24:46
|
Revision: 1172
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1172&view=rev
Author: jenslehmann
Date: 2008-09-08 09:24:41 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
Some changes and documentation for component config options.
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java
trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java
trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java
trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java
trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java
trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java
trunk/src/dl-learner/org/dllearner/kb/KBFile.java
trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java
trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java
trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -36,7 +36,6 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Intersection;
import org.dllearner.core.owl.NamedClass;
@@ -92,7 +91,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new IntegerConfigOption("maxLength", "maximum length of generated concepts", 7, Tags.NORMAL));
+ options.add(new IntegerConfigOption("maxLength", "maximum length of generated concepts", 7));
options.add(CommonConfigOptions.getReturnType());
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -36,7 +36,6 @@
import org.dllearner.core.config.DoubleConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Description;
import org.dllearner.learningproblems.PosNegDefinitionLP;
import org.dllearner.learningproblems.PosNegLP;
@@ -120,7 +119,7 @@
options.add(CommonConfigOptions.guaranteeXgoodDescriptions());
options.add(CommonConfigOptions.getLogLevel());
//TODO make a commonconfig Option out of this
- DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",0.0,Tags.NORMAL);
+ DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",0.0);
noisePercentage.setLowerLimit(0);
noisePercentage.setUpperLimit(100);
options.add(noisePercentage);
Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -34,7 +34,6 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Description;
public class RandomGuesser extends LearningAlgorithm {
@@ -66,8 +65,8 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new IntegerConfigOption("numberOfTrees", "number of randomly generated concepts/trees", 5, Tags.NORMAL));
- options.add(new IntegerConfigOption("maxDepth", "maximum depth of generated concepts/trees", 5, Tags.NORMAL));
+ options.add(new IntegerConfigOption("numberOfTrees", "number of randomly generated concepts/trees", 5));
+ options.add(new IntegerConfigOption("maxDepth", "maximum depth of generated concepts/trees", 5));
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -44,7 +44,6 @@
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.configuration.ExampleBasedROLComponentConfigurator;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.NamedClass;
@@ -204,10 +203,10 @@
options.add(CommonConfigOptions.minExecutionTimeInSeconds());
options.add(CommonConfigOptions.guaranteeXgoodDescriptions());
options.add(CommonConfigOptions.getLogLevel());
- options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)",usePropernessChecksDefault,Tags.NORMAL));
+ options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)",usePropernessChecksDefault));
options.add(new IntegerConfigOption("maxPosOnlyExpansion", "specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is" +
- " considered as solution candidate",maxPosOnlyExpansionDefault,Tags.NORMAL));
- DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",noisePercentageDefault,Tags.NORMAL);
+ " considered as solution candidate",maxPosOnlyExpansionDefault));
+ DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",noisePercentageDefault);
noisePercentage.setLowerLimit(0);
noisePercentage.setUpperLimit(100);
options.add(noisePercentage);
Modified: trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -26,13 +26,6 @@
*/
public class BooleanConfigOption extends ConfigOption<Boolean> {
-
-
- public BooleanConfigOption(String name, String description, Boolean defaultValue, Tags... tags) {
- super(name, description, defaultValue, tags);
-
- }
-
public BooleanConfigOption(String name, String description, Boolean defaultValue) {
super(name, description, defaultValue);
Modified: trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -19,7 +19,6 @@
*/
package org.dllearner.core.config;
-import org.dllearner.core.config.ConfigOption.Tags;
/**
@@ -59,7 +58,7 @@
}
public static DoubleConfigOption getPercentPerLenghtUnitOption(double defaultValue) {
- DoubleConfigOption option = new DoubleConfigOption("percentPerLenghtUnit", "describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one", defaultValue, Tags.NORMAL);
+ DoubleConfigOption option = new DoubleConfigOption("percentPerLenghtUnit", "describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one", defaultValue);
option.setLowerLimit(0.0);
option.setUpperLimit(1.0);
return option;
Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2007, Jens Lehmann
+ * Copyright (C) 2007-2008, Jens Lehmann
*
* This file is part of DL-Learner.
*
@@ -29,57 +29,79 @@
* Note: Currently, handling the type of a configuration option is not
* straightforward to implement, because Java Generics information is erased at
* runtime. This will be fixed in Java 7, in particular JSR 308, which is due at
- * approx. the end of 2008.
+ * approx. the beginning of 2009.
*
+ * @param <T> The type of the config option, e.g. Integer, String etc.
* @author Jens Lehmann
*
*/
public abstract class ConfigOption<T> {
+ /**
+ * Name of this option.
+ */
protected String name;
+ /**
+ * A short description explaining the effect of this option.
+ */
protected String description;
+ /**
+ * The default value of this option.
+ */
protected T defaultValue;
- public enum Tags {NORMAL, MANDATORY, REINIT}
+ /**
+ * Specifies whether this option is mandatory for a component,
+ * e.g. if a value other than the default value needs to be given.
+ */
+ protected boolean mandatory = false;
- protected boolean mandatory = false;
- protected boolean reinitNecessary = false;
+ /**
+ * Specifies whether a change of the value of the option requires
+ * running the init method of the component again. For some options
+ * (e.g. url of an OWL file component) a new run of init is needed,
+ * while others can be changed without the need to re-init the
+ * component.
+ */
+ protected boolean requiresInit = false;
+ /**
+ * Calls this(name, description, null, false, true).
+ * @param name Name of config option.
+ * @param description Explanation of option.
+ */
public ConfigOption(String name, String description) {
- this(name, description, null);
+ this(name, description, null, false, true);
}
- public ConfigOption(String name, String description, T defaultValue, Tags ...tags ) {
+ /**
+ * Calls this(name, description, defaultValue, false, true).
+ * @param name Name of config option.
+ * @param description Explanation of option.
+ * @param defaultValue Standard value of option.
+ */
+ public ConfigOption(String name, String description, T defaultValue) {
+ this(name, description, defaultValue, false, true);
+ }
+
+ /**
+ * Constructs a component configuration option.
+ * @param name Name of config option.
+ * @param description Explanation of option.
+ * @param defaultValue Standard value of option.
+ * @param mandatory Specifies whether assigning a value to the option is required.
+ * @param requiresInit Says whether init() has to be called again when the option is changed.
+ */
+ public ConfigOption(String name, String description, T defaultValue, boolean mandatory, boolean requiresInit) {
this.name = name;
this.description = description;
this.defaultValue = defaultValue;
- boolean normal = false;
- for(Tags t:tags){
- if (t.equals(Tags.NORMAL)){
- normal =true;
- }
- }
- for(Tags t:tags){
- if(normal){
- ;//DO Nothing
- }
- else if (t.equals(Tags.MANDATORY)){
- this.mandatory = true;
- } else if (t.equals(Tags.REINIT)){
- this.reinitNecessary = true;
- }
- }
-
+ this.mandatory = mandatory;
+ this.requiresInit = requiresInit;
}
- public ConfigOption(String name, String description, T defaultValue ) {
- this.name = name;
- this.description = description;
- this.defaultValue = defaultValue;
- }
-
public String getName() {
return name;
}
@@ -114,8 +136,8 @@
* says, if this option requires that the componnent is reinitialized with init()
* @return
*/
- public boolean isReinitNecessary() {
- return reinitNecessary;
+ public boolean requiresInit() {
+ return requiresInit;
}
/**
@@ -146,7 +168,27 @@
return getClass().toString();
}
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(T defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @param mandatory the mandatory to set
+ */
+ public void setMandatory(boolean mandatory) {
+ this.mandatory = mandatory;
+ }
+ /**
+ * @param requiresInit the requiresInit to set
+ */
+ public void setRequiresInit(boolean requiresInit) {
+ this.requiresInit = requiresInit;
+ }
+
@Override
public String toString() {
return "option name: " + name + "\ndescription: " + description + "\nvalues: "
Modified: trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -32,14 +32,6 @@
private double lowerLimit = Double.MIN_VALUE;
private double upperLimit = Double.MAX_VALUE;
-
-
-
- public DoubleConfigOption(String name, String description, Double defaultValue, Tags... tags) {
- super(name, description, defaultValue, tags);
-
- }
-
public DoubleConfigOption(String name, String description, Double defaultValue) {
super(name, description, defaultValue);
Modified: trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -32,13 +32,6 @@
private int lowerLimit = Integer.MIN_VALUE;
private int upperLimit = Integer.MAX_VALUE;
-
-
- public IntegerConfigOption(String name, String description, Integer defaultValue, Tags... tags) {
- super(name, description, defaultValue, tags);
-
- }
-
public IntegerConfigOption(String name, String description, Integer defaultValue) {
super(name, description, defaultValue);
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -34,23 +34,18 @@
private Set<String> allowedValues = new TreeSet<String>();
-
-
-
-
- public StringConfigOption(String name, String description, String defaultValue, Tags... tags) {
- super(name, description, defaultValue, tags);
+ public StringConfigOption(String name, String description) {
+ super(name, description);
- }
-
+ }
+
public StringConfigOption(String name, String description, String defaultValue) {
super(name, description, defaultValue);
}
- public StringConfigOption(String name, String description) {
- super(name, description);
-
+ public StringConfigOption(String name, String description, String defaultValue, boolean mandatory, boolean requiresInit) {
+ super(name, description, defaultValue, mandatory, requiresInit);
}
/* (non-Javadoc)
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2007, Jens Lehmann
+ * Copyright (C) 2007-2008, Jens Lehmann
*
* This file is part of DL-Learner.
*
@@ -31,22 +31,19 @@
*/
public class StringSetConfigOption extends ConfigOption<Set<String>> {
-
-
- public StringSetConfigOption(String name, String description, Set<String> defaultValue, Tags... tags) {
- super(name, description, defaultValue, tags);
+ public StringSetConfigOption(String name, String description) {
+ super(name, description);
- }
-
+ }
+
public StringSetConfigOption(String name, String description, Set<String> defaultValue) {
super(name, description, defaultValue);
}
- public StringSetConfigOption(String name, String description) {
- super(name, description);
-
- }
+ public StringSetConfigOption(String name, String description, Set<String> defaultValue, boolean mandatory, boolean requiresInit) {
+ super(name, description, defaultValue, mandatory, requiresInit);
+ }
/* (non-Javadoc)
* @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -33,7 +33,6 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.configuration.KBFileConfigurator;
import org.dllearner.core.owl.KB;
import org.dllearner.parser.KBParser;
@@ -93,8 +92,8 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new StringConfigOption("filename", "pointer to the KB file on local file system",null, Tags.MANDATORY, Tags.REINIT));
- options.add(new StringConfigOption("url", "URL pointer to the KB file",null, Tags.REINIT));
+ options.add(new StringConfigOption("filename", "pointer to the KB file on local file system",null, true, true));
+ options.add(new StringConfigOption("url", "URL pointer to the KB file",null, false, true));
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -33,7 +33,6 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.configuration.OWLFileConfigurator;
import org.dllearner.core.owl.KB;
import org.dllearner.reasoning.OWLAPIDIGConverter;
@@ -61,7 +60,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- options.add(new StringConfigOption("url", "URL pointing to the OWL file", null, Tags.MANDATORY ));
+ options.add(new StringConfigOption("url", "URL pointing to the OWL file", null, true, false));
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -45,7 +45,6 @@
import org.dllearner.core.config.StringConfigOption;
import org.dllearner.core.config.StringSetConfigOption;
import org.dllearner.core.config.StringTupleListConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.configuration.SparqlKnowledgeSourceConfigurator;
import org.dllearner.core.owl.KB;
import org.dllearner.kb.aquisitors.SparqlTupleAquisitor;
@@ -164,9 +163,9 @@
// Endpoint"));
options
.add(new StringSetConfigOption("instances",
- "relevant instances e.g. positive and negative examples in a learning problem",null,Tags.MANDATORY));
+ "relevant instances e.g. positive and negative examples in a learning problem",null,true,false));
options.add(new IntegerConfigOption("recursionDepth",
- "recursion depth of KB fragment selection", 1, Tags.NORMAL));
+ "recursion depth of KB fragment selection", 1));
options.add(new StringConfigOption("predefinedFilter",
"the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST"));
options.add(new StringConfigOption("predefinedEndpoint",
@@ -192,17 +191,17 @@
"Specifies whether the extracted NTriples are converted to RDF and deleted.",
true));
options.add(new BooleanConfigOption("useLits",
- "use Literals in SPARQL query", true, Tags.NORMAL));
+ "use Literals in SPARQL query", true));
options
.add(new BooleanConfigOption(
"getAllSuperClasses",
"If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.",
- true, Tags.NORMAL));
+ true));
//options.add(new BooleanConfigOption("learnDomain",
// "learns the Domain for a Role"));
options.add(new BooleanConfigOption("useCache",
- "If true a Cache is used",true, Tags.NORMAL));
+ "If true a Cache is used",true));
//options.add(new BooleanConfigOption("learnRange",
// "learns the Range for a Role"));
//options.add(new StringConfigOption("role",
Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegLP.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -34,7 +34,6 @@
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
import org.dllearner.core.config.StringSetConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Individual;
import org.dllearner.utilities.Helper;
@@ -86,13 +85,13 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
options.add(new StringSetConfigOption("positiveExamples",
- "positive examples",null, Tags.MANDATORY));
+ "positive examples",null, true, false));
options.add(new StringSetConfigOption("negativeExamples",
- "negative examples",null, Tags.MANDATORY));
+ "negative examples",null, true, false));
options.add(new BooleanConfigOption("useRetrievalForClassficiation",
- "Specifies whether to use retrieval or instance checks for testing a concept.", false, Tags.NORMAL));
+ "Specifies whether to use retrieval or instance checks for testing a concept.", false));
options.add(CommonConfigOptions.getPercentPerLenghtUnitOption(0.05));
- StringConfigOption multiInstanceChecks = new StringConfigOption("useMultiInstanceChecks", "See UseMultiInstanceChecks enum.","twoChecks",Tags.NORMAL);
+ StringConfigOption multiInstanceChecks = new StringConfigOption("useMultiInstanceChecks", "See UseMultiInstanceChecks enum.","twoChecks");
multiInstanceChecks.setAllowedValues(new String[] {"never", "twoChecks", "oneCheck"});
options.add(multiInstanceChecks);
return options;
Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyLP.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -31,7 +31,6 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringSetConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.owl.Individual;
/**
@@ -66,7 +65,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
options.add(new StringSetConfigOption("positiveExamples",
- "positive examples", null, Tags.MANDATORY));
+ "positive examples", null, true, false));
return options;
}
Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -44,7 +44,6 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
-import org.dllearner.core.config.ConfigOption.Tags;
import org.dllearner.core.configuration.OWLAPIReasonerConfigurator;
import org.dllearner.core.owl.Constant;
import org.dllearner.core.owl.Datatype;
@@ -152,7 +151,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet, which means \"pellet\" or \"fact\"", "pellet", Tags.NORMAL);
+ StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet, which means \"pellet\" or \"fact\"", "pellet");
type.setAllowedValues(new String[] {"fact", "pellet"});
// closure option? see:
// http://owlapi.svn.sourceforge.net/viewvc/owlapi/owl1_1/trunk/tutorial/src/main/java/uk/ac/manchester/owl/tutorial/examples/ClosureAxiomsExample.java?view=markup
Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -195,7 +195,7 @@
imports.addAll(option.getJavaImports());
vars.add(fillVariableDefTemplate(optionName, type, defaultValue));
- setters.add(fillSetterTemplate(className, comment, optionName, type, option.isReinitNecessary()));
+ setters.add(fillSetterTemplate(className, comment, optionName, type, option.requiresInit()));
getters.add(fillGetterTemplate(comment, optionName, type));
// System.out.println(option);
// componentOptions.get(component)) {
Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2008-09-05 14:53:16 UTC (rev 1171)
+++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2008-09-08 09:24:41 UTC (rev 1172)
@@ -82,6 +82,7 @@
ignore.add("./examples/sparql/SKOSTEST_local.conf"); // Out of Memory Error
ignore.add("./examples/sparql/scrobble.conf"); // HTTP 502 Proxy Error
ignore.add("./examples/family-benchmark/Cousin.conf"); // Out of Memory Error
+ ignore.add("./examples/sparql/SilentBobWorking2.conf"); // Out of Memory Error
for (String path : confFiles.keySet()) {
for (String file : confFiles.get(path)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2008-09-08 11:45:13
|
Revision: 1173
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1173&view=rev
Author: kurzum
Date: 2008-09-08 11:45:09 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
intermediate commit
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java
trunk/src/dl-learner/org/dllearner/kb/KBFile.java
trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java
trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java
trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/core/configurators/
trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java
trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java
Removed Paths:
-------------
trunk/src/dl-learner/org/dllearner/core/configuration/
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-08 09:24:41 UTC (rev 1172)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -44,7 +44,7 @@
import org.dllearner.core.config.IntegerConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
-import org.dllearner.core.configuration.ExampleBasedROLComponentConfigurator;
+import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.NamedClass;
import org.dllearner.core.owl.ObjectProperty;
Added: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -0,0 +1,88 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configurators;
+
+import org.dllearner.algorithms.BruteForceLearner;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class BruteForceLearnerConfigurator {
+
+private boolean reinitNecessary = false;
+private BruteForceLearner BruteForceLearner;
+
+public BruteForceLearnerConfigurator (BruteForceLearner BruteForceLearner){
+this.BruteForceLearner = BruteForceLearner;
+}
+
+/**
+**/
+public static BruteForceLearner getBruteForceLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
+BruteForceLearner component = ComponentManager.getInstance().learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService );
+return component;
+}
+
+/**
+* option name: maxLength
+* maximum length of generated concepts
+* default value: 7
+**/
+public int getMaxLength ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(BruteForceLearner, "maxLength") ;
+}
+/**
+* option name: returnType
+* Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.
+* default value: null
+**/
+public String getReturnType ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(BruteForceLearner, "returnType") ;
+}
+
+/**
+* option name: maxLength
+* maximum length of generated concepts
+* default value: 7
+**/
+public void setMaxLength ( int maxLength) {
+ComponentManager.getInstance().applyConfigEntry(BruteForceLearner, "maxLength", maxLength);
+reinitNecessary = true;
+}
+/**
+* option name: returnType
+* Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.
+* default value: null
+**/
+public void setReturnType ( String returnType) {
+ComponentManager.getInstance().applyConfigEntry(BruteForceLearner, "returnType", returnType);
+reinitNecessary = true;
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -0,0 +1,172 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configurators;
+
+import java.util.Set;
+import org.dllearner.algorithms.BruteForceLearner;
+import org.dllearner.algorithms.DBpediaNavigationSuggestor;
+import org.dllearner.algorithms.RandomGuesser;
+import org.dllearner.algorithms.gp.GP;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.algorithms.refinement.ROLearner;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.core.LearningAlgorithm;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+import org.dllearner.core.configurators.BruteForceLearnerConfigurator;
+import org.dllearner.core.configurators.DBpediaNavigationSuggestorConfigurator;
+import org.dllearner.core.configurators.DIGReasonerConfigurator;
+import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator;
+import org.dllearner.core.configurators.FastInstanceCheckerConfigurator;
+import org.dllearner.core.configurators.FastRetrievalReasonerConfigurator;
+import org.dllearner.core.configurators.GPConfigurator;
+import org.dllearner.core.configurators.KBFileConfigurator;
+import org.dllearner.core.configurators.OWLAPIReasonerConfigurator;
+import org.dllearner.core.configurators.OWLFileConfigurator;
+import org.dllearner.core.configurators.PosNegDefinitionLPConfigurator;
+import org.dllearner.core.configurators.PosNegInclusionLPConfigurator;
+import org.dllearner.core.configurators.PosOnlyDefinitionLPConfigurator;
+import org.dllearner.core.configurators.ROLearnerConfigurator;
+import org.dllearner.core.configurators.RandomGuesserConfigurator;
+import org.dllearner.core.configurators.SparqlKnowledgeSourceConfigurator;
+import org.dllearner.kb.KBFile;
+import org.dllearner.kb.OWLFile;
+import org.dllearner.kb.sparql.SparqlKnowledgeSource;
+import org.dllearner.learningproblems.PosNegDefinitionLP;
+import org.dllearner.learningproblems.PosNegInclusionLP;
+import org.dllearner.learningproblems.PosOnlyDefinitionLP;
+import org.dllearner.reasoning.DIGReasoner;
+import org.dllearner.reasoning.FastInstanceChecker;
+import org.dllearner.reasoning.FastRetrievalReasoner;
+import org.dllearner.reasoning.OWLAPIReasoner;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class ComponentFactory {
+
+/**
+* @param filename pointer to the KB file on local file system
+**/
+public static KBFile getKBFile (String filename ) {
+return KBFileConfigurator.getKBFile(filename);
+}
+
+/**
+* @param url URL pointing to the OWL file
+**/
+public static OWLFile getOWLFile (String url ) {
+return OWLFileConfigurator.getOWLFile(url);
+}
+
+/**
+* @param instances relevant instances e.g. positive and negative examples in a learning problem
+**/
+public static SparqlKnowledgeSource getSparqlKnowledgeSource (Set<String> instances ) {
+return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(instances);
+}
+
+/**
+**/
+public static DIGReasoner getDIGReasoner (KnowledgeSource knowledgeSource ) {
+return DIGReasonerConfigurator.getDIGReasoner(knowledgeSource);
+}
+
+/**
+**/
+public static FastInstanceChecker getFastInstanceChecker (KnowledgeSource knowledgeSource ) {
+return FastInstanceCheckerConfigurator.getFastInstanceChecker(knowledgeSource);
+}
+
+/**
+**/
+public static FastRetrievalReasoner getFastRetrievalReasoner (KnowledgeSource knowledgeSource ) {
+return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(knowledgeSource);
+}
+
+/**
+**/
+public static OWLAPIReasoner getOWLAPIReasoner (KnowledgeSource knowledgeSource ) {
+return OWLAPIReasonerConfigurator.getOWLAPIReasoner(knowledgeSource);
+}
+
+/**
+* @param positiveExamples positive examples
+* @param negativeExamples negative examples
+**/
+public static PosNegDefinitionLP getPosNegDefinitionLP (ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) {
+return PosNegDefinitionLPConfigurator.getPosNegDefinitionLP(reasoningService, positiveExamples, negativeExamples);
+}
+
+/**
+* @param positiveExamples positive examples
+* @param negativeExamples negative examples
+**/
+public static PosNegInclusionLP getPosNegInclusionLP (ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) {
+return PosNegInclusionLPConfigurator.getPosNegInclusionLP(reasoningService, positiveExamples, negativeExamples);
+}
+
+/**
+* @param positiveExamples positive examples
+**/
+public static PosOnlyDefinitionLP getPosOnlyDefinitionLP (ReasoningService reasoningService, Set<String> positiveExamples ) {
+return PosOnlyDefinitionLPConfigurator.getPosOnlyDefinitionLP(reasoningService, positiveExamples);
+}
+
+/**
+**/
+public static BruteForceLearner getBruteForceLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return BruteForceLearnerConfigurator.getBruteForceLearner(learningProblem, reasoningService);
+}
+
+/**
+**/
+public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return DBpediaNavigationSuggestorConfigurator.getDBpediaNavigationSuggestor(learningProblem, reasoningService);
+}
+
+/**
+**/
+public static RandomGuesser getRandomGuesser (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return RandomGuesserConfigurator.getRandomGuesser(learningProblem, reasoningService);
+}
+
+/**
+**/
+public static GP getGP (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return GPConfigurator.getGP(learningProblem, reasoningService);
+}
+
+/**
+**/
+public static ExampleBasedROLComponent getExampleBasedROLComponent (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return ExampleBasedROLComponentConfigurator.getExampleBasedROLComponent(learningProblem, reasoningService);
+}
+
+/**
+**/
+public static ROLearner getROLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+return ROLearnerConfigurator.getROLearner(learningProblem, reasoningService);
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -0,0 +1,501 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configurators;
+
+import java.util.Set;
+import org.dllearner.algorithms.DBpediaNavigationSuggestor;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class DBpediaNavigationSuggestorConfigurator {
+
+private boolean reinitNecessary = false;
+private DBpediaNavigationSuggestor DBpediaNavigationSuggestor;
+
+public DBpediaNavigationSuggestorConfigurator (DBpediaNavigationSuggestor DBpediaNavigationSuggestor){
+this.DBpediaNavigationSuggestor = DBpediaNavigationSuggestor;
+}
+
+/**
+**/
+public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
+DBpediaNavigationSuggestor component = ComponentManager.getInstance().learningAlgorithm(DBpediaNavigationSuggestor.class, learningProblem, reasoningService );
+return component;
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public boolean getWriteSearchTree ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "writeSearchTree") ;
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public String getSearchTreeFile ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "searchTreeFile") ;
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public boolean getReplaceSearchTree ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "replaceSearchTree") ;
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public String getHeuristic ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "heuristic") ;
+}
+/**
+* option name: applyAllFilter
+* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* default value: true
+**/
+public boolean getApplyAllFilter ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "applyAllFilter") ;
+}
+/**
+* option name: applyExistsFilter
+* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* default value: true
+**/
+public boolean getApplyExistsFilter ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "applyExistsFilter") ;
+}
+/**
+* option name: useTooWeakList
+* try to filter out too weak concepts without sending them to the reasoner
+* default value: true
+**/
+public boolean getUseTooWeakList ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useTooWeakList") ;
+}
+/**
+* option name: useOverlyGeneralList
+* try to find overly general concept without sending them to the reasoner
+* default value: true
+**/
+public boolean getUseOverlyGeneralList ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useOverlyGeneralList") ;
+}
+/**
+* option name: useShortConceptConstruction
+* shorten concept to see whether they already exist
+* default value: true
+**/
+public boolean getUseShortConceptConstruction ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useShortConceptConstruction") ;
+}
+/**
+* option name: horizontalExpansionFactor
+* horizontal expansion factor (see publication for description)
+* default value: 0.6
+**/
+public double getHorizontalExpansionFactor ( ) {
+return (Double) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "horizontalExpansionFactor") ;
+}
+/**
+* option name: improveSubsumptionHierarchy
+* simplify subsumption hierarchy to reduce search space (see publication for description)
+* default value: true
+**/
+public boolean getImproveSubsumptionHierarchy ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy") ;
+}
+/**
+* option name: allowedConcepts
+* concepts the algorithm is allowed to use
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getAllowedConcepts ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "allowedConcepts") ;
+}
+/**
+* option name: ignoredConcepts
+* concepts the algorithm must ignore
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getIgnoredConcepts ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "ignoredConcepts") ;
+}
+/**
+* option name: allowedRoles
+* roles the algorithm is allowed to use
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getAllowedRoles ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "allowedRoles") ;
+}
+/**
+* option name: ignoredRoles
+* roles the algorithm must ignore
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getIgnoredRoles ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "ignoredRoles") ;
+}
+/**
+* option name: useAllConstructor
+* specifies whether the universal concept constructor is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseAllConstructor ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useAllConstructor") ;
+}
+/**
+* option name: useExistsConstructor
+* specifies whether the existential concept constructor is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseExistsConstructor ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useExistsConstructor") ;
+}
+/**
+* option name: useCardinalityRestrictions
+* specifies whether CardinalityRestrictions is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseCardinalityRestrictions ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useCardinalityRestrictions") ;
+}
+/**
+* option name: useNegation
+* specifies whether negation is used in the learning algorothm
+* default value: true
+**/
+public boolean getUseNegation ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useNegation") ;
+}
+/**
+* option name: useBooleanDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public boolean getUseBooleanDatatypes ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useBooleanDatatypes") ;
+}
+/**
+* option name: maxExecutionTimeInSeconds
+* algorithm will stop after specified seconds
+* default value: 0
+**/
+public int getMaxExecutionTimeInSeconds ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds") ;
+}
+/**
+* option name: minExecutionTimeInSeconds
+* algorithm will run at least specified seconds
+* default value: 0
+**/
+public int getMinExecutionTimeInSeconds ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds") ;
+}
+/**
+* option name: guaranteeXgoodDescriptions
+* algorithm will run until X good (100%) concept descritpions are found
+* default value: 1
+**/
+public int getGuaranteeXgoodDescriptions ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions") ;
+}
+/**
+* option name: logLevel
+* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* default value: DEBUG
+**/
+public String getLogLevel ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "logLevel") ;
+}
+/**
+* option name: noisePercentage
+* the (approximated) percentage of noise within the examples
+* default value: 0.0
+**/
+public double getNoisePercentage ( ) {
+return (Double) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "noisePercentage") ;
+}
+/**
+* option name: startClass
+* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* default value: null
+**/
+public String getStartClass ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "startClass") ;
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public void setWriteSearchTree ( boolean writeSearchTree) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "writeSearchTree", writeSearchTree);
+reinitNecessary = true;
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public void setSearchTreeFile ( String searchTreeFile) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "searchTreeFile", searchTreeFile);
+reinitNecessary = true;
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public void setReplaceSearchTree ( boolean replaceSearchTree) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "replaceSearchTree", replaceSearchTree);
+reinitNecessary = true;
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public void setHeuristic ( String heuristic) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "heuristic", heuristic);
+reinitNecessary = true;
+}
+/**
+* option name: applyAllFilter
+* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* default value: true
+**/
+public void setApplyAllFilter ( boolean applyAllFilter) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "applyAllFilter", applyAllFilter);
+reinitNecessary = true;
+}
+/**
+* option name: applyExistsFilter
+* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* default value: true
+**/
+public void setApplyExistsFilter ( boolean applyExistsFilter) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "applyExistsFilter", applyExistsFilter);
+reinitNecessary = true;
+}
+/**
+* option name: useTooWeakList
+* try to filter out too weak concepts without sending them to the reasoner
+* default value: true
+**/
+public void setUseTooWeakList ( boolean useTooWeakList) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useTooWeakList", useTooWeakList);
+reinitNecessary = true;
+}
+/**
+* option name: useOverlyGeneralList
+* try to find overly general concept without sending them to the reasoner
+* default value: true
+**/
+public void setUseOverlyGeneralList ( boolean useOverlyGeneralList) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useOverlyGeneralList", useOverlyGeneralList);
+reinitNecessary = true;
+}
+/**
+* option name: useShortConceptConstruction
+* shorten concept to see whether they already exist
+* default value: true
+**/
+public void setUseShortConceptConstruction ( boolean useShortConceptConstruction) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useShortConceptConstruction", useShortConceptConstruction);
+reinitNecessary = true;
+}
+/**
+* option name: horizontalExpansionFactor
+* horizontal expansion factor (see publication for description)
+* default value: 0.6
+**/
+public void setHorizontalExpansionFactor ( double horizontalExpansionFactor) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "horizontalExpansionFactor", horizontalExpansionFactor);
+reinitNecessary = true;
+}
+/**
+* option name: improveSubsumptionHierarchy
+* simplify subsumption hierarchy to reduce search space (see publication for description)
+* default value: true
+**/
+public void setImproveSubsumptionHierarchy ( boolean improveSubsumptionHierarchy) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy", improveSubsumptionHierarchy);
+reinitNecessary = true;
+}
+/**
+* option name: allowedConcepts
+* concepts the algorithm is allowed to use
+* default value: null
+**/
+public void setAllowedConcepts ( Set<String> allowedConcepts) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "allowedConcepts", allowedConcepts);
+reinitNecessary = true;
+}
+/**
+* option name: ignoredConcepts
+* concepts the algorithm must ignore
+* default value: null
+**/
+public void setIgnoredConcepts ( Set<String> ignoredConcepts) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "ignoredConcepts", ignoredConcepts);
+reinitNecessary = true;
+}
+/**
+* option name: allowedRoles
+* roles the algorithm is allowed to use
+* default value: null
+**/
+public void setAllowedRoles ( Set<String> allowedRoles) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "allowedRoles", allowedRoles);
+reinitNecessary = true;
+}
+/**
+* option name: ignoredRoles
+* roles the algorithm must ignore
+* default value: null
+**/
+public void setIgnoredRoles ( Set<String> ignoredRoles) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "ignoredRoles", ignoredRoles);
+reinitNecessary = true;
+}
+/**
+* option name: useAllConstructor
+* specifies whether the universal concept constructor is used in the learning algorithm
+* default value: true
+**/
+public void setUseAllConstructor ( boolean useAllConstructor) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useAllConstructor", useAllConstructor);
+reinitNecessary = true;
+}
+/**
+* option name: useExistsConstructor
+* specifies whether the existential concept constructor is used in the learning algorithm
+* default value: true
+**/
+public void setUseExistsConstructor ( boolean useExistsConstructor) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useExistsConstructor", useExistsConstructor);
+reinitNecessary = true;
+}
+/**
+* option name: useCardinalityRestrictions
+* specifies whether CardinalityRestrictions is used in the learning algorithm
+* default value: true
+**/
+public void setUseCardinalityRestrictions ( boolean useCardinalityRestrictions) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useCardinalityRestrictions", useCardinalityRestrictions);
+reinitNecessary = true;
+}
+/**
+* option name: useNegation
+* specifies whether negation is used in the learning algorothm
+* default value: true
+**/
+public void setUseNegation ( boolean useNegation) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useNegation", useNegation);
+reinitNecessary = true;
+}
+/**
+* option name: useBooleanDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public void setUseBooleanDatatypes ( boolean useBooleanDatatypes) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useBooleanDatatypes", useBooleanDatatypes);
+reinitNecessary = true;
+}
+/**
+* option name: maxExecutionTimeInSeconds
+* algorithm will stop after specified seconds
+* default value: 0
+**/
+public void setMaxExecutionTimeInSeconds ( int maxExecutionTimeInSeconds) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds);
+reinitNecessary = true;
+}
+/**
+* option name: minExecutionTimeInSeconds
+* algorithm will run at least specified seconds
+* default value: 0
+**/
+public void setMinExecutionTimeInSeconds ( int minExecutionTimeInSeconds) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
+reinitNecessary = true;
+}
+/**
+* option name: guaranteeXgoodDescriptions
+* algorithm will run until X good (100%) concept descritpions are found
+* default value: 1
+**/
+public void setGuaranteeXgoodDescriptions ( int guaranteeXgoodDescriptions) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions);
+reinitNecessary = true;
+}
+/**
+* option name: logLevel
+* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* default value: DEBUG
+**/
+public void setLogLevel ( String logLevel) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "logLevel", logLevel);
+reinitNecessary = true;
+}
+/**
+* option name: noisePercentage
+* the (approximated) percentage of noise within the examples
+* default value: 0.0
+**/
+public void setNoisePercentage ( double noisePercentage) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "noisePercentage", noisePercentage);
+reinitNecessary = true;
+}
+/**
+* option name: startClass
+* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* default value: null
+**/
+public void setStartClass ( String startClass) {
+ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "startClass", startClass);
+reinitNecessary = true;
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -0,0 +1,103 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configurators;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.reasoning.DIGReasoner;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class DIGReasonerConfigurator {
+
+private boolean reinitNecessary = false;
+private DIGReasoner DIGReasoner;
+
+public DIGReasonerConfigurator (DIGReasoner DIGReasoner){
+this.DIGReasoner = DIGReasoner;
+}
+
+/**
+**/
+public static DIGReasoner getDIGReasoner (KnowledgeSource knowledgeSource ) {
+DIGReasoner component = ComponentManager.getInstance().reasoner(DIGReasoner.class, knowledgeSource );
+return component;
+}
+
+/**
+* option name: reasonerUrl
+* URL of the DIG reasoner
+* default value: null
+**/
+public String getReasonerUrl ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(DIGReasoner, "reasonerUrl") ;
+}
+/**
+* option name: writeDIGProtocol
+* specifies whether or not to write a protocoll of send and received DIG requests
+* default value: false
+**/
+public boolean getWriteDIGProtocol ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DIGReasoner, "writeDIGProtocol") ;
+}
+/**
+* option name: digProtocolFile
+* the file to store the DIG protocol
+* default value: log/digProtocol.txt
+**/
+public String getDigProtocolFile ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(DIGReasoner, "digProtocolFile") ;
+}
+
+/**
+* option name: reasonerUrl
+* URL of the DIG reasoner
+* default value: null
+**/
+public void setReasonerUrl ( String reasonerUrl) {
+ComponentManager.getInstance().applyConfigEntry(DIGReasoner, "reasonerUrl", reasonerUrl);
+reinitNecessary = true;
+}
+/**
+* option name: writeDIGProtocol
+* specifies whether or not to write a protocoll of send and received DIG requests
+* default value: false
+**/
+public void setWriteDIGProtocol ( boolean writeDIGProtocol) {
+ComponentManager.getInstance().applyConfigEntry(DIGReasoner, "writeDIGProtocol", writeDIGProtocol);
+reinitNecessary = true;
+}
+/**
+* option name: digProtocolFile
+* the file to store the DIG protocol
+* default value: log/digProtocol.txt
+**/
+public void setDigProtocolFile ( String digProtocolFile) {
+ComponentManager.getInstance().applyConfigEntry(DIGReasoner, "digProtocolFile", digProtocolFile);
+reinitNecessary = true;
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -0,0 +1,552 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configurators;
+
+import java.util.Set;
+import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.LearningProblem;
+import org.dllearner.core.LearningProblemUnsupportedException;
+import org.dllearner.core.ReasoningService;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class ExampleBasedROLComponentConfigurator {
+
+private boolean reinitNecessary = false;
+private ExampleBasedROLComponent ExampleBasedROLComponent;
+
+public ExampleBasedROLComponentConfigurator (ExampleBasedROLComponent ExampleBasedROLComponent){
+this.ExampleBasedROLComponent = ExampleBasedROLComponent;
+}
+
+/**
+**/
+public static ExampleBasedROLComponent getExampleBasedROLComponent (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
+ExampleBasedROLComponent component = ComponentManager.getInstance().learningAlgorithm(ExampleBasedROLComponent.class, learningProblem, reasoningService );
+return component;
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public boolean getWriteSearchTree ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "writeSearchTree") ;
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public String getSearchTreeFile ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "searchTreeFile") ;
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public boolean getReplaceSearchTree ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "replaceSearchTree") ;
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public String getHeuristic ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "heuristic") ;
+}
+/**
+* option name: applyAllFilter
+* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* default value: true
+**/
+public boolean getApplyAllFilter ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "applyAllFilter") ;
+}
+/**
+* option name: applyExistsFilter
+* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* default value: true
+**/
+public boolean getApplyExistsFilter ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "applyExistsFilter") ;
+}
+/**
+* option name: useTooWeakList
+* try to filter out too weak concepts without sending them to the reasoner
+* default value: true
+**/
+public boolean getUseTooWeakList ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useTooWeakList") ;
+}
+/**
+* option name: useOverlyGeneralList
+* try to find overly general concept without sending them to the reasoner
+* default value: true
+**/
+public boolean getUseOverlyGeneralList ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useOverlyGeneralList") ;
+}
+/**
+* option name: useShortConceptConstruction
+* shorten concept to see whether they already exist
+* default value: true
+**/
+public boolean getUseShortConceptConstruction ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useShortConceptConstruction") ;
+}
+/**
+* option name: horizontalExpansionFactor
+* horizontal expansion factor (see publication for description)
+* default value: 0.6
+**/
+public double getHorizontalExpansionFactor ( ) {
+return (Double) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "horizontalExpansionFactor") ;
+}
+/**
+* option name: improveSubsumptionHierarchy
+* simplify subsumption hierarchy to reduce search space (see publication for description)
+* default value: true
+**/
+public boolean getImproveSubsumptionHierarchy ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "improveSubsumptionHierarchy") ;
+}
+/**
+* option name: allowedConcepts
+* concepts the algorithm is allowed to use
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getAllowedConcepts ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "allowedConcepts") ;
+}
+/**
+* option name: ignoredConcepts
+* concepts the algorithm must ignore
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getIgnoredConcepts ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "ignoredConcepts") ;
+}
+/**
+* option name: allowedRoles
+* roles the algorithm is allowed to use
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getAllowedRoles ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "allowedRoles") ;
+}
+/**
+* option name: ignoredRoles
+* roles the algorithm must ignore
+* default value: null
+**/
+@SuppressWarnings("unchecked")
+public Set<String> getIgnoredRoles ( ) {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "ignoredRoles") ;
+}
+/**
+* option name: useAllConstructor
+* specifies whether the universal concept constructor is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseAllConstructor ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useAllConstructor") ;
+}
+/**
+* option name: useExistsConstructor
+* specifies whether the existential concept constructor is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseExistsConstructor ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useExistsConstructor") ;
+}
+/**
+* option name: useCardinalityRestrictions
+* specifies whether CardinalityRestrictions is used in the learning algorithm
+* default value: true
+**/
+public boolean getUseCardinalityRestrictions ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useCardinalityRestrictions") ;
+}
+/**
+* option name: useNegation
+* specifies whether negation is used in the learning algorothm
+* default value: true
+**/
+public boolean getUseNegation ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useNegation") ;
+}
+/**
+* option name: useBooleanDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public boolean getUseBooleanDatatypes ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useBooleanDatatypes") ;
+}
+/**
+* option name: useDoubleDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public boolean getUseDoubleDatatypes ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "useDoubleDatatypes") ;
+}
+/**
+* option name: maxExecutionTimeInSeconds
+* algorithm will stop after specified seconds
+* default value: 0
+**/
+public int getMaxExecutionTimeInSeconds ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "maxExecutionTimeInSeconds") ;
+}
+/**
+* option name: minExecutionTimeInSeconds
+* algorithm will run at least specified seconds
+* default value: 0
+**/
+public int getMinExecutionTimeInSeconds ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "minExecutionTimeInSeconds") ;
+}
+/**
+* option name: guaranteeXgoodDescriptions
+* algorithm will run until X good (100%) concept descritpions are found
+* default value: 1
+**/
+public int getGuaranteeXgoodDescriptions ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "guaranteeXgoodDescriptions") ;
+}
+/**
+* option name: logLevel
+* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* default value: DEBUG
+**/
+public String getLogLevel ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "logLevel") ;
+}
+/**
+* option name: usePropernessChecks
+* specifies whether to check for equivalence (i.e. discard equivalent refinements)
+* default value: false
+**/
+public boolean getUsePropernessChecks ( ) {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "usePropernessChecks") ;
+}
+/**
+* option name: maxPosOnlyExpansion
+* specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is considered as solution candidate
+* default value: 4
+**/
+public int getMaxPosOnlyExpansion ( ) {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "maxPosOnlyExpansion") ;
+}
+/**
+* option name: noisePercentage
+* the (approximated) percentage of noise within the examples
+* default value: 0.0
+**/
+public double getNoisePercentage ( ) {
+return (Double) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "noisePercentage") ;
+}
+/**
+* option name: startClass
+* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* default value: null
+**/
+public String getStartClass ( ) {
+return (String) ComponentManager.getInstance().getConfigOptionValue(ExampleBasedROLComponent, "startClass") ;
+}
+
+/**
+* option name: writeSearchTree
+* specifies whether to write a search tree
+* default value: false
+**/
+public void setWriteSearchTree ( boolean writeSearchTree) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "writeSearchTree", writeSearchTree);
+reinitNecessary = true;
+}
+/**
+* option name: searchTreeFile
+* file to use for the search tree
+* default value: log/searchTree.txt
+**/
+public void setSearchTreeFile ( String searchTreeFile) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "searchTreeFile", searchTreeFile);
+reinitNecessary = true;
+}
+/**
+* option name: replaceSearchTree
+* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* default value: false
+**/
+public void setReplaceSearchTree ( boolean replaceSearchTree) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "replaceSearchTree", replaceSearchTree);
+reinitNecessary = true;
+}
+/**
+* option name: heuristic
+* specifiy the heuristic to use
+* default value: lexicographic
+**/
+public void setHeuristic ( String heuristic) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "heuristic", heuristic);
+reinitNecessary = true;
+}
+/**
+* option name: applyAllFilter
+* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* default value: true
+**/
+public void setApplyAllFilter ( boolean applyAllFilter) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "applyAllFilter", applyAllFilter);
+reinitNecessary = true;
+}
+/**
+* option name: applyExistsFilter
+* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* default value: true
+**/
+public void setApplyExistsFilter ( boolean applyExistsFilter) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "applyExistsFilter", applyExistsFilter);
+reinitNecessary = true;
+}
+/**
+* option name: useTooWeakList
+* try to filter out too weak concepts without sending them to the reasoner
+* default value: true
+**/
+public void setUseTooWeakList ( boolean useTooWeakList) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useTooWeakList", useTooWeakList);
+reinitNecessary = true;
+}
+/**
+* option name: useOverlyGeneralList
+* try to find overly general concept without sending them to the reasoner
+* default value: true
+**/
+public void setUseOverlyGeneralList ( boolean useOverlyGeneralList) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useOverlyGeneralList", useOverlyGeneralList);
+reinitNecessary = true;
+}
+/**
+* option name: useShortConceptConstruction
+* shorten concept to see whether they already exist
+* default value: true
+**/
+public void setUseShortConceptConstruction ( boolean useShortConceptConstruction) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useShortConceptConstruction", useShortConceptConstruction);
+reinitNecessary = true;
+}
+/**
+* option name: horizontalExpansionFactor
+* horizontal expansion factor (see publication for description)
+* default value: 0.6
+**/
+public void setHorizontalExpansionFactor ( double horizontalExpansionFactor) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "horizontalExpansionFactor", horizontalExpansionFactor);
+reinitNecessary = true;
+}
+/**
+* option name: improveSubsumptionHierarchy
+* simplify subsumption hierarchy to reduce search space (see publication for description)
+* default value: true
+**/
+public void setImproveSubsumptionHierarchy ( boolean improveSubsumptionHierarchy) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "improveSubsumptionHierarchy", improveSubsumptionHierarchy);
+reinitNecessary = true;
+}
+/**
+* option name: allowedConcepts
+* concepts the algorithm is allowed to use
+* default value: null
+**/
+public void setAllowedConcepts ( Set<String> allowedConcepts) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "allowedConcepts", allowedConcepts);
+reinitNecessary = true;
+}
+/**
+* option name: ignoredConcepts
+* concepts the algorithm must ignore
+* default value: null
+**/
+public void setIgnoredConcepts ( Set<String> ignoredConcepts) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "ignoredConcepts", ignoredConcepts);
+reinitNecessary = true;
+}
+/**
+* option name: allowedRoles
+* roles the algorithm is allowed to use
+* default value: null
+**/
+public void setAllowedRoles ( Set<String> allowedRoles) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "allowedRoles", allowedRoles);
+reinitNecessary = true;
+}
+/**
+* option name: ignoredRoles
+* roles the algorithm must ignore
+* default value: null
+**/
+public void setIgnoredRoles ( Set<String> ignoredRoles) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "ignoredRoles", ignoredRoles);
+reinitNecessary = true;
+}
+/**
+* option name: useAllConstructor
+* specifies whether the universal concept constructor is used in the learning algorithm
+* default value: true
+**/
+public void setUseAllConstructor ( boolean useAllConstructor) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useAllConstructor", useAllConstructor);
+reinitNecessary = true;
+}
+/**
+* option name: useExistsConstructor
+* specifies whether the existential concept constructor is used in the learning algorithm
+* default value: true
+**/
+public void setUseExistsConstructor ( boolean useExistsConstructor) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useExistsConstructor", useExistsConstructor);
+reinitNecessary = true;
+}
+/**
+* option name: useCardinalityRestrictions
+* specifies whether CardinalityRestrictions is used in the learning algorithm
+* default value: true
+**/
+public void setUseCardinalityRestrictions ( boolean useCardinalityRestrictions) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useCardinalityRestrictions", useCardinalityRestrictions);
+reinitNecessary = true;
+}
+/**
+* option name: useNegation
+* specifies whether negation is used in the learning algorothm
+* default value: true
+**/
+public void setUseNegation ( boolean useNegation) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useNegation", useNegation);
+reinitNecessary = true;
+}
+/**
+* option name: useBooleanDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public void setUseBooleanDatatypes ( boolean useBooleanDatatypes) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useBooleanDatatypes", useBooleanDatatypes);
+reinitNecessary = true;
+}
+/**
+* option name: useDoubleDatatypes
+* specifies whether boolean datatypes are used in the learning algorothm
+* default value: true
+**/
+public void setUseDoubleDatatypes ( boolean useDoubleDatatypes) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "useDoubleDatatypes", useDoubleDatatypes);
+reinitNecessary = true;
+}
+/**
+* option name: maxExecutionTimeInSeconds
+* algorithm will stop after specified seconds
+* default value: 0
+**/
+public void setMaxExecutionTimeInSeconds ( int maxExecutionTimeInSeconds) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds);
+reinitNecessary = true;
+}
+/**
+* option name: minExecutionTimeInSeconds
+* algorithm will run at least specified seconds
+* default value: 0
+**/
+public void setMinExecutionTimeInSeconds ( int minExecutionTimeInSeconds) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
+reinitNecessary = true;
+}
+/**
+* option name: guaranteeXgoodDescriptions
+* algorithm will run until X good (100%) concept descritpions are found
+* default value: 1
+**/
+public void setGuaranteeXgoodDescriptions ( int guaranteeXgoodDescriptions) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions);
+reinitNecessary = true;
+}
+/**
+* option name: logLevel
+* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* default value: DEBUG
+**/
+public void setLogLevel ( String logLevel) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "logLevel", logLevel);
+reinitNecessary = true;
+}
+/**
+* option name: usePropernessChecks
+* specifies whether to check for equivalence (i.e. discard equivalent refinements)
+* default value: false
+**/
+public void setUsePropernessChecks ( boolean usePropernessChecks) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "usePropernessChecks", usePropernessChecks);
+reinitNecessary = true;
+}
+/**
+* option name: maxPosOnlyExpansion
+* specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is considered as solution candidate
+* default value: 4
+**/
+public void setMaxPosOnlyExpansion ( int maxPosOnlyExpansion) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "maxPosOnlyExpansion", maxPosOnlyExpansion);
+reinitNecessary = true;
+}
+/**
+* option name: noisePercentage
+* the (approximated) percentage of noise within the examples
+* default value: 0.0
+**/
+public void setNoisePercentage ( double noisePercentage) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "noisePercentage", noisePercentage);
+reinitNecessary = true;
+}
+/**
+* option name: startClass
+* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* default value: null
+**/
+public void setStartClass ( String startClass) {
+ComponentManager.getInstance().applyConfigEntry(ExampleBasedROLComponent, "startClass", startClass);
+reinitNecessary = true;
+}
+
+public boolean isReinitNecessary(){
+return reinitNecessary;
+}
+
+
+}
Added: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-08 11:45:09 UTC (rev 1173)
@@ -0,0 +1,69 @@
+/**
+ * Copyright (C) 2007-2008, 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.core.configurators;
+
+import org.dllearner.core.ComponentManager;
+import org.dllearner.core.KnowledgeSource;
+import org.dllearner.reasoning.FastInstanceChecker;
+
+/**
+* automatically generated, do not edit manually
+**/
+public class FastInstanceCheckerConfigurator {
+
+private boolean reinitNecessary = false;
+private FastInstanceChecker FastInstanceChecker;
+
+public FastInstanceCheckerConfigurator (FastInstanceChecker FastInstanceChecker){
+this.FastInstanceChecker = FastInstanceChecker;
+}
+
+/**
+**/
+public static FastInstanceChecker getFastInstanceChecker (KnowledgeSource knowledgeSource ) {
+FastInstance...
[truncated message content] |
|
From: <ku...@us...> - 2008-09-08 15:41:18
|
Revision: 1176
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1176&view=rev
Author: kurzum
Date: 2008-09-08 15:41:10 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
removed all checkstyle warnings from auto generated classes,
finished new options for all knowledgesources
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java
trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java
trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java
trunk/src/dl-learner/org/dllearner/kb/KBFile.java
trunk/src/dl-learner/org/dllearner/kb/OWLFile.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
Modified: trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -26,6 +26,13 @@
*/
public class BooleanConfigOption extends ConfigOption<Boolean> {
+
+
+ public BooleanConfigOption(String name, String description, Boolean defaultValue, boolean mandatory, boolean requiresInit) {
+ super(name, description, defaultValue, mandatory, requiresInit);
+
+ }
+
public BooleanConfigOption(String name, String description, Boolean defaultValue) {
super(name, description, defaultValue);
Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -196,9 +196,8 @@
}
public String getJavaDocString() {
- String line = "* option name: " + name + "\n";
- line += "* " + description + "\n";
- //line += "* allowed values: "+ getAllowedValuesDescription() + "\n";
+ String line = "* @param " + name + " " + description + ".\n";
+ line += "* mandatory: "+isMandatory()+"| reinit necessary: "+requiresInit()+"\n";
line += "* default value: " + defaultValue + "\n";
return line;
}
Modified: trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -32,6 +32,13 @@
private int lowerLimit = Integer.MIN_VALUE;
private int upperLimit = Integer.MAX_VALUE;
+
+
+ public IntegerConfigOption(String name, String description, Integer defaultValue, boolean mandatory, boolean requiresInit) {
+ super(name, description, defaultValue, mandatory, requiresInit);
+
+ }
+
public IntegerConfigOption(String name, String description, Integer defaultValue) {
super(name, description, defaultValue);
Modified: trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -33,15 +33,22 @@
*/
public class StringTupleListConfigOption extends ConfigOption<List<StringTuple>> {
- public StringTupleListConfigOption(String name, String description) {
- this(name, description, null);
+
+ public StringTupleListConfigOption(String name, String description, List<StringTuple> defaultValue, boolean mandatory, boolean requiresInit) {
+ super(name, description, defaultValue, mandatory, requiresInit);
+
}
- public StringTupleListConfigOption(String name, String description,
- List<StringTuple> defaultValue) {
+ public StringTupleListConfigOption(String name, String description, List<StringTuple> defaultValue) {
super(name, description, defaultValue);
+
}
+ public StringTupleListConfigOption(String name, String description) {
+ super(name, description);
+
+ }
+
/* (non-Javadoc)
* @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString()
*/
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -2,7 +2,7 @@
* Copyright (C) 2007-2008, 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
@@ -15,7 +15,8 @@
*
* 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.core.configurators;
@@ -26,60 +27,72 @@
import org.dllearner.core.ReasoningService;
/**
-* automatically generated, do not edit manually
+* automatically generated, do not edit manually.
+* run org.dllearner.scripts.ConfigJavaGenerator to update
**/
public class BruteForceLearnerConfigurator {
private boolean reinitNecessary = false;
-private BruteForceLearner BruteForceLearner;
+@SuppressWarnings("unused")
-public BruteForceLearnerConfigurator (BruteForceLearner BruteForceLearner){
-this.BruteForceLearner = BruteForceLearner;
+private BruteForceLearner bruteForceLearner;
+
+/**
+* @param bruteForceLearner see BruteForceLearner
+**/
+public BruteForceLearnerConfigurator(BruteForceLearner bruteForceLearner){
+this.bruteForceLearner = bruteForceLearner;
}
/**
+* @return BruteForceLearner
**/
-public static BruteForceLearner getBruteForceLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
-BruteForceLearner component = ComponentManager.getInstance().learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService );
+public static BruteForceLearner getBruteForceLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{
+BruteForceLearner component = ComponentManager.getInstance().learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService);
return component;
}
/**
-* option name: maxLength
-* maximum length of generated concepts
+* maxLength maximum length of generated concepts.
+* mandatory: false| reinit necessary: true
* default value: 7
+* @return int
**/
-public int getMaxLength ( ) {
-return (Integer) ComponentManager.getInstance().getConfigOptionValue(BruteForceLearner, "maxLength") ;
+public int getMaxLength() {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(bruteForceLearner, "maxLength") ;
}
/**
-* option name: returnType
-* Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.
+* returnType Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type..
+* mandatory: false| reinit necessary: true
* default value: null
+* @return String
**/
-public String getReturnType ( ) {
-return (String) ComponentManager.getInstance().getConfigOptionValue(BruteForceLearner, "returnType") ;
+public String getReturnType() {
+return (String) ComponentManager.getInstance().getConfigOptionValue(bruteForceLearner, "returnType") ;
}
/**
-* option name: maxLength
-* maximum length of generated concepts
+* @param maxLength maximum length of generated concepts.
+* mandatory: false| reinit necessary: true
* default value: 7
**/
-public void setMaxLength ( int maxLength) {
-ComponentManager.getInstance().applyConfigEntry(BruteForceLearner, "maxLength", maxLength);
+public void setMaxLength(int maxLength) {
+ComponentManager.getInstance().applyConfigEntry(bruteForceLearner, "maxLength", maxLength);
reinitNecessary = true;
}
/**
-* option name: returnType
-* Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.
+* @param returnType Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type..
+* mandatory: false| reinit necessary: true
* default value: null
**/
-public void setReturnType ( String returnType) {
-ComponentManager.getInstance().applyConfigEntry(BruteForceLearner, "returnType", returnType);
+public void setReturnType(String returnType) {
+ComponentManager.getInstance().applyConfigEntry(bruteForceLearner, "returnType", returnType);
reinitNecessary = true;
}
+/**
+* true, if this component needs reinitializsation
+**/
public boolean isReinitNecessary(){
return reinitNecessary;
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -2,7 +2,7 @@
* Copyright (C) 2007-2008, 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
@@ -15,7 +15,8 @@
*
* 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.core.configurators;
@@ -26,28 +27,10 @@
import org.dllearner.algorithms.gp.GP;
import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent;
import org.dllearner.algorithms.refinement.ROLearner;
-import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
-import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.LearningProblem;
import org.dllearner.core.LearningProblemUnsupportedException;
import org.dllearner.core.ReasoningService;
-import org.dllearner.core.configurators.BruteForceLearnerConfigurator;
-import org.dllearner.core.configurators.DBpediaNavigationSuggestorConfigurator;
-import org.dllearner.core.configurators.DIGReasonerConfigurator;
-import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator;
-import org.dllearner.core.configurators.FastInstanceCheckerConfigurator;
-import org.dllearner.core.configurators.FastRetrievalReasonerConfigurator;
-import org.dllearner.core.configurators.GPConfigurator;
-import org.dllearner.core.configurators.KBFileConfigurator;
-import org.dllearner.core.configurators.OWLAPIReasonerConfigurator;
-import org.dllearner.core.configurators.OWLFileConfigurator;
-import org.dllearner.core.configurators.PosNegDefinitionLPConfigurator;
-import org.dllearner.core.configurators.PosNegInclusionLPConfigurator;
-import org.dllearner.core.configurators.PosOnlyDefinitionLPConfigurator;
-import org.dllearner.core.configurators.ROLearnerConfigurator;
-import org.dllearner.core.configurators.RandomGuesserConfigurator;
-import org.dllearner.core.configurators.SparqlKnowledgeSourceConfigurator;
import org.dllearner.kb.KBFile;
import org.dllearner.kb.OWLFile;
import org.dllearner.kb.sparql.SparqlKnowledgeSource;
@@ -60,111 +43,154 @@
import org.dllearner.reasoning.OWLAPIReasoner;
/**
-* automatically generated, do not edit manually
+* automatically generated, do not edit manually.
+* run org.dllearner.scripts.ConfigJavaGenerator to update
**/
public class ComponentFactory {
/**
* @param filename pointer to the KB file on local file system
+* @return a component ready for initialization KBFile
**/
-public static KBFile getKBFile (String filename ) {
+public static KBFile getKBFile(String filename) {
return KBFileConfigurator.getKBFile(filename);
}
/**
* @param url URL pointing to the OWL file
+* @return a component ready for initialization OWLFile
**/
-public static OWLFile getOWLFile (String url ) {
+public static OWLFile getOWLFile(String url) {
return OWLFileConfigurator.getOWLFile(url);
}
/**
+* @param url URL of SPARQL Endpoint
* @param instances relevant instances e.g. positive and negative examples in a learning problem
+* @return a component ready for initialization SparqlKnowledgeSource
**/
-public static SparqlKnowledgeSource getSparqlKnowledgeSource (Set<String> instances ) {
-return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(instances);
+public static SparqlKnowledgeSource getSparqlKnowledgeSource(String url, Set<String> instances) {
+return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(url, instances);
}
/**
+* @param knowledgeSource see KnowledgeSource
+* @return a component ready for initialization DIGReasoner
**/
-public static DIGReasoner getDIGReasoner (KnowledgeSource knowledgeSource ) {
+public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) {
return DIGReasonerConfigurator.getDIGReasoner(knowledgeSource);
}
/**
+* @param knowledgeSource see KnowledgeSource
+* @return a component ready for initialization FastInstanceChecker
**/
-public static FastInstanceChecker getFastInstanceChecker (KnowledgeSource knowledgeSource ) {
+public static FastInstanceChecker getFastInstanceChecker(KnowledgeSource knowledgeSource) {
return FastInstanceCheckerConfigurator.getFastInstanceChecker(knowledgeSource);
}
/**
+* @param knowledgeSource see KnowledgeSource
+* @return a component ready for initialization FastRetrievalReasoner
**/
-public static FastRetrievalReasoner getFastRetrievalReasoner (KnowledgeSource knowledgeSource ) {
+public static FastRetrievalReasoner getFastRetrievalReasoner(KnowledgeSource knowledgeSource) {
return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(knowledgeSource);
}
/**
+* @param knowledgeSource see KnowledgeSource
+* @return a component ready for initialization OWLAPIReasoner
**/
-public static OWLAPIReasoner getOWLAPIReasoner (KnowledgeSource knowledgeSource ) {
+public static OWLAPIReasoner getOWLAPIReasoner(KnowledgeSource knowledgeSource) {
return OWLAPIReasonerConfigurator.getOWLAPIReasoner(knowledgeSource);
}
/**
* @param positiveExamples positive examples
* @param negativeExamples negative examples
+* @param reasoningService see ReasoningService
+* @return a component ready for initialization PosNegDefinitionLP
**/
-public static PosNegDefinitionLP getPosNegDefinitionLP (ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) {
+public static PosNegDefinitionLP getPosNegDefinitionLP(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) {
return PosNegDefinitionLPConfigurator.getPosNegDefinitionLP(reasoningService, positiveExamples, negativeExamples);
}
/**
* @param positiveExamples positive examples
* @param negativeExamples negative examples
+* @param reasoningService see ReasoningService
+* @return a component ready for initialization PosNegInclusionLP
**/
-public static PosNegInclusionLP getPosNegInclusionLP (ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) {
+public static PosNegInclusionLP getPosNegInclusionLP(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) {
return PosNegInclusionLPConfigurator.getPosNegInclusionLP(reasoningService, positiveExamples, negativeExamples);
}
/**
* @param positiveExamples positive examples
+* @param reasoningService see ReasoningService
+* @return a component ready for initialization PosOnlyDefinitionLP
**/
-public static PosOnlyDefinitionLP getPosOnlyDefinitionLP (ReasoningService reasoningService, Set<String> positiveExamples ) {
+public static PosOnlyDefinitionLP getPosOnlyDefinitionLP(ReasoningService reasoningService, Set<String> positiveExamples) {
return PosOnlyDefinitionLPConfigurator.getPosOnlyDefinitionLP(reasoningService, positiveExamples);
}
/**
+* @param learningProblem see LearningProblem
+* @param reasoningService see ReasoningService
+* @throws LearningProblemUnsupportedException see
+* @return a component ready for initialization BruteForceLearner
**/
-public static BruteForceLearner getBruteForceLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+public static BruteForceLearner getBruteForceLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException {
return BruteForceLearnerConfigurator.getBruteForceLearner(learningProblem, reasoningService);
}
/**
+* @param learningProblem see LearningProblem
+* @param reasoningService see ReasoningService
+* @throws LearningProblemUnsupportedException see
+* @return a component ready for initialization DBpediaNavigationSuggestor
**/
-public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException {
return DBpediaNavigationSuggestorConfigurator.getDBpediaNavigationSuggestor(learningProblem, reasoningService);
}
/**
+* @param learningProblem see LearningProblem
+* @param reasoningService see ReasoningService
+* @throws LearningProblemUnsupportedException see
+* @return a component ready for initialization RandomGuesser
**/
-public static RandomGuesser getRandomGuesser (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+public static RandomGuesser getRandomGuesser(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException {
return RandomGuesserConfigurator.getRandomGuesser(learningProblem, reasoningService);
}
/**
+* @param learningProblem see LearningProblem
+* @param reasoningService see ReasoningService
+* @throws LearningProblemUnsupportedException see
+* @return a component ready for initialization GP
**/
-public static GP getGP (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+public static GP getGP(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException {
return GPConfigurator.getGP(learningProblem, reasoningService);
}
/**
+* @param learningProblem see LearningProblem
+* @param reasoningService see ReasoningService
+* @throws LearningProblemUnsupportedException see
+* @return a component ready for initialization ExampleBasedROLComponent
**/
-public static ExampleBasedROLComponent getExampleBasedROLComponent (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+public static ExampleBasedROLComponent getExampleBasedROLComponent(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException {
return ExampleBasedROLComponentConfigurator.getExampleBasedROLComponent(learningProblem, reasoningService);
}
/**
+* @param learningProblem see LearningProblem
+* @param reasoningService see ReasoningService
+* @throws LearningProblemUnsupportedException see
+* @return a component ready for initialization ROLearner
**/
-public static ROLearner getROLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException {
+public static ROLearner getROLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException {
return ROLearnerConfigurator.getROLearner(learningProblem, reasoningService);
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -2,7 +2,7 @@
* Copyright (C) 2007-2008, 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
@@ -15,7 +15,8 @@
*
* 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.core.configurators;
@@ -27,472 +28,508 @@
import org.dllearner.core.ReasoningService;
/**
-* automatically generated, do not edit manually
+* automatically generated, do not edit manually.
+* run org.dllearner.scripts.ConfigJavaGenerator to update
**/
public class DBpediaNavigationSuggestorConfigurator {
private boolean reinitNecessary = false;
-private DBpediaNavigationSuggestor DBpediaNavigationSuggestor;
+@SuppressWarnings("unused")
-public DBpediaNavigationSuggestorConfigurator (DBpediaNavigationSuggestor DBpediaNavigationSuggestor){
-this.DBpediaNavigationSuggestor = DBpediaNavigationSuggestor;
+private DBpediaNavigationSuggestor dBpediaNavigationSuggestor;
+
+/**
+* @param dBpediaNavigationSuggestor see DBpediaNavigationSuggestor
+**/
+public DBpediaNavigationSuggestorConfigurator(DBpediaNavigationSuggestor dBpediaNavigationSuggestor){
+this.dBpediaNavigationSuggestor = dBpediaNavigationSuggestor;
}
/**
+* @return DBpediaNavigationSuggestor
**/
-public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{
-DBpediaNavigationSuggestor component = ComponentManager.getInstance().learningAlgorithm(DBpediaNavigationSuggestor.class, learningProblem, reasoningService );
+public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{
+DBpediaNavigationSuggestor component = ComponentManager.getInstance().learningAlgorithm(DBpediaNavigationSuggestor.class, learningProblem, reasoningService);
return component;
}
/**
-* option name: writeSearchTree
-* specifies whether to write a search tree
+* writeSearchTree specifies whether to write a search tree.
+* mandatory: false| reinit necessary: true
* default value: false
+* @return boolean
**/
-public boolean getWriteSearchTree ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "writeSearchTree") ;
+public boolean getWriteSearchTree() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "writeSearchTree") ;
}
/**
-* option name: searchTreeFile
-* file to use for the search tree
+* searchTreeFile file to use for the search tree.
+* mandatory: false| reinit necessary: true
* default value: log/searchTree.txt
+* @return String
**/
-public String getSearchTreeFile ( ) {
-return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "searchTreeFile") ;
+public String getSearchTreeFile() {
+return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "searchTreeFile") ;
}
/**
-* option name: replaceSearchTree
-* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* replaceSearchTree specifies whether to replace the search tree in the log file after each run or append the new search tree.
+* mandatory: false| reinit necessary: true
* default value: false
+* @return boolean
**/
-public boolean getReplaceSearchTree ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "replaceSearchTree") ;
+public boolean getReplaceSearchTree() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "replaceSearchTree") ;
}
/**
-* option name: heuristic
-* specifiy the heuristic to use
+* heuristic specifiy the heuristic to use.
+* mandatory: false| reinit necessary: true
* default value: lexicographic
+* @return String
**/
-public String getHeuristic ( ) {
-return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "heuristic") ;
+public String getHeuristic() {
+return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "heuristic") ;
}
/**
-* option name: applyAllFilter
-* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* applyAllFilter usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D).
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getApplyAllFilter ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "applyAllFilter") ;
+public boolean getApplyAllFilter() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "applyAllFilter") ;
}
/**
-* option name: applyExistsFilter
-* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* applyExistsFilter usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D).
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getApplyExistsFilter ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "applyExistsFilter") ;
+public boolean getApplyExistsFilter() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "applyExistsFilter") ;
}
/**
-* option name: useTooWeakList
-* try to filter out too weak concepts without sending them to the reasoner
+* useTooWeakList try to filter out too weak concepts without sending them to the reasoner.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseTooWeakList ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useTooWeakList") ;
+public boolean getUseTooWeakList() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useTooWeakList") ;
}
/**
-* option name: useOverlyGeneralList
-* try to find overly general concept without sending them to the reasoner
+* useOverlyGeneralList try to find overly general concept without sending them to the reasoner.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseOverlyGeneralList ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useOverlyGeneralList") ;
+public boolean getUseOverlyGeneralList() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useOverlyGeneralList") ;
}
/**
-* option name: useShortConceptConstruction
-* shorten concept to see whether they already exist
+* useShortConceptConstruction shorten concept to see whether they already exist.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseShortConceptConstruction ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useShortConceptConstruction") ;
+public boolean getUseShortConceptConstruction() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useShortConceptConstruction") ;
}
/**
-* option name: horizontalExpansionFactor
-* horizontal expansion factor (see publication for description)
+* horizontalExpansionFactor horizontal expansion factor (see publication for description).
+* mandatory: false| reinit necessary: true
* default value: 0.6
+* @return double
**/
-public double getHorizontalExpansionFactor ( ) {
-return (Double) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "horizontalExpansionFactor") ;
+public double getHorizontalExpansionFactor() {
+return (Double) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "horizontalExpansionFactor") ;
}
/**
-* option name: improveSubsumptionHierarchy
-* simplify subsumption hierarchy to reduce search space (see publication for description)
+* improveSubsumptionHierarchy simplify subsumption hierarchy to reduce search space (see publication for description).
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getImproveSubsumptionHierarchy ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy") ;
+public boolean getImproveSubsumptionHierarchy() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "improveSubsumptionHierarchy") ;
}
/**
-* option name: allowedConcepts
-* concepts the algorithm is allowed to use
+* allowedConcepts concepts the algorithm is allowed to use.
+* mandatory: false| reinit necessary: true
* default value: null
+* @return Set(String)
**/
@SuppressWarnings("unchecked")
-public Set<String> getAllowedConcepts ( ) {
-return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "allowedConcepts") ;
+public Set<String> getAllowedConcepts() {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "allowedConcepts") ;
}
/**
-* option name: ignoredConcepts
-* concepts the algorithm must ignore
+* ignoredConcepts concepts the algorithm must ignore.
+* mandatory: false| reinit necessary: true
* default value: null
+* @return Set(String)
**/
@SuppressWarnings("unchecked")
-public Set<String> getIgnoredConcepts ( ) {
-return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "ignoredConcepts") ;
+public Set<String> getIgnoredConcepts() {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "ignoredConcepts") ;
}
/**
-* option name: allowedRoles
-* roles the algorithm is allowed to use
+* allowedRoles roles the algorithm is allowed to use.
+* mandatory: false| reinit necessary: true
* default value: null
+* @return Set(String)
**/
@SuppressWarnings("unchecked")
-public Set<String> getAllowedRoles ( ) {
-return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "allowedRoles") ;
+public Set<String> getAllowedRoles() {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "allowedRoles") ;
}
/**
-* option name: ignoredRoles
-* roles the algorithm must ignore
+* ignoredRoles roles the algorithm must ignore.
+* mandatory: false| reinit necessary: true
* default value: null
+* @return Set(String)
**/
@SuppressWarnings("unchecked")
-public Set<String> getIgnoredRoles ( ) {
-return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "ignoredRoles") ;
+public Set<String> getIgnoredRoles() {
+return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "ignoredRoles") ;
}
/**
-* option name: useAllConstructor
-* specifies whether the universal concept constructor is used in the learning algorithm
+* useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseAllConstructor ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useAllConstructor") ;
+public boolean getUseAllConstructor() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useAllConstructor") ;
}
/**
-* option name: useExistsConstructor
-* specifies whether the existential concept constructor is used in the learning algorithm
+* useExistsConstructor specifies whether the existential concept constructor is used in the learning algorithm.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseExistsConstructor ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useExistsConstructor") ;
+public boolean getUseExistsConstructor() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useExistsConstructor") ;
}
/**
-* option name: useCardinalityRestrictions
-* specifies whether CardinalityRestrictions is used in the learning algorithm
+* useCardinalityRestrictions specifies whether CardinalityRestrictions is used in the learning algorithm.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseCardinalityRestrictions ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useCardinalityRestrictions") ;
+public boolean getUseCardinalityRestrictions() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useCardinalityRestrictions") ;
}
/**
-* option name: useNegation
-* specifies whether negation is used in the learning algorothm
+* useNegation specifies whether negation is used in the learning algorothm.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseNegation ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useNegation") ;
+public boolean getUseNegation() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useNegation") ;
}
/**
-* option name: useBooleanDatatypes
-* specifies whether boolean datatypes are used in the learning algorothm
+* useBooleanDatatypes specifies whether boolean datatypes are used in the learning algorothm.
+* mandatory: false| reinit necessary: true
* default value: true
+* @return boolean
**/
-public boolean getUseBooleanDatatypes ( ) {
-return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useBooleanDatatypes") ;
+public boolean getUseBooleanDatatypes() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useBooleanDatatypes") ;
}
/**
-* option name: maxExecutionTimeInSeconds
-* algorithm will stop after specified seconds
+* maxExecutionTimeInSeconds algorithm will stop after specified seconds.
+* mandatory: false| reinit necessary: true
* default value: 0
+* @return int
**/
-public int getMaxExecutionTimeInSeconds ( ) {
-return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds") ;
+public int getMaxExecutionTimeInSeconds() {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "maxExecutionTimeInSeconds") ;
}
/**
-* option name: minExecutionTimeInSeconds
-* algorithm will run at least specified seconds
+* minExecutionTimeInSeconds algorithm will run at least specified seconds.
+* mandatory: false| reinit necessary: true
* default value: 0
+* @return int
**/
-public int getMinExecutionTimeInSeconds ( ) {
-return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds") ;
+public int getMinExecutionTimeInSeconds() {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "minExecutionTimeInSeconds") ;
}
/**
-* option name: guaranteeXgoodDescriptions
-* algorithm will run until X good (100%) concept descritpions are found
+* guaranteeXgoodDescriptions algorithm will run until X good (100%) concept descritpions are found.
+* mandatory: false| reinit necessary: true
* default value: 1
+* @return int
**/
-public int getGuaranteeXgoodDescriptions ( ) {
-return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions") ;
+public int getGuaranteeXgoodDescriptions() {
+return (Integer) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "guaranteeXgoodDescriptions") ;
}
/**
-* option name: logLevel
-* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* logLevel determines the logLevel for this component, can be {TRACE, DEBUG, INFO}.
+* mandatory: false| reinit necessary: true
* default value: DEBUG
+* @return String
**/
-public String getLogLevel ( ) {
-return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "logLevel") ;
+public String getLogLevel() {
+return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "logLevel") ;
}
/**
-* option name: noisePercentage
-* the (approximated) percentage of noise within the examples
+* noisePercentage the (approximated) percentage of noise within the examples.
+* mandatory: false| reinit necessary: true
* default value: 0.0
+* @return double
**/
-public double getNoisePercentage ( ) {
-return (Double) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "noisePercentage") ;
+public double getNoisePercentage() {
+return (Double) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "noisePercentage") ;
}
/**
-* option name: startClass
-* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class).
+* mandatory: false| reinit necessary: true
* default value: null
+* @return String
**/
-public String getStartClass ( ) {
-return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "startClass") ;
+public String getStartClass() {
+return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "startClass") ;
}
/**
-* option name: writeSearchTree
-* specifies whether to write a search tree
+* @param writeSearchTree specifies whether to write a search tree.
+* mandatory: false| reinit necessary: true
* default value: false
**/
-public void setWriteSearchTree ( boolean writeSearchTree) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "writeSearchTree", writeSearchTree);
+public void setWriteSearchTree(boolean writeSearchTree) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "writeSearchTree", writeSearchTree);
reinitNecessary = true;
}
/**
-* option name: searchTreeFile
-* file to use for the search tree
+* @param searchTreeFile file to use for the search tree.
+* mandatory: false| reinit necessary: true
* default value: log/searchTree.txt
**/
-public void setSearchTreeFile ( String searchTreeFile) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "searchTreeFile", searchTreeFile);
+public void setSearchTreeFile(String searchTreeFile) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "searchTreeFile", searchTreeFile);
reinitNecessary = true;
}
/**
-* option name: replaceSearchTree
-* specifies whether to replace the search tree in the log file after each run or append the new search tree
+* @param replaceSearchTree specifies whether to replace the search tree in the log file after each run or append the new search tree.
+* mandatory: false| reinit necessary: true
* default value: false
**/
-public void setReplaceSearchTree ( boolean replaceSearchTree) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "replaceSearchTree", replaceSearchTree);
+public void setReplaceSearchTree(boolean replaceSearchTree) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "replaceSearchTree", replaceSearchTree);
reinitNecessary = true;
}
/**
-* option name: heuristic
-* specifiy the heuristic to use
+* @param heuristic specifiy the heuristic to use.
+* mandatory: false| reinit necessary: true
* default value: lexicographic
**/
-public void setHeuristic ( String heuristic) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "heuristic", heuristic);
+public void setHeuristic(String heuristic) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "heuristic", heuristic);
reinitNecessary = true;
}
/**
-* option name: applyAllFilter
-* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D)
+* @param applyAllFilter usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D).
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setApplyAllFilter ( boolean applyAllFilter) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "applyAllFilter", applyAllFilter);
+public void setApplyAllFilter(boolean applyAllFilter) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "applyAllFilter", applyAllFilter);
reinitNecessary = true;
}
/**
-* option name: applyExistsFilter
-* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D)
+* @param applyExistsFilter usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D).
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setApplyExistsFilter ( boolean applyExistsFilter) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "applyExistsFilter", applyExistsFilter);
+public void setApplyExistsFilter(boolean applyExistsFilter) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "applyExistsFilter", applyExistsFilter);
reinitNecessary = true;
}
/**
-* option name: useTooWeakList
-* try to filter out too weak concepts without sending them to the reasoner
+* @param useTooWeakList try to filter out too weak concepts without sending them to the reasoner.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseTooWeakList ( boolean useTooWeakList) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useTooWeakList", useTooWeakList);
+public void setUseTooWeakList(boolean useTooWeakList) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useTooWeakList", useTooWeakList);
reinitNecessary = true;
}
/**
-* option name: useOverlyGeneralList
-* try to find overly general concept without sending them to the reasoner
+* @param useOverlyGeneralList try to find overly general concept without sending them to the reasoner.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseOverlyGeneralList ( boolean useOverlyGeneralList) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useOverlyGeneralList", useOverlyGeneralList);
+public void setUseOverlyGeneralList(boolean useOverlyGeneralList) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useOverlyGeneralList", useOverlyGeneralList);
reinitNecessary = true;
}
/**
-* option name: useShortConceptConstruction
-* shorten concept to see whether they already exist
+* @param useShortConceptConstruction shorten concept to see whether they already exist.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseShortConceptConstruction ( boolean useShortConceptConstruction) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useShortConceptConstruction", useShortConceptConstruction);
+public void setUseShortConceptConstruction(boolean useShortConceptConstruction) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useShortConceptConstruction", useShortConceptConstruction);
reinitNecessary = true;
}
/**
-* option name: horizontalExpansionFactor
-* horizontal expansion factor (see publication for description)
+* @param horizontalExpansionFactor horizontal expansion factor (see publication for description).
+* mandatory: false| reinit necessary: true
* default value: 0.6
**/
-public void setHorizontalExpansionFactor ( double horizontalExpansionFactor) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "horizontalExpansionFactor", horizontalExpansionFactor);
+public void setHorizontalExpansionFactor(double horizontalExpansionFactor) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "horizontalExpansionFactor", horizontalExpansionFactor);
reinitNecessary = true;
}
/**
-* option name: improveSubsumptionHierarchy
-* simplify subsumption hierarchy to reduce search space (see publication for description)
+* @param improveSubsumptionHierarchy simplify subsumption hierarchy to reduce search space (see publication for description).
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setImproveSubsumptionHierarchy ( boolean improveSubsumptionHierarchy) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy", improveSubsumptionHierarchy);
+public void setImproveSubsumptionHierarchy(boolean improveSubsumptionHierarchy) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "improveSubsumptionHierarchy", improveSubsumptionHierarchy);
reinitNecessary = true;
}
/**
-* option name: allowedConcepts
-* concepts the algorithm is allowed to use
+* @param allowedConcepts concepts the algorithm is allowed to use.
+* mandatory: false| reinit necessary: true
* default value: null
**/
-public void setAllowedConcepts ( Set<String> allowedConcepts) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "allowedConcepts", allowedConcepts);
+public void setAllowedConcepts(Set<String> allowedConcepts) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "allowedConcepts", allowedConcepts);
reinitNecessary = true;
}
/**
-* option name: ignoredConcepts
-* concepts the algorithm must ignore
+* @param ignoredConcepts concepts the algorithm must ignore.
+* mandatory: false| reinit necessary: true
* default value: null
**/
-public void setIgnoredConcepts ( Set<String> ignoredConcepts) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "ignoredConcepts", ignoredConcepts);
+public void setIgnoredConcepts(Set<String> ignoredConcepts) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "ignoredConcepts", ignoredConcepts);
reinitNecessary = true;
}
/**
-* option name: allowedRoles
-* roles the algorithm is allowed to use
+* @param allowedRoles roles the algorithm is allowed to use.
+* mandatory: false| reinit necessary: true
* default value: null
**/
-public void setAllowedRoles ( Set<String> allowedRoles) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "allowedRoles", allowedRoles);
+public void setAllowedRoles(Set<String> allowedRoles) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "allowedRoles", allowedRoles);
reinitNecessary = true;
}
/**
-* option name: ignoredRoles
-* roles the algorithm must ignore
+* @param ignoredRoles roles the algorithm must ignore.
+* mandatory: false| reinit necessary: true
* default value: null
**/
-public void setIgnoredRoles ( Set<String> ignoredRoles) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "ignoredRoles", ignoredRoles);
+public void setIgnoredRoles(Set<String> ignoredRoles) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "ignoredRoles", ignoredRoles);
reinitNecessary = true;
}
/**
-* option name: useAllConstructor
-* specifies whether the universal concept constructor is used in the learning algorithm
+* @param useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseAllConstructor ( boolean useAllConstructor) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useAllConstructor", useAllConstructor);
+public void setUseAllConstructor(boolean useAllConstructor) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useAllConstructor", useAllConstructor);
reinitNecessary = true;
}
/**
-* option name: useExistsConstructor
-* specifies whether the existential concept constructor is used in the learning algorithm
+* @param useExistsConstructor specifies whether the existential concept constructor is used in the learning algorithm.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseExistsConstructor ( boolean useExistsConstructor) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useExistsConstructor", useExistsConstructor);
+public void setUseExistsConstructor(boolean useExistsConstructor) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useExistsConstructor", useExistsConstructor);
reinitNecessary = true;
}
/**
-* option name: useCardinalityRestrictions
-* specifies whether CardinalityRestrictions is used in the learning algorithm
+* @param useCardinalityRestrictions specifies whether CardinalityRestrictions is used in the learning algorithm.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseCardinalityRestrictions ( boolean useCardinalityRestrictions) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useCardinalityRestrictions", useCardinalityRestrictions);
+public void setUseCardinalityRestrictions(boolean useCardinalityRestrictions) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useCardinalityRestrictions", useCardinalityRestrictions);
reinitNecessary = true;
}
/**
-* option name: useNegation
-* specifies whether negation is used in the learning algorothm
+* @param useNegation specifies whether negation is used in the learning algorothm.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseNegation ( boolean useNegation) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useNegation", useNegation);
+public void setUseNegation(boolean useNegation) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useNegation", useNegation);
reinitNecessary = true;
}
/**
-* option name: useBooleanDatatypes
-* specifies whether boolean datatypes are used in the learning algorothm
+* @param useBooleanDatatypes specifies whether boolean datatypes are used in the learning algorothm.
+* mandatory: false| reinit necessary: true
* default value: true
**/
-public void setUseBooleanDatatypes ( boolean useBooleanDatatypes) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useBooleanDatatypes", useBooleanDatatypes);
+public void setUseBooleanDatatypes(boolean useBooleanDatatypes) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useBooleanDatatypes", useBooleanDatatypes);
reinitNecessary = true;
}
/**
-* option name: maxExecutionTimeInSeconds
-* algorithm will stop after specified seconds
+* @param maxExecutionTimeInSeconds algorithm will stop after specified seconds.
+* mandatory: false| reinit necessary: true
* default value: 0
**/
-public void setMaxExecutionTimeInSeconds ( int maxExecutionTimeInSeconds) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds);
+public void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds);
reinitNecessary = true;
}
/**
-* option name: minExecutionTimeInSeconds
-* algorithm will run at least specified seconds
+* @param minExecutionTimeInSeconds algorithm will run at least specified seconds.
+* mandatory: false| reinit necessary: true
* default value: 0
**/
-public void setMinExecutionTimeInSeconds ( int minExecutionTimeInSeconds) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
+public void setMinExecutionTimeInSeconds(int minExecutionTimeInSeconds) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
reinitNecessary = true;
}
/**
-* option name: guaranteeXgoodDescriptions
-* algorithm will run until X good (100%) concept descritpions are found
+* @param guaranteeXgoodDescriptions algorithm will run until X good (100%) concept descritpions are found.
+* mandatory: false| reinit necessary: true
* default value: 1
**/
-public void setGuaranteeXgoodDescriptions ( int guaranteeXgoodDescriptions) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions);
+public void setGuaranteeXgoodDescriptions(int guaranteeXgoodDescriptions) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions);
reinitNecessary = true;
}
/**
-* option name: logLevel
-* determines the logLevel for this component, can be {TRACE, DEBUG, INFO}
+* @param logLevel determines the logLevel for this component, can be {TRACE, DEBUG, INFO}.
+* mandatory: false| reinit necessary: true
* default value: DEBUG
**/
-public void setLogLevel ( String logLevel) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "logLevel", logLevel);
+public void setLogLevel(String logLevel) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "logLevel", logLevel);
reinitNecessary = true;
}
/**
-* option name: noisePercentage
-* the (approximated) percentage of noise within the examples
+* @param noisePercentage the (approximated) percentage of noise within the examples.
+* mandatory: false| reinit necessary: true
* default value: 0.0
**/
-public void setNoisePercentage ( double noisePercentage) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "noisePercentage", noisePercentage);
+public void setNoisePercentage(double noisePercentage) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "noisePercentage", noisePercentage);
reinitNecessary = true;
}
/**
-* option name: startClass
-* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)
+* @param startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class).
+* mandatory: false| reinit necessary: true
* default value: null
**/
-public void setStartClass ( String startClass) {
-ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "startClass", startClass);
+public void setStartClass(String startClass) {
+ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "startClass", startClass);
reinitNecessary = true;
}
+/**
+* true, if this component needs reinitializsation
+**/
public boolean isReinitNecessary(){
return reinitNecessary;
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 12:38:52 UTC (rev 1175)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 15:41:10 UTC (rev 1176)
@@ -2,7 +2,7 @@
* Copyright (C) 2007-2008, 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
@@ -15,7 +15,8 @@
*
* 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.core.configurators;
@@ -24,77 +25,90 @@
import org.dllearner.reasoning.DIGReasoner;
/**
-* automatically generated, do not edit manually
+* automatically generated, do not edit manually.
+* run org.dllearner.scripts.ConfigJavaGenerator to update
**/
public class DIGReasonerConfigurator {
private boolean reinitNecessary = false;
-private DIGReasoner DIGReasoner;
+@SuppressWarnings("unused")
-public DIGReasonerConfigurator (DIGReasoner DIGReasoner){
-this.DIGReasoner = DIGReasoner;
+private DIGReasoner dIGReasoner;
+
+/**
+* @param dIGReasoner see DIGReasoner
+**/
+public DIGReasonerConfigurator(DIGReasoner dIGReasoner){
+this.dIGReasoner = dIGReasoner;
}
/**
+* @return DIGReasoner
**/
-public static DIGReasoner getDIGReasoner (KnowledgeSource knowledgeSource ) {
-DIGReasoner component = ComponentManager.getInstance().reasoner(DIGReasoner.class, knowledgeSource );
+public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) {
+DIGReasoner component =...
[truncated message content] |
|
From: <ku...@us...> - 2008-09-08 17:26:35
|
Revision: 1178
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1178&view=rev
Author: kurzum
Date: 2008-09-08 17:26:27 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
some fixes
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java
trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java
trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java
trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
trunk/src/dl-learner/org/dllearner/scripts/NewSample.java
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -77,7 +77,7 @@
* @param knowledgeSource see KnowledgeSource
* @return a component ready for initialization DIGReasoner
**/
-public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) {
+public static DIGReasoner getDIGReasoner(Set<KnowledgeSource> knowledgeSource) {
return DIGReasonerConfigurator.getDIGReasoner(knowledgeSource);
}
@@ -85,7 +85,7 @@
* @param knowledgeSource see KnowledgeSource
* @return a component ready for initialization FastInstanceChecker
**/
-public static FastInstanceChecker getFastInstanceChecker(KnowledgeSource knowledgeSource) {
+public static FastInstanceChecker getFastInstanceChecker(Set<KnowledgeSource> knowledgeSource) {
return FastInstanceCheckerConfigurator.getFastInstanceChecker(knowledgeSource);
}
@@ -93,7 +93,7 @@
* @param knowledgeSource see KnowledgeSource
* @return a component ready for initialization FastRetrievalReasoner
**/
-public static FastRetrievalReasoner getFastRetrievalReasoner(KnowledgeSource knowledgeSource) {
+public static FastRetrievalReasoner getFastRetrievalReasoner(Set<KnowledgeSource> knowledgeSource) {
return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(knowledgeSource);
}
@@ -101,7 +101,7 @@
* @param knowledgeSource see KnowledgeSource
* @return a component ready for initialization OWLAPIReasoner
**/
-public static OWLAPIReasoner getOWLAPIReasoner(KnowledgeSource knowledgeSource) {
+public static OWLAPIReasoner getOWLAPIReasoner(Set<KnowledgeSource> knowledgeSource) {
return OWLAPIReasonerConfigurator.getOWLAPIReasoner(knowledgeSource);
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -20,6 +20,7 @@
package org.dllearner.core.configurators;
+import java.util.Set;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
import org.dllearner.reasoning.DIGReasoner;
@@ -45,7 +46,7 @@
/**
* @return DIGReasoner
**/
-public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) {
+public static DIGReasoner getDIGReasoner(Set<KnowledgeSource> knowledgeSource) {
DIGReasoner component = ComponentManager.getInstance().reasoner(DIGReasoner.class, knowledgeSource);
return component;
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -20,6 +20,7 @@
package org.dllearner.core.configurators;
+import java.util.Set;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
import org.dllearner.reasoning.FastInstanceChecker;
@@ -45,7 +46,7 @@
/**
* @return FastInstanceChecker
**/
-public static FastInstanceChecker getFastInstanceChecker(KnowledgeSource knowledgeSource) {
+public static FastInstanceChecker getFastInstanceChecker(Set<KnowledgeSource> knowledgeSource) {
FastInstanceChecker component = ComponentManager.getInstance().reasoner(FastInstanceChecker.class, knowledgeSource);
return component;
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -20,6 +20,7 @@
package org.dllearner.core.configurators;
+import java.util.Set;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
import org.dllearner.reasoning.FastRetrievalReasoner;
@@ -45,7 +46,7 @@
/**
* @return FastRetrievalReasoner
**/
-public static FastRetrievalReasoner getFastRetrievalReasoner(KnowledgeSource knowledgeSource) {
+public static FastRetrievalReasoner getFastRetrievalReasoner(Set<KnowledgeSource> knowledgeSource) {
FastRetrievalReasoner component = ComponentManager.getInstance().reasoner(FastRetrievalReasoner.class, knowledgeSource);
return component;
}
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -20,6 +20,7 @@
package org.dllearner.core.configurators;
+import java.util.Set;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.KnowledgeSource;
import org.dllearner.reasoning.OWLAPIReasoner;
@@ -45,7 +46,7 @@
/**
* @return OWLAPIReasoner
**/
-public static OWLAPIReasoner getOWLAPIReasoner(KnowledgeSource knowledgeSource) {
+public static OWLAPIReasoner getOWLAPIReasoner(Set<KnowledgeSource> knowledgeSource) {
OWLAPIReasoner component = ComponentManager.getInstance().reasoner(OWLAPIReasoner.class, knowledgeSource);
return component;
}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -74,16 +74,19 @@
public class SparqlKnowledgeSource extends KnowledgeSource {
// RBC
- static final boolean debug = false;
+ private static final boolean debug = false;
// tupleaquisitor
- static final boolean debugUseImprovedTupleAquisitor = debug && false; // switches
+ private static final boolean debugUseImprovedTupleAquisitor = debug && false; // switches
// sysex
- static final boolean debugExitAfterExtraction = debug && false; // switches
+ private static final boolean debugExitAfterExtraction = debug && false; // switches
private SparqlKnowledgeSourceConfigurator configurator;
+ /**
+ * @return the configurator for this Knowledgesource
+ */
public SparqlKnowledgeSourceConfigurator getConfigurator() {
return configurator;
}
@@ -93,7 +96,7 @@
}
// ConfigOptions
- public URL url;
+ private URL url;
private String format = "N-TRIPLES";
@@ -101,7 +104,7 @@
private URL dumpFile;
- SparqlEndpoint endpoint = null;
+ private SparqlEndpoint endpoint = null;
// received ontology as array, used if format=Array(an element of the
// array consists of the subject, predicate and object separated by '<'
@@ -113,6 +116,7 @@
// mainly used for statistic
private int nrOfExtractedTriples = 0;
+
public static String getName() {
return "SPARQL Endpoint";
}
@@ -193,9 +197,9 @@
options.add(CommonConfigOptions.getVerbosityOption());
options.add(new StringSetConfigOption("defaultGraphURIs",
- "a list of all default Graph URIs", new TreeSet<String> (), false, true));
+ "a list of all default Graph URIs", new TreeSet<String>(), false, true));
options.add(new StringSetConfigOption("namedGraphURIs",
- "a list of all named Graph URIs", new TreeSet<String> (), false, true));
+ "a list of all named Graph URIs", new TreeSet<String>(), false, true));
return options;
}
@@ -203,7 +207,7 @@
* @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry)
*/
@Override
- @SuppressWarnings( { "unchecked" })
+ @SuppressWarnings({ "unchecked" })
public <T> void applyConfigEntry(ConfigEntry<T> entry)
throws InvalidConfigOptionValueException {
//TODO remove this function
@@ -311,11 +315,12 @@
*/
@Override
public String toDIG(URI kbURI) {
- if (format.equals("N-TRIPLES"))
+ if (format.equals("N-TRIPLES")){
return JenaOWLDIGConverter.getTellsString(dumpFile,
OntologyFormat.N_TRIPLES, kbURI);
- else
+ }else {
return DIGConverter.getDIGString(kb, kbURI).toString();
+ }
}
/*
@@ -332,8 +337,16 @@
throw new OntologyFormatUnsupportedException("export", format);
}
+ /**
+ * @return the URL of the used sparql endpoint
+ */
public URL getURL() {
- return url;
+ if(url == null && endpoint!=null){
+ return endpoint.getURL();
+ }
+ else{
+ return url;
+ }
}
public String[] getOntArray() {
@@ -366,11 +379,12 @@
// get Options for endpoints
- if (configurator.getUseCache())
+ if (configurator.getUseCache()){
return new SPARQLTasks(new Cache(configurator.getCacheDir()),
getSparqlEndpoint());
- else
+ }else {
return new SPARQLTasks(getSparqlEndpoint());
+ }
}
public SparqlQueryMaker getSparqlQueryMaker() {
Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -46,8 +46,7 @@
*/
public class PosNegDefinitionLP extends PosNegLP implements DefinitionLP {
-
-
+
public PosNegDefinitionLP(ReasoningService reasoningService) {
super(reasoningService);
}
Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -39,6 +39,7 @@
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.config.InvalidConfigOptionValueException;
import org.dllearner.core.config.StringConfigOption;
+import org.dllearner.core.configurators.ComponentFactory;
import org.dllearner.core.configurators.FastInstanceCheckerConfigurator;
import org.dllearner.core.owl.BooleanValueRestriction;
import org.dllearner.core.owl.DataRange;
@@ -90,8 +91,6 @@
private boolean defaultNegation = true;
- private String reasonerType = "pellet";
-
private FastInstanceCheckerConfigurator configurator;
public FastInstanceCheckerConfigurator getConfigurator (){
return configurator;
@@ -128,12 +127,13 @@
public FastInstanceChecker(Set<KnowledgeSource> sources) {
this.sources = sources;
+ this.configurator = new FastInstanceCheckerConfigurator(this);
}
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet to dematerialize", "pellet");
+ StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet to dematerialize", "pellet", false, true);
type.setAllowedValues(new String[] {"fact", "pellet"});
// closure option? see:
// http://owlapi.svn.sourceforge.net/viewvc/owlapi/owl1_1/trunk/tutorial/src/main/java/uk/ac/manchester/owl/tutorial/examples/ClosureAxiomsExample.java?view=markup
@@ -148,9 +148,6 @@
*/
@Override
public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException {
- String name = entry.getOptionName();
- if(name.equals("reasonerType"))
- reasonerType = (String) entry.getValue();
}
public static String getName() {
@@ -165,8 +162,9 @@
*/
@Override
public void init() throws ComponentInitException {
- rc = new OWLAPIReasoner(sources);
- rc.setReasonerType(reasonerType);
+ //rc = new OWLAPIReasoner(sources);
+ rc = ComponentFactory.getOWLAPIReasoner(sources);
+ rc.getConfigurator().setReasonerType(configurator.getReasonerType());
rc.init();
try {
@@ -629,7 +627,7 @@
}
public void setReasonerType(String type){
- reasonerType=type;
+ configurator.setReasonerType(type);
}
Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -103,7 +103,7 @@
// private static Logger logger = Logger
// .getLogger(OWLAPIReasoner.class);
- private String reasonerType = "pellet";
+ //private String reasonerType = "pellet";
private OWLAPIReasonerConfigurator configurator;
public OWLAPIReasonerConfigurator getConfigurator(){
return configurator;
@@ -151,7 +151,7 @@
public static Collection<ConfigOption<?>> createConfigOptions() {
Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>();
- StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet, which means \"pellet\" or \"fact\"", "pellet");
+ StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet, which means \"pellet\" or \"fact\"", "pellet", false, true);
type.setAllowedValues(new String[] {"fact", "pellet"});
// closure option? see:
// http://owlapi.svn.sourceforge.net/viewvc/owlapi/owl1_1/trunk/tutorial/src/main/java/uk/ac/manchester/owl/tutorial/examples/ClosureAxiomsExample.java?view=markup
@@ -164,9 +164,7 @@
*/
@Override
public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException {
- String name = entry.getOptionName();
- if(name.equals("reasonerType"))
- reasonerType = (String) entry.getValue();
+
}
@Override
@@ -269,7 +267,7 @@
}
// create actual reasoner
- if(reasonerType.equals("fact")) {
+ if(configurator.getReasonerType().equals("fact")) {
try {
reasoner = new uk.ac.manchester.cs.factplusplus.owlapi.Reasoner(manager);
} catch (Exception e) {
@@ -388,7 +386,7 @@
* @see org.dllearner.core.Reasoner#getReasonerType()
*/
public ReasonerType getReasonerType() {
- if(reasonerType.equals("FaCT++"))
+ if(configurator.getReasonerType().equals("fact"))
return ReasonerType.FACT;
else
return ReasonerType.PELLET;
@@ -948,7 +946,7 @@
}
public void setReasonerType(String type){
- reasonerType=type;
+ configurator.setReasonerType(type);
}
@Override
Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -26,6 +26,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -148,7 +149,8 @@
ConfigJavaGenerator c = new ConfigJavaGenerator(component,
"reasoner");
c.imports.add("org.dllearner.core.KnowledgeSource");
- c.additionalMandatoryVars.put("KnowledgeSource knowledgeSource",
+ c.imports.add(Set.class.getCanonicalName());
+ c.additionalMandatoryVars.put("Set<KnowledgeSource> knowledgeSource",
"knowledgeSource");
c.makeConfigurator();
@@ -338,9 +340,13 @@
ret += applyConf;
ret += "return component;\n}\n";
+
return ret;
}
+
+
+
private String makeComponentFactoryMethods(String comments) {
Map<String, String> parametersWithType = new LinkedHashMap<String, String>();
Modified: trunk/src/dl-learner/org/dllearner/scripts/NewSample.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-08 15:43:39 UTC (rev 1177)
+++ trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-08 17:26:27 UTC (rev 1178)
@@ -20,7 +20,9 @@
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -33,6 +35,7 @@
import org.dllearner.core.ComponentInitException;
import org.dllearner.core.ComponentManager;
import org.dllearner.core.EvaluatedDescription;
+import org.dllearner.core.KnowledgeSource;
import org.dllearner.core.LearningProblemUnsupportedException;
import org.dllearner.core.ReasoningService;
import org.dllearner.core.configurators.ComponentFactory;
@@ -119,9 +122,10 @@
String fileURL = new File(owlFile).toURI().toString();
OWLFile ks = ComponentFactory.getOWLFile( fileURL);
-
+ Set<KnowledgeSource> tmp = new HashSet<KnowledgeSource>();
+ tmp.add(ks);
// reasoner
- FastInstanceChecker f = ComponentFactory.getFastInstanceChecker( ks);
+ FastInstanceChecker f = ComponentFactory.getFastInstanceChecker(tmp);
ReasoningService rs = cm.reasoningService(f);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|