From: <lor...@us...> - 2009-11-24 08:48:37
|
Revision: 1917 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1917&view=rev Author: lorenz_b Date: 2009-11-24 08:48:27 +0000 (Tue, 24 Nov 2009) Log Message: ----------- Modified workflow - now in automatic learning mode, pressing the 'Save and go back to class choose panel' button in the last wizard step brings back to automatic learning view. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ConcurrencyBug.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ConcurrencyBug.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ConcurrencyBug.java 2009-11-24 07:14:29 UTC (rev 1916) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ConcurrencyBug.java 2009-11-24 08:48:27 UTC (rev 1917) @@ -4,18 +4,32 @@ import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; -import java.util.Timer; -import java.util.TimerTask; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.kb.OWLAPIOntology; import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.reasoning.PelletReasoner; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLEntity; +import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import uk.ac.manchester.cs.owl.modularity.ModuleType; + +import com.clarkparsia.explanation.util.OntologyUtils; +import com.clarkparsia.modularity.ModularityUtils; + public class ConcurrencyBug { /** @@ -27,15 +41,29 @@ * @throws LearningProblemUnsupportedException */ public static void main(String[] args) throws MalformedURLException, ComponentInitException, OWLOntologyCreationException, URISyntaxException, LearningProblemUnsupportedException { - File file = new File("examples/swore/swore.rdf"); - URL classToDescribe = new URL("http://ns.softwiki.de/req/CustomerRequirement"); + File file = new File("examples/family-benchmark/family-benchmark_rich_background.owl"); + URL classToDescribe = new URL("http://www.benchmark.org/family#Father"); + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLDataFactory factory = manager.getOWLDataFactory(); + OWLClass father = factory.getOWLClass(classToDescribe.toURI()); + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(file.toURI()); + Set<OWLEntity> signature = new HashSet<OWLEntity>(); + for(OWLDescription d : father.getSuperClasses(ontology)){ + signature.addAll(d.getSignature()); + } + signature.addAll(father.getSignature()); + + OWLOntology module = com.clarkparsia.owlapi.OntologyUtils.getOntologyFromAxioms(ModularityUtils.extractModule(ontology, signature, ModuleType.TOP_OF_BOT)); ComponentManager cm = ComponentManager.getInstance(); + OWLAPIOntology ont = new OWLAPIOntology(module); + ont.init(); + OWLFile ks = cm.knowledgeSource(OWLFile.class); ((OWLFile)ks).getConfigurator().setUrl(file.toURI().toURL()); ks.init(); - PelletReasoner reasoner = cm.reasoner(PelletReasoner.class, ks); + PelletReasoner reasoner = cm.reasoner(PelletReasoner.class, ont); reasoner.init(); reasoner.loadOntologies(); reasoner.dematerialise(); @@ -53,19 +81,19 @@ la.getConfigurator().setMaxNrOfResults(10); la.init(); - Timer timer = new Timer(); - timer.schedule(new TimerTask() { - - @Override - public void run() { - if(la.isRunning()){ - System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true)); - } else { - cancel(); - } - - } - }, 1000, 1000); +// Timer timer = new Timer(); +// timer.schedule(new TimerTask() { +// +// @Override +// public void run() { +// if(la.isRunning()){ +// System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true)); +// } else { +// cancel(); +// } +// +// } +// }, 1000, 1000); la.start(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java 2009-11-24 07:14:29 UTC (rev 1916) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java 2009-11-24 08:48:27 UTC (rev 1917) @@ -80,7 +80,11 @@ OntologyModifier modifier = OREManager.getInstance().getModifier(); if(e.getActionCommand().equals("Save and go to class choose panel")){ modifier.saveOntology(); - getWizard().setCurrentPanel(ClassChoosePanelDescriptor.IDENTIFIER); + if(LearningManager.getInstance().getLearningMode() == LearningManager.MANUAL_LEARN_MODE){ + getWizard().setCurrentPanel(ClassChoosePanelDescriptor.IDENTIFIER); + } else { + getWizard().setCurrentPanel(AutoLearnPanelDescriptor.IDENTIFIER); + } }else if(e.getActionCommand().equals("Save and Exit")){ modifier.saveOntology(); getWizard().close(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |