001 /**
002 * Copyright (C) 2007-2008, Jens Lehmann
003 *
004 * This file is part of DL-Learner.
005 *
006 * DL-Learner is free software; you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation; either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * DL-Learner is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program. If not, see <http://www.gnu.org/licenses/>.
018 *
019 */
020 package org.dllearner.tools.ore;
021
022 import java.util.SortedSet;
023 import java.util.TreeSet;
024
025 import org.dllearner.core.LearningAlgorithm;
026 import org.dllearner.kb.sparql.SPARQLTasks;
027 import org.dllearner.kb.sparql.SparqlEndpoint;
028 import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL;
029 import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL;
030 import org.dllearner.utilities.learn.LearnSPARQLConfiguration;
031
032 /**
033 * Test class for SPARQL mode.
034 * @author Lorenz Buehmann
035 *
036 */
037 public class SPARQLTest{
038
039 @SuppressWarnings("unused")
040 public static void main(String[] args){
041
042 SparqlEndpoint endPoint = SparqlEndpoint.getEndpointDBpedia();
043
044 SPARQLTasks task = new SPARQLTasks(endPoint);
045
046 AutomaticPositiveExampleFinderSPARQL pos = new AutomaticPositiveExampleFinderSPARQL(task);
047 pos.makePositiveExamplesFromConcept("angela_merkel");
048 SortedSet<String> posExamples = pos.getPosExamples();
049
050 AutomaticNegativeExampleFinderSPARQL neg = new AutomaticNegativeExampleFinderSPARQL(posExamples, task, new TreeSet<String>());
051 SortedSet<String> negExamples = neg.getNegativeExamples(20);
052
053 LearnSPARQLConfiguration conf = new LearnSPARQLConfiguration();
054
055 // TODO Please update class to either use ComponentManager or
056 // add a convenience constructor to org.dllearner.utilities.components.ComponentCombo
057
058 // LearnSparql learn = new LearnSparql(conf);
059
060 LearningAlgorithm la = null;
061
062 // try {
063 //la = learn.learn(posExamples, negExamples, OWLAPIReasoner.class);
064 // } catch (ComponentInitException e) {
065 // // TODO Auto-generated catch block
066 // e.printStackTrace();
067 // } catch (LearningProblemUnsupportedException e) {
068 // // TODO Auto-generated catch block
069 // e.printStackTrace();
070 // }
071
072 la.start();
073 }
074 }