You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ku...@us...> - 2008-09-25 16:20:57
|
Revision: 1258 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1258&view=rev Author: kurzum Date: 2008-09-25 16:20:47 +0000 (Thu, 25 Sep 2008) Log Message: ----------- server commit Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java Modified: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-25 15:49:07 UTC (rev 1257) +++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-25 16:20:47 UTC (rev 1258) @@ -20,6 +20,9 @@ package org.dllearner.scripts; import java.io.File; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -28,21 +31,19 @@ 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.ComponentManager; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasoningService; +import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.core.owl.Individual; -import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.kb.sparql.SparqlKnowledgeSource; +import org.dllearner.learningproblems.PosNegDefinitionLP; 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; @@ -51,289 +52,204 @@ 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<? extends ReasonerComponent> usedReasoner = OWLAPIReasoner.class; - + + private static String ontologyPath = "examples/semantic_bible/NTNcombined.owl"; + private static int numberOfLearningProblems = 100; - + + private static String baseDir = "sembib/"; + + private static String baseDirSparql = baseDir + "sparql/"; + + private static String baseDirNormal = baseDir + "normal/"; + private static boolean allOrExists = true; + private static boolean tenORthirty = true; - - private static boolean sparql = true; - + private static boolean DEBUG = false; - //private static boolean allOrExists = true; + // private static boolean allOrExists = true; + /** * @param args */ public static void main(String[] args) { initLogger(); logger.info("started"); - //String fileURL = new File(ontologyFile).toURI().toString(); - + // 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()); - + allIndividuals.addAll(reasoningService.getIndividuals()); + reasoningService = null; ComponentManager.getInstance().freeAllComponents(); - + int count = 0; - while(count<numberOfLearningProblems){ - - /*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; + while (count < numberOfLearningProblems) { + + 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); + } + } - //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; - if(sparql){ - d = learnSPARQL( positiveEx, negativeEx); - }else { - d = learnOriginal( positiveEx, negativeEx); - } - - - - String div = (System.currentTimeMillis()%10000)+""; - if(d.getAccuracy()>=0.99){ - filename +="99+"; - }else if(d.getAccuracy()>=0.90){ - filename +="90+"; - }else if(d.getAccuracy()>=0.80){ - filename +="80+"; - }else if(d.getAccuracy()>=0.70){ - filename +="70+"; - }else if(d.getAccuracy()>0.50){ - filename +="50+"; - }else { - filename +="50-"; - } - filename+="_"; - filename+=(d.getDescriptionLength()<10)?"0"+d.getDescriptionLength():d.getDescriptionLength()+""; - 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) { + + EvaluatedDescription d; + + d = learnSPARQL(positiveEx, negativeEx); + + writeFiles(filename, d, positiveEx, negativeEx); + + } catch (Exception e) { e.printStackTrace(); - }finally{ + } finally { ComponentManager.getInstance().freeAllComponents(); } - //System.out.println(count); + // System.out.println(count); count++; } + } + private static void writeFiles(String filename, EvaluatedDescription d, + SortedSet<Individual> positiveEx, SortedSet<Individual> negativeEx) { + String div = (System.currentTimeMillis() % 10000) + ""; + if (d.getAccuracy() >= 0.99) { + filename += "99+"; + } else if (d.getAccuracy() >= 0.90) { + filename += "90+"; + } else if (d.getAccuracy() >= 0.80) { + filename += "80+"; + } else if (d.getAccuracy() >= 0.70) { + filename += "70+"; + } else if (d.getAccuracy() > 0.50) { + filename += "50+"; + } else { + filename += "50-"; + } + filename += "_"; + filename += (d.getDescriptionLength() < 10) ? "0" + + d.getDescriptionLength() : d.getDescriptionLength() + ""; + 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); } - 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) { } - + @SuppressWarnings("unused") + private 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"; + + private 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"; + str += "\"" + individual + "\",\n"; } for (Individual individual : n) { - str+="\""+individual+"\",\n"; + str += "\"" + individual + "\",\n"; } - str = str.substring(0, str.length()-2); - str+="};\n"; - + str = str.substring(0, str.length() - 2); + str += "};\n"; + } - - str+="\n"+ - "/**EXAMPLES**/\n"+ - ConfWriter.listExamples(true, p)+"\n"+ - ConfWriter.listExamples(false, n)+"\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 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; - - - } - + private static EvaluatedDescription learnSPARQL( + SortedSet<Individual> posExamples, SortedSet<Individual> negExamples) { - 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<? extends ReasonerComponent> tmp = FastInstanceChecker.class; - if(usedReasoner.equals(tmp)){ - lc.maxExecutionTimeInSeconds = 30; - }else{ - lc.maxExecutionTimeInSeconds = 200; - } - return lc; + ExampleBasedROLComponent la = null; - } - - private static LearnSPARQLConfiguration getConfForSparql() { - LearnSPARQLConfiguration lc = new LearnSPARQLConfiguration(); - // lsc.sparqlEndpoint = sparqlTasks.getSparqlEndpoint(); + try { - - 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; + SortedSet<Individual> instances = new TreeSet<Individual>(); + instances.addAll(posExamples); + instances.addAll(negExamples); + + SparqlKnowledgeSource ks = ComponentFactory + .getSparqlKnowledgeSource(URI.create( + "http://www.blabla.com").toURL(), SetManipulation + .indToString(instances)); + + ks.getConfigurator().setCloseAfterRecursion(true); + ks.getConfigurator().setRecursionDepth(2); + ks.getConfigurator().setPredefinedEndpoint("LOCALJOSEKIBIBLE"); + ks.getConfigurator().setUseLits(true); + + Set<KnowledgeSource> tmp = new HashSet<KnowledgeSource>(); + tmp.add(ks); + // reasoner + OWLAPIReasoner f = ComponentFactory + .getOWLAPIReasoner(tmp); + ReasoningService rs = ComponentManager.getInstance() + .reasoningService(f); + + // learning problem + PosNegDefinitionLP lp = ComponentFactory.getPosNegDefinitionLP(rs, + SetManipulation.indToString(posExamples), SetManipulation + .indToString(negExamples)); + + // learning algorithm + la = ComponentFactory.getExampleBasedROLComponent(lp, rs); + la.getConfigurator().setNoisePercentage(0.0); + la.getConfigurator().setGuaranteeXgoodDescriptions(1); + la.getConfigurator().setMaxExecutionTimeInSeconds(30); + + la.start(); + } catch (Exception e) { + // System.out.println("ignoring the error "+e.toString()); + } - - // lsc.searchTreeFile = "log/WikipediaCleaner.txt"; - return lc; + return la.getCurrentlyBestEvaluatedDescription(); } - - + private static void initLogger() { SimpleLayout layout = new SimpleLayout(); @@ -347,18 +263,15 @@ e.printStackTrace(); } - logger.removeAllAppenders(); - if(DEBUG){ + if (DEBUG) { logger.setLevel(Level.DEBUG); ConsoleAppender consoleAppender = new ConsoleAppender(layout); logger.addAppender(consoleAppender); - }else{ + } else { logger.setLevel(Level.INFO); } logger.addAppender(fileAppender); - - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-25 15:49:19
|
Revision: 1257 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1257&view=rev Author: kurzum Date: 2008-09-25 15:49:07 +0000 (Thu, 25 Sep 2008) Log Message: ----------- renamed class, first experiment Added Paths: ----------- trunk/src/dl-learner/org/dllearner/scripts/SemanticBibleComparison.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java Deleted: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-25 13:40:25 UTC (rev 1256) +++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-25 15:49:07 UTC (rev 1257) @@ -1,441 +0,0 @@ -/** - * 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.ArrayList; -import java.util.Arrays; -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.cli.Start; -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.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.MonitorFactory; - -public class SemanticBible2 { - - private static ReasoningService reasoningService; - - private static Logger logger = Logger.getRootLogger(); - - - public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl"; - public static String dir = "sembib/"; - public static String sparqldir = dir+"sparql/"; - public static String normaldir = dir+"normal/"; - - public static String tmpFilename = dir + "tmp.conf"; - static File log = new File(dir+"results+prop.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 boolean fragHasNot = false; - private static boolean fragHasAll = false; - private static boolean fragHasBooleanData = false; - private static boolean fragHasNrRes = false; - - private static boolean wholeHasNot = false; - private static boolean wholeHasAll = false; - private static boolean wholeHasBooleanData = false; - private static boolean wholeHasNrRes = false; - - - - //private static Class usedReasoner = FastInstanceChecker.class; - - private static boolean useSPARQL = true; - - /** - * @param args - */ - public static void main(String[] args) { - SimpleClock total = new SimpleClock(); - Files.createFile(log, ""); - - initLogger(); - logger.warn("Start"); - File tmpFile = new File(tmpFilename); - - - List<File> confs = getFilesContaining(useSPARQL,"ten","all", "99+"); - //analyzeFiles(confs); - - - - reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET); - ComponentManager cm =ComponentManager.getInstance(); - try{ - - - for (File f : confs) { - - Cache.getDefaultCache().clearCache(); - String fileContent = Files.readFile(f); - - SortedSet<Individual> posEx = SetManipulation.stringToInd(getIndividuals(fileContent, true)); - SortedSet<Individual> negEx = SetManipulation.stringToInd(getIndividuals(fileContent, false)); - - - StringBuffer sbuf = new StringBuffer(fileContent); - sbuf.insert(0, sparqlOptions()); - Files.createFile(tmpFile, sbuf.toString()); - - SimpleClock sc = new SimpleClock(); - Start.main(new String[] { tmpFilename }); - timeFragment.addNumber((double) sc.getTime()); - - LearningAlgorithm la = cm.getLiveLearningAlgorithms().remove(0); - - EvaluatedDescription onFragment =(la.getCurrentlyBestEvaluatedDescription()); - - accFragment.addNumber(onFragment.getAccuracy()); - dDepthFragment.addNumber((double)onFragment.getDescriptionDepth()); - dLengthFragment.addNumber((double)onFragment.getDescriptionLength()); - - String desc = onFragment.getDescription().toKBSyntaxString(); - - fragHasNot = ( fragHasNot || desc.contains("NOT")); - fragHasAll = (fragHasAll || desc.contains("ALL")); - fragHasBooleanData = (fragHasBooleanData || desc.contains("= FALSE")|| desc.contains("= TRUE")); - fragHasNrRes = (fragHasNrRes || desc.contains("<")|| desc.contains(">")); - - SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription()); - EvaluatedDescription onOnto = reEvaluateDescription( - onFragment.getDescription(), retrieved, posEx, negEx); - - 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()); - 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()); - - fragHasNot = ( fragHasNot || desc.contains("NOT")); - fragHasAll = (fragHasAll || desc.contains("ALL")); - fragHasBooleanData = (fragHasBooleanData || desc.contains("= FALSE")|| desc.contains("= TRUE")); - fragHasNrRes = (fragHasNrRes || desc.contains("<")|| desc.contains(">")); - - cm.freeAllComponents(); - writeLog(); - - - }//end for - }catch (Exception e) { - e.printStackTrace(); - - } - writeLog(); - total.printAndSet("Finished"); - //logger.warn("Finished"); - - } - - public static void writeLog(){ - String l = "\n\n\n*********************\n"; - l +="COUNT: "+accFragment.getCount()+"\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"; - 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.appendFile(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>(); - SortedSet<Individual> NegAsPos = new TreeSet<Individual>(); - SortedSet<Individual> NegAsNeg = new TreeSet<Individual>(); - - // PosAsPos - 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); - - } - - 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 List<File> getFilesContaining(boolean sparql, String numExamples, String allOrEx, String acc) { - List<File> ret = new ArrayList<File>(); - //SortedSet<File> ret = new TreeSet<File>(); - - String actualDir = (sparql)?sparqldir:normaldir; - logger.warn(actualDir); - File f = new File(actualDir); - String[] files = f.list(); - Arrays.sort(files); - int consistent = 0; - try{ - for (int i = 0; i < files.length; i++) { - - if( files[i].contains(numExamples) - && files[i].contains(allOrEx) - && files[i].contains(acc) - ){ - consistent++; - ret.add(new File(actualDir+files[i])); - if(ret.size() != consistent){ - logger.warn("double file: "+files[i]); - } - } - - } - }catch (Exception e) { - - e.printStackTrace(); - } - if(consistent != ret.size()){ - logger.warn("double files"+consistent+"::"+ret.size()); - System.exit(0); - }else{ - logger.warn("all files different"); - } - return ret; - } - - /*public static void analyzeFiles(List<File> l){ - - SortedSet<String> differentIndividuals = new TreeSet<String>(); - for ( 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"+ - - "\n"+ - "reasoner = owlAPIReasoner;\n"+ - //"reasoner = fastInstanceChecker;\n"+ - "owlAPIReasoner.reasonerType = pellet;\n\n"+ - ""; - return s; - } - - public static String sparqlOptions (){ - String s="// SPARQL options\n"+ - "sparql.recursionDepth = 2;\n"+ - "sparql.useLits = true;\n"+ - "sparql.predefinedEndpoint = \"LOCALJOSEKIBIBLE\";\n"+ - "sparql.getPropertyInformation = true;\n"+ - "refexamples.maxExecutionTimeInSeconds = "+sparqllMaxExecution+";\n"+ - "import(\"http://localhost:2020/bible\",\"SPARQL\");\n"+ - getCombinedOptions()+ - ""; - return s; - } - - public static String normalOptions (){ - String s="\n"+ - "import(\"NTNcombined.owl\");\n"+ - "refexamples.maxExecutionTimeInSeconds = "+normalMaxExecution+";\n"; - - s+="refexamples.noisePercentage = "+normalNoisePercentage+";\n"+ - getCombinedOptions()+ - ""; - return s; - } - - - 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.WARN); - - - } - - -} Copied: trunk/src/dl-learner/org/dllearner/scripts/SemanticBibleComparison.java (from rev 1255, trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/SemanticBibleComparison.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBibleComparison.java 2008-09-25 15:49:07 UTC (rev 1257) @@ -0,0 +1,441 @@ +/** + * 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.ArrayList; +import java.util.Arrays; +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.cli.Start; +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.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.MonitorFactory; + +public class SemanticBibleComparison { + + private static ReasoningService reasoningService; + + private static Logger logger = Logger.getRootLogger(); + + + public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl"; + public static String dir = "sembib/"; + public static String sparqldir = dir+"sparql/"; + public static String normaldir = dir+"normal/"; + + public static String tmpFilename = dir + "tmp.conf"; + static File log = new File(dir+"results+prop.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 boolean fragHasNot = false; + private static boolean fragHasAll = false; + private static boolean fragHasBooleanData = false; + private static boolean fragHasNrRes = false; + + private static boolean wholeHasNot = false; + private static boolean wholeHasAll = false; + private static boolean wholeHasBooleanData = false; + private static boolean wholeHasNrRes = false; + + + + //private static Class usedReasoner = FastInstanceChecker.class; + + private static boolean useSPARQL = true; + + /** + * @param args + */ + public static void main(String[] args) { + SimpleClock total = new SimpleClock(); + Files.createFile(log, ""); + + initLogger(); + logger.warn("Start"); + File tmpFile = new File(tmpFilename); + + + List<File> confs = getFilesContaining(useSPARQL,"ten","all", "99+"); + //analyzeFiles(confs); + + + + reasoningService = ReasoningServiceFactory.getReasoningService(ontologyPath, AvailableReasoners.OWLAPIREASONERPELLET); + ComponentManager cm =ComponentManager.getInstance(); + try{ + + + for (File f : confs) { + + Cache.getDefaultCache().clearCache(); + String fileContent = Files.readFile(f); + + SortedSet<Individual> posEx = SetManipulation.stringToInd(getIndividuals(fileContent, true)); + SortedSet<Individual> negEx = SetManipulation.stringToInd(getIndividuals(fileContent, false)); + + + StringBuffer sbuf = new StringBuffer(fileContent); + sbuf.insert(0, sparqlOptions()); + Files.createFile(tmpFile, sbuf.toString()); + + SimpleClock sc = new SimpleClock(); + Start.main(new String[] { tmpFilename }); + timeFragment.addNumber((double) sc.getTime()); + + LearningAlgorithm la = cm.getLiveLearningAlgorithms().remove(0); + + EvaluatedDescription onFragment =(la.getCurrentlyBestEvaluatedDescription()); + + accFragment.addNumber(onFragment.getAccuracy()); + dDepthFragment.addNumber((double)onFragment.getDescriptionDepth()); + dLengthFragment.addNumber((double)onFragment.getDescriptionLength()); + + String desc = onFragment.getDescription().toKBSyntaxString(); + + fragHasNot = ( fragHasNot || desc.contains("NOT")); + fragHasAll = (fragHasAll || desc.contains("ALL")); + fragHasBooleanData = (fragHasBooleanData || desc.contains("= FALSE")|| desc.contains("= TRUE")); + fragHasNrRes = (fragHasNrRes || desc.contains("<")|| desc.contains(">")); + + SortedSet<Individual> retrieved = reasoningService.retrieval(onFragment.getDescription()); + EvaluatedDescription onOnto = reEvaluateDescription( + onFragment.getDescription(), retrieved, posEx, negEx); + + 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()); + 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()); + + fragHasNot = ( fragHasNot || desc.contains("NOT")); + fragHasAll = (fragHasAll || desc.contains("ALL")); + fragHasBooleanData = (fragHasBooleanData || desc.contains("= FALSE")|| desc.contains("= TRUE")); + fragHasNrRes = (fragHasNrRes || desc.contains("<")|| desc.contains(">")); + + cm.freeAllComponents(); + writeLog(); + + + }//end for + }catch (Exception e) { + e.printStackTrace(); + + } + writeLog(); + total.printAndSet("Finished"); + //logger.warn("Finished"); + + } + + public static void writeLog(){ + String l = "\n\n\n*********************\n"; + l +="COUNT: "+accFragment.getCount()+"\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"; + 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.appendFile(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>(); + SortedSet<Individual> NegAsPos = new TreeSet<Individual>(); + SortedSet<Individual> NegAsNeg = new TreeSet<Individual>(); + + // PosAsPos + 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); + + } + + 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 List<File> getFilesContaining(boolean sparql, String numExamples, String allOrEx, String acc) { + List<File> ret = new ArrayList<File>(); + //SortedSet<File> ret = new TreeSet<File>(); + + String actualDir = (sparql)?sparqldir:normaldir; + logger.warn(actualDir); + File f = new File(actualDir); + String[] files = f.list(); + Arrays.sort(files); + int consistent = 0; + try{ + for (int i = 0; i < files.length; i++) { + + if( files[i].contains(numExamples) + && files[i].contains(allOrEx) + && files[i].contains(acc) + ){ + consistent++; + ret.add(new File(actualDir+files[i])); + if(ret.size() != consistent){ + logger.warn("double file: "+files[i]); + } + } + + } + }catch (Exception e) { + + e.printStackTrace(); + } + if(consistent != ret.size()){ + logger.warn("double files"+consistent+"::"+ret.size()); + System.exit(0); + }else{ + logger.warn("all files different"); + } + return ret; + } + + /*public static void analyzeFiles(List<File> l){ + + SortedSet<String> differentIndividuals = new TreeSet<String>(); + for ( 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"+ + + "\n"+ + "reasoner = owlAPIReasoner;\n"+ + //"reasoner = fastInstanceChecker;\n"+ + "owlAPIReasoner.reasonerType = pellet;\n\n"+ + ""; + return s; + } + + public static String sparqlOptions (){ + String s="// SPARQL options\n"+ + "sparql.recursionDepth = 2;\n"+ + "sparql.useLits = true;\n"+ + "sparql.predefinedEndpoint = \"LOCALJOSEKIBIBLE\";\n"+ + "sparql.getPropertyInformation = true;\n"+ + "refexamples.maxExecutionTimeInSeconds = "+sparqllMaxExecution+";\n"+ + "import(\"http://localhost:2020/bible\",\"SPARQL\");\n"+ + getCombinedOptions()+ + ""; + return s; + } + + public static String normalOptions (){ + String s="\n"+ + "import(\"NTNcombined.owl\");\n"+ + "refexamples.maxExecutionTimeInSeconds = "+normalMaxExecution+";\n"; + + s+="refexamples.noisePercentage = "+normalNoisePercentage+";\n"+ + getCombinedOptions()+ + ""; + return s; + } + + + 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.WARN); + + + } + + +} Property changes on: trunk/src/dl-learner/org/dllearner/scripts/SemanticBibleComparison.java ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-25 13:40:49
|
Revision: 1256 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1256&view=rev Author: kurzum Date: 2008-09-25 13:40:25 +0000 (Thu, 25 Sep 2008) Log Message: ----------- finished blanknode support for sparql extration. it might still be buggy, but basically works. added two new options in SparqlknowledgeSource: "dissolveBlankNodes", "determines whether Blanknodes are dissolved. This is a costly function." default true; "useImprovedSparqlTupelAquisitor", "uses deeply nested SparqlQueries, according to recursion depth, still EXPERIMENTAL" default false; added missing package.html Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/package.html trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupleAquisitor.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupleAquisitor.java trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.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/Manager.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/ConfigJavaGenerator.java trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/package.html Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/scripts/semanticbible/ Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -225,6 +225,24 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "getPropertyInformation") ; } /** +* dissolveBlankNodes determines whether Blanknodes are dissolved. This is a costly function.. +* mandatory: false| reinit necessary: true +* default value: true +* @return boolean +**/ +public boolean getDissolveBlankNodes() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "dissolveBlankNodes") ; +} +/** +* useImprovedSparqlTupelAquisitor uses deeply nested SparqlQueries, according to recursion depth, still EXPERIMENTAL. +* mandatory: false| reinit necessary: true +* default value: false +* @return boolean +**/ +public boolean getUseImprovedSparqlTupelAquisitor() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useImprovedSparqlTupelAquisitor") ; +} +/** * verbosity control verbosity of output for this component. * mandatory: false| reinit necessary: true * default value: warning @@ -417,6 +435,24 @@ reinitNecessary = true; } /** +* @param dissolveBlankNodes determines whether Blanknodes are dissolved. This is a costly function.. +* mandatory: false| reinit necessary: true +* default value: true +**/ +public void setDissolveBlankNodes(boolean dissolveBlankNodes) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "dissolveBlankNodes", dissolveBlankNodes); +reinitNecessary = true; +} +/** +* @param useImprovedSparqlTupelAquisitor uses deeply nested SparqlQueries, according to recursion depth, still EXPERIMENTAL. +* mandatory: false| reinit necessary: true +* default value: false +**/ +public void setUseImprovedSparqlTupelAquisitor(boolean useImprovedSparqlTupelAquisitor) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useImprovedSparqlTupelAquisitor", useImprovedSparqlTupelAquisitor); +reinitNecessary = true; +} +/** * @param verbosity control verbosity of output for this component. * mandatory: false| reinit necessary: true * default value: warning Modified: trunk/src/dl-learner/org/dllearner/core/configurators/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/package.html 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/core/configurators/package.html 2008-09-25 13:40:25 UTC (rev 1256) @@ -1,8 +1 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -<html> -<head></head> -<body bgcolor="white"> -<p>Automatically generated classes, which enable programmatically setting -and getting configuration options of components.</p> -</body> -</html> \ No newline at end of file +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head></head><body bgcolor="white"><p>Automatically generated classes, which enable programmatically settingand getting configuration options of components.</p></body></html> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -28,6 +28,8 @@ blankNodes.put(id, new TreeSet<RDFNodeTuple>()); } blankNodes.get(id).add(t); + //System.out.println("added: "+id+" "+t); + //System.out.println(); } public static SortedSet<RDFNodeTuple> getBlankNode(int id){ Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupleAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupleAquisitor.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupleAquisitor.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -56,9 +56,16 @@ public SortedSet<RDFNodeTuple> retrieveTuplesForClassesOnly(String uri){ throw new RuntimeException("Not Implemented yet"); } + @Override + protected void disambiguateBlankNodes(String uri, SortedSet<RDFNodeTuple> resultSet){ + throw new RuntimeException("Not Implemented yet"); + } + @Override + public SortedSet<RDFNodeTuple> getBlankNode(int id){ + throw new RuntimeException("Not Implemented yet"); + } - } Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -50,7 +50,7 @@ @Override public String toString(){ //RBC - return "I'm a blank node with id: "+bNodeId+"||"+blankNode; + return "bnodeid: "+bNodeId+" ||"+blankNode; } // overidden Functions Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -20,17 +20,21 @@ package org.dllearner.kb.aquisitors; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.SortedSet; import org.apache.log4j.Logger; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlQueryMaker; +import org.dllearner.utilities.JamonMonitorLogger; import org.dllearner.utilities.datastructures.RDFNodeTuple; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSetRewindable; import com.hp.hpl.jena.rdf.model.RDFNode; +import com.jamonapi.Monitor; /** * Can execute different queries. @@ -48,9 +52,10 @@ protected SparqlQueryMaker sparqlQueryMaker; protected SPARQLTasks sparqlTasks; - //RBC + + public SparqlTupleAquisitor(SparqlQueryMaker sparqlQueryMaker, SPARQLTasks sparqlTasks) { @@ -64,6 +69,7 @@ String sparqlQueryString = sparqlQueryMaker.makeSubjectQueryUsingFilters(uri); SortedSet<RDFNodeTuple> ret = sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, PREDICATE, OBJECT); disambiguateBlankNodes(uri, ret); + return ret; } @Override @@ -71,22 +77,45 @@ // getQuery String sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri); SortedSet<RDFNodeTuple> ret = sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, PREDICATE, OBJECT); + disambiguateBlankNodes(uri, ret); return ret; } @Override public SortedSet<RDFNodeTuple> retrieveTuplesForClassesOnly(String uri){ SortedSet<RDFNodeTuple> ret = retrieveTupel(uri); + disambiguateBlankNodes(uri, ret); return ret; } - private void disambiguateBlankNodes(String uri, SortedSet<RDFNodeTuple> resultSet){ + @Override + public SortedSet<RDFNodeTuple> getBlankNode(int id){ + return BlankNodeCollector.getBlankNode(id); + } + + public void printHM(){ + + for (int j = 0; j < BlankNodeCollector.getBlankNodeMap().size(); j++) { + System.out.println(j); + for(RDFNodeTuple t :BlankNodeCollector.getBlankNodeMap().get(j)){ + System.out.println(t); + } + } + + } + + // main function for resolving blanknodes + @Override + protected void disambiguateBlankNodes(String uri, SortedSet<RDFNodeTuple> resultSet){ + Monitor bnodeMonitor = JamonMonitorLogger.getTimeMonitor(SparqlTupleAquisitor.class, "blanknode time").start(); try{ for (RDFNodeTuple tuple : resultSet) { + if(tuple.b.isAnon()){ int currentId = BlankNodeCollector.getNextGlobalBNodeId(); + // replace the blanknode tuple.b = new RDFBlankNode(currentId, tuple.b); - System.out.println(uri+" replaced blanknode "+tuple.b); + //System.out.println(uri+" replaced blanknode "+tuple.b); dissolveBlankNodes(currentId, uri, tuple); //System.out.println(BlankNodeCollector.getBlankNodeMap()); @@ -95,15 +124,20 @@ }catch (Exception e) { e.printStackTrace(); System.exit(0); + }finally{ + bnodeMonitor.stop(); } + } + // extends a sparql query as long as there are undissolved blanknodes private void dissolveBlankNodes(int currentId, String uri, RDFNodeTuple tuple){ int currentDepth = 1; int lastDepth = 1; ResultSetRewindable rsw=null; do{ String q = BlankNodeCollector.makeQuery(uri, tuple.a.toString(), currentDepth); + //System.out.println(q); rsw = sparqlTasks.queryAsResultSet(q); lastDepth = currentDepth; @@ -113,7 +147,9 @@ } + //takes the resultset and assigns internal ids private void assignIds(int currentId, ResultSetRewindable rsw, int lastDepth){ + //prepare variables according to last depth List<String> vars = new ArrayList<String>(); vars.add("o0"); for (int i = 1; i <= lastDepth; i++) { @@ -123,16 +159,24 @@ final List<String> tmpVars = new ArrayList<String>(); + Map<String, Integer> lastNodes = new HashMap<String, Integer>(); + // the resultset first variable is o0 + // iteration over each tuple of the set while (rsw.hasNext()){ tmpVars.clear(); tmpVars.addAll(vars); QuerySolution q = rsw.nextSolution(); + //skip all that do not start with a blanknode + // could be two different blank nodes here, but unlikely if(!q.get("o0").isAnon()){ + lastNodes.put(q.get("o0").toString(), currentId); continue; }else{ + + // remove the first node tmpVars.remove(0); - assignIdRec(currentId, q, tmpVars); + assignIdRec(currentId, q, tmpVars,lastNodes); } @@ -141,17 +185,25 @@ } - private void assignIdRec(int currentId, QuerySolution q, List<String> vars ){ + private void assignIdRec(int currentId, QuerySolution q, List<String> vars, Map<String, Integer> lastNodes ){ if(vars.isEmpty()){return;} String pvar = vars.remove(0); String ovar = vars.remove(0); + // the next node RDFNode n = q.get(ovar); if(n.isAnon()){ - int nextId = BlankNodeCollector.getNextGlobalBNodeId(); + int nextId; + if(lastNodes.get(n.toString())==null){ + nextId = BlankNodeCollector.getNextGlobalBNodeId(); + lastNodes.put(n.toString(), nextId); + //System.out.println(n.toString()); + }else{ + nextId = lastNodes.get(n.toString()); + } RDFNodeTuple tuple = new RDFNodeTuple(q.get(pvar), new RDFBlankNode(nextId,n)); BlankNodeCollector.addBlankNode(currentId, tuple); - assignIdRec(nextId, q, vars); + assignIdRec(nextId, q, vars, lastNodes); }else{ BlankNodeCollector.addBlankNode(currentId, new RDFNodeTuple(q.get(pvar), n)); } Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupleAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupleAquisitor.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupleAquisitor.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -44,7 +44,8 @@ protected final int CLASS_INFORMATION = 2; protected int mode = 0; - private boolean uriDebugCheck = true; + protected boolean uriDebugCheck = true; + protected boolean dissolveBlankNodes = true; public final SortedSet<RDFNodeTuple> getTupelForResource(String uri){ checkURIforValidity(uri); @@ -68,6 +69,8 @@ public abstract SortedSet<RDFNodeTuple> retrieveTupel(String uri); public abstract SortedSet<RDFNodeTuple> retrieveClassesForInstances(String uri); public abstract SortedSet<RDFNodeTuple> retrieveTuplesForClassesOnly(String uri); + protected abstract void disambiguateBlankNodes(String uri, SortedSet<RDFNodeTuple> resultSet); + public abstract SortedSet<RDFNodeTuple> getBlankNode(int id); /*private void setMode(int mode) { this.mode = mode; @@ -91,6 +94,12 @@ } return true; } + public boolean isDissolveBlankNodes() { + return dissolveBlankNodes; + } + public void setDissolveBlankNodes(boolean dissolveBlankNodes) { + this.dissolveBlankNodes = dissolveBlankNodes; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -8,25 +8,32 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.aquisitors.BlankNodeCollector; +import org.apache.log4j.Logger; import org.dllearner.kb.aquisitors.RDFBlankNode; import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.datastructures.StringTuple; import org.dllearner.utilities.owl.OWLVocabulary; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLObjectProperty; public class BlankNode extends Node { - + private static Logger logger = Logger + .getLogger(BlankNode.class); + RDFBlankNode bNode; String inboundEdge; - private List<Node> connectedNodes =new ArrayList<Node>(); - private List<ObjectPropertyNode> objectProperties = new ArrayList<ObjectPropertyNode>(); + private List<BlankNode> blankNodes =new ArrayList<BlankNode>(); + private SortedSet<StringTuple> otherNodes = new TreeSet<StringTuple> (); private List<DatatypePropertyNode> datatypeProperties = new ArrayList<DatatypePropertyNode>(); + + //private List<ObjectPropertyNode> objectProperties = new ArrayList<ObjectPropertyNode>(); + //private List<DatatypePropertyNode> datatypeProperties = new ArrayList<DatatypePropertyNode>(); public BlankNode(RDFBlankNode bNode, String inboundEdge){ @@ -38,25 +45,35 @@ @Override - public List<Node> expand(TupleAquisitor TupelAquisitor, + public List<Node> expand(TupleAquisitor tupleAquisitor, Manipulator manipulator) { List<Node> newNodes = new ArrayList<Node>(); - SortedSet<RDFNodeTuple> s = BlankNodeCollector.getBlankNode(bNode.getBNodeId()); + SortedSet<RDFNodeTuple> s = tupleAquisitor.getBlankNode(bNode.getBNodeId()); + //System.out.println("entering "+bNode.getBNodeId()); + + for (RDFNodeTuple tuple : s) { if(tuple.b.isLiteral()) { + //System.out.println("adding dtype: "+tuple); datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); - connectedNodes.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); + //connectedNodes.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); }else if(tuple.b.isAnon()){ - + //System.out.println("adding bnode: "+tuple); BlankNode tmp = new BlankNode( (RDFBlankNode)tuple.b, tuple.a.toString()); - objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, tmp )); - connectedNodes.add(new BlankNode( (RDFBlankNode)tuple.b, tuple.a.toString())); + //objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, tmp )); + //connectedNodes.add(new BlankNode( (RDFBlankNode)tuple.b, tuple.a.toString())); + blankNodes.add(tmp); newNodes.add(tmp); }else{ - objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); - connectedNodes.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); + //System.out.println("adding other: "+tuple); + otherNodes.add(new StringTuple(tuple.a.toString(), tuple.b.toString())); + //objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); + //connectedNodes.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); } } + + //System.out.println("finished"); + return newNodes; } @@ -69,11 +86,11 @@ @Override public SortedSet<String> toNTriple() { SortedSet<String> returnSet = new TreeSet<String>(); - String subject = getNTripleForm(); - for (ObjectPropertyNode one : objectProperties) { + //String subject = getNTripleForm(); + /*for (ObjectPropertyNode one : objectProperties) { returnSet.add(subject + one.getNTripleForm() + one.getBPart().getNTripleForm()+" . "); returnSet.addAll(one.getBPart().toNTriple()); - } + }*/ return returnSet; } @@ -83,6 +100,12 @@ } @Override + public String toString(){ + return "id: "+bNode.getBNodeId()+" inbound: "+getInBoundEdge(); + + } + + @Override public URI getURI(){ return URI.create("http://www.empty.org/empty#empty"); } @@ -95,44 +118,167 @@ public String getInBoundEdge(){ return inboundEdge; } - + public OWLDescription getAnonymousClass(OWLAPIOntologyCollector owlAPIOntologyCollector){ OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); OWLDescription ret = factory.getOWLClass(URI.create("http://dummy.org/dummy")); - for (Node n : connectedNodes) { - System.out.println(n.toString()); + //System.out.println(inboundEdge); + + if( + (inboundEdge.equals(OWLVocabulary.OWL_intersectionOf))|| + (inboundEdge.equals(OWLVocabulary.OWL_complementOf))|| + (inboundEdge.equals(OWLVocabulary.OWL_unionOf)) + ){ + Set<OWLDescription> target = new HashSet<OWLDescription>(); + List<BlankNode> tmp = new ArrayList<BlankNode>(); + tmp.add(this); + while(!tmp.isEmpty()){ + BlankNode next = tmp.remove(0); + //next.printAll(); + + if(next.otherNodes.contains(new StringTuple(OWLVocabulary.RDF_REST, OWLVocabulary.RDF_NIL))){ + for(StringTuple t : next.otherNodes){ + if(t.a.equals(OWLVocabulary.RDF_FIRST)){ + target.add(factory.getOWLClass(URI.create(t.b))); + //System.out.println("added "+t.b); + } + } + //System.out.println("nil found"); + //do nothing + }else{ + if(next.otherNodes.first().a.equals(OWLVocabulary.RDF_FIRST)){ + target.add(factory.getOWLClass(URI.create(next.otherNodes.first().b))); + tmp.add(next.blankNodes.get(0)); + //System.out.println("bnode added"); + }else{ + System.out.println("double nesting not supported yet"); + System.exit(0); + } + } + }//end while + + if(inboundEdge.equals(OWLVocabulary.OWL_intersectionOf)){ + return factory.getOWLObjectIntersectionOf(target); + }else if(inboundEdge.equals(OWLVocabulary.OWL_unionOf)){ + return factory.getOWLObjectUnionOf(target); + }else if(inboundEdge.equals(OWLVocabulary.OWL_complementOf)){ + if(target.size()>1) { + logger.warn("more than one complement"+target); + System.exit(0); + }else{ + return factory.getOWLObjectComplementOf(new ArrayList<OWLDescription>(target).remove(0)); + } + }else{ + printAll(); + tail("wrong type: " +inboundEdge+ this); + } } - if(containsDataTypeProperties()){ - //do nothing right now, add a return here; + // restriction + if(otherNodes.contains( + new StringTuple(OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_RESTRICTION))){ + return getRestriction( owlAPIOntologyCollector); + } - Set<OWLDescription> l = new HashSet<OWLDescription>(); - for (Node n : connectedNodes) { - if(n instanceof BlankNode){ - l.add(((BlankNode)n).getAnonymousClass(owlAPIOntologyCollector)); - }else{ - l.add(factory.getOWLClass(n.getURI())); + if(!blankNodes.isEmpty()){ + return blankNodes.get(0).getAnonymousClass(owlAPIOntologyCollector); + } + + + return ret; + + } + + public void printAll(){ + System.out.println(this); + + System.out.println("otherNodes"); + for (StringTuple t : otherNodes) { + System.out.println(""+t); + } + System.out.println("***************"); + System.out.println("dtype "); + for (DatatypePropertyNode d : datatypeProperties) { + System.out.println(d.getURIString()+" "+d.getNTripleFormOfB()); + } + System.out.println("***************"); + System.out.println("other bnodes"); + for (BlankNode b : blankNodes) { + System.out.println(b); + } + System.out.println("***************"); + + } + + private OWLDescription getRestriction(OWLAPIOntologyCollector owlAPIOntologyCollector){ + OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); + OWLObjectProperty property = null; + OWLDescription concept = null; + OWLDescription dummy = factory.getOWLClass(URI.create("http://dummy.org/dummy")); + + int total = otherNodes.size()+blankNodes.size()+datatypeProperties.size(); + if(total >=4 ){ + System.out.println("qualified p restrictions not supported currently"); + } + + // get Objectproperty + for(StringTuple n : otherNodes) { + if(n.a.equals(OWLVocabulary.OWL_ON_PROPERTY)){ + property = factory.getOWLObjectProperty(URI.create(n.b)); } } - if(isOfType(OWLVocabulary.OWL_intersectionOf)){ - ret = factory.getOWLObjectIntersectionOf(l); - System.out.println("aaa"); - }else if(isOfType(OWLVocabulary.OWL_unionOf)){ - ret = factory.getOWLObjectUnionOf(l); - System.out.println("aaa"); - }else if(isOfType(OWLVocabulary.OWL_complementOf)){ - ret = factory.getOWLObjectComplementOf(new ArrayList<OWLDescription>(l).remove(0)); - System.out.println("aaa"); + // has an Integer value + if(!datatypeProperties.isEmpty()){ + DatatypePropertyNode d = datatypeProperties.get(0); + String p = d.getURIString(); + if( p.equals(OWLVocabulary.OWL_cardinality)){ + return factory.getOWLObjectExactCardinalityRestriction(property, d.getBPart().getLiteral().getInt()); + }else if(p.equals(OWLVocabulary.OWL_maxCardinality)){ + return factory.getOWLObjectMaxCardinalityRestriction(property, d.getBPart().getLiteral().getInt()); + }else if(p.equals(OWLVocabulary.OWL_minCardinality)){ + return factory.getOWLObjectMinCardinalityRestriction(property, d.getBPart().getLiteral().getInt()); + }else { + tail(p+d+" in "+this); + } } - return ret; + + if(!blankNodes.isEmpty()){ + concept = blankNodes.get(0).getAnonymousClass(owlAPIOntologyCollector); + }else{ + for(StringTuple n : otherNodes) { + String p = n.a; + String o = n.b; + if( + (p.equals(OWLVocabulary.OWL_ALL_VALUES_FROM)) || + (p.equals(OWLVocabulary.OWL_SOME_VALUES_FROM)) || + (p.equals(OWLVocabulary.OWL_HAS_VALUE)) + ){ + concept = factory.getOWLClass(URI.create(o)); + } + } + } + + for(StringTuple n : otherNodes) { + String p = n.a; + if(p.equals(OWLVocabulary.OWL_ALL_VALUES_FROM)){ + return factory.getOWLObjectAllRestriction(property, concept); + }else if(p.equals(OWLVocabulary.OWL_SOME_VALUES_FROM)){ + return factory.getOWLObjectSomeRestriction(property, concept); + }else if(p.equals(OWLVocabulary.OWL_HAS_VALUE)){ + logger.warn("OWL_hasValue not implemented yet"); + return dummy; + } + } + return dummy; } - private boolean isOfType(String type){ + + /*private boolean isOfType(String type){ for (Node n : connectedNodes) { if((n instanceof BlankNode ) && @@ -154,6 +300,6 @@ } } return false; - } + }*/ } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -33,6 +33,7 @@ import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLCommentAnnotation; import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLLabelAnnotation; /** @@ -65,28 +66,31 @@ List<Node> newNodes = new ArrayList<Node>(); Node tmp; for (RDFNodeTuple tuple : newTuples) { - if((tmp = processTuple(tuple))!= null) { + if((tmp = processTuple(tuple,tupelAquisitor.isDissolveBlankNodes()))!= null) { newNodes.add(tmp); } } return newNodes; } - private Node processTuple( RDFNodeTuple tuple) { + private Node processTuple( RDFNodeTuple tuple, boolean dissolveBlankNodes) { try { String property = tuple.a.toString(); if(tuple.b.isLiteral()) { datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); return null; }else if(tuple.b.isAnon()){ - logger.warn("blanknodes not supported as of now "+ this +" in tuple" + tuple); - RDFBlankNode n = (RDFBlankNode) tuple.b; - - BlankNode tmp = new BlankNode( n, tuple.a.toString()); - //add it to the graph - blankNodes.add(tmp); - //return tmp; - return tmp; + if(dissolveBlankNodes){ + RDFBlankNode n = (RDFBlankNode) tuple.b; + BlankNode tmp = new BlankNode( n, tuple.a.toString()); + //add it to the graph + blankNodes.add(tmp); + //return tmp; + return tmp; + }else{ + //do nothing + return null; + } // substitute rdf:type with owl:subclassof }else if (property.equals(OWLVocabulary.RDF_TYPE) || OWLVocabulary.isStringSubClassVocab(property)) { @@ -173,7 +177,18 @@ } for (BlankNode bn : blankNodes) { - System.out.println(bn.getAnonymousClass(owlAPIOntologyCollector).toString()); + OWLDescription target = bn.getAnonymousClass(owlAPIOntologyCollector); + + if(OWLVocabulary.isStringSubClassVocab(bn.getInBoundEdge())){ + owlAPIOntologyCollector.addAxiom(factory.getOWLSubClassAxiom(me, target)); + }else if(bn.getInBoundEdge().equals(OWLVocabulary.OWL_DISJOINT_WITH)){ + owlAPIOntologyCollector.addAxiom(factory.getOWLDisjointClassesAxiom(me, target)); + }else if(bn.getInBoundEdge().equals(OWLVocabulary.OWL_EQUIVALENT_CLASS)){ + owlAPIOntologyCollector.addAxiom(factory.getOWLEquivalentClassesAxiom(me, target)); + }else { + tail( getURIString()+"||"+bn.getInBoundEdge()); + } + } }catch (Exception e) { System.out.println("aaa"+getURIString()); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -130,15 +130,17 @@ if(configuration.isGetPropertyInformation() ){ - + Monitor m = JamonMonitorLogger.getTimeMonitor(ExtractionAlgorithm.class, "TimeGetPropertyInformation").start(); List<ObjectPropertyNode> l = getObjectPropertyNodes(collectNodes); for (ObjectPropertyNode node : l) { - //FIXME has to be transported to the next step - node.expandProperties(tupleAquisitor, configuration.getManipulator()); + collectNodes.addAll(node.expandProperties(tupleAquisitor, configuration.getManipulator())); } + m.stop(); } + Monitor m = JamonMonitorLogger.getTimeMonitor(ExtractionAlgorithm.class, "TimeBlankNode").start(); expandBlankNodes(getBlankNodes(collectNodes),tupleAquisitor); + m.stop(); return seedNode; Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -87,6 +87,7 @@ return null; }else if(tuple.b.isAnon()){ RDFBlankNode n = (RDFBlankNode) tuple.b; + //RBC System.out.println(n.getBNodeId()); System.exit(0); logger.warn("blanknodes not supported as of now"+ this +"in tuple" + tuple); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -28,8 +28,11 @@ import java.util.TreeSet; import org.apache.log4j.Logger; +import org.dllearner.utilities.JamonMonitorLogger; import org.semanticweb.owl.model.OWLOntology; +import com.jamonapi.Monitor; + /** * An object of this class encapsulates everything. * @@ -80,17 +83,24 @@ } } + //((SparqlTupleAquisitor) configuration.getTupelAquisitor()).printHM(); + //System.exit(0); logger.info("Finished extraction"); return allExtractedNodes; } public OWLOntology getOWLAPIOntologyForNodes(List<Node> nodes, boolean saveOntology){ + Monitor m1 = JamonMonitorLogger.getTimeMonitor(Manager.class, "Time conversion to OWL Ontology").start(); for (Node n : nodes) { n.toOWLOntology(configuration.getOwlAPIOntologyCollector()); } + m1.stop(); + if(saveOntology){ - configuration.getOwlAPIOntologyCollector().saveOntology(); + Monitor m2 = JamonMonitorLogger.getTimeMonitor(Manager.class, "Time saving Ontology").start(); + configuration.getOwlAPIOntologyCollector().saveOntology(); + m2.stop(); } return configuration.getOwlAPIOntologyCollector().getCurrentOntology(); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -34,6 +34,7 @@ import org.dllearner.utilities.owl.OWLVocabulary; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLLabelAnnotation; import org.semanticweb.owl.model.OWLObjectProperty; @@ -80,13 +81,15 @@ specialTypes.add(tuple.b.toString()); } }else if(tuple.b.isAnon()){ - logger.warn("blanknodes currently not implemented in this tuple aquisitor"); - RDFBlankNode n = (RDFBlankNode) tuple.b; + + if(tupelAquisitor.isDissolveBlankNodes()){ + RDFBlankNode n = (RDFBlankNode) tuple.b; + BlankNode tmp = new BlankNode( n, tuple.a.toString()); + //add it to the graph + blankNodes.add(tmp); + ret.add( tmp); + } - BlankNode tmp = new BlankNode( n, tuple.a.toString()); - //add it to the graph - blankNodes.add(tmp); - ret.add( tmp); }else{ propertyInformation.add(tuple); @@ -128,19 +131,18 @@ OWLObjectProperty me =factory.getOWLObjectProperty(getURI()); for (RDFNodeTuple one : propertyInformation) { + OWLClass c = factory.getOWLClass(URI.create(one.a.toString())); + if(one.aPartContains(OWLVocabulary.RDFS_range)){ - OWLClass c = factory.getOWLClass(URI.create(one.a.toString())); owlAPIOntologyCollector.addAxiom(factory.getOWLObjectPropertyRangeAxiom(me, c)); }else if(one.aPartContains(OWLVocabulary.RDFS_domain)){ - OWLClass c = factory.getOWLClass(URI.create(one.a.toString())); owlAPIOntologyCollector.addAxiom(factory.getOWLObjectPropertyDomainAxiom(me, c)); }else if(one.aPartContains(OWLVocabulary.RDFS_SUB_PROPERTY_OF)){ OWLObjectProperty p = factory.getOWLObjectProperty(URI.create(one.b.toString())); owlAPIOntologyCollector.addAxiom(factory.getOWLSubObjectPropertyAxiom(me, p)); - }else if(one.aPartContains(OWLVocabulary.OWL_inverseOf)){ OWLObjectProperty p = factory.getOWLObjectProperty(URI.create(one.b.toString())); - owlAPIOntologyCollector.addAxiom(factory.getOWLInverseObjectPropertiesAxiom(me, p)); + owlAPIOntologyCollector.addAxiom(factory.getOWLInverseObjectPropertiesAxiom(me, p)); }else if(one.aPartContains(OWLVocabulary.OWL_equivalentProperty)){ OWLObjectProperty p = factory.getOWLObjectProperty(URI.create(one.b.toString())); Set<OWLObjectProperty> tmp = new HashSet<OWLObjectProperty>(); @@ -174,7 +176,13 @@ } } for (BlankNode bn : blankNodes) { - System.out.println(bn.getAnonymousClass(owlAPIOntologyCollector).toString()); + OWLDescription target = bn.getAnonymousClass(owlAPIOntologyCollector); + if(bn.getInBoundEdge().equals(OWLVocabulary.RDFS_range)){ + owlAPIOntologyCollector.addAxiom(factory.getOWLObjectPropertyRangeAxiom(me, target)); + }else if(bn.getInBoundEdge().equals(OWLVocabulary.RDFS_domain)){ + owlAPIOntologyCollector.addAxiom(factory.getOWLObjectPropertyDomainAxiom(me, target)); + } + //System.out.println(bn.getAnonymousClass(owlAPIOntologyCollector).toString()); } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -76,7 +76,7 @@ private static final boolean debug = false; // tupleaquisitor - private static final boolean debugUseImprovedTupleAquisitor = debug && false; // switches + //private static final boolean debugUseImprovedTupleAquisitor = debug && false; // switches // sysex private static final boolean debugExitAfterExtraction = debug && false; // switches @@ -192,6 +192,12 @@ options.add(new BooleanConfigOption("getPropertyInformation", "gets all types for extracted ObjectProperties", false, false, true)); + options.add(new BooleanConfigOption("dissolveBlankNodes", + "determines whether Blanknodes are dissolved. This is a costly function.", true, false, + true)); + options.add(new BooleanConfigOption("useImprovedSparqlTupelAquisitor", + "uses deeply nested SparqlQueries, according to recursion depth, still EXPERIMENTAL", false, false, + true)); options.add(CommonConfigOptions.getVerbosityOption()); options.add(new StringSetConfigOption("defaultGraphURIs", @@ -389,13 +395,16 @@ } public TupleAquisitor getTupleAquisitor() { - if (debugUseImprovedTupleAquisitor) { - return new SparqlTupleAquisitorImproved(getSparqlQueryMaker(), + TupleAquisitor ret = null; + if (configurator.getUseImprovedSparqlTupelAquisitor()) { + ret = new SparqlTupleAquisitorImproved(getSparqlQueryMaker(), getSPARQLTasks(), configurator.getRecursionDepth()); } else { - return new SparqlTupleAquisitor(getSparqlQueryMaker(), + ret = new SparqlTupleAquisitor(getSparqlQueryMaker(), getSPARQLTasks()); } + ret.setDissolveBlankNodes(configurator.getDissolveBlankNodes()); + return ret; } Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -197,6 +197,7 @@ makeComponentFactory(); makeInterface(); + writePackageHTML(); System.out.println("Done"); } @@ -503,6 +504,21 @@ } + private static void writePackageHTML(){ + String c = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">"+ + "<html>"+ + "<head></head>"+ + "<body bgcolor=\"white\">"+ + "<p>Automatically generated classes, which enable programmatically setting"+ + "and getting configuration options of components.</p>"+ + "</body>"+ + "</html>"; + try{ + Files.createFile(new File(TARGET_DIR+File.separator+"package.html"), c); + }catch (Exception e) { + e.printStackTrace(); + } + } private static String expandCollection(Collection<String> col, @@ -545,6 +561,7 @@ } + private static String checkstyleAdjust(String type) { type = type.replaceAll("<", "("); type = type.replaceAll(">", ")"); Modified: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -56,6 +56,9 @@ //private static Class usedReasoner = FastInstanceChecker.class; private static Class<? extends ReasonerComponent> usedReasoner = OWLAPIReasoner.class; + + private static int numberOfLearningProblems = 100; + private static boolean allOrExists = true; private static boolean tenORthirty = true; @@ -88,8 +91,8 @@ reasoningService = null; ComponentManager.getInstance().freeAllComponents(); - int count = 1; - while(count<10000){ + int count = 0; + while(count<numberOfLearningProblems){ /*if((count%5)==0){ //System.out.println(count+" "+allOrExists+"::"+tenORthirty); Added: trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/package.html 2008-09-25 13:40:25 UTC (rev 1256) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Classes for the WikipediaCategoryCleaner script</p> +</body> +</html> Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/utilities/examples/ExampleContainer.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Jens Lehmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -24,6 +24,17 @@ import org.dllearner.core.owl.Individual; + + +/** + * A simple container for storing pos and negexamples, + * basically a more simple parameter or return value. + * + * It also contains static functions to test if all example sets are different. + * + * @author Sebastian Hellmann + * + */ public class ExampleContainer implements Comparable<ExampleContainer>{ Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-09-24 15:33:30 UTC (rev 1255) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-09-25 13:40:25 UTC (rev 1256) @@ -23,6 +23,10 @@ public static final String RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; + public static final String RDF_FIRST = "http://www.w3.org/1999/02/22-rdf-syntax-ns#first"; + public static final String RDF_REST = "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"; + public static final String RDF_NIL = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"; + public static final String RDFS_SUBCLASS_OF = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; public static final String RDFS_CLASS = "http://www.w3.org/2000/01/rdf-schema#Class"; @@ -35,6 +39,7 @@ public static final String RDFS_range = "http://www.w3.org/2000/01/rdf-schema#range"; + public static final String OWL_SAME_AS = "http://www.w3.org/2002/07/owl#sameAs"; public static final String OWL_OBJECTPROPERTY = "http://www.w3.org/2002/07/owl#ObjectProperty"; public static final String OWL_DATATYPPROPERTY = "http://www.w3.org/2002/07/owl#DataTypeProperty"; @@ -48,8 +53,17 @@ public static final String OWL_unionOf = "http://www.w3.org/2002/07/owl#unionOf"; public static final String OWL_complementOf = "http://www.w3.org/2002/07/owl#complementOf"; + public static final String OWL_RESTRICTION = "http://www.w3.org/2002/07/owl#Restriction"; + public static final String OWL_ON_PROPERTY = "http://www.w3.org/2002/07/owl#onProperty"; + public static final String OWL_ALL_VALUES_FROM = "http://www.w3.org/2002/07/owl#allValuesFrom"; + public static final String OWL_SOME_VALUES_FROM = "http://www.w3.org/2002/07/owl#allValuesFrom"; + public static final String OWL_HAS_VALUE = "http://www.w3.org/2002/07/owl#hasValue"; + public static final String OWL_maxCardinality = "http://www.w3.org/2002/07/owl#maxCardinality"; + public static final String OWL_minCardinality = "http://www.w3.org/2002/07/owl#minCardinality"; + public static final String OWL_cardinality = "http://www.w3.org/2002/07/owl#cardinality"; + public static final String OWL_FunctionalProperty = "http://www.w3.org/2002/07/owl#FunctionalProperty"; public static final String OWL_InverseFunctionalProperty = "http://www.w3.org/2002/07/owl#InverseFunctionalProperty"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-24 15:38:25
|
Revision: 1255 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1255&view=rev Author: kurzum Date: 2008-09-24 15:33:30 +0000 (Wed, 24 Sep 2008) Log Message: ----------- latest changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.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/LiteralNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.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/test/SparqlExtractionTest.java trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/aquisitors/package.html trunk/src/dl-learner/org/dllearner/kb/extraction/package.html trunk/src/dl-learner/org/dllearner/kb/manipulator/package.html Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -151,7 +151,7 @@ return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "objList") ; } /** -* saveExtractedFragment Specifies whether the extracted ontology is written to a file or not.. +* saveExtractedFragment Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.. * mandatory: false| reinit necessary: true * default value: true * @return boolean @@ -345,7 +345,7 @@ reinitNecessary = true; } /** -* @param saveExtractedFragment Specifies whether the extracted ontology is written to a file or not.. +* @param saveExtractedFragment Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.. * mandatory: false| reinit necessary: true * default value: true **/ Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -47,6 +47,7 @@ return bNodeId; } //RBC + @Override public String toString(){ //RBC return "I'm a blank node with id: "+bNodeId+"||"+blankNode; Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -88,7 +88,7 @@ tuple.b = new RDFBlankNode(currentId, tuple.b); System.out.println(uri+" replaced blanknode "+tuple.b); dissolveBlankNodes(currentId, uri, tuple); - System.out.println(BlankNodeCollector.getBlankNodeMap()); + //System.out.println(BlankNodeCollector.getBlankNodeMap()); } } Added: trunk/src/dl-learner/org/dllearner/kb/aquisitors/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/package.html 2008-09-24 15:33:30 UTC (rev 1255) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Different classes for physically extracting triples from data sources.</p> +</body> +</html> Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -1,7 +1,10 @@ package org.dllearner.kb.extraction; +import java.net.URI; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -10,18 +13,26 @@ import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; public class BlankNode extends Node { RDFBlankNode bNode; + String inboundEdge; + + private List<Node> connectedNodes =new ArrayList<Node>(); + private List<ObjectPropertyNode> objectProperties = new ArrayList<ObjectPropertyNode>(); private List<DatatypePropertyNode> datatypeProperties = new ArrayList<DatatypePropertyNode>(); - public BlankNode(RDFBlankNode bNode){ - super("_:internal_"+bNode.getBNodeId()); + public BlankNode(RDFBlankNode bNode, String inboundEdge){ + super(""+bNode.getBNodeId()); this.bNode=bNode; + this.inboundEdge = inboundEdge; } @@ -34,21 +45,25 @@ for (RDFNodeTuple tuple : s) { if(tuple.b.isLiteral()) { datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); + connectedNodes.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); }else if(tuple.b.isAnon()){ - BlankNode tmp = new BlankNode( (RDFBlankNode)tuple.b); + BlankNode tmp = new BlankNode( (RDFBlankNode)tuple.b, tuple.a.toString()); objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, tmp )); + connectedNodes.add(new BlankNode( (RDFBlankNode)tuple.b, tuple.a.toString())); newNodes.add(tmp); }else{ objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); + connectedNodes.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); } } return newNodes; } @Override - public void expandProperties(TupleAquisitor TupelAquisitor, + public List<BlankNode> expandProperties(TupleAquisitor TupelAquisitor, Manipulator manipulator) { + return new ArrayList<BlankNode>(); } @Override @@ -68,8 +83,77 @@ } @Override + public URI getURI(){ + return URI.create("http://www.empty.org/empty#empty"); + } + + @Override public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ //FIXME } + + public String getInBoundEdge(){ + return inboundEdge; + } + + public OWLDescription getAnonymousClass(OWLAPIOntologyCollector owlAPIOntologyCollector){ + OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); + OWLDescription ret = factory.getOWLClass(URI.create("http://dummy.org/dummy")); + + for (Node n : connectedNodes) { + System.out.println(n.toString()); + } + + if(containsDataTypeProperties()){ + //do nothing right now, add a return here; + } + + Set<OWLDescription> l = new HashSet<OWLDescription>(); + for (Node n : connectedNodes) { + if(n instanceof BlankNode){ + l.add(((BlankNode)n).getAnonymousClass(owlAPIOntologyCollector)); + }else{ + l.add(factory.getOWLClass(n.getURI())); + } + } + + if(isOfType(OWLVocabulary.OWL_intersectionOf)){ + ret = factory.getOWLObjectIntersectionOf(l); + System.out.println("aaa"); + }else if(isOfType(OWLVocabulary.OWL_unionOf)){ + ret = factory.getOWLObjectUnionOf(l); + System.out.println("aaa"); + }else if(isOfType(OWLVocabulary.OWL_complementOf)){ + ret = factory.getOWLObjectComplementOf(new ArrayList<OWLDescription>(l).remove(0)); + System.out.println("aaa"); + } + return ret; + } + + + + private boolean isOfType(String type){ + for (Node n : connectedNodes) { + if((n instanceof BlankNode ) + && + ((BlankNode)n).getInBoundEdge().equals(type)) { + return true; + }else if((n instanceof ObjectPropertyNode ) + && + ((ObjectPropertyNode)n).getAPart().toString().equals(type)) { + return true; + } + } + return false; + } + + private boolean containsDataTypeProperties(){ + for (Node n : connectedNodes) { + if(n instanceof DatatypePropertyNode) { + return true; + } + } + return false; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -48,7 +48,8 @@ List<ObjectPropertyNode> classProperties = new ArrayList<ObjectPropertyNode>(); List<DatatypePropertyNode> datatypeProperties = new ArrayList<DatatypePropertyNode>(); - + List<BlankNode> blankNodes = new ArrayList<BlankNode>(); + public ClassNode(String uri) { super(uri); } @@ -80,12 +81,12 @@ }else if(tuple.b.isAnon()){ logger.warn("blanknodes not supported as of now "+ this +" in tuple" + tuple); RDFBlankNode n = (RDFBlankNode) tuple.b; - //SortedSet<RDFNodeTuple> bNodeTuples = BlankNodeCollector.getBlankNode(n.getBNodeId()); - //BlankNode tmp = new BlankNode(n); + + BlankNode tmp = new BlankNode( n, tuple.a.toString()); //add it to the graph - //classProperties.add(new ObjectPropertyNode( tuple.a.toString(), this, tmp)); + blankNodes.add(tmp); //return tmp; - return null; + return tmp; // substitute rdf:type with owl:subclassof }else if (property.equals(OWLVocabulary.RDF_TYPE) || OWLVocabulary.isStringSubClassVocab(property)) { @@ -108,7 +109,8 @@ // gets the types for properties recursively @Override - public void expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + public List<BlankNode> expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + return new ArrayList<BlankNode>(); } @@ -151,7 +153,7 @@ }else if(one.getURIString().equals(OWLVocabulary.OWL_EQUIVALENT_CLASS)){ owlAPIOntologyCollector.addAxiom(factory.getOWLEquivalentClassesAxiom(me, c)); }else { - logger.warn("missing : " +one.getURIString()); + tail( getURIString()+"||"+one.getURIString()); } one.getBPart().toOWLOntology(owlAPIOntologyCollector); } @@ -166,10 +168,13 @@ OWLLabelAnnotation label = factory.getOWLLabelAnnotation(one.getBPart().getLiteral().getString()); owlAPIOntologyCollector.addAxiom(factory.getOWLEntityAnnotationAxiom(me, label)); }else { - logger.warn("missing : " +one.getURIString()); + tail(getURIString()+"||"+one.getURIString()); } } + for (BlankNode bn : blankNodes) { + System.out.println(bn.getAnonymousClass(owlAPIOntologyCollector).toString()); + } }catch (Exception e) { System.out.println("aaa"+getURIString()); e.printStackTrace(); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -19,6 +19,7 @@ */ package org.dllearner.kb.extraction; +import java.util.ArrayList; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -49,7 +50,8 @@ // gets the types for properties recursively @Override - public void expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + public List<BlankNode> expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + return new ArrayList<BlankNode>(); } @Override Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -98,7 +98,7 @@ tupleAquisitor.setNextTaskToNormal(); tmp.addAll(nextNode.expand(tupleAquisitor, configuration.getManipulator())); - //System.out.println(tmpVec); + //.out.println(tmpVec); } collectNodes.addAll(tmp); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -112,10 +112,12 @@ // gets the types for properties recursively @Override - public void expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + public List<BlankNode> expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + List<BlankNode> ret = new ArrayList<BlankNode>(); for (ObjectPropertyNode one : objectProperties) { - one.expandProperties(tupelAquisitor, manipulator); + ret.addAll(one.expandProperties(tupelAquisitor, manipulator)); } + return ret; } @@ -164,12 +166,12 @@ for (DatatypePropertyNode one : datatypeProperties) { OWLDataProperty p = factory.getOWLDataProperty(one.getURI()); Literal ln = one.getBPart().getLiteral(); + try{ - - if(one.getBPart().isString()){ owlAPIOntologyCollector.addAxiom( - factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getString())); + factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getString())); + } else if(one.getBPart().isDouble()){ owlAPIOntologyCollector.addAxiom( factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getDouble())); @@ -183,7 +185,7 @@ owlAPIOntologyCollector.addAxiom( factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getBoolean())); } else { - logger.warn("missing : "+one.getURIString()); + tail(getURIString()+"||"+one.getURIString()); } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -70,7 +70,8 @@ // gets the types for properties recursively @Override - public void expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + public List<BlankNode> expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + return new ArrayList<BlankNode>(); } @Override @@ -145,6 +146,9 @@ return false; } } + public boolean hasLanguageTag(){ + return (!(l.getLanguage().length()==0)); + } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -85,12 +85,15 @@ } - public OWLOntology getOWLAPIOntologyForNodes(List<Node> nodes){ + public OWLOntology getOWLAPIOntologyForNodes(List<Node> nodes, boolean saveOntology){ for (Node n : nodes) { n.toOWLOntology(configuration.getOwlAPIOntologyCollector()); } + if(saveOntology){ configuration.getOwlAPIOntologyCollector().saveOntology(); + } return configuration.getOwlAPIOntologyCollector().getCurrentOntology(); + } public URL getPhysicalOntologyURL()throws MalformedURLException{ Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -23,6 +23,7 @@ import java.util.List; import java.util.SortedSet; +import org.apache.log4j.Logger; import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; @@ -35,8 +36,11 @@ * */ public abstract class Node { - + private static Logger logger = Logger + .getLogger(Node.class); + // make sure no information is missed during the transition to OWLAPI + public static final boolean DEBUGTAIL = true; protected String uri; // protected String type; @@ -61,7 +65,7 @@ * * @param manipulator */ - public abstract void expandProperties( + public abstract List<BlankNode> expandProperties( TupleAquisitor TupelAquisitor, Manipulator manipulator); /** @@ -99,11 +103,16 @@ return "<"+uri+"> "; } - - - public boolean isExpanded(){ return expanded; } + + public void tail(String uri){ + if(DEBUGTAIL){ + logger.warn("missing: "+uri); + System.exit(0); + } + + } } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -19,15 +19,22 @@ */ package org.dllearner.kb.extraction; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.kb.aquisitors.RDFBlankNode; import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; +import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLLabelAnnotation; import org.semanticweb.owl.model.OWLObjectProperty; @@ -46,6 +53,7 @@ private SortedSet<String> specialTypes = new TreeSet<String>(); @SuppressWarnings("unused") private SortedSet<RDFNodeTuple> propertyInformation = new TreeSet<RDFNodeTuple>(); + List<BlankNode> blankNodes = new ArrayList<BlankNode>(); public ObjectPropertyNode(String propertyURI, Node a, Node b) { super(propertyURI, a, b); @@ -60,16 +68,27 @@ // gets the types for properties recursively @Override - public void expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { - b.expandProperties(tupelAquisitor, manipulator); + public List<BlankNode> expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { + List<BlankNode> ret = new ArrayList<BlankNode>(); + ret.addAll(b.expandProperties(tupelAquisitor, manipulator)); SortedSet<RDFNodeTuple> newTypes = tupelAquisitor.getTupelForResource(uri); for (RDFNodeTuple tuple : newTypes) { try { + if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)) { - specialTypes.add(tuple.b.toString()); + if(!tuple.b.toString().equals(OWLVocabulary.OWL_OBJECTPROPERTY)){ + specialTypes.add(tuple.b.toString()); + } }else if(tuple.b.isAnon()){ logger.warn("blanknodes currently not implemented in this tuple aquisitor"); + RDFBlankNode n = (RDFBlankNode) tuple.b; + + BlankNode tmp = new BlankNode( n, tuple.a.toString()); + //add it to the graph + blankNodes.add(tmp); + ret.add( tmp); }else{ + propertyInformation.add(tuple); } @@ -77,7 +96,10 @@ logger.warn("resource "+uri+" with "+ tuple); e.printStackTrace(); } + } + return ret; + } @@ -105,8 +127,40 @@ OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); OWLObjectProperty me =factory.getOWLObjectProperty(getURI()); + for (RDFNodeTuple one : propertyInformation) { + if(one.aPartContains(OWLVocabulary.RDFS_range)){ + OWLClass c = factory.getOWLClass(URI.create(one.a.toString())); + owlAPIOntologyCollector.addAxiom(factory.getOWLObjectPropertyRangeAxiom(me, c)); + }else if(one.aPartContains(OWLVocabulary.RDFS_domain)){ + OWLClass c = factory.getOWLClass(URI.create(one.a.toString())); + owlAPIOntologyCollector.addAxiom(factory.getOWLObjectPropertyDomainAxiom(me, c)); + }else if(one.aPartContains(OWLVocabulary.RDFS_SUB_PROPERTY_OF)){ + OWLObjectProperty p = factory.getOWLObjectProperty(URI.create(one.b.toString())); + owlAPIOntologyCollector.addAxiom(factory.getOWLSubObjectPropertyAxiom(me, p)); + + }else if(one.aPartContains(OWLVocabulary.OWL_inverseOf)){ + OWLObjectProperty p = factory.getOWLObjectProperty(URI.create(one.b.toString())); + owlAPIOntologyCollector.addAxiom(factory.getOWLInverseObjectPropertiesAxiom(me, p)); + }else if(one.aPartContains(OWLVocabulary.OWL_equivalentProperty)){ + OWLObjectProperty p = factory.getOWLObjectProperty(URI.create(one.b.toString())); + Set<OWLObjectProperty> tmp = new HashSet<OWLObjectProperty>(); + tmp.add(me);tmp.add(p); + owlAPIOntologyCollector.addAxiom(factory.getOWLEquivalentObjectPropertiesAxiom(tmp)); + + }else if(one.a.toString().equals(OWLVocabulary.RDFS_LABEL)){ + OWLLabelAnnotation label = factory.getOWLLabelAnnotation(one.b.toString()); + owlAPIOntologyCollector.addAxiom(factory.getOWLEntityAnnotationAxiom(me, label)); + }else if(one.b.isLiteral()){ + // XXX comments + } + else { + tail(getURIString()+"||"+one); + } + + } for (String one : specialTypes) { + if(one.equals(OWLVocabulary.OWL_FunctionalProperty)){ owlAPIOntologyCollector.addAxiom(factory.getOWLFunctionalObjectPropertyAxiom(me)); }else if(one.equals(OWLVocabulary.OWL_InverseFunctionalProperty)){ @@ -115,8 +169,13 @@ owlAPIOntologyCollector.addAxiom(factory.getOWLTransitiveObjectPropertyAxiom(me)); }else if(one.equals(OWLVocabulary.OWL_SymmetricProperty)){ owlAPIOntologyCollector.addAxiom(factory.getOWLSymmetricObjectPropertyAxiom(me)); + }else{ + tail(getURIString()+"||"+one); } } + for (BlankNode bn : blankNodes) { + System.out.println(bn.getAnonymousClass(owlAPIOntologyCollector).toString()); + } } Added: trunk/src/dl-learner/org/dllearner/kb/extraction/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/package.html 2008-09-24 15:33:30 UTC (rev 1255) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Core extraction algorithm including datastructures.</p> +</body> +</html> Added: trunk/src/dl-learner/org/dllearner/kb/manipulator/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/package.html 2008-09-24 15:33:30 UTC (rev 1255) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Classes for manipulating extracted triples</p> +</body> +</html> Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -170,11 +170,8 @@ options .add(new BooleanConfigOption( "saveExtractedFragment", - "Specifies whether the extracted ontology is written to a file or not.", + "Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.", true, false, true)); - - - options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates", new ArrayList<StringTuple>(), false, true)); options.add(new StringTupleListConfigOption("replaceObject", @@ -253,49 +250,14 @@ extractionTime.setTime(); List<Node> seedNodes = m.extract(configurator.getInstances()); - fragment = m.getOWLAPIOntologyForNodes(seedNodes); - //System.exit(0); + fragment = m.getOWLAPIOntologyForNodes(seedNodes, configurator.getSaveExtractedFragment()); - //ont = m.getNTripleForNodes(seedNodes); extractionTime.printAndSet("extraction needed"); logger.info("Finished collecting Fragment"); ontologyFragmentURL = m.getPhysicalOntologyURL(); - /* - if (dumpToFile) { - String filename = System.currentTimeMillis() + ".nt"; - String basedir = "cache" + File.separator; - try { - if (!new File(basedir).exists()) { - new File(basedir).mkdir(); - } - - File dump = new File(basedir + filename); - - FileWriter fw = new FileWriter(dump, true); - fw.write(ont); - fw.flush(); - fw.close(); - - dumpFile = (dump).toURI().toURL(); - - if (configurator.getConvertNT2RDF()) { - NT2RDF.convertNT2RDF(dump.getAbsolutePath()); - - } - } catch (Exception e) { - e.printStackTrace(); - } - }*/ - /*if (format.equals("KB")) { - try { - // kb = KBParser.parseKBFile(new StringReader(ont)); - kb = KBParser.parseKBFile(dumpFile); - } catch (Exception e) { - e.printStackTrace(); - } - }*/ + } catch (Exception e) { e.printStackTrace(); } @@ -318,13 +280,8 @@ */ @Override public String toDIG(URI kbURI) { - //if (format.equals("RDF/XML")){ return JenaOWLDIGConverter.getTellsString(ontologyFragmentURL, OntologyFormat.RDF_XML, kbURI); - //}else { - //throw new Error("KB Format not supported any more"); - //return DIGConverter.getDIGString(kb, kbURI).toString(); - //} } /* @@ -363,9 +320,6 @@ } - /*public String[] getOntArray() { - return ontArray; - }*/ public SparqlQuery sparqlQuery(String query) { return new SparqlQuery(query, getSparqlEndpoint()); Modified: trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -76,7 +76,7 @@ 200 ); m.useConfiguration(conf); - + @SuppressWarnings("unused") String u2 = "http://dbpedia.org/resource/Angela_Merkel"; String filename = "cache/"+System.currentTimeMillis() + ".nt"; Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/RDFNodeTuple.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -62,7 +62,7 @@ return b.toString().contains(partOf); } - @Deprecated + public String getNTriple (String subject){ String ret = "<"+subject+"> "; ret+="<"+a.toString()+"> "; Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-09-24 13:36:46 UTC (rev 1254) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-09-24 15:33:30 UTC (rev 1255) @@ -30,7 +30,11 @@ public static final String RDFS_LABEL = "http://www.w3.org/2000/01/rdf-schema#label"; public static final String RDFS_DESCRIPTION = "http://www.w3.org/2000/01/rdf-schema#description"; + public static final String RDFS_SUB_PROPERTY_OF = "http://www.w3.org/2000/01/rdf-schema#subPropertyOf"; + public static final String RDFS_domain = "http://www.w3.org/2000/01/rdf-schema#domain"; + public static final String RDFS_range = "http://www.w3.org/2000/01/rdf-schema#range"; + public static final String OWL_SAME_AS = "http://www.w3.org/2002/07/owl#sameAs"; public static final String OWL_OBJECTPROPERTY = "http://www.w3.org/2002/07/owl#ObjectProperty"; public static final String OWL_DATATYPPROPERTY = "http://www.w3.org/2002/07/owl#DataTypeProperty"; @@ -40,13 +44,24 @@ public static final String OWL_DISJOINT_WITH = "http://www.w3.org/2002/07/owl#disjointWith"; public static final String OWL_EQUIVALENT_CLASS = "http://www.w3.org/2002/07/owl#equivalentClass"; + public static final String OWL_intersectionOf = "http://www.w3.org/2002/07/owl#intersectionOf"; + public static final String OWL_unionOf = "http://www.w3.org/2002/07/owl#unionOf"; + public static final String OWL_complementOf = "http://www.w3.org/2002/07/owl#complementOf"; + + public static final String OWL_FunctionalProperty = "http://www.w3.org/2002/07/owl#FunctionalProperty"; public static final String OWL_InverseFunctionalProperty = "http://www.w3.org/2002/07/owl#InverseFunctionalProperty"; public static final String OWL_TransitiveProperty = "http://www.w3.org/2002/07/owl#TransitiveProperty"; public static final String OWL_SymmetricProperty = "http://www.w3.org/2002/07/owl#SymmetricProperty"; + + public static final String OWL_equivalentProperty = "http://www.w3.org/2002/07/owl#equivalentProperty"; + public static final String OWL_inverseOf = "http://www.w3.org/2002/07/owl#inverseOf"; + + + 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"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 13:36:52
|
Revision: 1254 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1254&view=rev Author: sknappe Date: 2008-09-24 13:36:46 +0000 (Wed, 24 Sep 2008) Log Message: ----------- worked on getting instances from concepts, should now work for some more concepts, still some are missing (some with NOT and ALL,...) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -150,11 +150,9 @@ if (count($result['results']['bindings'])==0) throw new Exception("An article with that name does not exist. The Search is started ..."); $ret=array(); foreach ($result['results']['bindings'] as $results){ - if (isset($results['obj'])) $value=$results['obj']; - else if (isset($results['sub'])) $value=$results['sub']; - if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))){ - if (isset($results['obj'])) $ret[0][$results['pred']['value']][]=$value; - else if (isset($results['sub'])) $ret[1][$results['pred']['value']][]=$value; + if (!(isset($results['xml:lang'])&&($results['xml:lang']!=$this->lang))){ + if (isset($results['obj'])) $ret[0][$results['pred']['value']][]=$results['obj']; + else if (isset($results['sub'])) $ret[1][$results['pred']['value']][]=$results['sub']; } } @@ -258,9 +256,9 @@ return $return; }*/ - function getSubjectsFromConcept($concept) + function getSubjectsFromConcept($concept,$number) { - $query=$this->client->SparqlRetrieval($concept); + $query=$this->client->SparqlRetrieval($concept,$number); $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -49,7 +49,7 @@ $alltriples=$sc->getTriples($uri); $triples=$alltriples[0]; $subjecttriples=$alltriples[1]; - + //BUILD ARTICLE // goal: display the data in a nice (DBpedia specific way), maybe similar to // dbpedia.org/search @@ -294,7 +294,7 @@ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; // display the remaining properties as list which can be used for further navigation - $content .= get_triple_table($triples,$subjecttriples); + $content .= get_triple_table($triples,$subjecttriples,$predicatelabels); } //Restart the Session Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -19,17 +19,16 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); $label=$sc->getNaturalDescription($kb); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/class\/yago\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); $content=""; if ($test){ - //connect to the database - $settings=new Settings(); - $databaseConnection=new DatabaseConnection($settings->database_type); - $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); - $databaseConnection->select_database($settings->database_name); - preg_match_all("/\"http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); $final=''; @@ -70,21 +69,35 @@ $result2=$databaseConnection->nextEntry($res2); $labels[]=$result2['label']; } - $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$label,$number); + $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$number); $bestsearches=getBestSearches($names,$labels); } else $content.="Your Search brought no results."; } else{ - /*try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - $subjects=$sc->getSubjectsFromConcept($concept); - $content.=getResultsTable($subjects); + try{ + $subjects=$sc->getSubjectsFromConcept($kb,$number); + $names=array(); + $labels=array(); + foreach ($subjects as $subject){ + $query='SELECT number, label FROM rank WHERE name="'.$subject.'"'; + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); + $names[]=$result['number'].'<'.$subject; + $labels[]=$result['number'].$subject.'<'.$result['label']; + } + rsort($labels); + rsort($names); + for ($i=0;$i<count($names);$i++){ + $labels[$i]=substr($labels[$i],strpos($labels[$i],'<')+1); + $names[$i]=substr($names[$i],strpos($names[$i],'<')+1); + } + $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$number); + $bestsearches=getBestSearches($names,$labels); } catch (Exception $e){ $content=$e->getMessage(); - }*/ + } } print $content; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -154,7 +154,7 @@ return $ret; } -function getConceptResultsTable($names,$labels,$kb,$label,$number) +function getConceptResultsTable($names,$labels,$kb,$number) { $ret="<p>These are your results. Show best "; for ($k=10;$k<125;){ @@ -224,7 +224,7 @@ fclose($file); } -function get_triple_table($triples,$subjecttriples) { +function get_triple_table($triples,$subjecttriples,$predicateLabels) { $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; $i=1; @@ -313,15 +313,15 @@ function nicePredicate($predicate) { if (strripos ($predicate, "#")>strripos ($predicate, "/")){ - $namespace=substr ($predicate,0,strripos ($predicate, "#")); + //$namespace=substr ($predicate,0,strripos ($predicate, "#")); $name=substr ($predicate,strripos ($predicate, "#")+1); } else{ - $namespace=substr ($predicate,0,strripos ($predicate, "/")); + //$namespace=substr ($predicate,0,strripos ($predicate, "/")); $name=substr ($predicate,strripos ($predicate, "/")+1); } - switch ($namespace){ + /*switch ($namespace){ case "http://www.w3.org/2000/01/rdf-schema": $namespace="rdfs"; break; case "http://www.w3.org/2002/07/owl": $namespace="owl"; @@ -336,11 +336,15 @@ break; case "http://www.georss.org/georss/point": $namespace="georss"; break; - } + }*/ - //fl\xE4che has strange url - $name=str_replace('fl_percent_C3_percent_A4che','fl%C3%A4che',$name); - return $namespace.':'.urldecode($name); + //change urls with \xE4,\xF6,\xFC + $name=str_replace('_percent_C3_percent_A4','%C3%A4',$name); + $name=str_replace('_percent_C3_percent_B6','%C3%B6',$name); + $name=str_replace('_percent_C3_percent_BC','%C3%BC',$name); + $name=str_replace('_',' ',$name); + + return urldecode($name); } function formatClassArray($ar) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 13:35:46
|
Revision: 1253 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1253&view=rev Author: sknappe Date: 2008-09-24 13:35:30 +0000 (Wed, 24 Sep 2008) Log Message: ----------- changed sparqlqueryconcept function so that i can give a limit Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-24 11:52:27 UTC (rev 1252) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-24 13:35:30 UTC (rev 1253) @@ -716,9 +716,9 @@ } @WebMethod - public String SparqlRetrieval(String conceptString) throws ParseException { + public String SparqlRetrieval(String conceptString,int limit) throws ParseException { // call parser to parse concept - return SparqlQueryDescriptionConvertVisitor.getSparqlQuery(conceptString); + return SparqlQueryDescriptionConvertVisitor.getSparqlQuery(conceptString,limit); } @WebMethod This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 12:23:34
|
Revision: 1251 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1251&view=rev Author: sknappe Date: 2008-09-24 11:49:47 +0000 (Wed, 24 Sep 2008) Log Message: ----------- bugfix in sparqlknowledgesource, changed navigator manipulator (added a rule to filter type tripels that are not yago), changed evaluationdescriptions ws a bit (added method with 3 parameters, bugfix for JSON syntax) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorFilterRule.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-24 08:58:31 UTC (rev 1250) +++ trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-24 11:49:47 UTC (rev 1251) @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.LinkedList; +import java.util.List; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.core.ComponentInitException; @@ -180,6 +181,11 @@ public EvaluatedDescription getCurrentlyBestEvaluatedDescription() { return learner.getCurrentlyBestEvaluatedDescription(); } + + @Override + public List<EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions){ + return learner.getCurrentlyBestEvaluatedDescriptions(nrOfDescriptions, accuracyThreshold, filterNonMinimalDescriptions); + } @Override public Score getSolutionScore() { Added: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorFilterRule.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorFilterRule.java 2008-09-24 11:49:47 UTC (rev 1251) @@ -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.kb.manipulator; + +import java.util.LinkedList; +import java.util.List; +import java.util.SortedSet; + +import org.dllearner.kb.extraction.Node; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.RDFNode; +import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; + + +public class DBpediaNavigatorFilterRule extends Rule{ + + + public DBpediaNavigatorFilterRule(Months month){ + super(month); + } + // Set<String> classproperties; + + @Override + public SortedSet<RDFNodeTuple> applyRule(Node subject, SortedSet<RDFNodeTuple> tuples){ + RDFNode clazz = null; + RDFNodeTuple typeTuple = null; + List<RDFNodeTuple> toRemove=new LinkedList<RDFNodeTuple>(); + for (RDFNodeTuple tuple : tuples) { + + if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)){ + clazz = tuple.b; + typeTuple = tuple; + } + + if (tuple.a.toString().equals("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") && !(tuple.b.toString().startsWith("http://dbpedia.org/class/yago"))){ + toRemove.add(typeTuple); + } + }//end for + for (RDFNodeTuple tuple : toRemove) + tuples.remove(tuple); + return tuples; + } + + @Override + public void logJamon(){ + + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-09-24 08:58:31 UTC (rev 1250) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-09-24 11:49:47 UTC (rev 1251) @@ -45,7 +45,7 @@ RDFNode clazz = null; RDFNodeTuple typeTuple = null; for (RDFNodeTuple tuple : tuples) { - + if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)){ clazz = tuple.b; typeTuple = tuple; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-09-24 08:58:31 UTC (rev 1250) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-09-24 11:49:47 UTC (rev 1251) @@ -89,8 +89,9 @@ public static Manipulator getDBpediaNavigatorManipulator(){ Manipulator m = new Manipulator(); - m.addRule(new DBPediaNavigatorCityLocatorRule(Months.JANUARY)); - m.addRule(new DBpediaNavigatorOtherRule(Months.DECEMBER)); + //m.addRule(new DBPediaNavigatorCityLocatorRule(Months.JANUARY)); + //m.addRule(new DBpediaNavigatorOtherRule(Months.DECEMBER)); + m.addRule(new DBpediaNavigatorFilterRule(Months.JANUARY)); return m; } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 08:58:31 UTC (rev 1250) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 11:49:47 UTC (rev 1251) @@ -417,7 +417,7 @@ public Manipulator getManipulator() { // get Options for Filters - if (configurator.getPredefinedManipulator() == null) { + if (configurator.getPredefinedManipulator() != null) { return Manipulator.getManipulatorByName(configurator .getPredefinedManipulator()); Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-24 08:58:31 UTC (rev 1250) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-24 11:49:47 UTC (rev 1251) @@ -394,12 +394,26 @@ @WebMethod public String getCurrentlyBestEvaluatedDescriptions(int id, int limit) throws ClientNotKnownException{ + return currentlyBestEvaluatedDescriptions(id,limit,-1,false); + } + + @WebMethod + public String getCurrentlyBestEvaluatedDescriptionsFiltered(int id,int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions) throws ClientNotKnownException + { + return currentlyBestEvaluatedDescriptions(id,nrOfDescriptions,accuracyThreshold,filterNonMinimalDescriptions); + } + + private String currentlyBestEvaluatedDescriptions(int id,int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions) throws ClientNotKnownException + { ClientState state = getState(id); - List<EvaluatedDescription> descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(limit); + List<EvaluatedDescription> descriptions; + if (accuracyThreshold!=-1) descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(nrOfDescriptions, accuracyThreshold, filterNonMinimalDescriptions); + else descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(nrOfDescriptions); String json = "{"; int count = 1; for(EvaluatedDescription description : descriptions) { - json += "\"solution" + count + "\" : " + description.asJSON(); + if (count>1) json += ",\"solution" + count + "\" : " + description.asJSON(); + else json += "\"solution" + count + "\" : " + description.asJSON(); count++; } json+="}"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 11:52:34
|
Revision: 1252 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1252&view=rev Author: sknappe Date: 2008-09-24 11:52:27 +0000 (Wed, 24 Sep 2008) Log Message: ----------- little changes to get more descriptions Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 11:49:47 UTC (rev 1251) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 11:52:27 UTC (rev 1252) @@ -110,7 +110,7 @@ fclose($file); if ($run=="false"){ $this->client->stop($this->id); - return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,3,0.8,true),true); } } while($seconds<$this->learnttl&&$running); @@ -118,7 +118,7 @@ } //return $concepts->item; - return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,3,0.8,true),true); } function getNaturalDescription($concept) Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-24 11:49:47 UTC (rev 1251) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-24 11:52:27 UTC (rev 1252) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=10; + public $learnttl=5; public $language="en"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-24 08:58:34
|
Revision: 1250 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1250&view=rev Author: jenslehmann Date: 2008-09-24 08:58:31 +0000 (Wed, 24 Sep 2008) Log Message: ----------- moved ORE OWL test files from source tree to examples directory Modified Paths: -------------- trunk/build.xml Added Paths: ----------- trunk/examples/ore/ trunk/examples/ore/all_test.owl trunk/examples/ore/eq_test.owl trunk/examples/ore/father.owl trunk/examples/ore/father3.owl trunk/examples/ore/father_disjoint.owl trunk/examples/ore/father_inverse_property.owl trunk/examples/ore/father_neg.owl trunk/examples/ore/father_new.owl trunk/examples/ore/father_property.owl trunk/examples/ore/father_wrong.owl trunk/examples/ore/incohaerent.owl trunk/examples/ore/inconsistent.owl trunk/examples/ore/neg_has_all.owl trunk/examples/ore/neg_has_some.owl trunk/examples/ore/pos_b.owl trunk/examples/ore/pos_has_all.owl Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/ore/all_test.owl trunk/src/dl-learner/org/dllearner/tools/ore/eq_test.owl trunk/src/dl-learner/org/dllearner/tools/ore/father.owl trunk/src/dl-learner/org/dllearner/tools/ore/father3.owl trunk/src/dl-learner/org/dllearner/tools/ore/father_disjoint.owl trunk/src/dl-learner/org/dllearner/tools/ore/father_inverse_property.owl trunk/src/dl-learner/org/dllearner/tools/ore/father_neg.owl trunk/src/dl-learner/org/dllearner/tools/ore/father_new.owl trunk/src/dl-learner/org/dllearner/tools/ore/father_property.owl trunk/src/dl-learner/org/dllearner/tools/ore/father_wrong.owl trunk/src/dl-learner/org/dllearner/tools/ore/incohaerent.owl trunk/src/dl-learner/org/dllearner/tools/ore/inconsistent.owl trunk/src/dl-learner/org/dllearner/tools/ore/neg_has_all.owl trunk/src/dl-learner/org/dllearner/tools/ore/neg_has_some.owl trunk/src/dl-learner/org/dllearner/tools/ore/pos_b.owl trunk/src/dl-learner/org/dllearner/tools/ore/pos_has_all.owl Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-09-24 08:52:11 UTC (rev 1249) +++ trunk/build.xml 2008-09-24 08:58:31 UTC (rev 1250) @@ -4,7 +4,7 @@ <!-- directory settings --> <property name="lib_dir" value="lib" /> <property name="source_dir" value="src/dl-learner" /> - <property name="protege_dir" value="/Programme/Protege_4.0_alpha/plugins" /> + <property name="protege_dir" value="/home/jl/programme/Protege_4.0_beta/plugins" /> <property name="class_dir" value="classes" /> <property name="php_client_dir" value="src/php-client" /> Copied: trunk/examples/ore/all_test.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/all_test.owl) =================================================================== --- trunk/examples/ore/all_test.owl (rev 0) +++ trunk/examples/ore/all_test.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,219 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#anton --> + + <male rdf:about="#anton"> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#michelle"/> + <hasChild rdf:resource="#patrick"/> + </male> + + + + <!-- http://example.com/father#katja --> + + <female rdf:about="#katja"/> + + + + <!-- http://example.com/father#katrin --> + + <female rdf:about="#katrin"/> + + + + <!-- http://example.com/father#maria --> + + <female rdf:about="#maria"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#anton"/> + <hasChild rdf:resource="#michelle"/> + <hasChild rdf:resource="#tina"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#maria"/> + <hasChild rdf:resource="#steffi"/> + <hasChild rdf:resource="#tim"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#nicole --> + + <female rdf:about="#nicole"/> + + + + <!-- http://example.com/father#patrick --> + + <male rdf:about="#patrick"/> + + + + <!-- http://example.com/father#sarah --> + + <female rdf:about="#sarah"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#sarah"/> + <hasChild rdf:resource="#tina"/> + </father> + + + + <!-- http://example.com/father#steffi --> + + <female rdf:about="#steffi"/> + + + + <!-- http://example.com/father#thomas --> + + <father rdf:about="#thomas"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#katrin"/> + <hasChild rdf:resource="#nicole"/> + </father> + + + + <!-- http://example.com/father#tim --> + + <male rdf:about="#tim"> + <rdf:type rdf:resource="#father"/> + </male> + + + + <!-- http://example.com/father#tina --> + + <female rdf:about="#tina"/> +</rdf:RDF> Copied: trunk/examples/ore/eq_test.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/eq_test.owl) =================================================================== --- trunk/examples/ore/eq_test.owl (rev 0) +++ trunk/examples/ore/eq_test.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,151 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"> + <owl:equivalentClass rdf:resource="#horse"/> + </owl:Class> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#horse --> + + <owl:Class rdf:about="#horse"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- http://www.w3.org/2002/07/owl#Thing --> + + <owl:Class rdf:about="&owl;Thing"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/father.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father.owl) =================================================================== --- trunk/examples/ore/father.owl (rev 0) +++ trunk/examples/ore/father.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<rdf:RDF + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns="http://example.com/father#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xml:base="http://example.com/father"> + <owl:Ontology rdf:about=""/> + <owl:Class rdf:ID="father"/> + <owl:Class rdf:ID="female"/> + <owl:Class rdf:ID="male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:ObjectProperty rdf:ID="hasChild"/> + <father rdf:ID="markus"> + <rdf:type rdf:resource="#male"/> + <hasChild> + <female rdf:ID="anna"> + <hasChild> + <male rdf:ID="heinz"/> + </hasChild> + </female> + </hasChild> + </father> + <father rdf:ID="stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> + <female rdf:ID="michelle"/> + <father rdf:ID="martin"> + <hasChild rdf:resource="#heinz"/> + <rdf:type rdf:resource="#male"/> + </father> +</rdf:RDF> + +<!-- Created with Protege (with OWL Plugin 3.3.1, Build 430) http://protege.stanford.edu --> Copied: trunk/examples/ore/father3.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father3.owl) =================================================================== --- trunk/examples/ore/father3.owl (rev 0) +++ trunk/examples/ore/father3.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,151 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"> + <hasChild rdf:resource="#michelle"/> + <hasChild rdf:resource="#patrick"/> + </male> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#thomas"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#patrick --> + + <male rdf:about="#patrick"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> + + + + <!-- http://example.com/father#thomas --> + + <male rdf:about="#thomas"/> +</rdf:RDF> Copied: trunk/examples/ore/father_disjoint.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father_disjoint.owl) =================================================================== --- trunk/examples/ore/father_disjoint.owl (rev 0) +++ trunk/examples/ore/father_disjoint.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,131 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"> + <owl:disjointWith rdf:resource="#male"/> + </owl:Class> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/father_inverse_property.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father_inverse_property.owl) =================================================================== --- trunk/examples/ore/father_inverse_property.owl (rev 0) +++ trunk/examples/ore/father_inverse_property.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,147 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- http://example.com/father#hasParent --> + + <owl:ObjectProperty rdf:about="#hasParent"> + <owl:inverseOf rdf:resource="#hasChild"/> + </owl:ObjectProperty> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + <hasParent rdf:resource="#markus"/> + <hasParent rdf:resource="#michelle"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#stefan"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + <hasParent rdf:resource="#markus"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/father_neg.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father_neg.owl) =================================================================== --- trunk/examples/ore/father_neg.owl (rev 0) +++ trunk/examples/ore/father_neg.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,143 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#animal --> + + <owl:Class rdf:about="#animal"/> + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <animal rdf:about="#heinz"> + <rdf:type rdf:resource="#male"/> + </animal> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/father_new.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father_new.owl) =================================================================== --- trunk/examples/ore/father_new.owl (rev 0) +++ trunk/examples/ore/father_new.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,143 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"/> + + + + <!-- http://example.com/father#lorenz --> + + <male rdf:about="#lorenz"> + <rdf:type rdf:resource="#father"/> + </male> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/father_property.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father_property.owl) =================================================================== --- trunk/examples/ore/father_property.owl (rev 0) +++ trunk/examples/ore/father_property.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,136 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/father_wrong.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/father_wrong.owl) =================================================================== --- trunk/examples/ore/father_wrong.owl (rev 0) +++ trunk/examples/ore/father_wrong.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,143 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> + + + + <!-- http://example.com/father#wrong --> + + <father rdf:about="#wrong"> + <rdf:type rdf:resource="#male"/> + </father> +</rdf:RDF> Copied: trunk/examples/ore/incohaerent.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/incohaerent.owl) =================================================================== --- trunk/examples/ore/incohaerent.owl (rev 0) +++ trunk/examples/ore/incohaerent.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,101 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY www "http://www.test.owl#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://www.test.owl#" + xml:base="http://www.test.owl" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:www="http://www.test.owl#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://www.test.owl#A --> + + <owl:Class rdf:about="#A"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://www.test.owl#B --> + + <owl:Class rdf:about="#B"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + <owl:disjointWith rdf:resource="#C"/> + </owl:Class> + + + + <!-- http://www.test.owl#C --> + + <owl:Class rdf:about="#C"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://www.test.owl#D --> + + <owl:Class rdf:about="#D"> + <rdfs:subClassOf rdf:resource="#B"/> + <rdfs:subClassOf rdf:resource="#C"/> + </owl:Class> + + + + <!-- http://www.w3.org/2002/07/owl#Thing --> + + <owl:Class rdf:about="&owl;Thing"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://www.test.owl#frank --> + + <B rdf:about="#frank"/> + + + + <!-- http://www.test.owl#lorenz --> + + <C rdf:about="#lorenz"> + <rdf:type rdf:resource="#A"/> + </C> +</rdf:RDF> Copied: trunk/examples/ore/inconsistent.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/inconsistent.owl) =================================================================== --- trunk/examples/ore/inconsistent.owl (rev 0) +++ trunk/examples/ore/inconsistent.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,95 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY www "http://www.test.owl#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://www.test.owl#" + xml:base="http://www.test.owl" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:www="http://www.test.owl#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://www.test.owl#A --> + + <owl:Class rdf:about="#A"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://www.test.owl#B --> + + <owl:Class rdf:about="#B"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + <owl:disjointWith rdf:resource="#C"/> + </owl:Class> + + + + <!-- http://www.test.owl#C --> + + <owl:Class rdf:about="#C"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://www.test.owl#D --> + + <owl:Class rdf:about="#D"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://www.w3.org/2002/07/owl#Thing --> + + <owl:Class rdf:about="&owl;Thing"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://www.test.owl#lorenz --> + + <C rdf:about="#lorenz"> + <rdf:type rdf:resource="#A"/> + <rdf:type rdf:resource="#B"/> + </C> +</rdf:RDF> Copied: trunk/examples/ore/neg_has_all.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/neg_has_all.owl) =================================================================== --- trunk/examples/ore/neg_has_all.owl (rev 0) +++ trunk/examples/ore/neg_has_all.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,217 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#anton --> + + <male rdf:about="#anton"/> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#michelle"/> + <hasChild rdf:resource="#patrick"/> + </male> + + + + <!-- http://example.com/father#katja --> + + <female rdf:about="#katja"/> + + + + <!-- http://example.com/father#katrin --> + + <female rdf:about="#katrin"/> + + + + <!-- http://example.com/father#maria --> + + <female rdf:about="#maria"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#anton"/> + <hasChild rdf:resource="#michelle"/> + <hasChild rdf:resource="#tina"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#maria"/> + <hasChild rdf:resource="#steffi"/> + <hasChild rdf:resource="#tim"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#nicole --> + + <female rdf:about="#nicole"/> + + + + <!-- http://example.com/father#patrick --> + + <male rdf:about="#patrick"/> + + + + <!-- http://example.com/father#sarah --> + + <female rdf:about="#sarah"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#sarah"/> + <hasChild rdf:resource="#tina"/> + </father> + + + + <!-- http://example.com/father#steffi --> + + <female rdf:about="#steffi"/> + + + + <!-- http://example.com/father#thomas --> + + <father rdf:about="#thomas"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#katrin"/> + <hasChild rdf:resource="#nicole"/> + </father> + + + + <!-- http://example.com/father#tim --> + + <male rdf:about="#tim"> + <rdf:type rdf:resource="#father"/> + </male> + + + + <!-- http://example.com/father#tina --> + + <female rdf:about="#tina"/> +</rdf:RDF> Copied: trunk/examples/ore/neg_has_some.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/neg_has_some.owl) =================================================================== --- trunk/examples/ore/neg_has_some.owl (rev 0) +++ trunk/examples/ore/neg_has_some.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,149 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"/> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"> + <hasChild rdf:resource="#tina"/> + </male> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#michelle"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"/> + + + + <!-- http://example.com/father#nina --> + + <female rdf:about="#nina"/> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#nina"/> + </father> + + + + <!-- http://example.com/father#tina --> + + <female rdf:about="#tina"/> +</rdf:RDF> Copied: trunk/examples/ore/pos_b.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/pos_b.owl) =================================================================== --- trunk/examples/ore/pos_b.owl (rev 0) +++ trunk/examples/ore/pos_b.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,212 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/2006/12/owl2#" + xmlns:father="http://example.com/father#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#hasChild --> + + <owl:ObjectProperty rdf:about="#hasChild"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#father --> + + <owl:Class rdf:about="#father"> + <rdfs:subClassOf rdf:resource="&owl;Thing"/> + </owl:Class> + + + + <!-- http://example.com/father#female --> + + <owl:Class rdf:about="#female"/> + + + + <!-- http://example.com/father#male --> + + <owl:Class rdf:about="#male"> + <owl:equivalentClass> + <owl:Class> + <owl:complementOf rdf:resource="#female"/> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- http://www.w3.org/2002/07/owl#Thing --> + + <owl:Class rdf:about="&owl;Thing"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://example.com/father#Christian --> + + <father rdf:about="#Christian"> + <rdf:type rdf:resource="#female"/> + <hasChild rdf:resource="#lydia"/> + </father> + + + + <!-- http://example.com/father#Connie --> + + <female rdf:about="#Connie"> + <hasChild rdf:resource="#sara"/> + </female> + + + + <!-- http://example.com/father#Paul --> + + <male rdf:about="#Paul"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#Connie"/> + <hasChild rdf:resource="#stefanie"/> + </male> + + + + <!-- http://example.com/father#anna --> + + <female rdf:about="#anna"> + <hasChild rdf:resource="#heinz"/> + </female> + + + + <!-- http://example.com/father#christine --> + + <female rdf:about="#christine"/> + + + + <!-- http://example.com/father#heinz --> + + <male rdf:about="#heinz"> + <hasChild rdf:resource="#stefan"/> + </male> + + + + <!-- http://example.com/father#lydia --> + + <female rdf:about="#lydia"/> + + + + <!-- http://example.com/father#markus --> + + <male rdf:about="#markus"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#anna"/> + <hasChild rdf:resource="#christine"/> + </male> + + + + <!-- http://example.com/father#martin --> + + <male rdf:about="#martin"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#heinz"/> + </male> + + + + <!-- http://example.com/father#michelle --> + + <female rdf:about="#michelle"> + <rdf:type rdf:resource="#father"/> + </female> + + + + <!-- http://example.com/father#nadine --> + + <female rdf:about="#nadine"/> + + + + <!-- http://example.com/father#sara --> + + <female rdf:about="#sara"> + <hasChild rdf:resource="#christine"/> + </female> + + + + <!-- http://example.com/father#stefan --> + + <father rdf:about="#stefan"> + <rdf:type rdf:resource="#male"/> + <hasChild rdf:resource="#markus"/> + </father> + + + + <!-- http://example.com/father#stefanie --> + + <female rdf:about="#stefanie"> + <rdf:type rdf:resource="#father"/> + <hasChild rdf:resource="#lydia"/> + <hasChild rdf:resource="#nadine"/> + <hasChild rdf:resource="#sara"/> + </female> +</rdf:RDF> Copied: trunk/examples/ore/pos_has_all.owl (from rev 1244, trunk/src/dl-learner/org/dllearner/tools/ore/pos_has_all.owl) =================================================================== --- trunk/examples/ore/pos_has_all.owl (rev 0) +++ trunk/examples/ore/pos_has_all.owl 2008-09-24 08:58:31 UTC (rev 1250) @@ -0,0 +1,269 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY father "http://example.com/father#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<rdf:RDF xmlns="http://example.com/father#" + xml:base="http://example.com/father" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:owl2="http://www.w3.org/20... [truncated message content] |
From: <sk...@us...> - 2008-09-24 08:52:14
|
Revision: 1249 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1249&view=rev Author: sknappe Date: 2008-09-24 08:52:11 +0000 (Wed, 24 Sep 2008) Log Message: ----------- bugfix for the problem with the two .. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2008-09-24 08:49:29 UTC (rev 1248) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2008-09-24 08:52:11 UTC (rev 1249) @@ -137,9 +137,9 @@ description.accept(visitor); String ret = visitor.getSparqlQuery(resultLimit); //HACK see replace might be a good solution, needs testing - while (ret.contains("..")) { + /*while (ret.contains("..")) { ret = ret.replace("..", "."); - } + }*/ return ret; } @@ -261,7 +261,6 @@ description.getChild(0).accept(this); query+="."; description.getChild(1).accept(this); - query+="."; } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-24 08:49:38
|
Revision: 1248 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1248&view=rev Author: jenslehmann Date: 2008-09-24 08:49:29 +0000 (Wed, 24 Sep 2008) Log Message: ----------- removed all warnings reported by Javadoc tool (closes #2052984) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/ComponentManager.java trunk/src/dl-learner/org/dllearner/core/ComponentPool.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java trunk/src/dl-learner/org/dllearner/scripts/CloseOntology.java trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSPARQLReEvaluator.java trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/WikipediaCategoryTasks.java trunk/src/dl-learner/org/dllearner/server/ClientState.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java trunk/src/dl-learner/org/dllearner/utilities/datastructures/Datastructures.java trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloserOWLAPI.java trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -77,8 +77,6 @@ * In this type of algorithm offspring is produced by a number of indivuals. * The offspring then replaces the weakest individuals of the previous * generation. - * - * @see #setNumberOfSelectedIndividuals(int) */ STEADY_STATE}; Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/Program.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -50,8 +50,6 @@ /** * Create a new program. * - * @param concept - * The program tree. */ public Program(Score score, Description hypothesis) { this(score, hypothesis, null); Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -836,7 +836,7 @@ /** * @deprecated See ConfMapper. * @param componentSuperClass - * @return + * @return String. */ @Deprecated public static String getCLIMapping(String componentSuperClass){ Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -691,7 +691,7 @@ /** * Retuns a list of all instanciated and registered Components - * @return + * @return Currently active components. */ public List<Component> getLiveComponents(){ return pool.getComponents(); @@ -699,7 +699,7 @@ /** * Retuns a list of all instanciated and registered LearningAlgorithm - * @return + * @return Currently active learning algorithms. */ public List<LearningAlgorithm> getLiveLearningAlgorithms(){ List<LearningAlgorithm> list = new ArrayList<LearningAlgorithm>(); @@ -714,7 +714,7 @@ /** * Retuns a list of all instanciated and registered KnowledgeSource - * @return + * @return Currently active knowledge sources. */ public List<KnowledgeSource> getLiveKnowledgeSources(){ List<KnowledgeSource> list = new ArrayList<KnowledgeSource>(); Modified: trunk/src/dl-learner/org/dllearner/core/ComponentPool.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentPool.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/core/ComponentPool.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -115,7 +115,7 @@ } /** - * @return + * @return The components in this pool. */ public List<Component> getComponents(){ return components; Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -66,7 +66,7 @@ * Implementations, which do not only use the provided sources * class variable, must make sure that a call to this method * indeed changes them. - * @param The new knowledge sources. + * @param sources The new knowledge sources. */ public void changeSources(Set<KnowledgeSource> sources) { this.sources = sources; Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -156,7 +156,7 @@ * TODO Method should be removed and a mapping table in ConfigJavaGenerator * created instead. * gets java imports - * @return + * @return Java imports. */ public SortedSet<String> getJavaImports() { return new TreeSet<String>(); Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeQuantorRestriction.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -32,7 +32,7 @@ /** * Creates a <code>DatatypeQuantorRestriction</code> along the * given property. - * @param propertyExpression The datatype property along which this restriction acts. + * @param datatypeProperty The datatype property along which this restriction acts. */ public DatatypeQuantorRestriction(DatatypeProperty datatypeProperty) { super(datatypeProperty); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -67,10 +67,7 @@ * most important function expands one example * CAVE: the recursion is not a * recursion anymore, it was transformed to an iteration - * - * @param uri - * @param typedSparqlQuery - * @return + * */ public Node expandNode(String uri, TupleAquisitor tupleAquisitor) { Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -50,7 +50,6 @@ * Nodes are expanded with a certain context, given by the typedSparqlQuery * and the manipulator * - * @param typedSparqlQuery * @param manipulator * @return Vector<Node> all Nodes that are new because of expansion */ @@ -60,9 +59,7 @@ /** * gets type defs for properties like rdf:type SymmetricProperties * - * @param typedSparqlQuery * @param manipulator - * @return Vector<Node> */ public abstract void expandProperties( TupleAquisitor TupelAquisitor, Manipulator manipulator); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -144,7 +144,8 @@ /** * gets a SortedSet of all subclasses up to a certain depth * - * @see conceptRewrite(String descriptionKBSyntax, SparqlEndpoint se, Cache + * TODO the mentioned method does not exist + * conceptRewrite(String descriptionKBSyntax, SparqlEndpoint se, Cache * c, boolean simple ) * @param classURI An URI string with no quotes * @param maxDepth @@ -276,7 +277,6 @@ * An URI string with no quotes * @param sparqlResultLimit * Limits the ResultSet size - * @return */ public SortedSet<String> getClassesForInstance(String instance, int sparqlResultLimit) { @@ -454,7 +454,6 @@ * The query * @param variable * The single variable used in the query - * @return */ public SortedSet<String> queryAsSet(String sparqlQueryString, String variable) { @@ -487,7 +486,6 @@ * * @param sparqlQueryString * The query - * @return */ public String query(String sparqlQueryString) { String jsonString; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -128,9 +128,10 @@ .getLogger(SparqlKnowledgeSource.class); /** - * sets the ConfigOptions for this KnowledgeSource. + * Specifies the configuration options for this knowledge source. * - * @return + * @see org.dllearner.core.Component#createConfigOptions() + * @return Options of this component. */ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -47,10 +47,6 @@ * ((a OR b OR c) AND (b OR a)) * * @param descriptionKBSyntax - * @param se - * @param c - * a cache object, makes only sense if you use this function - * often * @param maxDepth * determines the depth of retrieval, if 1 classes are replaced by direct subclasses only, * 1 is HIGHLY RECOMMENDED FOR LARGE HIERARCHIES) Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -151,14 +151,12 @@ /** * COMMENT: write some more * includes subclasses, costly function, because subclasses have to be received first. - * @see conceptRewrite(String descriptionKBSyntax, SparqlEndpoint se, Cache c, + * TODO mentioned method cannot be found by Javadoc tool + * conceptRewrite(String descriptionKBSyntax, SparqlEndpoint se, Cache c, boolean simple) - * @param descriptionKBSyntax @see getSparqlQuery(Description description, int limit) - * @param limit @see getSparqlQuery(Description description, int limit) - * @param se - * @param c + * @param descriptionKBSyntax @see #getSparqlQuery(Description description, int limit) + * @param resultLimit @see #getSparqlQuery(Description description, int limit) * @param maxDepth - * @return * @throws ParseException */ public static String getSparqlQueryIncludingSubclasses(String descriptionKBSyntax, int resultLimit, SPARQLTasks st, int maxDepth) throws ParseException Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -84,7 +84,7 @@ * If it is not weak, it returns the number of covered negative example. It * can use retrieval or instance checks for classification. * - * @see org.dllearner.learningproblems.PosNegLP.MultiInstanceChecks + * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks * TODO: Performance could be slightly improved by counting the number of * covers instead of using sets and counting their size. * @param concept @@ -163,7 +163,7 @@ * to implement TWO_CHECKS in this function, because we have to test all * examples to create a score object anyway). * - * @see org.dllearner.learningproblems.PosNegLP.MultiInstanceChecks + * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks * @param concept * The concept to test. * @return Corresponding Score object. Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -115,7 +115,7 @@ * concept. Thus, this methods uses a different notion of coverage than * the one for the standard definition learning problem. * - * @see org.dllearner.learningproblems.PosNegLP.MultiInstanceChecks + * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks * @param concept * The concept to test. * @return -1 if concept is too weak and the number of covered negative Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -95,7 +95,6 @@ * property cannot have applicable subproperties, because subproperties * can only restrict, but not broaden their domain.) * - * @param rs The underlying reasoning service. * @param applicableObjectProperties The set of applicable properties. * @return The most general applicable properties. */ Modified: trunk/src/dl-learner/org/dllearner/scripts/CloseOntology.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/CloseOntology.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/scripts/CloseOntology.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -39,7 +39,7 @@ public class CloseOntology { /** - * @param argument0 + * @param args * simply the path to the owl ontology "examples/test.owl" */ public static void main(String[] args) { Modified: trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -209,7 +209,7 @@ * Has been used to create the statistics for the MLDM 2007 paper. * Warning: this method runs for several hours * - * @todo: This method has not been fully adapted to the base structure + * TODO This method has not been fully adapted to the base structure * changes. To reproduce the results, the method has to be implemented * properly. */ Modified: trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/scripts/RDF2NT.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -33,7 +33,7 @@ /** * converts .nt file to rdf, same file name, different ending - * @param ontopath path to nt file + * @param inputOntopath path to nt file */ public static void convertRDF2NT(String inputOntopath){ Modified: trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSPARQLReEvaluator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSPARQLReEvaluator.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSPARQLReEvaluator.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -80,7 +80,6 @@ * Category (50/60) * * @param positiveSet - * @return */ public List<EvaluatedDescription> reevaluateConceptsByDataCoverage( List<EvaluatedDescription> descToBeReevaluated, @@ -136,7 +135,6 @@ * e.g. 50 correct out of 400 retrieved (50/400) * * @param positiveSet - * @return */ public List<EvaluatedDescription> reevaluateConceptsByLowestRecall( List<EvaluatedDescription> descToBeReevaluated, Modified: trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/WikipediaCategoryTasks.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/WikipediaCategoryTasks.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/WikipediaCategoryTasks.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -61,7 +61,6 @@ * * @param conceptresults * @param posExamples - * @return */ public SortedSet<String> calculateWrongIndividualsAndNewPosEx( List<EvaluatedDescription> conceptresults, @@ -91,7 +90,6 @@ * TODO could be more sophisticated * * @param reEvaluatedDesc - * @return */ public SortedSet<String> makeNewNegativeExamples( List<EvaluatedDescription> reEvaluatedDesc, Modified: trunk/src/dl-learner/org/dllearner/server/ClientState.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/ClientState.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/server/ClientState.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -201,7 +201,7 @@ } /** - * @param is A component ID. + * @param id A component ID. * @return The component associated with this ID. * @see java.util.Map#get(java.lang.Object) */ Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -284,7 +284,6 @@ * Retrieves description parts that might cause inconsistency - for negative examples only. * @param ind * @param desc - * @return */ public Set<Description> getNegCriticalDescriptions(Individual ind, Description desc){ @@ -431,7 +430,6 @@ * Returns individuals that are in range of property. * @param objRestr * @param ind - * @return */ public Set<Individual> getIndividualsInPropertyRange(ObjectQuantorRestriction objRestr, Individual ind){ @@ -445,7 +443,6 @@ * Returns individuals that are not in range of property. * @param objRestr * @param ind - * @return */ public Set<Individual> getIndividualsNotInPropertyRange(ObjectQuantorRestriction objRestr, Individual ind){ @@ -529,7 +526,6 @@ * Get the complement classes where individual is asserted to. * @param desc * @param ind - * @return */ public Set<NamedClass> getComplements(Description desc, Individual ind){ // System.out.println("----------------" + desc + "---------------"); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -93,7 +93,6 @@ * Adds an EquivalentClassesAxiom axiom to the ontology. * @param newDesc new axiom to add * @param oldDesc old description - * @return */ public OWLOntologyChange addAxiomToOWL(Description newDesc, Description oldDesc){ @@ -478,7 +477,6 @@ * checks whether desc1 and desc2 are disjoint. * @param desc1 class 1 * @param desc2 class 2 - * @return */ public boolean isComplement(Description desc1, Description desc2){ @@ -555,7 +553,6 @@ /** * Returns object properties for an individual. * @param ind - * @return */ public Set<ObjectPropertyAssertion> getObjectProperties(Individual ind){ Set<ObjectPropertyAssertion> objectProperties = new HashSet<ObjectPropertyAssertion>(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -215,7 +215,6 @@ /** * Returns all ontology changes been done by repairing ontology. - * @return */ public Set<OWLOntologyChange> getOntologyChanges() { return ontologyChanges; Modified: trunk/src/dl-learner/org/dllearner/utilities/Helper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -208,7 +208,6 @@ * @param <T> * @param set1 * @param set2 - * @return */ public static <T> Set<T> union(Set<T> set1, Set<T> set2) { // TODO: effizientere Implementierung (längere Liste klonen und Elemente @@ -450,8 +449,7 @@ * concepts are those having prefix "anon" and concepts belonging to * the RDF, RDFS, OWL standards. * - * @param concepts - * @return + * @param concepts The set from which concepts will be removed. */ public static void removeUninterestingConcepts(Set<NamedClass> concepts) { Iterator<NamedClass> it = concepts.iterator(); @@ -536,7 +534,7 @@ /** * Checks whether the roles exist in background knowledge - * @param roles The roles to check. + * @param concepts The concepts to check. * @return The first non-existing role or null if they are all in the * background knowledge. */ Modified: trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/StringFormatter.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -8,7 +8,6 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/Datastructures.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/datastructures/Datastructures.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/Datastructures.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -50,7 +50,6 @@ * easy conversion * * @param s - * @return */ public static String[] setToArray(Set<String> s) { if(s==null)return null; Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -17,7 +17,6 @@ * * @param set * @param limit - * @return */ public static SortedSet<String> fuzzyShrink(SortedSet<String> set, int limit) { if (set.size() <= limit) { @@ -48,7 +47,6 @@ * * @param set * @param limit - * @return */ public static SortedSet<Individual> fuzzyShrinkInd(SortedSet<Individual> set, int limit) { if (set.size() <= limit) { @@ -78,7 +76,6 @@ * * @param set * @param limit - * @return */ public static SortedSet<String> stableShrink(SortedSet<String> set, int limit) { @@ -102,7 +99,6 @@ * * @param set * @param limit - * @return */ public static SortedSet<Individual> stableShrinkInd(SortedSet<Individual> set, int limit) { Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -72,7 +72,6 @@ /** * see <code> getNegativeExamples(int neglimit, boolean stable )</code> * @param neglimit - * @return */ public SortedSet<Individual> getNegativeExamples(int neglimit, boolean forceNegLimit ) { return getNegativeExamples(neglimit, false, forceNegLimit); @@ -86,7 +85,6 @@ * @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, boolean forceNegLimit ) { SortedSet<Individual> negatives = new TreeSet<Individual>(); Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -54,7 +54,7 @@ * takes as input a full positive set to make sure no negatives are added as positives * * @param fullPositiveSet - * @param SPARQLTasks st + * @param st */ public AutomaticNegativeExampleFinderSPARQL( SortedSet<String> fullPositiveSet, @@ -71,7 +71,6 @@ /** * see <code> getNegativeExamples(int neglimit, boolean stable )</code> * @param neglimit - * @return */ public SortedSet<String> getNegativeExamples(int neglimit ) { return getNegativeExamples(neglimit, false); @@ -84,7 +83,6 @@ * * @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 */ public SortedSet<String> getNegativeExamples(int neglimit, boolean stable ) { SortedSet<String> negatives = new TreeSet<String>(); Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloserOWLAPI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloserOWLAPI.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloserOWLAPI.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -178,7 +178,6 @@ /** * makes some retrieval queries * @param conceptStr - * @return */ public SortedSet<Individual> verifyConcept(String conceptStr) { Modified: trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java 2008-09-24 08:45:14 UTC (rev 1247) +++ trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java 2008-09-24 08:49:29 UTC (rev 1248) @@ -85,7 +85,7 @@ /** * Gets the mean of all numbers as percentage * *100 so 0.5678 -> "56.78%" - * @return + * @return The mean as formatted string. */ public String getMeanAsPercentage(){ return df.format(getMean()); @@ -94,7 +94,7 @@ /** * Gets the standard deviation of all numbers. * - * @return The stanard deviation of all numbers. + * @return The standard deviation of all numbers. */ public double getStandardDeviation() { if(count <= 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 08:45:26
|
Revision: 1247 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1247&view=rev Author: sknappe Date: 2008-09-24 08:45:14 +0000 (Wed, 24 Sep 2008) Log Message: ----------- some changes when stopping algorithm Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/js/navigator.js Added Paths: ----------- trunk/src/dbpedia-navigator/images/spinner.gif Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -70,7 +70,15 @@ $start = microtime(true); $this->client->initAll($this->id); - + + //look, if algorithm was stopped + $file=fopen("./temp/".$this->id.".temp","r"); + $run=fgets($file); + fclose($file); + if ($run=="false"){ + return array(); + } + $threaded=true; if($threaded == false) { @@ -102,12 +110,13 @@ fclose($file); if ($run=="false"){ $this->client->stop($this->id); - throw new Exception("Learning stopped"); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } } while($seconds<$this->learnttl&&$running); - $this->client->stop($this->id); + if ($running) $this->client->stop($this->id); } + //return $concepts->item; return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } @@ -170,7 +179,7 @@ return $result; } - $seconds = $i * $sleeptime; + $microseconds = $i * $sleeptime; $i++; //look, if algorithm was stopped $file=fopen("./temp/".$this->id.".temp","r"); @@ -180,7 +189,7 @@ $this->client->stopSparqlThread($this->id,$queryID); throw new Exception("Query stopped"); } - } while($seconds<$this->ttl); + } while($microseconds<$this->ttl); $this->client->stopSparqlThread($this->id,$queryID); } Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=60000000; + public $learnttl=10; public $language="en"; Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -265,10 +265,10 @@ if (isset($triples['http://dbpedia.org/property/imagesize'])) unset($triples['http://dbpedia.org/property/imagesize']); if (isset($triples['http://dbpedia.org/property/id'])) unset($triples['http://dbpedia.org/property/id']); if (isset($triples['http://dbpedia.org/property/issue'])) unset($triples['http://dbpedia.org/property/issue']); - if (isset($triples['http://dbpedia.org/property/hips'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/hips']); - if (isset($triples['http://dbpedia.org/property/weight'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/weight']); - if (isset($triples['http://dbpedia.org/property/waist'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/waist']); - if (isset($triples['http://dbpedia.org/property/height'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/height']); + if (isset($triples['http://dbpedia.org/property/hips'])&&$triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); + if (isset($triples['http://dbpedia.org/property/weight'])&&$triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); + if (isset($triples['http://dbpedia.org/property/waist'])&&$triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); + if (isset($triples['http://dbpedia.org/property/height'])&&$triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); if (isset($triples['http://www.geonames.org/ontology#featureCode'])) unset($triples['http://www.geonames.org/ontology#featureCode']); if (isset($triples['http://www.geonames.org/ontology#featureClass'])) unset($triples['http://www.geonames.org/ontology#featureClass']); if (isset($triples['http://dbpedia.org/property/dmozProperty'])) unset($triples['http://dbpedia.org/property/dmozProperty']); @@ -328,8 +328,7 @@ } catch (Exception $e) { - $content=$e->getMessage(); - $artTitle="Article not found"; + $content="-"; } } else { Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -1,4 +1,6 @@ <?php + ini_set('max_execution_time',200); + include('helper_functions.php'); session_start(); Property changes on: trunk/src/dbpedia-navigator/images/spinner.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/index.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -55,7 +55,7 @@ <div id="conceptlink" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> -</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none;font-weight:bold;color:#ff0000;">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> +</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none;font-weight:bold;color:#ff0000;">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span><span id="DatabaseLoading" style="display:none;font-weight:bold;color:#ff0000;">Database Call... <a href=""><img src="images/spinner.gif"/></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-09-24 08:45:14 UTC (rev 1247) @@ -1,5 +1,6 @@ function search_it(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -22,6 +23,9 @@ document.getElementById('SearchResultBox').style.display='block'; } } + if (XhrObj.readyState == 4){ + setDatabaseRunning(false); + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -44,23 +48,26 @@ XhrObj.onreadystatechange = function() { + if (XhrObj.readyState == 4) + setRunning(false); if (XhrObj.readyState == 4 && XhrObj.status == 200){ var response = XhrObj.responseText.split('$$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; - setRunning(false); - if (response[5].length>0&&response[6].length>0) - loadGoogleMap(response[5],response[6],''+response[1]); - if (response[1]=='Article not found'){ - setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); - } - else - document.getElementById('LastArticlesBox').style.display='block'; - learnConcept(); - } + if (response[0]!='-'){ + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + if (response[5].length>0&&response[6].length>0) + loadGoogleMap(response[5],response[6],''+response[1]); + if (response[1]=='Article not found') + setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); + else { + document.getElementById('LastArticlesBox').style.display='block'; + learnConcept(); + } + } + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -69,6 +76,7 @@ function get_class(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -89,6 +97,8 @@ document.getElementById('lastclasses').innerHTML=response[2]; document.getElementById('LastClassesBox').style.display='block'; } + if (XhrObj.readyState == 4) + setDatabaseRunning(false); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -114,6 +124,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -140,6 +151,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -188,6 +200,7 @@ { if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Negatives').innerHTML = XhrObj.responseText; + learnConcept(); } } @@ -214,6 +227,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -240,6 +254,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -263,12 +278,14 @@ XhrObj.onreadystatechange = function() { + if (XhrObj.readyState == 4){ + setRunning(false); + } if (XhrObj.readyState == 4 && XhrObj.status == 200){ if (XhrObj.responseText!='-'){ document.getElementById('conceptlink').innerHTML=XhrObj.responseText; document.getElementById('ConceptBox').style.display='block'; } - setRunning(false); } } @@ -292,6 +309,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ + setRunning(false); } } @@ -331,6 +349,7 @@ function getSubjectsFromCategory(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -353,6 +372,8 @@ document.getElementById('SearchResultBox').style.display='block'; } } + if (XhrObj.readyState == 4) + setDatabaseRunning(false); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-24 08:45:14 UTC (rev 1247) @@ -3,6 +3,12 @@ if (running) document.getElementById('Loading').style.display='inline'; else document.getElementById('Loading').style.display='none'; } + +function setDatabaseRunning(running) +{ + if (running) document.getElementById('DatabaseLoading').style.display='inline'; + else document.getElementById('DatabaseLoading').style.display='none'; +} function loadGoogleMap(Lat,Lng,Label) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-24 08:09:53
|
Revision: 1246 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1246&view=rev Author: jenslehmann Date: 2008-09-24 08:09:38 +0000 (Wed, 24 Sep 2008) Log Message: ----------- added package.html files for various packages Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/configurators/package.html trunk/src/dl-learner/org/dllearner/gui/widgets/package.html trunk/src/dl-learner/org/dllearner/tools/ore/package.html trunk/src/dl-learner/org/dllearner/tools/protege/package.html trunk/src/dl-learner/org/dllearner/utilities/datastructures/package.html trunk/src/dl-learner/org/dllearner/utilities/examples/package.html trunk/src/dl-learner/org/dllearner/utilities/learn/package.html trunk/src/dl-learner/org/dllearner/utilities/owl/package.html trunk/src/dl-learner/org/dllearner/utilities/statistics/package.html Added: trunk/src/dl-learner/org/dllearner/core/configurators/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Automatically generated classes, which enable programmatically setting +and getting configuration options of components.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/gui/widgets/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Widgets for displaying and setting values of configuration options.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/tools/ore/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>The ontology repair and enrichment tool.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/tools/protege/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>The Protege DL-Learner plugin, which enables learning +class descriptions in the Protege ontology editor.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/utilities/datastructures/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/datastructures/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Utility classesfor manipulating general data structures. Note that +OWL related datastructures have their own package.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/utilities/examples/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/examples/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/examples/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Utility classes related to finding/modifying examples of +learning problems.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/utilities/learn/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/learn/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/learn/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Reusable learnings tasks.</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/utilities/owl/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>OWL utility classes (file manipulation, converting +between different formats, orderings on OWL structures etc.).</p> +</body> +</html> \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/utilities/statistics/package.html =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/statistics/package.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/statistics/package.html 2008-09-24 08:09:38 UTC (rev 1246) @@ -0,0 +1,7 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<head></head> +<body bgcolor="white"> +<p>Utility classes for capturing statistics.</p> +</body> +</html> \ 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: <jen...@us...> - 2008-09-24 06:10:56
|
Revision: 1245 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1245&view=rev Author: jenslehmann Date: 2008-09-24 06:10:45 +0000 (Wed, 24 Sep 2008) Log Message: ----------- removed unresolved import Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/scripts/NT2RDF.java Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-23 23:24:34 UTC (rev 1244) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-24 06:10:45 UTC (rev 1245) @@ -24,14 +24,12 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.collections.list.TypedList; import org.apache.log4j.Logger; import org.dllearner.kb.aquisitors.RDFBlankNode; import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; -import org.semanticweb.owl.expression.OWLExpressionParser; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDataProperty; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-23 23:24:34 UTC (rev 1244) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-24 06:10:45 UTC (rev 1245) @@ -54,7 +54,6 @@ import org.dllearner.kb.manipulator.ObjectReplacementRule; import org.dllearner.kb.manipulator.PredicateReplacementRule; import org.dllearner.kb.manipulator.Rule.Months; -import org.dllearner.reasoning.DIGConverter; import org.dllearner.reasoning.JenaOWLDIGConverter; import org.dllearner.utilities.Files; import org.dllearner.utilities.JamonMonitorLogger; Modified: trunk/src/dl-learner/org/dllearner/scripts/NT2RDF.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/NT2RDF.java 2008-09-23 23:24:34 UTC (rev 1244) +++ trunk/src/dl-learner/org/dllearner/scripts/NT2RDF.java 2008-09-24 06:10:45 UTC (rev 1245) @@ -16,6 +16,7 @@ * 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.net.URI; @@ -24,50 +25,45 @@ import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyManager; -import com.hp.hpl.jena.rdf.arp.NTriple; public class NT2RDF { - - public static void main(String[] args) { - - //String ontopath=args[0]; - String ontopath = "examples/semantic_bible/NTNcombined.nt"; - //String ontopath = "examples/semantic_bible/test.nt"; - convertNT2RDF(ontopath); - - - } - - - /** - * converts .nt file to rdf, same file name, different ending - * @param ontopath path to nt file - */ - public static void convertNT2RDF(String ontopath){ - - try { - URI inputURI = new File(ontopath).toURI(); - System.out.println(inputURI); - // outputURI - String ending = ontopath.substring(ontopath.lastIndexOf(".") + 1); - System.out.println(ending); - ontopath = ontopath.replace("." + ending, ".rdf" ); - URI outputURI = new File(ontopath).toURI(); + public static void main(String[] args) { - OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - OWLOntology ontology = manager.loadOntologyFromPhysicalURI(inputURI); - manager.saveOntology(ontology, new RDFXMLOntologyFormat(), outputURI); - //manager.saveOntology(ontology, new NTriple(), outputURI); - // Remove the ontology from the manager - manager.removeOntology(ontology.getURI()); - } - catch (Exception e) { - System.out.println("The ontology could not be created: " + e.getMessage()); - e.printStackTrace(); - } - - } - + // String ontopath=args[0]; + String ontopath = "examples/semantic_bible/NTNcombined.nt"; + // String ontopath = "examples/semantic_bible/test.nt"; + convertNT2RDF(ontopath); + } + /** + * converts .nt file to rdf, same file name, different ending + * + * @param ontopath + * path to nt file + */ + public static void convertNT2RDF(String ontopath) { + try { + URI inputURI = new File(ontopath).toURI(); + System.out.println(inputURI); + // outputURI + String ending = ontopath.substring(ontopath.lastIndexOf(".") + 1); + System.out.println(ending); + ontopath = ontopath.replace("." + ending, ".rdf"); + URI outputURI = new File(ontopath).toURI(); + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(inputURI); + manager.saveOntology(ontology, new RDFXMLOntologyFormat(), outputURI); + // manager.saveOntology(ontology, new NTriple(), outputURI); + // Remove the ontology from the manager + manager.removeOntology(ontology.getURI()); + } catch (Exception e) { + System.out.println("The ontology could not be created: " + e.getMessage()); + e.printStackTrace(); + } + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-23 23:24:43
|
Revision: 1244 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1244&view=rev Author: kurzum Date: 2008-09-23 23:24:34 +0000 (Tue, 23 Sep 2008) Log Message: ----------- added function getOWLAPIOntology to SparqlKnowledgeSource Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-23 23:24:34 UTC (rev 1244) @@ -76,6 +76,15 @@ return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "cacheDir") ; } /** +* useCache If true a Cache is used. +* mandatory: false| reinit necessary: true +* default value: true +* @return boolean +**/ +public boolean getUseCache() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCache") ; +} +/** * instances relevant instances e.g. positive and negative examples in a learning problem. * mandatory: true| reinit necessary: true * default value: null @@ -142,60 +151,15 @@ return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "objList") ; } /** -* format N-TRIPLES or KB format. +* saveExtractedFragment Specifies whether the extracted ontology is written to a file or not.. * mandatory: false| reinit necessary: true -* default value: N-TRIPLES -* @return String -**/ -public String getFormat() { -return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "format") ; -} -/** -* dumpToFile Specifies whether the extracted ontology is written to a file or not.. -* mandatory: false| reinit necessary: true * default value: true * @return boolean **/ -public boolean getDumpToFile() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "dumpToFile") ; +public boolean getSaveExtractedFragment() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "saveExtractedFragment") ; } /** -* convertNT2RDF Specifies whether the extracted NTriples are converted to RDF and deleted.. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getConvertNT2RDF() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "convertNT2RDF") ; -} -/** -* useLits use Literals in SPARQL query. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseLits() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useLits") ; -} -/** -* getAllSuperClasses If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getGetAllSuperClasses() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "getAllSuperClasses") ; -} -/** -* useCache If true a Cache is used. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseCache() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCache") ; -} -/** * replacePredicate rule for replacing predicates. * mandatory: false| reinit necessary: true * default value: [] @@ -225,6 +189,24 @@ return (Integer) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "breakSuperClassRetrievalAfter") ; } /** +* useLits use Literals in SPARQL query. +* mandatory: false| reinit necessary: true +* default value: true +* @return boolean +**/ +public boolean getUseLits() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useLits") ; +} +/** +* getAllSuperClasses If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.. +* mandatory: false| reinit necessary: true +* default value: true +* @return boolean +**/ +public boolean getGetAllSuperClasses() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "getAllSuperClasses") ; +} +/** * closeAfterRecursion gets all classes for all instances. * mandatory: false| reinit necessary: true * default value: true @@ -291,6 +273,15 @@ reinitNecessary = true; } /** +* @param useCache If true a Cache is used. +* mandatory: false| reinit necessary: true +* default value: true +**/ +public void setUseCache(boolean useCache) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useCache", useCache); +reinitNecessary = true; +} +/** * @param instances relevant instances e.g. positive and negative examples in a learning problem. * mandatory: true| reinit necessary: true * default value: null @@ -354,60 +345,15 @@ reinitNecessary = true; } /** -* @param format N-TRIPLES or KB format. +* @param saveExtractedFragment Specifies whether the extracted ontology is written to a file or not.. * mandatory: false| reinit necessary: true -* default value: N-TRIPLES -**/ -public void setFormat(String format) { -ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "format", format); -reinitNecessary = true; -} -/** -* @param dumpToFile Specifies whether the extracted ontology is written to a file or not.. -* mandatory: false| reinit necessary: true * default value: true **/ -public void setDumpToFile(boolean dumpToFile) { -ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "dumpToFile", dumpToFile); +public void setSaveExtractedFragment(boolean saveExtractedFragment) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "saveExtractedFragment", saveExtractedFragment); reinitNecessary = true; } /** -* @param convertNT2RDF Specifies whether the extracted NTriples are converted to RDF and deleted.. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setConvertNT2RDF(boolean convertNT2RDF) { -ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "convertNT2RDF", convertNT2RDF); -reinitNecessary = true; -} -/** -* @param useLits use Literals in SPARQL query. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseLits(boolean useLits) { -ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useLits", useLits); -reinitNecessary = true; -} -/** -* @param getAllSuperClasses If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setGetAllSuperClasses(boolean getAllSuperClasses) { -ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "getAllSuperClasses", getAllSuperClasses); -reinitNecessary = true; -} -/** -* @param useCache If true a Cache is used. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseCache(boolean useCache) { -ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useCache", useCache); -reinitNecessary = true; -} -/** * @param replacePredicate rule for replacing predicates. * mandatory: false| reinit necessary: true * default value: [] @@ -435,6 +381,24 @@ reinitNecessary = true; } /** +* @param useLits use Literals in SPARQL query. +* mandatory: false| reinit necessary: true +* default value: true +**/ +public void setUseLits(boolean useLits) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useLits", useLits); +reinitNecessary = true; +} +/** +* @param getAllSuperClasses If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.. +* mandatory: false| reinit necessary: true +* default value: true +**/ +public void setGetAllSuperClasses(boolean getAllSuperClasses) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "getAllSuperClasses", getAllSuperClasses); +reinitNecessary = true; +} +/** * @param closeAfterRecursion gets all classes for all instances. * mandatory: false| reinit necessary: true * default value: true Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-23 23:06:40 UTC (rev 1243) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-23 23:24:34 UTC (rev 1244) @@ -96,27 +96,26 @@ this.configurator = new SparqlKnowledgeSourceConfigurator(this); } - // ConfigOptions + // these are saved for further reference private URL url; + private SparqlEndpoint endpoint = null; //private String format = "N-TRIPLES"; - private String format = "RDF/XML"; + //private String format = "RDF/XML"; - private boolean dumpToFile = true; + private URL ontologyFragmentURL; + - - private URL dumpFile; - private OWLOntology fragment; - 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 '<' - private String[] ontArray; + //private String[] ontArray; // received ontology as KB, the internal format - private KB kb; + //private KB kb; // mainly used for statistic private int nrOfExtractedTriples = 0; @@ -140,6 +139,8 @@ null, true, true)); options.add(new StringConfigOption("cacheDir", "dir of cache", "cache", false, true)); + options.add(new BooleanConfigOption("useCache", + "If true a Cache is used", true, false, true)); options .add(new StringSetConfigOption( "instances", @@ -166,27 +167,14 @@ "list of all ignored roles", new TreeSet<String>(), false, true)); options.add(new StringSetConfigOption("objList", "list of all ignored objects", new TreeSet<String>(), false, true)); - options.add(new StringConfigOption("format", "N-TRIPLES or KB format", - "N-TRIPLES", false, true)); options .add(new BooleanConfigOption( - "dumpToFile", + "saveExtractedFragment", "Specifies whether the extracted ontology is written to a file or not.", true, false, true)); - options - .add(new BooleanConfigOption( - "convertNT2RDF", - "Specifies whether the extracted NTriples are converted to RDF and deleted.", - false, false, true)); - options.add(new BooleanConfigOption("useLits", - "use Literals in SPARQL query", true, false, true)); - options - .add(new BooleanConfigOption( - "getAllSuperClasses", - "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", - true, false, true)); - options.add(new BooleanConfigOption("useCache", - "If true a Cache is used", true, false, true)); + + + options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates", new ArrayList<StringTuple>(), false, true)); options.add(new StringTupleListConfigOption("replaceObject", @@ -194,6 +182,14 @@ options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes", 1000, false, true)); + + options.add(new BooleanConfigOption("useLits", + "use Literals in SPARQL query", true, false, true)); + options + .add(new BooleanConfigOption( + "getAllSuperClasses", + "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", + true, false, true)); options.add(new BooleanConfigOption("closeAfterRecursion", "gets all classes for all instances", true, false, true)); options.add(new BooleanConfigOption("getPropertyInformation", @@ -264,7 +260,7 @@ extractionTime.printAndSet("extraction needed"); logger.info("Finished collecting Fragment"); - dumpFile = m.getPhysicalOntologyURL(); + ontologyFragmentURL = m.getPhysicalOntologyURL(); /* if (dumpToFile) { @@ -322,12 +318,13 @@ */ @Override public String toDIG(URI kbURI) { - if (format.equals("RDF/XML")){ - return JenaOWLDIGConverter.getTellsString(dumpFile, + //if (format.equals("RDF/XML")){ + return JenaOWLDIGConverter.getTellsString(ontologyFragmentURL, OntologyFormat.RDF_XML, kbURI); - }else { - return DIGConverter.getDIGString(kb, kbURI).toString(); - } + //}else { + //throw new Error("KB Format not supported any more"); + //return DIGConverter.getDIGString(kb, kbURI).toString(); + //} } /* @@ -366,9 +363,9 @@ } - public String[] getOntArray() { + /*public String[] getOntArray() { return ontArray; - } + }*/ public SparqlQuery sparqlQuery(String query) { return new SparqlQuery(query, getSparqlEndpoint()); @@ -456,12 +453,16 @@ @Override public KB toKB() { // TODO Does this work? - return kb; + return new KB(); } - public URL getNTripleURL() { - return dumpFile; + public URL getOntologyFragmentURL() { + return ontologyFragmentURL; } + + public OWLOntology getOWLAPIOntology() { + return fragment; + } public boolean isUseCache() { return configurator.getUseCache(); Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-23 23:06:40 UTC (rev 1243) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-23 23:24:34 UTC (rev 1244) @@ -206,7 +206,7 @@ url = ((OWLFile)source).getURL(); } else if(source instanceof SparqlKnowledgeSource) { - url=((SparqlKnowledgeSource)source).getNTripleURL(); + url=((SparqlKnowledgeSource)source).getOntologyFragmentURL(); } try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-23 23:06:50
|
Revision: 1243 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1243&view=rev Author: kurzum Date: 2008-09-23 23:06:40 +0000 (Tue, 23 Sep 2008) Log Message: ----------- switched SparqlKnowledgeSource output to RDF/XML. This will be necessary to include blanknodes. Modified Paths: -------------- 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/Configurator.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/OWLAPIOntologyConfigurator.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/PosNegDefinitionLPStrictConfigurator.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/PosOnlyInclusionLPConfigurator.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/SimpleSuggestionLearningAlgorithmConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.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/LiteralNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/scripts/NT2RDF.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 trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/OWLAPIOntologyCollector.java trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; @@ -42,6 +42,7 @@ import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.learningproblems.PosOnlyInclusionLP; +import org.dllearner.learningproblems.RoleLearning; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -167,6 +168,16 @@ } /** +* @param positiveExamples positive examples +* @param negativeExamples negative examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization RoleLearning +**/ +public static RoleLearning getRoleLearning(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { +return RoleLearningConfigurator.getRoleLearning(reasoningService, positiveExamples, negativeExamples); +} + +/** * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see Modified: trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -16,7 +16,7 @@ * 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; Added: trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/BlankNodeCollector.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -0,0 +1,93 @@ +package org.dllearner.kb.aquisitors; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.utilities.datastructures.RDFNodeTuple; + +import com.hp.hpl.jena.query.QuerySolution; +import com.hp.hpl.jena.query.ResultSetRewindable; + +public class BlankNodeCollector { + + private static int globalBNodeId = 0; + public static synchronized int getNextGlobalBNodeId(){ + int ret = globalBNodeId; + globalBNodeId++; + return ret; + } + + private static Map<Integer, SortedSet<RDFNodeTuple>> blankNodes = new HashMap<Integer, SortedSet<RDFNodeTuple>>(); + + public static void addBlankNode(int id, RDFNodeTuple t){ + if(blankNodes.get(id)==null){ + blankNodes.put(id, new TreeSet<RDFNodeTuple>()); + } + blankNodes.get(id).add(t); + } + + public static SortedSet<RDFNodeTuple> getBlankNode(int id){ + return blankNodes.get(id); + } + + public static Map<Integer, SortedSet<RDFNodeTuple>> getBlankNodeMap(){ + return blankNodes; + } + + + public static boolean testResultSet(ResultSetRewindable rsw, int depth){ + List<String> vars = new ArrayList<String>(); + vars.add("o0"); + for (int i = 1; i <= depth; i++) { + vars.add("o"+i); + } + + while (rsw.hasNext()){ + QuerySolution q = rsw.nextSolution(); + if(!q.get("o0").isAnon()){ + continue; + }else{ + if(!testOneQuerySolution(vars, q)){ + rsw.reset(); + return false; + } + + } + } + rsw.reset(); + return true; + } + private static boolean testOneQuerySolution(List<String> vars, QuerySolution q){ + for (String v : vars) { + if(!q.get(v).isAnon()){ + return true; + } + } + return false; + } + + public static String makeQuery(String uri, String predicate, int maxDepth){ + int currentDepth = 0; + StringBuffer sq = new StringBuffer(); + String init = "SELECT * WHERE { "+ + "<"+uri+"> <"+predicate+"> ?o"+currentDepth+". "; + + sq.append(init); + + for (; currentDepth < maxDepth; currentDepth++) { + String currentO = "?o"+currentDepth; + String nextP = "?p"+(currentDepth+1); + String nextO = "?o"+(currentDepth+1); + sq.append(" { OPTIONAL { "+currentO+" "+nextP+" "+nextO+". }}"); + } + + + sq.append(" } "); + return sq.toString(); + } + +} Added: trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/RDFBlankNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -0,0 +1,104 @@ +/** + * 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.kb.aquisitors; + +import com.hp.hpl.jena.graph.Node; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.RDFNode; +import com.hp.hpl.jena.rdf.model.RDFVisitor; + +/** + * This class is used to save disambiguated information for a blankNode in an RDF + * Graph. It is used to silently transport the info to the layer above. + * + * @author Sebastian Hellmann + * + */ +public class RDFBlankNode implements RDFNode { + + + private RDFNode blankNode; + private int bNodeId; + + public RDFBlankNode(int id, RDFNode blankNode) { + super(); + this.bNodeId = id; + this.blankNode = blankNode; + } + + public int getBNodeId(){ + return bNodeId; + } + //RBC + public String toString(){ + //RBC + return "I'm a blank node with id: "+bNodeId+"||"+blankNode; + } + + // overidden Functions + + public RDFNode as(Class view) { + + return blankNode.as(view); + } + + public boolean canAs(Class view) { + + return blankNode.canAs(view); + } + + public RDFNode inModel(Model m) { + + return blankNode.inModel(m); + } + + public boolean isAnon() { + + return blankNode.isAnon(); + } + + public boolean isLiteral() { + + return blankNode.isLiteral(); + } + + public boolean isResource() { + + return blankNode.isResource(); + } + + public boolean isURIResource() { + + return blankNode.isURIResource(); + } + + public Object visitWith(RDFVisitor rv) { + + return blankNode.visitWith(rv); + } + + public Node asNode() { + + return blankNode.asNode(); + } + + + +} Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -19,6 +19,8 @@ */ package org.dllearner.kb.aquisitors; +import java.util.ArrayList; +import java.util.List; import java.util.SortedSet; import org.apache.log4j.Logger; @@ -26,6 +28,10 @@ import org.dllearner.kb.sparql.SparqlQueryMaker; import org.dllearner.utilities.datastructures.RDFNodeTuple; +import com.hp.hpl.jena.query.QuerySolution; +import com.hp.hpl.jena.query.ResultSetRewindable; +import com.hp.hpl.jena.rdf.model.RDFNode; + /** * Can execute different queries. * @@ -42,6 +48,7 @@ protected SparqlQueryMaker sparqlQueryMaker; protected SPARQLTasks sparqlTasks; + //RBC @@ -55,21 +62,107 @@ public SortedSet<RDFNodeTuple> retrieveTupel(String uri){ // getQuery String sparqlQueryString = sparqlQueryMaker.makeSubjectQueryUsingFilters(uri); - return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, PREDICATE, OBJECT); - + SortedSet<RDFNodeTuple> ret = sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, PREDICATE, OBJECT); + disambiguateBlankNodes(uri, ret); + return ret; } @Override public SortedSet<RDFNodeTuple> retrieveClassesForInstances(String uri){ // getQuery String sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri); - return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, PREDICATE, OBJECT); + SortedSet<RDFNodeTuple> ret = sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, PREDICATE, OBJECT); + return ret; } @Override public SortedSet<RDFNodeTuple> retrieveTuplesForClassesOnly(String uri){ - return retrieveTupel(uri); + SortedSet<RDFNodeTuple> ret = retrieveTupel(uri); + return ret; } + + private void disambiguateBlankNodes(String uri, SortedSet<RDFNodeTuple> resultSet){ + try{ + for (RDFNodeTuple tuple : resultSet) { + if(tuple.b.isAnon()){ + int currentId = BlankNodeCollector.getNextGlobalBNodeId(); + tuple.b = new RDFBlankNode(currentId, tuple.b); + System.out.println(uri+" replaced blanknode "+tuple.b); + dissolveBlankNodes(currentId, uri, tuple); + System.out.println(BlankNodeCollector.getBlankNodeMap()); + + } + } + }catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } + } + + private void dissolveBlankNodes(int currentId, String uri, RDFNodeTuple tuple){ + int currentDepth = 1; + int lastDepth = 1; + ResultSetRewindable rsw=null; + do{ + String q = BlankNodeCollector.makeQuery(uri, tuple.a.toString(), currentDepth); + + rsw = sparqlTasks.queryAsResultSet(q); + lastDepth = currentDepth; + }while (!BlankNodeCollector.testResultSet(rsw, currentDepth++)); + + assignIds( currentId, rsw, lastDepth); + + } + + private void assignIds(int currentId, ResultSetRewindable rsw, int lastDepth){ + List<String> vars = new ArrayList<String>(); + vars.add("o0"); + for (int i = 1; i <= lastDepth; i++) { + vars.add("p"+i); + vars.add("o"+i); + } + + final List<String> tmpVars = new ArrayList<String>(); + + while (rsw.hasNext()){ + tmpVars.clear(); + tmpVars.addAll(vars); + QuerySolution q = rsw.nextSolution(); + + if(!q.get("o0").isAnon()){ + continue; + }else{ + tmpVars.remove(0); + assignIdRec(currentId, q, tmpVars); + } + + + } + rsw.reset(); + + } + + private void assignIdRec(int currentId, QuerySolution q, List<String> vars ){ + if(vars.isEmpty()){return;} + String pvar = vars.remove(0); + String ovar = vars.remove(0); + + RDFNode n = q.get(ovar); + if(n.isAnon()){ + int nextId = BlankNodeCollector.getNextGlobalBNodeId(); + RDFNodeTuple tuple = new RDFNodeTuple(q.get(pvar), new RDFBlankNode(nextId,n)); + BlankNodeCollector.addBlankNode(currentId, tuple); + assignIdRec(nextId, q, vars); + }else{ + BlankNodeCollector.addBlankNode(currentId, new RDFNodeTuple(q.get(pvar), n)); + } + + + } + + + + Added: trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -0,0 +1,75 @@ +package org.dllearner.kb.extraction; + +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.aquisitors.BlankNodeCollector; +import org.dllearner.kb.aquisitors.RDFBlankNode; +import org.dllearner.kb.aquisitors.TupleAquisitor; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.utilities.datastructures.RDFNodeTuple; + +public class BlankNode extends Node { + + RDFBlankNode bNode; + + private List<ObjectPropertyNode> objectProperties = new ArrayList<ObjectPropertyNode>(); + private List<DatatypePropertyNode> datatypeProperties = new ArrayList<DatatypePropertyNode>(); + + + public BlankNode(RDFBlankNode bNode){ + super("_:internal_"+bNode.getBNodeId()); + this.bNode=bNode; + } + + + + @Override + public List<Node> expand(TupleAquisitor TupelAquisitor, + Manipulator manipulator) { + List<Node> newNodes = new ArrayList<Node>(); + SortedSet<RDFNodeTuple> s = BlankNodeCollector.getBlankNode(bNode.getBNodeId()); + for (RDFNodeTuple tuple : s) { + if(tuple.b.isLiteral()) { + datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); + }else if(tuple.b.isAnon()){ + + BlankNode tmp = new BlankNode( (RDFBlankNode)tuple.b); + objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, tmp )); + newNodes.add(tmp); + }else{ + objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, new ClassNode(tuple.b.toString()) )); + } + } + return newNodes; + } + + @Override + public void expandProperties(TupleAquisitor TupelAquisitor, + Manipulator manipulator) { + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> returnSet = new TreeSet<String>(); + String subject = getNTripleForm(); + for (ObjectPropertyNode one : objectProperties) { + returnSet.add(subject + one.getNTripleForm() + one.getBPart().getNTripleForm()+" . "); + returnSet.addAll(one.getBPart().toNTriple()); + } + return returnSet; + } + + @Override + public String getNTripleForm(){ + return " "+uri+" "; + } + + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + //FIXME + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -25,10 +25,15 @@ import java.util.TreeSet; import org.apache.log4j.Logger; +import org.dllearner.kb.aquisitors.RDFBlankNode; import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLCommentAnnotation; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLLabelAnnotation; /** * Is a node in the graph, that is a class. @@ -66,7 +71,7 @@ return newNodes; } - public Node processTuple( RDFNodeTuple tuple) { + private Node processTuple( RDFNodeTuple tuple) { try { String property = tuple.a.toString(); if(tuple.b.isLiteral()) { @@ -74,6 +79,12 @@ return null; }else if(tuple.b.isAnon()){ logger.warn("blanknodes not supported as of now "+ this +" in tuple" + tuple); + RDFBlankNode n = (RDFBlankNode) tuple.b; + //SortedSet<RDFNodeTuple> bNodeTuples = BlankNodeCollector.getBlankNode(n.getBNodeId()); + //BlankNode tmp = new BlankNode(n); + //add it to the graph + //classProperties.add(new ObjectPropertyNode( tuple.a.toString(), this, tmp)); + //return tmp; return null; // substitute rdf:type with owl:subclassof }else if (property.equals(OWLVocabulary.RDF_TYPE) || @@ -110,21 +121,60 @@ @Override public SortedSet<String> toNTriple() { SortedSet<String> returnSet = new TreeSet<String>(); - returnSet.add("<" + this.uri + "><" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_CLASS + ">."); + String subject = getNTripleForm(); + returnSet.add(subject+"<" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_CLASS + ">."); for (ObjectPropertyNode one : classProperties) { - returnSet.add("<" + this.uri + "><" + one.getURI() + "><" - + one.getB().getURI() + ">."); - returnSet.addAll(one.getB().toNTriple()); + returnSet.add(subject + one.getNTripleForm() + + one.getBPart().getNTripleForm()+" ."); + returnSet.addAll(one.getBPart().toNTriple()); } for (DatatypePropertyNode one : datatypeProperties) { - returnSet.add("<" + uri + "><" + one.getURI() + "> " + one.getNTripleFormOfB() + returnSet.add(subject+ one.getNTripleForm() + one.getNTripleFormOfB() + " ."); } return returnSet; } - + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + try{ + OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); + OWLClass me =factory.getOWLClass(getURI()); + for (ObjectPropertyNode one : classProperties) { + OWLClass c = factory.getOWLClass(one.getBPart().getURI()); + if(OWLVocabulary.isStringSubClassVocab(one.getURIString())){ + owlAPIOntologyCollector.addAxiom(factory.getOWLSubClassAxiom(me, c)); + }else if(one.getURIString().equals(OWLVocabulary.OWL_DISJOINT_WITH)){ + owlAPIOntologyCollector.addAxiom(factory.getOWLDisjointClassesAxiom(me, c)); + }else if(one.getURIString().equals(OWLVocabulary.OWL_EQUIVALENT_CLASS)){ + owlAPIOntologyCollector.addAxiom(factory.getOWLEquivalentClassesAxiom(me, c)); + }else { + logger.warn("missing : " +one.getURIString()); + } + one.getBPart().toOWLOntology(owlAPIOntologyCollector); + } + for (DatatypePropertyNode one : datatypeProperties) { + //FIXME add languages + // watch for tail + if(one.getURIString().equals(OWLVocabulary.RDFS_COMMENT)){ + OWLCommentAnnotation comment = factory.getCommentAnnotation(one.getBPart().getLiteral().getString()); + owlAPIOntologyCollector.addAxiom(factory.getOWLEntityAnnotationAxiom(me, comment)); + + }else if(one.getURIString().equals(OWLVocabulary.RDFS_LABEL)) { + OWLLabelAnnotation label = factory.getOWLLabelAnnotation(one.getBPart().getLiteral().getString()); + owlAPIOntologyCollector.addAxiom(factory.getOWLEntityAnnotationAxiom(me, label)); + }else { + logger.warn("missing : " +one.getURIString()); + } + + } + }catch (Exception e) { + System.out.println("aaa"+getURIString()); + e.printStackTrace(); + } + } + } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -25,34 +25,36 @@ /** * Stores all configuration settings. this class collects all configuration * information see the other classes, which are used as attributes here - * + * * @author Sebastian Hellmann */ public class Configuration { - + private OWLAPIOntologyCollector owlAPIOntologyCollector; + private Manipulator manipulator; + private TupleAquisitor tupelAquisitor; - + // the following needs to be moved to // class extraction algorithm or manipulator private boolean optimizeForDLLearner = true; + private int recursiondepth; + private boolean getAllSuperClasses = true; + private boolean closeAfterRecursion = true; + private boolean getPropertyInformation = false; + private int breakSuperClassesAfter = 200; + public Configuration(TupleAquisitor tupelAquisitor, + Manipulator manipulator, int recursiondepth, + boolean getAllSuperClasses, boolean closeAfterRecursion, + boolean getPropertyInformation, int breakSuperClassesAfter) { - public Configuration( - TupleAquisitor tupelAquisitor, - Manipulator manipulator, - int recursiondepth, - boolean getAllSuperClasses, - boolean closeAfterRecursion, - boolean getPropertyInformation, - int breakSuperClassesAfter) { - this.tupelAquisitor = tupelAquisitor; this.manipulator = manipulator; this.recursiondepth = recursiondepth; @@ -61,51 +63,54 @@ this.getPropertyInformation = getPropertyInformation; this.breakSuperClassesAfter = breakSuperClassesAfter; + this.owlAPIOntologyCollector = new OWLAPIOntologyCollector(); } + public Configuration(TupleAquisitor tupelAquisitor, + Manipulator manipulator, int recursiondepth, + boolean getAllSuperClasses, boolean closeAfterRecursion, + boolean getPropertyInformation, int breakSuperClassesAfter, + OWLAPIOntologyCollector owlAPIOntologyCollector) { + this(tupelAquisitor, manipulator, recursiondepth, getAllSuperClasses, + closeAfterRecursion, getAllSuperClasses, breakSuperClassesAfter); + this.owlAPIOntologyCollector = owlAPIOntologyCollector; + } public int getBreakSuperClassesAfter() { return breakSuperClassesAfter; } - public boolean isCloseAfterRecursion() { return closeAfterRecursion; } - public boolean isGetAllSuperClasses() { return getAllSuperClasses; } - public Manipulator getManipulator() { return manipulator; } - public int getRecursiondepth() { return recursiondepth; } - public TupleAquisitor getTupelAquisitor() { return tupelAquisitor; } - public boolean isOptimizeForDLLearner() { return optimizeForDLLearner; } - public boolean isGetPropertyInformation() { return getPropertyInformation; } + public OWLAPIOntologyCollector getOwlAPIOntologyCollector() { + return owlAPIOntologyCollector; + } - - - } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -34,18 +34,10 @@ * */ -public class DatatypePropertyNode extends Node { +public class DatatypePropertyNode extends PropertyNode { - // the a and b part of a property - private Node a; - private LiteralNode b; - - public DatatypePropertyNode(String uri, Node a, LiteralNode b) { - super(uri); - // this.type = "property"; - this.a = a; - this.b = b; + super(uri, a, b); } // Property Nodes are normally not expanded, @@ -60,15 +52,10 @@ public void expandProperties(TupleAquisitor tupelAquisitor, Manipulator manipulator) { } - - - public Node getA() { - return a; + @Override + public LiteralNode getBPart(){ + return (LiteralNode)b; } - - public Node getB() { - return b; - } public String getNTripleFormOfB() { return b.getNTripleForm(); @@ -77,12 +64,17 @@ @Override public SortedSet<String> toNTriple() { SortedSet<String> s = new TreeSet<String>(); - s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + s.add(getNTripleForm()+"<" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_DATATYPPROPERTY + ">."); return s; } - + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + + } + + } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -59,6 +59,7 @@ for (String oneURI : uris) { nodeList.add(expandNode(oneURI, tupelAquisitor)); } + return nodeList; } @@ -135,14 +136,32 @@ List<ObjectPropertyNode> l = getObjectPropertyNodes(collectNodes); for (ObjectPropertyNode node : l) { + //FIXME has to be transported to the next step node.expandProperties(tupleAquisitor, configuration.getManipulator()); } } + + expandBlankNodes(getBlankNodes(collectNodes),tupleAquisitor); + return seedNode; } + private List<Node> expandBlankNodes(List<BlankNode> blankNodes, TupleAquisitor tupelAquisitor) { + List<Node> newNodes = new ArrayList<Node>(); + while (!blankNodes.isEmpty()) { + Node next = blankNodes.remove(0); + List<Node> l = next.expand(tupelAquisitor, configuration.getManipulator()); + for (Node node : l) { + blankNodes.add((BlankNode) node); + } + + } + return newNodes; + } + + private List<Node> expandCloseAfterRecursion(List<InstanceNode> instanceNodes, TupleAquisitor tupelAquisitor) { List<Node> newNodes = new ArrayList<Node>(); @@ -179,9 +198,9 @@ Node next = newClasses.remove(0); logger.trace("Getting Superclasses for: " + next); - if (!alreadyQueriedSuperClasses.contains(next.getURI().toString())) { + if (!alreadyQueriedSuperClasses.contains(next.getURIString().toString())) { logger.trace("" + next+" not in cache retrieving"); - alreadyQueriedSuperClasses.add(next.getURI().toString()); + alreadyQueriedSuperClasses.add(next.getURIString().toString()); tupelAquisitor.setNextTaskToClassInformation(); newClasses.addAll(next.expand(tupelAquisitor, configuration.getManipulator())); @@ -226,6 +245,18 @@ return retList; } + public static List<BlankNode> getBlankNodes(List<Node> l ){ + List<BlankNode> retList = new ArrayList<BlankNode>(); + for (Node node : l) { + if (node instanceof BlankNode) { + retList.add( (BlankNode) node); + + } + + } + return retList; + } + public static List<ObjectPropertyNode> getObjectPropertyNodes(List<Node> l ){ List<ObjectPropertyNode> properties = new ArrayList<ObjectPropertyNode>(); for (Node node : l) { Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -24,12 +24,22 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.apache.commons.collections.list.TypedList; import org.apache.log4j.Logger; +import org.dllearner.kb.aquisitors.RDFBlankNode; import org.dllearner.kb.aquisitors.TupleAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; +import org.semanticweb.owl.expression.OWLExpressionParser; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataProperty; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObjectProperty; +import com.hp.hpl.jena.rdf.model.Literal; + /** * A node in the graph that is an instance. * @@ -47,10 +57,8 @@ private List<ObjectPropertyNode> objectProperties = new ArrayList<ObjectPropertyNode>(); private List<DatatypePropertyNode> datatypeProperties = new ArrayList<DatatypePropertyNode>(); - public InstanceNode(String uri) { super(uri); - } // expands all directly connected nodes @@ -80,6 +88,9 @@ datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); return null; }else if(tuple.b.isAnon()){ + RDFBlankNode n = (RDFBlankNode) tuple.b; + System.out.println(n.getBNodeId()); + System.exit(0); logger.warn("blanknodes not supported as of now"+ this +"in tuple" + tuple); return null; @@ -115,30 +126,85 @@ SortedSet<String> returnSet = new TreeSet<String>(); returnSet.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_THING + ">."); for (ClassNode one : classes) { - returnSet.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + one.getURI() + ">."); + returnSet.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + one.getURIString() + ">."); returnSet.addAll(one.toNTriple()); } for (ObjectPropertyNode one : objectProperties) { - returnSet.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() + returnSet.add("<" + uri + "><" + one.getURIString() + "><" + one.getBPart().getURIString() + ">."); returnSet.addAll(one.toNTriple()); - returnSet.addAll(one.getB().toNTriple()); + returnSet.addAll(one.getBPart().toNTriple()); } for (DatatypePropertyNode one : datatypeProperties) { - returnSet.add("<" + uri + "><" + one.getURI() + "> " + one.getNTripleFormOfB() + returnSet.add("<" + uri + "><" + one.getURIString() + "> " + one.getNTripleFormOfB() + " ."); } return returnSet; } + + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); + + + OWLIndividual me = factory.getOWLIndividual(getURI()); + for (ClassNode one : classes) { + OWLClass c = factory.getOWLClass(one.getURI()); + owlAPIOntologyCollector.addAxiom(factory.getOWLClassAssertionAxiom(me, c)); + one.toOWLOntology(owlAPIOntologyCollector); + } + for (ObjectPropertyNode one : objectProperties) { + OWLIndividual o = factory.getOWLIndividual(one.getBPart().getURI()); + OWLObjectProperty p = factory.getOWLObjectProperty(one.getURI()); + factory.getOWLObjectPropertyAssertionAxiom(me, p, o); + one.toOWLOntology(owlAPIOntologyCollector); + one.getBPart().toOWLOntology(owlAPIOntologyCollector); + } + + for (DatatypePropertyNode one : datatypeProperties) { + OWLDataProperty p = factory.getOWLDataProperty(one.getURI()); + Literal ln = one.getBPart().getLiteral(); + try{ + + + if(one.getBPart().isString()){ + owlAPIOntologyCollector.addAxiom( + factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getString())); + } else if(one.getBPart().isDouble()){ + owlAPIOntologyCollector.addAxiom( + factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getDouble())); + } else if(one.getBPart().isFloat()){ + owlAPIOntologyCollector.addAxiom( + factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getFloat())); + } else if(one.getBPart().isInt()){ + owlAPIOntologyCollector.addAxiom( + factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getInt())); + } else if(one.getBPart().isBoolean()){ + owlAPIOntologyCollector.addAxiom( + factory.getOWLDataPropertyAssertionAxiom(me, p, ln.getBoolean())); + } else { + logger.warn("missing : "+one.getURIString()); + } + + + }catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } + + //factory.getOWLDataPropertyAssertionAxiom() + //returnSet.add("<" + uri + "><" + one.getURI() + "> " + one.getNTripleFormOfB() + // + " ."); + } + } + public List<ObjectPropertyNode> getObjectProperties() { return objectProperties; } - - } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -48,14 +48,17 @@ public LiteralNode(String uri) { super(uri); - // this.type = "instance"; - + } public LiteralNode(RDFNode node) { super(node.toString()); l = (Literal) node; } + + public Literal getLiteral(){ + return l; + } // expands all directly connected nodes @Override @@ -77,7 +80,7 @@ - + @Override public String getNTripleForm() { String quote = "\\\""; quote = """; @@ -92,5 +95,59 @@ } } + + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + + } + + public boolean isDouble(){ + try{ + l.getDouble(); + return true; + }catch (Exception e) { + return false; + } + } + + public boolean isFloat(){ + try{ + l.getFloat(); + return true; + }catch (Exception e) { + return false; + } + } + + public boolean isInt(){ + try{ + l.getInt(); + return true; + }catch (Exception e) { + return false; + } + } + + public boolean isBoolean(){ + try{ + l.getBoolean(); + return true; + }catch (Exception e) { + return false; + } + } + + public boolean isString(){ + try{ + l.getString(); + return true; + }catch (Exception e) { + return false; + } + } + + + + } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -19,11 +19,16 @@ */ package org.dllearner.kb.extraction; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import org.apache.log4j.Logger; +import org.semanticweb.owl.model.OWLOntology; /** * An object of this class encapsulates everything. @@ -36,54 +41,73 @@ private Configuration configuration; private ExtractionAlgorithm extractionAlgorithm; private int nrOfExtractedTriples = 0; + private List<Node> seedNodes = new ArrayList<Node>(); private static Logger logger = Logger .getLogger(Manager.class); public void useConfiguration(Configuration configuration) { - this.configuration = configuration; - //System.out.println(this.configuration); - this.extractionAlgorithm = new ExtractionAlgorithm(configuration); - } - public String extract(String uri) { + public Node extractOneURI(String uri) { - logger.info("Start extracting"); - + logger.info("Start extracting: "+uri); Node n = extractionAlgorithm.expandNode(uri, configuration.getTupelAquisitor()); - SortedSet<String> s = n.toNTriple(); - logger.info("number of triples: "+s.size()); - StringBuffer nt = new StringBuffer(33000); - for (String str : s) { - nt.append(str + "\n"); - } - logger.info("sizeofStringBuffer"+nt.length()); - return nt.toString(); + logger.info("Finished extracting: "+uri ); + seedNodes.add(n); + return n; } + + - public String extract(Set<String> instances) { - // this.TypedSparqlQuery.query(uri); - // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); - logger.info("Start extracting"); - SortedSet<String> tripleCollector = new TreeSet<String>(); + public List<Node> extract(Set<String> instances) { + List<Node> allExtractedNodes = new ArrayList<Node>(); + logger.info("Start extracting "+instances.size() + " instances "); int progress=0; for (String one : instances) { progress++; - //if(progress % 10 == 0) { - logger.info("Progress: "+progress+" of "+instances.size()+" finished: "+one); - //} + logger.info("Progress: "+progress+" of "+instances.size()+" finished: "+one); try { Node n = extractionAlgorithm.expandNode(one, configuration.getTupelAquisitor()); - tripleCollector.addAll(n.toNTriple()); + seedNodes.add(n); + allExtractedNodes.add(n); } catch (Exception e) { + logger.warn("extraction failed for: "+one); e.printStackTrace(); + } } - logger.info("Finished extracting, start conversion"); + logger.info("Finished extraction"); + return allExtractedNodes; + + } + + public OWLOntology getOWLAPIOntologyForNodes(List<Node> nodes){ + for (Node n : nodes) { + n.toOWLOntology(configuration.getOwlAPIOntologyCollector()); + } + configuration.getOwlAPIOntologyCollector().saveOntology(); + return configuration.getOwlAPIOntologyCollector().getCurrentOntology(); + } + + public URL getPhysicalOntologyURL()throws MalformedURLException{ + return configuration.getOwlAPIOntologyCollector().getPhysicalURI().toURL(); + + } + + public String getNTripleForAllExtractedNodes(){ + return getNTripleForNodes(seedNodes); + } + + public String getNTripleForNodes(List<Node> nodes){ + SortedSet<String> tripleCollector = new TreeSet<String>(); + for (Node n : nodes) { + tripleCollector.addAll(n.toNTriple()); + } + logger.info("Converting to NTriple"); StringBuffer nt = new StringBuffer(100000); Object[] arr = tripleCollector.toArray(); nrOfExtractedTriples = arr.length; @@ -93,11 +117,6 @@ logger.info(i + " of " + arr.length + " triples done"); } logger.info(arr.length + " of " + arr.length + " triples done"); - /* - * String tmp=""; while ( ret.size() > 0) { tmp=ret.first(); nt+=tmp; - * ret.remove(tmp); System.out.println(ret.size()); } /*for (String str : - * ret) { nt += str + "\n"; } - */ logger.info("Ontology String size = " + nt.length()); return nt.toString(); } @@ -107,6 +126,7 @@ return configuration; } + @Deprecated public int getNrOfExtractedTriples() { return nrOfExtractedTriples; } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -19,6 +19,7 @@ */ package org.dllearner.kb.extraction; +import java.net.URI; import java.util.List; import java.util.SortedSet; @@ -73,17 +74,34 @@ */ public abstract SortedSet<String> toNTriple(); + public abstract void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector); + + /* + + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + + } + */ + @Override public String toString() { return "Node: " + uri + ":" + this.getClass().getSimpleName(); } - public String getURI() { + public String getURIString() { return uri; } + public URI getURI() { + return URI.create(uri); + } + public String getNTripleForm(){ + return "<"+uri+"> "; + } + Added: trunk/src/dl-learner/org/dllearner/kb/extraction/OWLAPIOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/OWLAPIOntologyCollector.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/OWLAPIOntologyCollector.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -0,0 +1,80 @@ +package org.dllearner.kb.extraction; + +import java.io.File; +import java.net.URI; + +import org.apache.log4j.Logger; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.AddAxiom; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.util.SimpleURIMapper; + +public class OWLAPIOntologyCollector { + + private static Logger logger = Logger.getLogger(OWLAPIOntologyCollector.class); + + private OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + private OWLDataFactory factory; + private OWLOntology currentOntology; + private URI ontologyURI; + private URI physicalURI; + + + + public OWLAPIOntologyCollector(){ + this("http://www.fragment.org/fragment", "cache/"+System.currentTimeMillis()+".owl"); + } + + public OWLAPIOntologyCollector(String ontologyURI, String physicalURI){ + this.ontologyURI = URI.create(ontologyURI); + this.physicalURI = new File(physicalURI).toURI(); + SimpleURIMapper mapper = new SimpleURIMapper(this.ontologyURI, this.physicalURI); + this.manager.addURIMapper(mapper); + try{ + this.currentOntology = manager.createOntology(this.ontologyURI); + }catch(OWLOntologyCreationException e){ + logger.error("FATAL failed to create Ontology " + this.ontologyURI); + e.printStackTrace(); + } + this.factory = manager.getOWLDataFactory(); + } + + public void addAxiom(OWLAxiom axiom){ + AddAxiom addAxiom = new AddAxiom(currentOntology, axiom); + try{ + manager.applyChange(addAxiom); + }catch (OWLOntologyChangeException e) { + //TODO + e.printStackTrace(); + } + } + + public OWLDataFactory getFactory() { + return factory; + } + + public void saveOntology(){ + try{ + manager.saveOntology(currentOntology); + }catch (Exception e) { + e.printStackTrace(); + + } + } + + public OWLOntology getCurrentOntology() { + return currentOntology; + } + + public URI getPhysicalURI() { + return physicalURI; + } + + + +} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-23 18:35:57 UTC (rev 1242) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-09-23 23:06:40 UTC (rev 1243) @@ -23,11 +23,12 @@ 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; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLObjectProperty; @@ -38,24 +39,16 @@ * */ -public class ObjectPropertyNode extends Node { +public class ObjectPropertyNode extends PropertyNode { - 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 = 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; - + public ObjectPropertyNode(String propertyURI, Node a, Node b) { + super(propertyURI, a, b); } // Property Nodes are normally not expanded, @@ -88,24 +81,13 @@ } - - - - public Node getA() { - return a; - } - - public Node getB() { - return b; - } - @Override public SortedSet<String> toNTriple() { SortedSet<String> s = new TreeSet<String>(); - s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + s.add(getNTripleForm()+"<" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_OBJECTPROPERTY + ">."); for (String one : specialTypes) { - s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + s.add(getNTripleForm()+"<" + OWLVocabulary.RDF_TYPE + "><" + one + ">."); } @@ -115,6 +97,28 @@ return s; } + + @Override + public void toOWLOntology( OWLAPIOntologyCollector owlAPIOntologyCollector){ + //FIXME Property information + OWLDataFactory factory = owlAPIOntologyCollector.getFactory(); + OWLObjectProperty me =factory.getOWLObjectPro... [truncated message content] |
From: <sk...@us...> - 2008-09-23 18:37:22
|
Revision: 1242 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1242&view=rev Author: sknappe Date: 2008-09-23 18:35:57 +0000 (Tue, 23 Sep 2008) Log Message: ----------- design changes, filters, bugfixes, resource as object, etc. Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -135,14 +135,18 @@ function getTriples($uri) { //i am filtering the references out at the moment, because they are causing errors with URL with ...&profile=bla, the XMLParser thinks &profile is a HTML-Entitie and misses the ; - $query="SELECT ?pred ?obj ". - "WHERE {{<".$uri."> ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}}"; + $query="SELECT ?pred ?obj ?sub ". + "WHERE {{<".$uri."> ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{?sub ?pred <".$uri.">}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?sub ?pred ?Conc}}"; $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("An article with that name does not exist. The Search is started ..."); $ret=array(); foreach ($result['results']['bindings'] as $results){ - $value=$results['obj']; - if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))) $ret[$results['pred']['value']][]=$value; + if (isset($results['obj'])) $value=$results['obj']; + else if (isset($results['sub'])) $value=$results['sub']; + if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))){ + if (isset($results['obj'])) $ret[0][$results['pred']['value']][]=$value; + else if (isset($results['sub'])) $ret[1][$results['pred']['value']][]=$value; + } } return $ret; @@ -256,7 +260,7 @@ } return $ret; } - + /*not used at the moment function getYagoSubCategories($category) { $query="SELECT ?subject ?label count(?subclass) as ?numberOfSubclasses\n". @@ -272,7 +276,7 @@ if (strlen($res['label'])>0) $ret[]=$res; } return $ret; - } + }*/ public function loadWSDLfiles($wsdluri){ $main=DLLearnerConnection::getwsdl($wsdluri); Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -3,6 +3,7 @@ $positives=$_SESSION['positive']; $negatives=$_SESSION['negative']; + $attr=array(); $pos=""; $i=1; if (isset($_SESSION['positive'])) foreach ($positives as $key=>$value){ @@ -10,7 +11,10 @@ else $pos.=$key; $i++; } - if (strlen($pos)>0) $pos='positives=['.$pos.']'; + if (strlen($pos)>0){ + $pos='positives=['.$pos.']'; + $attr[]=$pos; + } $neg=""; $i=1; if (isset($_SESSION['negative'])) foreach ($negatives as $key=>$value){ @@ -18,12 +22,19 @@ else $neg.=$key; $i++; } - if (strlen($neg)>0) $neg='negatives=['.$neg.']'; - - if (strlen($pos)>0||strlen($neg)>0) $interests='?'.$pos.$neg; - else $interests=""; + if (strlen($neg)>0){ + $neg.='negatives=['.$neg.']'; + $attr[]=$neg; + } - $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$_SESSION['lastAction'].$interests; + $last_action=$_SESSION['lastAction']; + if (strpos($last_action,'searchConceptInstances')===0){ + $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); + $last_action='searchConceptInstances/Concept'; + } + $attributes='?'.implode('&',$attr); + $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; + print $url.'<br/><br/>'; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -46,7 +46,9 @@ try{ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); - $triples=$sc->getTriples($uri); + $alltriples=$sc->getTriples($uri); + $triples=$alltriples[0]; + $subjecttriples=$alltriples[1]; //BUILD ARTICLE // goal: display the data in a nice (DBpedia specific way), maybe similar to @@ -83,7 +85,8 @@ $content.=', <img src="images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; } - if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])){ + //display owl:sameAs properties + if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])||isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])){ $content.='<br/><hr><h4>Same as</h4><br/>'; $content.='<ul>'; foreach ($triples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ @@ -91,12 +94,18 @@ $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; else $content.= '<li>'.urldecode($same['value']).'</li>'; } + if (isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])) foreach ($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ + if ($same['type']=="uri") + $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; + else $content.= '<li>'.urldecode($same['value']).'</li>'; + } $content.='</ul>'; } + // display a list of classes $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; - // display a list of classes + if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; @@ -137,7 +146,7 @@ $birthuri=false; foreach ($birthdates as $dates){ if ($birthdate!=false){ - unset($triples[$dates]); + if (isset($triples[$dates])) unset($triples[$dates]); continue; } if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ @@ -148,7 +157,7 @@ $birthuri=$dates; $characteristics['Birthdate']=$triples[$dates]; } - else unset($triples[$dates]); + else if (isset($triples[$dates])) unset($triples[$dates]); } //display only one deathdate @@ -157,7 +166,7 @@ $deathuri=false; foreach ($deathdates as $dates){ if ($deathdate!=false){ - unset($triples[$dates]); + if (isset($triples[$dates])) unset($triples[$dates]); continue; } if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ @@ -168,7 +177,7 @@ $deathuri=$dates; $characteristics['Deathdate']=$triples[$dates]; } - else unset($triples[$dates]); + else if (isset($triples[$dates])) unset($triples[$dates]); } //display a small characteristics of a person, if at least the birth date is given @@ -179,15 +188,13 @@ if (isset($triples['http://dbpedia.org/property/birthPlace'])) $characteristics['Birthplace']=$triples['http://dbpedia.org/property/birthPlace']; if (isset($triples['http://dbpedia.org/property/deathPlace'])) $characteristics['Deathplace']=$triples['http://dbpedia.org/property/deathPlace']; if (isset($triples['http://dbpedia.org/property/spouse'])) $characteristics['Spouse']=$triples['http://dbpedia.org/property/spouse']; - if (isset($triples['http://dbpedia.org/property/shortDescription'])) $characteristics['Short Description']=$triples['http://dbpedia.org/property/shortDescription']; if (isset($triples['http://dbpedia.org/property/alternativeNames'])) $characteristics['Alternative Names']=$triples['http://dbpedia.org/property/alternativeNames']; $content.=createCharacteristics($characteristics); - unset($triples['http://dbpedia.org/property/birthname']); - unset($triples['http://dbpedia.org/property/birthPlace']); - unset($triples['http://dbpedia.org/property/deathPlace']); - unset($triples['http://dbpedia.org/property/spouse']); - unset($triples['http://dbpedia.org/property/shortDescription']); - unset($triples['http://dbpedia.org/property/alternativeNames']); + if (isset($triples['http://dbpedia.org/property/birthname'])) unset($triples['http://dbpedia.org/property/birthname']); + if (isset($triples['http://dbpedia.org/property/birthPlace'])) unset($triples['http://dbpedia.org/property/birthPlace']); + if (isset($triples['http://dbpedia.org/property/deathPlace'])) unset($triples['http://dbpedia.org/property/deathPlace']); + if (isset($triples['http://dbpedia.org/property/spouse'])) unset($triples['http://dbpedia.org/property/spouse']); + if (isset($triples['http://dbpedia.org/property/alternativeNames'])) unset($triples['http://dbpedia.org/property/alternativeNames']); if ($birthdate!=false) unset($triples[$birthdate]); if ($birthuri!=false) unset($triples[$birthuri]); if ($deathdate!=false) unset($triples[$deathdate]); @@ -224,54 +231,70 @@ // filter out uninteresting properties and properties which // have already been displayed - unset($triples['http://www.w3.org/2002/07/owl#sameAs']); - unset($triples['http://xmlns.com/foaf/0.1/page']); - unset($triples['http://xmlns.com/foaf/0.1/depiction']); - unset($triples['http://dbpedia.org/property/abstract']); - unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); - unset($triples['http://dbpedia.org/property/redirect']); - unset($triples['http://dbpedia.org/property/reference']); - unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); - unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat']); - unset($triples['http://dbpedia.org/property/hasPhotoCollection']); - unset($triples['http://www.w3.org/2004/02/skos/core#subject']); - unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); - unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); - unset($triples['http://dbpedia.org/property/latSec']); - unset($triples['http://dbpedia.org/property/lonSec']); - unset($triples['http://dbpedia.org/property/lonDeg']); - unset($triples['http://dbpedia.org/property/latMin']); - unset($triples['http://dbpedia.org/property/lonMin']); - unset($triples['http://dbpedia.org/property/latDeg']); - unset($triples['http://dbpedia.org/property/lonMin']); - unset($triples['http://www.georss.org/georss/point']); - unset($triples['http://dbpedia.org/property/audioProperty']); - unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); - unset($triples['http://dbpedia.org/property/relatedInstance']); - unset($triples['http://dbpedia.org/property/boxWidth']); - unset($triples['http://dbpedia.org/property/pp']); - unset($triples['http://dbpedia.org/property/caption']); - unset($triples['http://dbpedia.org/property/s']); - unset($triples['http://dbpedia.org/property/lifetimeProperty']); - unset($triples['http://dbpedia.org/property/imagesize']); - unset($triples['http://dbpedia.org/property/id']); - unset($triples['http://dbpedia.org/property/issue']); - if ($triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); - if ($triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); - if ($triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); - if ($triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); - unset($triples['http://www.geonames.org/ontology#featureCode']); - unset($triples['http://www.geonames.org/ontology#featureClass']); - unset($triples['http://dbpedia.org/property/dmozProperty']); - unset($triples['http://dbpedia.org/property/color']); - unset($triples['http://dbpedia.org/property/imageCaption']); - unset($triples['http://dbpedia.org/property/name']); + if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])) unset($triples['http://www.w3.org/2002/07/owl#sameAs']); + if (isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])) unset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs']); + if (isset($triples['http://xmlns.com/foaf/0.1/page'])) unset($triples['http://xmlns.com/foaf/0.1/page']); + if (isset($triples['http://xmlns.com/foaf/0.1/depiction'])) unset($triples['http://xmlns.com/foaf/0.1/depiction']); + if (isset($triples['http://dbpedia.org/property/abstract'])) unset($triples['http://dbpedia.org/property/abstract']); + if (isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); + if (isset($triples['http://dbpedia.org/property/redirect'])) unset($triples['http://dbpedia.org/property/redirect']); + if (isset($triples['http://dbpedia.org/property/reference'])) unset($triples['http://dbpedia.org/property/reference']); + if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])) unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); + if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])) unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat']); + if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])) unset($triples['http://dbpedia.org/property/hasPhotoCollection']); + if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])) unset($triples['http://www.w3.org/2004/02/skos/core#subject']); + if (isset($triples['http://www.w3.org/2000/01/rdf-schema#label'])) unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); + if (isset($triples['http://www.w3.org/2000/01/rdf-schema#comment'])) unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); + if (isset($triples['http://dbpedia.org/property/latSec'])) unset($triples['http://dbpedia.org/property/latSec']); + if (isset($triples['http://dbpedia.org/property/lonSec'])) unset($triples['http://dbpedia.org/property/lonSec']); + if (isset($triples['http://dbpedia.org/property/lonDeg'])) unset($triples['http://dbpedia.org/property/lonDeg']); + if (isset($triples['http://dbpedia.org/property/latMin'])) unset($triples['http://dbpedia.org/property/latMin']); + if (isset($triples['http://dbpedia.org/property/lonMin'])) unset($triples['http://dbpedia.org/property/lonMin']); + if (isset($triples['http://dbpedia.org/property/latDeg'])) unset($triples['http://dbpedia.org/property/latDeg']); + if (isset($triples['http://dbpedia.org/property/lonMin'])) unset($triples['http://dbpedia.org/property/lonMin']); + if (isset($triples['http://www.georss.org/georss/point'])) unset($triples['http://www.georss.org/georss/point']); + if (isset($triples['http://dbpedia.org/property/audioProperty'])) unset($triples['http://dbpedia.org/property/audioProperty']); + if (isset($triples['http://dbpedia.org/property/wikiPageUsesTemplate'])) unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); + if (isset($triples['http://dbpedia.org/property/relatedInstance'])) unset($triples['http://dbpedia.org/property/relatedInstance']); + if (isset($triples['http://dbpedia.org/property/boxWidth'])) unset($triples['http://dbpedia.org/property/boxWidth']); + if (isset($triples['http://dbpedia.org/property/pp'])) unset($triples['http://dbpedia.org/property/pp']); + if (isset($triples['http://dbpedia.org/property/caption'])) unset($triples['http://dbpedia.org/property/caption']); + if (isset($subjecttriples['http://dbpedia.org/property/caption'])) unset($subjecttriples['http://dbpedia.org/property/caption']); + if (isset($triples['http://dbpedia.org/property/s'])) unset($triples['http://dbpedia.org/property/s']); + if (isset($triples['http://dbpedia.org/property/lifetimeProperty'])) unset($triples['http://dbpedia.org/property/lifetimeProperty']); + if (isset($triples['http://dbpedia.org/property/imagesize'])) unset($triples['http://dbpedia.org/property/imagesize']); + if (isset($triples['http://dbpedia.org/property/id'])) unset($triples['http://dbpedia.org/property/id']); + if (isset($triples['http://dbpedia.org/property/issue'])) unset($triples['http://dbpedia.org/property/issue']); + if (isset($triples['http://dbpedia.org/property/hips'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/hips']); + if (isset($triples['http://dbpedia.org/property/weight'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/weight']); + if (isset($triples['http://dbpedia.org/property/waist'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/waist']); + if (isset($triples['http://dbpedia.org/property/height'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/height']); + if (isset($triples['http://www.geonames.org/ontology#featureCode'])) unset($triples['http://www.geonames.org/ontology#featureCode']); + if (isset($triples['http://www.geonames.org/ontology#featureClass'])) unset($triples['http://www.geonames.org/ontology#featureClass']); + if (isset($triples['http://dbpedia.org/property/dmozProperty'])) unset($triples['http://dbpedia.org/property/dmozProperty']); + if (isset($triples['http://dbpedia.org/property/color'])) unset($triples['http://dbpedia.org/property/color']); + if (isset($triples['http://dbpedia.org/property/imageCaption'])) unset($triples['http://dbpedia.org/property/imageCaption']); + if (isset($triples['http://dbpedia.org/property/name'])) unset($triples['http://dbpedia.org/property/name']); + if (isset($triples['http://dbpedia.org/property/audioIpaProperty'])) unset($triples['http://dbpedia.org/property/audioIpaProperty']); + if (isset($subjecttriples['http://dbpedia.org/property/redirect'])) unset($subjecttriples['http://dbpedia.org/property/redirect']); + if (isset($triples['http://dbpedia.org/property/audioDeProperty'])) unset($triples['http://dbpedia.org/property/audioDeProperty']); + if (isset($triples['http://dbpedia.org/property/art'])) unset($triples['http://dbpedia.org/property/art']); + if (isset($subjecttriples['http://dbpedia.org/property/babAsProperty'])) unset($subjecttriples['http://dbpedia.org/property/babAsProperty']); + if (isset($triples['http://dbpedia.org/property/babAsProperty'])) unset($triples['http://dbpedia.org/property/babAsProperty']); + if (isset($triples['http://dbpedia.org/property/imageWidth'])) unset($triples['http://dbpedia.org/property/imageWidth']); + if (isset($triples['http://dbpedia.org/property/rangeMapWidth'])) unset($triples['http://dbpedia.org/property/rangeMapWidth']); + if (isset($triples['http://dbpedia.org/property/rangeMapCaption'])) unset($triples['http://dbpedia.org/property/rangeMapCaption']); + if (isset($subjecttriples['http://dbpedia.org/property/nihongoProperty'])) unset($subjecttriples['http://dbpedia.org/property/nihongoProperty']); + if (isset($triples['http://dbpedia.org/property/shortDescription'])) unset($triples['http://dbpedia.org/property/shortDescription']); + if (isset($triples['http://dbpedia.org/property/refLabelProperty'])) unset($triples['http://dbpedia.org/property/refLabelProperty']); + if (isset($triples['http://dbpedia.org/property/noteLabelProperty'])) unset($triples['http://dbpedia.org/property/noteLabelProperty']); + if (isset($triples['http://dbpedia.org/property/wikisourcelangProperty'])) unset($triples['http://dbpedia.org/property/wikisourcelangProperty']); if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; // display the remaining properties as list which can be used for further navigation - $content .= get_triple_table($triples); + $content .= get_triple_table($triples,$subjecttriples); } //Restart the Session Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -3,20 +3,25 @@ include_once('Settings.php'); include_once('DatabaseConnection.php'); - $manchester=html_entity_decode($_POST['manchester']); $kb=html_entity_decode($_POST['kb']); $number=$_POST['number']; - $label=$_POST['label']; - + session_start(); $id=$_SESSION['id']; $ksID=$_SESSION['ksID']; + //write last action into session + $actionuri=urlencode($kb); + $_SESSION['lastAction']='searchConceptInstances/'.$actionuri; session_write_close(); setRunning($id,"true"); - $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$manchester); + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $label=$sc->getNaturalDescription($kb); + $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/class\/yago\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); + $content=""; if ($test){ //connect to the database @@ -25,24 +30,24 @@ $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); $databaseConnection->select_database($settings->database_name); - preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$manchester,$treffer,PREG_OFFSET_CAPTURE); + preg_match_all("/\"http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); $final=''; $i=1; $pos=0; foreach ($treffer[0] as $tref){ - $final.=substr($manchester,$pos,$tref[1]-$pos).'('; - $category=substr($manchester,$tref[1],strlen($tref[0])); - $query='SELECT child FROM classhierarchy WHERE father=\''.$category.'\''; + $final.=substr($kb,$pos,$tref[1]-$pos).'('; + $category=substr($kb,$tref[1],strlen($tref[0])); + $query='SELECT child FROM classhierarchy WHERE father='.$category.''; $res=$databaseConnection->query($query); while ($result=$databaseConnection->nextEntry($res)){ - $final.='cat'.$i.'.category=\''.$result['child'].'\' OR '; + $final.='cat'.$i.'.category="'.$result['child'].'" OR '; } - $final.='cat'.$i.'.category=\''.$category.'\')'; + $final.='cat'.$i.'.category='.$category.')'; $i++; $pos=$tref[1]+strlen($tref[0]); } - $final.=substr($manchester,$pos); + $final.=substr($kb,$pos); $temp='SELECT cat1.name FROM '; for ($j=0;$j<$i-1;$j++) if ($j!=$i-2) $temp.='articlecategories as cat'.($j+1).','; @@ -65,7 +70,7 @@ $result2=$databaseConnection->nextEntry($res2); $labels[]=$result2['label']; } - $content.=getConceptResultsTable($names,$labels,htmlentities($manchester),htmlentities($kb),$label,$number); + $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$label,$number); $bestsearches=getBestSearches($names,$labels); } else Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -30,7 +30,7 @@ $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -10,10 +10,11 @@ $subject=ucfirst($subject); //replace spaces with _ $subject=str_replace(' ','_',$subject); + $subject=urlencode($subject); //add the uri $subject="http://dbpedia.org/resource/".$subject; - return urldecode($subject); + return $subject; } function getTagCloud($tags,$label) @@ -104,6 +105,9 @@ $string=str_replace("u00F6","ö",$string); $string=str_replace("u00FC","ü",$string); $string=str_replace("u0161","š",$string); + $string=str_replace("u00FA","ú",$string); + $string=str_replace("u00F0","ð",$string); + $string=str_replace("u00E6","æ",$string); return $string; } @@ -150,11 +154,11 @@ return $ret; } -function getConceptResultsTable($names,$labels,$manchester,$kb,$label,$number) +function getConceptResultsTable($names,$labels,$kb,$label,$number) { $ret="<p>These are your results. Show best "; for ($k=10;$k<125;){ - $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('manchester=".$manchester."&kb=".$kb."&label=".$label."number=".$k."');return false;\""; + $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('kb=".$kb."&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; else $ret.=" style=\"text-decoration:underline;\""; $ret.=">".($k)."</a>"; @@ -220,9 +224,9 @@ fclose($file); } -function get_triple_table($triples) { +function get_triple_table($triples,$subjecttriples) { - $table = '<table border="0"><tr><td><b>Predicate</b></td><td><b>Object</b></td></tr>'; + $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; $i=1; foreach($triples as $predicate=>$object) { $number=count($object); @@ -231,30 +235,77 @@ $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; $table .= '<td>'; if ($number>1) $table.='<ul>'; + $k=1; foreach($object as $element) { + if ($k>3) $display=" style=\"display:none\""; + else $display=""; if ($element['type']=="uri"){ if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ $label=str_replace('_',' ',substr($element['value'],28)); - if ($number>1) $table.='<li>'; + if (strlen($label)>60) $label=substr($label,0,60).'...'; + if ($number>1) $table.='<li'.$display.'>'; $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a>'; if ($number>1) $table.='</li>'; } else{ - if ($number>1) $table.='<li>'; - $table .= '<a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a>'; + if ($number>1) $table.='<li'.$display.'>'; + $label=urldecode($element['value']); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; if ($number>1) $table.='</li>'; } } else{ - if ($number>1) $table.='<li>'; + if ($number>1) $table.='<li'.$display.'>'; $table .= $element['value']; if ($number>1) $table.='</li>'; } + $k++; } + if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; if ($number>1) $table.='</ul>'; $table .= '</td>'; $i*=-1; } + foreach($subjecttriples as $predicate=>$object) { + $number=count($object); + if ($i>0) $backgroundcolor="eee"; + else $backgroundcolor="ffffff"; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">is '.nicePredicate($predicate).' of </a></td>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; + $k=1; + foreach($object as $element) { + if ($k>3) $display=" style=\"display:none\""; + else $display=""; + if ($element['type']=="uri"){ + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($element['value'],28)); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + if ($number>1) $table.='<li'.$display.'>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $label=urldecode($element['value']); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + if ($number>1) $table.='</li>'; + } + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $table .= $element['value']; + if ($number>1) $table.='</li>'; + } + $k++; + } + if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; + $i*=-1; + } $table .= '</table>'; return $table; } @@ -367,7 +418,7 @@ $ret.='<tr style="height:20px"><td><hr/></td></tr>'; $ret.='<tr><td style="font-size:14px;"><b>Current class</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; - $ret.='<tr><td><b>'.$title.'</b></td></tr>'; + $ret.='<tr><td><b>'.$title.'</b> ('.urldecode(str_replace("_"," ",substr (strrchr ($class, "/"), 1))).')</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'; $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&number=10\');" title="Search Instances of Shown class."/>'; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/index.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -21,6 +21,7 @@ else if (isset($_GET['search'])) $onLoad.="search_it('label=".$_GET['search']."&number=10');"; else if (isset($_GET['showClass'])) $onLoad.="get_class('class=http://dbpedia.org/class/yago/".$_GET['showClass']."&cache=-1');"; else if (isset($_GET['searchInstances'])) $onLoad.="getSubjectsFromCategory('category=http://dbpedia.org/class/yago/".$_GET['searchInstances']."&number=10');"; +else if (isset($_GET['searchConceptInstances'])) $onLoad.="getSubjectsFromConcept('kb=".htmlentities(urldecode($_GET['concept']))."&number=10');"; else if (isset($_SESSION['currentArticle'])){ $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } @@ -75,7 +76,7 @@ </div> <!-- box --> <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle" style="cursor:help;" title="The best 10 Search Results are shown here.">Search Results</div> + <div class="boxtitle" style="cursor:help;" title="The best 10 Search Results are shown here.">Best Search Results</div> <div class="boxcontent"> <div id="searchcontent" style="display:block"></div> </div> <!-- boxcontent --> Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-23 18:35:57 UTC (rev 1242) @@ -60,4 +60,22 @@ else sitenumbers[i].style.display='inline'; } -} \ No newline at end of file +} + +function toggleAttributes(element) +{ + var list=element.parentNode.getElementsByTagName('li'); + if (element.innerHTML.match('hide'+'$')=='hide'){ + element.innerHTML='<img src="images/arrow_down.gif"> show'; + for (var i=3;i<list.length;i++) + list[i].style.display='none'; + } + else { + element.innerHTML='<img src="images/arrow_up.gif"> hide'; + for (var i=3;i<list.length;i++) + list[i].style.display='list-item'; + } +} + +function none() +{} \ 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: <sk...@us...> - 2008-09-23 10:46:27
|
Revision: 1241 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1241&view=rev Author: sknappe Date: 2008-09-23 10:46:20 +0000 (Tue, 23 Sep 2008) Log Message: ----------- changed design stuff, filtered some triples and made a simple characteristics view for persons and a seperate part for owl:sameAs property Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 10:44:04 UTC (rev 1240) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 10:46:20 UTC (rev 1241) @@ -59,8 +59,10 @@ $artTitle=urldecode(str_replace("_"," ",substr (strrchr ($url, "/"), 1))); // display a picture if there is one + if (isset($triples['http://dbpedia.org/property/imageCaption'])&&$triples['http://dbpedia.org/property/imageCaption'][0]['type']!='uri') $alt=$triples['http://dbpedia.org/property/imageCaption'][0]['value']; + else $alt='Picture of '.$artTitle; if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$artTitle.'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="'.$alt.'" style="float:right; max-width:200px;" \>'; //display where it was redirected from, if it was redirected $redirect=""; @@ -128,33 +130,68 @@ $long=""; } + $characteristic=array(); //display only one birthdate - $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthDate"); - $date=false; + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthdate","http://dbpedia.org/property/birthDate"); + $birthdate=false; + $birthuri=false; foreach ($birthdates as $dates){ - if ($date){ + if ($birthdate!=false){ unset($triples[$dates]); continue; } - if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ + $birthdate=$dates; + $characteristics['Birthdate']=$triples[$dates]; + } + else if ($triples[$dates][0]['type']=='uri'&&$birthuri==false){ + $birthuri=$dates; + $characteristics['Birthdate']=$triples[$dates]; + } else unset($triples[$dates]); } //display only one deathdate - $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathDate"); - $date=false; + $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathdate","http://dbpedia.org/property/deathDate"); + $deathdate=false; + $deathuri=false; foreach ($deathdates as $dates){ - if ($date){ + if ($deathdate!=false){ unset($triples[$dates]); continue; } - if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ + $deathdate=$dates; + $characteristics['Deathdate']=$triples[$dates]; + } + else if ($triples[$dates][0]['type']=='uri'&&$deathuri==false){ + $deathuri=$dates; + $characteristics['Deathdate']=$triples[$dates]; + } else unset($triples[$dates]); } //display a small characteristics of a person, if at least the birth date is given - if ($date){ - $information=array(); + if ($birthdate!=false||$birthuri!=false){ + $content.='<br/><hr><h4>Characteristics</h4><br/>'; + + if (isset($triples['http://dbpedia.org/property/birthname'])) $characteristics['Birthname']=$triples['http://dbpedia.org/property/birthname']; + if (isset($triples['http://dbpedia.org/property/birthPlace'])) $characteristics['Birthplace']=$triples['http://dbpedia.org/property/birthPlace']; + if (isset($triples['http://dbpedia.org/property/deathPlace'])) $characteristics['Deathplace']=$triples['http://dbpedia.org/property/deathPlace']; + if (isset($triples['http://dbpedia.org/property/spouse'])) $characteristics['Spouse']=$triples['http://dbpedia.org/property/spouse']; + if (isset($triples['http://dbpedia.org/property/shortDescription'])) $characteristics['Short Description']=$triples['http://dbpedia.org/property/shortDescription']; + if (isset($triples['http://dbpedia.org/property/alternativeNames'])) $characteristics['Alternative Names']=$triples['http://dbpedia.org/property/alternativeNames']; + $content.=createCharacteristics($characteristics); + unset($triples['http://dbpedia.org/property/birthname']); + unset($triples['http://dbpedia.org/property/birthPlace']); + unset($triples['http://dbpedia.org/property/deathPlace']); + unset($triples['http://dbpedia.org/property/spouse']); + unset($triples['http://dbpedia.org/property/shortDescription']); + unset($triples['http://dbpedia.org/property/alternativeNames']); + if ($birthdate!=false) unset($triples[$birthdate]); + if ($birthuri!=false) unset($triples[$birthuri]); + if ($deathdate!=false) unset($triples[$deathdate]); + if ($deathuri!=false) unset($triples[$deathuri]); } @@ -226,6 +263,9 @@ unset($triples['http://www.geonames.org/ontology#featureCode']); unset($triples['http://www.geonames.org/ontology#featureClass']); unset($triples['http://dbpedia.org/property/dmozProperty']); + unset($triples['http://dbpedia.org/property/color']); + unset($triples['http://dbpedia.org/property/imageCaption']); + unset($triples['http://dbpedia.org/property/name']); if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 10:44:04 UTC (rev 1240) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 10:46:20 UTC (rev 1241) @@ -225,21 +225,34 @@ $table = '<table border="0"><tr><td><b>Predicate</b></td><td><b>Object</b></td></tr>'; $i=1; foreach($triples as $predicate=>$object) { + $number=count($object); if ($i>0) $backgroundcolor="eee"; else $backgroundcolor="ffffff"; $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; - $table .= '<td><ul>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; foreach($object as $element) { if ($element['type']=="uri"){ if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ $label=str_replace('_',' ',substr($element['value'],28)); - $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a></li>'; + if ($number>1) $table.='<li>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; } - else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; + else{ + if ($number>1) $table.='<li>'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a>'; + if ($number>1) $table.='</li>'; + } } - else $table .= '<li>'.$element['value'].'</li>'; + else{ + if ($number>1) $table.='<li>'; + $table .= $element['value']; + if ($number>1) $table.='</li>'; + } } - $table .= '</ul></td>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; $i*=-1; } $table .= '</table>'; @@ -371,4 +384,46 @@ return $ret; } + +function createCharacteristics($char) +{ + $ret='<table border="0" style="padding:5px">'; + $i=0; + foreach ($char as $label=>$value){ + if ($i%2==0) + $ret.='<tr>'; + $ret.='<td style="width:20%;text-align:right"><b>'.$label.'</b>:</td><td style="width:30%;text-align:left">'; + $number=count($value); + if ($number>1) $ret.='<ul>'; + foreach ($value as $val){ + if ($val['type']=="uri"){ + if (strpos($val['value'],"http://dbpedia.org/resource/")===0&&substr_count($val['value'],"/")==4&&strpos($val['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($val['value'],28)); + if ($number>1) $ret.='<li>'; + $ret .= '<a href="#" onclick="get_article(\'label='.$val['value'].'&cache=-1\');return false;">'.urldecode($label).'</a>'; + if ($number>1) $ret.='</li>'; + } + else{ + if ($number>1) $ret.='<li>'; + $ret .= '<a href="'.$val['value'].'" target="_blank">'.urldecode($val['value']).'</a>'; + if ($number>1) $ret.='</li>'; + } + } + else{ + if ($number>1) $ret.='<li>'; + $ret .= $val['value']; + if ($number>1) $ret.='</li>'; + } + } + if ($number>1) $ret.='</ul>'; + $ret.='</td>'; + if ($i%2==1||$i==count($char)-1){ + $ret.='</tr>'; + $ret.='<tr><td colspan="4" style="height:10px"></td></tr>'; + } + $i++; + } + $ret.='</table>'; + return $ret; +} ?> \ 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: <sk...@us...> - 2008-09-23 10:44:08
|
Revision: 1240 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1240&view=rev Author: sknappe Date: 2008-09-23 10:44:04 +0000 (Tue, 23 Sep 2008) Log Message: ----------- changed it in that way, that for a named class "a" is used if it doesn't begin with a,e,i,o,u and "an" else Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java 2008-09-23 08:30:47 UTC (rev 1239) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java 2008-09-23 10:44:04 UTC (rev 1240) @@ -228,7 +228,9 @@ logger.trace("NamedClass"); SortedSet<String> label=tasks.queryAsSet("SELECT ?label WHERE {<"+description.getName()+"> <http://www.w3.org/2000/01/rdf-schema#label> ?label}", "label"); - query+="a "+label.first(); + String l=label.first(); + if (l.toLowerCase().startsWith("a")||l.toLowerCase().startsWith("e")||l.toLowerCase().startsWith("i")||l.toLowerCase().startsWith("o")||l.toLowerCase().startsWith("u")) query+="an "+l; + else query+="a "+l; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-23 08:30:58
|
Revision: 1239 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1239&view=rev Author: sknappe Date: 2008-09-23 08:30:47 +0000 (Tue, 23 Sep 2008) Log Message: ----------- some design changes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-22 17:17:49 UTC (rev 1238) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 08:30:47 UTC (rev 1239) @@ -81,11 +81,22 @@ $content.=', <img src="images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; } - $content.='<br/><hr><h4>Classes and Categories</h4><br/>'; + if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])){ + $content.='<br/><hr><h4>Same as</h4><br/>'; + $content.='<ul>'; + foreach ($triples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ + if ($same['type']=="uri") + $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; + else $content.= '<li>'.urldecode($same['value']).'</li>'; + } + $content.='</ul>'; + } + $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; + // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>Yago classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; //skos-subjects //not used, because one class systems, YAGO, is enough @@ -96,7 +107,8 @@ $content .= '</ul></p>'; }*/ - //not used at the moment + //references not used at the moment because some urls cause problems with + //the xml parser that recognizes html entities, where no entities are /*if(isset($triples['http://dbpedia.org/property/reference'])) { $content .= '<p>references: <ul>'; foreach($triples['http://dbpedia.org/property/reference'] as $reference) @@ -117,13 +129,35 @@ } //display only one birthdate - $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth"); + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthDate"); $date=false; foreach ($birthdates as $dates){ - if ($date) unset($triples[$dates]); - if (isset($triples[$dates])&&!$date) $date=true; + if ($date){ + unset($triples[$dates]); + continue; + } + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + else unset($triples[$dates]); } + //display only one deathdate + $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathDate"); + $date=false; + foreach ($deathdates as $dates){ + if ($date){ + unset($triples[$dates]); + continue; + } + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + else unset($triples[$dates]); + } + + //display a small characteristics of a person, if at least the birth date is given + if ($date){ + $information=array(); + } + + //display foreign wiki pages $languages=array('Deutsch'=>'http://dbpedia.org/property/wikipage-de' ,'Espa%C3%B1ol'=>'http://dbpedia.org/property/wikipage-es' @@ -153,6 +187,7 @@ // filter out uninteresting properties and properties which // have already been displayed + unset($triples['http://www.w3.org/2002/07/owl#sameAs']); unset($triples['http://xmlns.com/foaf/0.1/page']); unset($triples['http://xmlns.com/foaf/0.1/depiction']); unset($triples['http://dbpedia.org/property/abstract']); @@ -173,8 +208,25 @@ unset($triples['http://dbpedia.org/property/latDeg']); unset($triples['http://dbpedia.org/property/lonMin']); unset($triples['http://www.georss.org/georss/point']); + unset($triples['http://dbpedia.org/property/audioProperty']); + unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); + unset($triples['http://dbpedia.org/property/relatedInstance']); + unset($triples['http://dbpedia.org/property/boxWidth']); + unset($triples['http://dbpedia.org/property/pp']); + unset($triples['http://dbpedia.org/property/caption']); + unset($triples['http://dbpedia.org/property/s']); + unset($triples['http://dbpedia.org/property/lifetimeProperty']); + unset($triples['http://dbpedia.org/property/imagesize']); + unset($triples['http://dbpedia.org/property/id']); + unset($triples['http://dbpedia.org/property/issue']); + if ($triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); + if ($triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); + if ($triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); + if ($triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); + unset($triples['http://www.geonames.org/ontology#featureCode']); + unset($triples['http://www.geonames.org/ontology#featureClass']); + unset($triples['http://dbpedia.org/property/dmozProperty']); - if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-22 17:17:49 UTC (rev 1238) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 08:30:47 UTC (rev 1239) @@ -13,7 +13,7 @@ //add the uri $subject="http://dbpedia.org/resource/".$subject; - return $subject; + return urldecode($subject); } function getTagCloud($tags,$label) @@ -232,7 +232,7 @@ foreach($object as $element) { if ($element['type']=="uri"){ if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ - $label=substr($element['value'],28); + $label=str_replace('_',' ',substr($element['value'],28)); $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a></li>'; } else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; @@ -290,10 +290,12 @@ $string="<ul>"; for($i=0; $i<count($ar); $i++) { + $yagoPrefix = 'http://dbpedia.org/class/yago/'; + if(substr($ar[$i]['value'],0,30)!=$yagoPrefix) continue; $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person") $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; + $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; } return $string."</ul>"; } @@ -301,17 +303,7 @@ // format a class nicely, i.e. link to it and possibly display // it in a better way function formatClass($className,$label) { - $yagoPrefix = 'http://dbpedia.org/class/yago/'; - if(substr($className,0,30)==$yagoPrefix) { - return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; - // DBpedia is Linked Data, so it makes always sense to link it - // ToDo: instead of linking to other pages, the resource should better - // be openened within DBpedia Navigator - } else if(substr($className,0,14)=='http://dbpedia') { - return '<a href="'.$className.'" target="_blank">'.$className.'</a>'; - } else { - return $className; - } + return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; } function arrayToCommaSseparatedList($ar) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2008-09-22 17:17:59
|
Revision: 1238 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1238&view=rev Author: lorenz_b Date: 2008-09-22 17:17:49 +0000 (Mon, 22 Sep 2008) Log Message: ----------- improved performance of disjoint check Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-22 16:41:09 UTC (rev 1237) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-22 17:17:49 UTC (rev 1238) @@ -74,7 +74,7 @@ private Map<String, String> prefixes; /** - * constructor + * constructor. * * @param d * @param mode Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-22 16:41:09 UTC (rev 1237) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-22 17:17:49 UTC (rev 1238) @@ -532,6 +532,7 @@ * @return */ public Set<NamedClass> getComplements(Description desc, Individual ind){ +// System.out.println("----------------" + desc + "---------------"); Set<NamedClass> complements = new HashSet<NamedClass>(); for(NamedClass nc : owlReasoner.getAtomicConcepts()){ if(!(nc.toString().endsWith("Thing"))){ @@ -542,7 +543,7 @@ } } } - System.out.println(complements); +// System.out.println("Disjunkt sind: " + complements); return complements; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-22 16:41:09 UTC (rev 1237) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-22 17:17:49 UTC (rev 1238) @@ -488,8 +488,8 @@ //superclasses and class1 // Set<OWLDescription> superClasses1 = owlClass1.getSuperClasses(ontology); Set<OWLDescription> superClasses1 = new HashSet<OWLDescription>(); - for(Description d : rs.getMoreGeneralConcepts(desc1)){ - superClasses1.add(OWLAPIDescriptionConvertVisitor.getOWLDescription(d)); + for(Description d1 : rs.getMoreGeneralConcepts(desc1)){ + superClasses1.add(OWLAPIDescriptionConvertVisitor.getOWLDescription(d1)); } superClasses1.add(owlClass1); // System.out.println(desc1 + "::" + superClasses1); @@ -497,33 +497,54 @@ //superclasses and class2 // Set<OWLDescription> superClasses2 = owlClass2.getSuperClasses(ontology); Set<OWLDescription> superClasses2 = new HashSet<OWLDescription>(); - for(Description d : rs.getMoreGeneralConcepts(desc2)){ - superClasses2.add(OWLAPIDescriptionConvertVisitor.getOWLDescription(d)); + for(Description d2 : rs.getMoreGeneralConcepts(desc2)){ + superClasses2.add(OWLAPIDescriptionConvertVisitor.getOWLDescription(d2)); } superClasses2.add(owlClass2); - for(OWLAxiom ax : ontology.getAxioms()){ +// System.out.println("superklassen von " + desc2 + " sind: " + superClasses2); + for(OWLDescription o1 : superClasses1){ - for(OWLDescription o1 : superClasses1){ + OWLDescription negO1 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o1.toString()))); + for(OWLDescription o2 : superClasses2){ + + OWLDescription negO2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o2.toString()))); - OWLDescription negO1 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o1.toString()))); - for(OWLDescription o2 : superClasses2){ -// System.out.println(o1 + " " + o2); - OWLDescription negO2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o2.toString()))); -// System.out.println(factory.getOWLDisjointClassesAxiom(o1, o2)); - if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o1, o2).toString())){ - return true; - }else if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o2, o1).toString())){ - return true; - }else if(ax.toString().equals(factory.getOWLEquivalentClassesAxiom(o1, negO2).toString())){ - return true; - }else if(ax.toString().equals(factory.getOWLEquivalentClassesAxiom(o2, negO1).toString())){ - return true; - } + if(ontology.containsAxiom(factory.getOWLDisjointClassesAxiom(o1, o2))){ + return true; + }else if(ontology.containsAxiom(factory.getOWLDisjointClassesAxiom(o2, o1))){ + return true; + }else if(ontology.containsAxiom(factory.getOWLEquivalentClassesAxiom(o1, negO2))){ + return true; + }else if(ontology.containsAxiom(factory.getOWLEquivalentClassesAxiom(o2, negO1))){ + return true; } - } + } + +// for(OWLAxiom ax : ontology.getAxioms()){ +// +// for(OWLDescription o1 : superClasses1){ +// +// OWLDescription negO1 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o1.toString()))); +// for(OWLDescription o2 : superClasses2){ +// +// OWLDescription negO2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o2.toString()))); +// +// if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o1, o2).toString())){ +// return true; +// }else if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o2, o1).toString())){ +// return true; +// }else if(ax.toString().equals(factory.getOWLEquivalentClassesAxiom(o1, negO2).toString())){ +// return true; +// }else if(ax.toString().equals(factory.getOWLEquivalentClassesAxiom(o2, negO1).toString())){ +// return true; +// } +// } +// +// } +// } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2008-09-22 16:41:29
|
Revision: 1237 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1237&view=rev Author: lorenz_b Date: 2008-09-22 16:41:09 +0000 (Mon, 22 Sep 2008) Log Message: ----------- checkstyle Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/Main.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/Wizard.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardModel.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelNotFoundException.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -42,10 +42,10 @@ private static final long serialVersionUID = -934113184795465461L; /** - * Constructor - * @param label - * @param changes - * @param mL + * Constructor. + * @param label labelname + * @param changes ontology changes + * @param mL mouse listener */ public ChangePanel(String label, List<OWLOntologyChange> changes, MouseListener mL){ super(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -37,6 +37,9 @@ private static final long serialVersionUID = -7538532926820669891L; + /** + * Constructor. + */ public ChangesPanel(){ super(); setLayout(new GridLayout(0, 1)); @@ -48,7 +51,7 @@ /** * Refresh the actual panel. - * @param cont + * @param cont gui container for changes */ public void updatePanel(Container cont){ remove(cont); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -53,6 +53,9 @@ private JXBusyLabel loadingLabel; private JLabel statusLabel; + /** + * Constructor. + */ @SuppressWarnings("unchecked") public ClassPanelOWL() { @@ -102,25 +105,43 @@ return contentPanel1; } + /** + * Returns list model for owl-classes. + * @return the list model + */ public DefaultListModel getModel(){ return model; } - + /** + * Adds list selection listener to atomic classes list. + * @param l the default list selection listener + */ public void addSelectionListener(ListSelectionListener l){ conceptList.addListSelectionListener(l); } - + + /** + * Returns the list where atomic owl classes are the list elements. + * @return instance of JList + */ public JList getList(){ return conceptList; } - + /** + * Returns the label which reports the loading status. + * @return instance of JLabel + */ public JLabel getStatusLabel() { return statusLabel; } + /** + * Returns the animated label for loading action. + * @return instance of JXBusyLabel + */ public JXBusyLabel getLoadingLabel() { return loadingLabel; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -21,8 +21,8 @@ package org.dllearner.tools.ore; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; + import org.dllearner.core.owl.NamedClass; @@ -33,14 +33,23 @@ * @author Lorenz Buehmann * */ -public class ClassPanelOWLDescriptor extends WizardPanelDescriptor implements ListSelectionListener{ +public class ClassPanelOWLDescriptor extends WizardPanelDescriptor implements javax.swing.event.ListSelectionListener{ + /** + * Identification string for class choose panel. + */ public static final String IDENTIFIER = "CLASS_CHOOSE_OWL_PANEL"; - public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " + - "Select one of them which should be (re)learned from, then press \"Next-Button\""; + /** + * Information string for class choose panel. + */ + public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " + + "Select one of them which should be (re)learned from, then press \"Next-Button\""; private ClassPanelOWL owlClassPanel; + /** + * Constructor creates new panel and adds listener to list. + */ public ClassPanelOWLDescriptor() { owlClassPanel = new ClassPanelOWL(); owlClassPanel.addSelectionListener(this); @@ -66,12 +75,15 @@ setNextButtonAccordingToConceptSelected(); } - + /** + * Method is called when other element in list is selected, and sets next button enabled. + * @param e ListSelectionEvent + */ public void valueChanged(ListSelectionEvent e) { setNextButtonAccordingToConceptSelected(); - if (!e.getValueIsAdjusting()) - getWizardModel().getOre().setClassToLearn((NamedClass)owlClassPanel.getList().getSelectedValue()); - + if (!e.getValueIsAdjusting()) { + getWizardModel().getOre().setClassToLearn((NamedClass) owlClassPanel.getList().getSelectedValue()); + } } private void setNextButtonAccordingToConceptSelected() { @@ -83,7 +95,11 @@ } } - + + /** + * Returns the JPanel with the GUI elements. + * @return extended JPanel + */ public ClassPanelOWL getOwlClassPanel() { return owlClassPanel; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -56,15 +56,15 @@ statusLabel = new JLabel(); - loadingLabel = new JXBusyLabel(new Dimension(15,15)); + loadingLabel = new JXBusyLabel(new Dimension(15, 15)); BusyPainter painter = new BusyPainter( - new RoundRectangle2D.Float(0, 0,6.0f,2.6f,10.0f,10.0f), - new Ellipse2D.Float(2.0f,2.0f,11.0f,11.0f)); + new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f), + new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f)); painter.setTrailLength(2); painter.setPoints(7); painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15,15)); - loadingLabel.setIcon(new EmptyIcon(15,15)); + loadingLabel.setPreferredSize(new Dimension(15, 15)); + loadingLabel.setIcon(new EmptyIcon(15, 15)); loadingLabel.setBusyPainter(painter); @@ -74,7 +74,7 @@ contentPanel = getContentPanel(); setLayout(new java.awt.BorderLayout()); - add(contentPanel,BorderLayout.CENTER); + add(contentPanel, BorderLayout.CENTER); add(labelPanel, BorderLayout.SOUTH); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -48,11 +48,11 @@ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - if(value instanceof NamedClass) - setText(((NamedClass)value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - else if(value instanceof Individual) - setText(((Individual)value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - + if(value instanceof NamedClass){ + setText(((NamedClass) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + } else if(value instanceof Individual){ + setText(((Individual) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + } Color background; Color foreground; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -61,11 +61,11 @@ desc.setText(((EvaluatedDescription) value).getDescription().toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); //round accuracy to 2 digits double accuracy = ((EvaluatedDescription) value).getAccuracy(); - BigDecimal roundedAccuracy = new BigDecimal( accuracy * 100 ); - roundedAccuracy = roundedAccuracy.setScale( 2, BigDecimal.ROUND_HALF_UP ); + BigDecimal roundedAccuracy = new BigDecimal(accuracy * 100); + roundedAccuracy = roundedAccuracy.setScale(2, BigDecimal.ROUND_HALF_UP); cor.setText(roundedAccuracy.toString()); - add(cor,new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); - add(desc,new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); + add(cor, new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); + add(desc, new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); Color background; Color foreground; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -95,7 +95,7 @@ baseURI = ore.getBaseURI(); prefixes = ore.getPrefixes(); - setText(((Description)desc).toManchesterSyntaxString(ore.getBaseURI(),ore.getPrefixes())); + setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); menu = new JPopupMenu(); ToolTipManager.sharedInstance().setDismissDelay(7000); //negative example solutions @@ -103,22 +103,23 @@ if(!(desc instanceof Negation)){ if(desc instanceof NamedClass){ //1. description is a named class descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc) ); //1.a remove class assertion + menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); //1.a remove class assertion JMenu dme = new JMenu("move class assertion " + descriptionLabel + " to ..."); //1.b move individual for(NamedClass nc : ore.getpossibleClassesMoveTo(ind)){ - DescriptionMenuItem move = new DescriptionMenuItem(MOVE_TO_CLASS, nc.toManchesterSyntaxString(baseURI, prefixes), (NamedClass)desc); + DescriptionMenuItem move = new DescriptionMenuItem(MOVE_TO_CLASS, nc.toManchesterSyntaxString(baseURI, prefixes), (NamedClass) desc); move.setName(nc.toString()); dme.add(move); Set<NamedClass> complements = ore.getComplements(nc, ind); //check for complement error - if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(desc.toString())) ) ){ + if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(desc.toString())))){ move.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -126,27 +127,25 @@ } } menu.add(dme); - } - else if(desc instanceof ObjectSomeRestriction){ //2. description is a object some restriction - String propertyName = ((ObjectSomeRestriction)desc).getRole().toString(baseURI, prefixes); - String propertyRange = ((ObjectSomeRestriction)desc).getChild(0).toManchesterSyntaxString(baseURI, prefixes); + } else if(desc instanceof ObjectSomeRestriction){ //2. description is a object some restriction + String propertyName = ((ObjectSomeRestriction) desc).getRole().toString(baseURI, prefixes); + String propertyRange = ((ObjectSomeRestriction) desc).getChild(0).toManchesterSyntaxString(baseURI, prefixes); menu.add(new DescriptionMenuItem(DELETE_PROPERTY, propertyName , desc)); //2.a remove all property assertions - if (!(desc.getChild(0) instanceof Thing)) - menu.add(new DescriptionMenuItem(REMOVE_RANGE_PROPERTY,propertyRange , desc)); //2.b remove property assertions with objects in range - - } - else if(desc instanceof ObjectAllRestriction){ //3. description is a object all restriction + if (!(desc.getChild(0) instanceof Thing)){ + menu.add(new DescriptionMenuItem(REMOVE_RANGE_PROPERTY, propertyRange, desc)); //2.b remove property assertions with objects in range + } + } else if(desc instanceof ObjectAllRestriction){ //3. description is a object all restriction if (!(desc.getChild(0) instanceof Thing)) { JMenu dme = new JMenu("add property assertion " + ((ObjectAllRestriction) desc).getRole().toKBSyntaxString(baseURI, prefixes) //3.a add property assertion with object not in range + " with object ..."); - for (Individual i : ore.getIndividualsNotInPropertyRange((ObjectAllRestriction) desc, ind)) - dme.add(new DescriptionMenuItem(ADD_PROPERTY,i.toManchesterSyntaxString(baseURI, prefixes), desc)); - menu.add(dme); + for (Individual i : ore.getIndividualsNotInPropertyRange((ObjectAllRestriction) desc, ind)){ + dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); + } + menu.add(dme); } } - } - else if(desc instanceof Negation){ + } else if(desc instanceof Negation){ if(desc.getChild(0) instanceof NamedClass){ //4. description is a negated named class DescriptionMenuItem addItem = new DescriptionMenuItem(ADD_CLASS, desc.getChild(0).toManchesterSyntaxString(baseURI, prefixes), desc.getChild(0)); menu.add(addItem); //4.a add class assertion @@ -154,11 +153,12 @@ if(!complements.isEmpty()){ addItem.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -166,9 +166,7 @@ } } } - } - //positive example solutions - else if(mode.equals("pos")){ + } else if(mode.equals("pos")){//positive example solutions if(!(desc instanceof Negation)){ if(desc instanceof NamedClass){ DescriptionMenuItem add = new DescriptionMenuItem(ADD_CLASS, desc.toManchesterSyntaxString(baseURI, prefixes), desc); @@ -176,11 +174,12 @@ if(!(complements.isEmpty())){ add.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -192,18 +191,19 @@ if(moveClasses.size() > 0){ JMenu move = new JMenu("move to " + desc.toManchesterSyntaxString(baseURI, prefixes) + " from ..."); for (NamedClass m : moveClasses){System.out.println("hier" + m); - DescriptionMenuItem item = new DescriptionMenuItem(MOVE_FROM_CLASS,m.toManchesterSyntaxString(baseURI, prefixes), desc); + DescriptionMenuItem item = new DescriptionMenuItem(MOVE_FROM_CLASS, m.toManchesterSyntaxString(baseURI, prefixes), desc); item.setName(m.toString()); move.add(item); if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(m.toString())))){ move.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>moving class is not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>moving class is not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -215,31 +215,28 @@ } - } - else if(desc instanceof ObjectSomeRestriction){ + } else if(desc instanceof ObjectSomeRestriction){ JMenu dme = new JMenu("add property assertion " + ((ObjectSomeRestriction) desc).getRole() + " with object ..."); - for (Individual i : ore.getIndividualsInPropertyRange((ObjectSomeRestriction) desc, ind)) - dme.add(new DescriptionMenuItem(ADD_PROPERTY,i.toManchesterSyntaxString(baseURI, prefixes), desc)); - menu.add(dme); + for (Individual i : ore.getIndividualsInPropertyRange((ObjectSomeRestriction) desc, ind)){ + dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); + } + menu.add(dme); - } - else if(desc instanceof ObjectAllRestriction){ + } else if(desc instanceof ObjectAllRestriction){ if (!(desc.getChild(0) instanceof Thing)) { - menu.add(new DescriptionMenuItem(REMOVE_NOT_RANGE_PROPERTY,((ObjectAllRestriction) desc).getChild(0).toString(baseURI, prefixes), desc)); - menu.add(new DescriptionMenuItem(DELETE_PROPERTY,((ObjectAllRestriction) desc).getRole().toString(baseURI, prefixes), desc)); + menu.add(new DescriptionMenuItem(REMOVE_NOT_RANGE_PROPERTY, ((ObjectAllRestriction) desc).getChild(0).toString(baseURI, prefixes), desc)); + menu.add(new DescriptionMenuItem(DELETE_PROPERTY, ((ObjectAllRestriction) desc).getRole().toString(baseURI, prefixes), desc)); } } } - } - - else if(desc instanceof Negation){ + } else if(desc instanceof Negation){ if(desc.getChild(0) instanceof NamedClass){ descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc) ); + menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); } } } @@ -247,6 +244,7 @@ /** * returns actual description. + * @return desc Description */ public Description getDescription(){ return desc; @@ -254,15 +252,17 @@ /** * adds action listeners to menu items. - * @param aL + * @param aL ActionListener */ public void addActionListeners(ActionListener aL){ for(Component c : menu.getComponents()){ - if(c instanceof DescriptionMenuItem) - ((DescriptionMenuItem)c).addActionListener(aL); - else if(c instanceof JMenu) - for( int i = 0; i < ((JMenu)c).getItemCount(); i++) - ((JMenu)c).getItem(i).addActionListener(aL); + if(c instanceof DescriptionMenuItem){ + ((DescriptionMenuItem) c).addActionListener(aL); + } else if(c instanceof JMenu){ + for(int i = 0; i < ((JMenu) c).getItemCount(); i++){ + ((JMenu) c).getItem(i).addActionListener(aL); + } + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -41,22 +41,23 @@ public DescriptionMenuItem(int action, String text, Description d){ super(); - if(action == 3) + if(action == 3){ setText("remove class assertion to " + text); - else if(action == 0) + } else if(action == 0){ setText(text); - else if(action == 2) + } else if(action == 2){ setText("add class assertion to " + text); - else if(action == 4) + } else if(action == 4){ setText(text); - else if(action == 6) + } else if(action == 6){ setText("delete complete property " + text); - else if(action == 5) + }else if(action == 5){ setText("remove all property assertions to " + text); - else if(action == 7) + } else if(action == 7){ setText("remove all property assertions with range not in " + text); - else if(action == 1) + } else if(action == 1){ setText(text); + } this.desc = d; this.action = action; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -66,22 +66,21 @@ add(jL); if(jL instanceof DescriptionLabel){ - ((DescriptionLabel)jL).setIndOre(ore, ind); - ((DescriptionLabel)jL).init(); - ((DescriptionLabel)jL).addActionListeners(aL); + ((DescriptionLabel) jL).setIndOre(ore, ind); + ((DescriptionLabel) jL).init(); + ((DescriptionLabel) jL).addActionListeners(aL); } } - } - else if(mode.equals("pos")){ + } else if(mode.equals("pos")){ for(JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)){ add(jL); if(jL instanceof DescriptionLabel){ - ((DescriptionLabel)jL).setIndOre(ore, ind); - ((DescriptionLabel)jL).init(); - ((DescriptionLabel)jL).addActionListeners(aL); + ((DescriptionLabel) jL).setIndOre(ore, ind); + ((DescriptionLabel) jL).init(); + ((DescriptionLabel) jL).addActionListeners(aL); } @@ -93,10 +92,11 @@ * Updates the panel. */ public void updatePanel(){ - for(Component c : getComponents()) - if(c instanceof JLabel) + for(Component c : getComponents()){ + if(c instanceof JLabel){ remove(c); - + } + } ore.updateReasoner(); correct = true; if (mode.equals("neg")) { @@ -110,8 +110,7 @@ } } - } - else if(mode.equals("pos")){ + } else if(mode.equals("pos")){ for (JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)) { add(jL); if (jL instanceof DescriptionLabel) { Modified: trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -84,12 +84,12 @@ instructionsField.setEditable(false); instructionsField.setLineWrap(true); instructionsField.setRows(5); - instructionsField.setFont(new Font("Serif",Font.PLAIN,14)); - instructionsField.setText("This is an test of a wizard dialog, which allows a knowledge engineer to select " + - "a class of an ontology which should be (re)learned.\n" + - "On the next page, choose a OWL file or a SPARQL-URL, that contains an ontology. After that " + - "you might be able to select a class in the ontology to learn. When the class you selected is learned" + - ", you are able to add the axiom to the ontology and after all you might be able to repair if necessary. " ); + instructionsField.setFont(new Font("Serif", Font.PLAIN, 14)); + instructionsField.setText("This is an test of a wizard dialog, which allows a knowledge engineer to select " + + "a class of an ontology which should be (re)learned.\n" + + "On the next page, choose a OWL file or a SPARQL-URL, that contains an ontology. After that " + + "you might be able to select a class in the ontology to learn. When the class you selected is learned" + + ", you are able to add the axiom to the ontology and after all you might be able to repair if necessary. "); instructionsField.setWrapStyleWord(true); jScrollPane1.setViewportView(instructionsField); @@ -99,7 +99,7 @@ welcomeTitle.setText("Welcome to the DL-Learner ORE-Tool!"); contentPanel1.add(welcomeTitle, java.awt.BorderLayout.NORTH); - jPanel1.setLayout(new java.awt.GridLayout(0, 1,0,0)); + jPanel1.setLayout(new java.awt.GridLayout(0, 1, 0, 0)); jPanel1.add(jScrollPane1); contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -151,7 +151,7 @@ .addComponent(sparqlMessage)); - contentPanel1.setLayout(new GridLayout(0,1)); + contentPanel1.setLayout(new GridLayout(0, 1)); contentPanel1.add(buttonPanel); contentPanel1.add(owlPanel); contentPanel1.add(sparqlPanel); @@ -177,28 +177,33 @@ filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY); String choosenPath = fileURL.getText(); - if(!choosenPath.equals("") && (new File(choosenPath)).exists()) + if(!choosenPath.equals("") && (new File(choosenPath)).exists()){ filechooser.setCurrentDirectory(new File(fileURL.getText())); + } filechooser.addChoosableFileFilter(new FileFilter() { @Override public boolean accept(File f) { - if (f.isDirectory()) return true; + if(f.isDirectory()){ + return true; + } return f.getName().toLowerCase().endsWith(".owl"); } @Override - public String getDescription () { return "OWLs"; } + public String getDescription(){ + return "OWLs"; + } }); - int status = filechooser.showOpenDialog( null ); + int status = filechooser.showOpenDialog(null); - if ( status == JFileChooser.APPROVE_OPTION ){ + if (status == JFileChooser.APPROVE_OPTION){ String strURL = filechooser.getSelectedFile().getAbsolutePath(); fileURL.setText(strURL); - }else{ - System.out.println( "Auswahl abgebrochen" ); + } else{ + System.out.println("Auswahl abgebrochen"); } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -52,10 +52,11 @@ @Override public Object getNextPanelDescriptor() { - if(getWizard().getKnowledgeSourceType() == 0) + if(getWizard().getKnowledgeSourceType() == 0){ return ClassPanelOWLDescriptor.IDENTIFIER; - else + } else{ return ClassPanelSparqlDescriptor.IDENTIFIER; + } } @Override @@ -72,6 +73,7 @@ /** * Actions for buttons. + * @param e ActionListener */ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -86,15 +86,15 @@ JPanel statusPanel = new JPanel(); statusLabel = new JLabel(); - loadingLabel = new JXBusyLabel(new Dimension(15,15)); + loadingLabel = new JXBusyLabel(new Dimension(15, 15)); BusyPainter<Object> painter = new BusyPainter<Object>( - new RoundRectangle2D.Float(0, 0,6.0f,2.6f,10.0f,10.0f), - new Ellipse2D.Float(2.0f,2.0f,11.0f,11.0f)); + new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f), + new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f)); painter.setTrailLength(2); painter.setPoints(7); painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15,15)); - loadingLabel.setIcon(new EmptyIcon(15,15)); + loadingLabel.setPreferredSize(new Dimension(15, 15)); + loadingLabel.setIcon(new EmptyIcon(15, 15)); loadingLabel.setBusyPainter(painter); statusPanel.add(loadingLabel); statusPanel.add(statusLabel); @@ -102,7 +102,7 @@ contentPanel = getContentPanel(); setLayout(new java.awt.BorderLayout()); - add(contentPanel,BorderLayout.CENTER); + add(contentPanel, BorderLayout.CENTER); add(statusPanel, BorderLayout.SOUTH); { buttonSliderPanel = new JPanel(); @@ -145,10 +145,10 @@ noiseSlider.setMajorTickSpacing(10); noiseSlider.setMinorTickSpacing(5); Dictionary<Integer, JLabel> map = new Hashtable<Integer, JLabel>(); - map.put( new Integer(0), new JLabel("0%") ); - map.put( new Integer(50), new JLabel("50%") ); - map.put( new Integer(100),new JLabel("100%") ); - noiseSlider.setLabelTable( map ); + map.put(new Integer(0), new JLabel("0%")); + map.put(new Integer(50), new JLabel("50%")); + map.put(new Integer(100), new JLabel("100%")); + noiseSlider.setLabelTable(map); noiseSlider.setPaintLabels(true); noisePanel.add(noiseSlider); } @@ -162,7 +162,7 @@ listPanel = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.0, 0.5}; - jPanel1Layout.rowHeights = new int[] {16,400}; + jPanel1Layout.rowHeights = new int[] {16, 400}; jPanel1Layout.columnWeights = new double[] {0.0, 0.5}; jPanel1Layout.columnWidths = new int[] {50, 700}; listPanel.setLayout(jPanel1Layout); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -46,8 +46,8 @@ public class LearningPanelDescriptor extends WizardPanelDescriptor implements ActionListener, ListSelectionListener{ public static final String IDENTIFIER = "LEARNING_PANEL"; - public static final String INFORMATION = "In this panel you can start the learning algorithm. While it ist running, " + - "temporary results are shown in the list above. Select one of them and press Next"; + public static final String INFORMATION = "In this panel you can start the learning algorithm. While it ist running, " + + "temporary results are shown in the list above. Select one of them and press Next"; private LearningPanel learnPanel; private LearnSwingWorker worker; @@ -105,6 +105,7 @@ /** * Actions for pressing start- or stop-button. + * @param event */ public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("Start")){ @@ -113,8 +114,7 @@ learnPanel.getStopButton().setEnabled(true); worker = new LearnSwingWorker(); worker.execute(); - } - else{ + } else{ learnPanel.getStopButton().setEnabled(false); la.stop(); @@ -177,7 +177,7 @@ */ class LearnSwingWorker extends SwingWorker<List<EvaluatedDescription>, List<EvaluatedDescription>> { - Thread t; + private Thread t; @SuppressWarnings("unchecked") @Override @@ -255,7 +255,7 @@ } } - void updateList(final List<EvaluatedDescription> result) { + private void updateList(final List<EvaluatedDescription> result) { Runnable doUpdateList = new Runnable() { @@ -275,9 +275,7 @@ SwingUtilities.invokeLater(doUpdateList); } - + - - } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -38,13 +38,17 @@ private static final long serialVersionUID = -1205252523136710091L; private JLabel[] jLabel; + /** + * Constructor instantiating JLabels with wizard step names. + * @param i step number printed bold + */ public LeftPanel(int i){ jLabel = new JLabel[6]; setBackground(new java.awt.Color(255, 255, 255)); JPanel panel2 = new JPanel(); panel2.setBackground(new java.awt.Color(255, 255, 255)); - panel2.setLayout(new GridLayout(5,1,0,10)); + panel2.setLayout(new GridLayout(5, 1, 0, 10)); jLabel[0] = new JLabel("1. Introduction"); jLabel[1] = new JLabel("2. Knowledge Source"); jLabel[2] = new JLabel("3. Choose Class"); @@ -53,10 +57,11 @@ jLabel[5] = new JLabel("6. Save/Exit"); jLabel[i].setFont(jLabel[i].getFont().deriveFont(Font.BOLD)); - for(JLabel current : jLabel) - panel2.add(current); + for(JLabel current : jLabel){ + panel2.add(current); + } setLayout(new BorderLayout()); - setPreferredSize(new Dimension(140,500)); + setPreferredSize(new Dimension(140, 500)); add(panel2, BorderLayout.NORTH); } @@ -71,7 +76,7 @@ setBackground(new java.awt.Color(255, 255, 255)); JPanel panel2 = new JPanel(); panel2.setBackground(new java.awt.Color(255, 255, 255)); - panel2.setLayout(new GridLayout(6,1,0,10)); + panel2.setLayout(new GridLayout(6, 1, 0, 10)); jLabel[0] = new JLabel("1. Introduction"); jLabel[1] = new JLabel("2. Knowledge Source"); jLabel[2] = new JLabel("3. Choose Class"); @@ -81,8 +86,9 @@ jLabel[i].setFont(jLabel[i].getFont().deriveFont(Font.BOLD)); - for(JLabel current : jLabel) - panel2.add(current); + for(JLabel current : jLabel){ + panel2.add(current); + } setLayout(new BorderLayout()); add(panel2, BorderLayout.NORTH); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/Main.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/Main.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/Main.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -80,10 +80,10 @@ WizardPanelDescriptor descriptor7 = new SavePanelDescriptor(); wizard.registerWizardPanel(SavePanelDescriptor.IDENTIFIER, descriptor7); - if ( !(args.length == 1)){ + if (!(args.length == 1)){ wizard.setCurrentPanel(IntroductionPanelDescriptor.IDENTIFIER); - }else{ - ((KnowledgeSourcePanelDescriptor)descriptor2).getPanel().setFileURL(args[0]); + } else{ + ((KnowledgeSourcePanelDescriptor) descriptor2).getPanel().setFileURL(args[0]); wizard.setCurrentPanel(KnowledgeSourcePanelDescriptor.IDENTIFIER); wizard.setLeftPanel(1); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -281,7 +281,7 @@ /** - * retrieves description parts that might cause inconsistency - for negative examples only + * Retrieves description parts that might cause inconsistency - for negative examples only. * @param ind * @param desc * @return @@ -296,18 +296,19 @@ if(children.size() >= 2){ if(desc instanceof Intersection){ - for(Description d: children) + for(Description d: children){ criticals.addAll(getNegCriticalDescriptions(ind, d)); - - } - else if(desc instanceof Union){ - for(Description d: children) - if(owlReasoner.instanceCheck(d, ind)) + } + } else if(desc instanceof Union){ + for(Description d: children){ + if(owlReasoner.instanceCheck(d, ind)){ criticals.addAll(getNegCriticalDescriptions(ind, d)); + } + } } - } - else + } else{ criticals.add(desc); + } } return criticals; @@ -337,36 +338,32 @@ } criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(children.size()-1))); criticals.add(new JLabel(")")); - } - else if(desc instanceof Union){ + } else if(desc instanceof Union){ criticals.add(new JLabel("(")); for(int i = 0; i<children.size()-1; i++){ if(fastReasoner.instanceCheck(desc.getChild(i), ind)){ criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(i))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel("or")); } if(fastReasoner.instanceCheck(desc.getChild(children.size()-1), ind)){ criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(children.size()-1))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel(")")); } - } - else{ + } else{ criticals.add(new DescriptionLabel(desc, "neg")); } - } - else + } else{ criticals.add(new JLabel(desc.toManchesterSyntaxString(baseURI, prefixes))); + } } catch (ReasoningMethodUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -399,36 +396,29 @@ } criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); criticals.add(new JLabel(")")); - } - else if(desc instanceof Intersection){ + } else if(desc instanceof Intersection){ criticals.add(new JLabel("(")); for(int i = 0; i<children.size()-1; i++){ if(!fastReasoner.instanceCheck(desc.getChild(i), ind)){ criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(i))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel("and")); } if(!fastReasoner.instanceCheck(desc.getChild(children.size()-1), ind)){ criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel(")")); - - } - } - else{ - + } else{ criticals.add(new DescriptionLabel(desc, "pos")); } - } - else + } else{ criticals.add(new JLabel(desc.toManchesterSyntaxString(baseURI, prefixes))); + } } catch (ReasoningMethodUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -523,7 +513,7 @@ // TODO Auto-generated catch block e.printStackTrace(); } - owlReasoner = cm.reasoner(OWLAPIReasoner.class,new OWLAPIOntology(modifier.getOntology())); + owlReasoner = cm.reasoner(OWLAPIReasoner.class, new OWLAPIOntology(modifier.getOntology())); try { owlReasoner.init(); @@ -552,6 +542,7 @@ } } } + System.out.println(complements); return complements; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -189,7 +189,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLEntityRemover remover = new OWLEntityRemover(manager, Collections.singleton(ontology)); @@ -219,7 +219,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLDescription owlDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc); OWLClassAssertionAxiom owlCl = factory.getOWLClassAssertionAxiom(individualOWLAPI, owlDesc); @@ -249,7 +249,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLDescription owlDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc); OWLClassAssertionAxiom owlCl = factory.getOWLClassAssertionAxiom(individualOWLAPI, owlDesc); @@ -283,7 +283,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); //Loeschen OWLDescription oldDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(oldClass); @@ -300,7 +300,8 @@ try { - manager.applyChanges(changes);saveOntology(); + manager.applyChanges(changes); + saveOntology(); return changes; } catch (OWLOntologyChangeException e) { @@ -322,7 +323,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLObjectProperty propertyOWLAPI = factory.getOWLObjectProperty(URI.create(objSome.getRole().getName())); Set<OWLObjectPropertyAssertionAxiom> properties = ontology.getObjectPropertyAssertionAxioms(individualOWLAPI); @@ -333,8 +334,7 @@ for(OWLInverseObjectPropertiesAxiom inv : invProperties){ if(propertyOWLAPI.equals(inv.getSecondProperty())){ invProperty = inv.getFirstProperty(); - } - else{ + } else{ invProperty = inv.getSecondProperty(); } } @@ -343,7 +343,7 @@ List<RemoveAxiom> removeList = new LinkedList<RemoveAxiom>(); for(OWLObjectPropertyAssertionAxiom o :properties){ - if( (o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(individualOWLAPI))){ + if((o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(individualOWLAPI))){ removeList.add(new RemoveAxiom(ontology, o)); } if(invProperty != null){ @@ -382,16 +382,19 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual subjectOWLAPI = factory.getOWLIndividual( URI.create(subject.getName())); - OWLIndividual objectOWLAPI = factory.getOWLIndividual( URI.create(object.getName())); + OWLIndividual subjectOWLAPI = factory.getOWLIndividual(URI.create(subject.getName())); + OWLIndividual objectOWLAPI = factory.getOWLIndividual(URI.create(object.getName())); OWLObjectProperty propertyOWLAPI = factory.getOWLObjectProperty(URI.create(objSome.getRole().getName())); Set<OWLObjectPropertyAssertionAxiom> properties = ontology.getObjectPropertyAssertionAxioms(subjectOWLAPI); RemoveAxiom remove = null; - for(OWLObjectPropertyAssertionAxiom o :properties) - if( (o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(subjectOWLAPI)) && (o.getObject().equals(objectOWLAPI))) + for(OWLObjectPropertyAssertionAxiom o :properties){ + if((o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(subjectOWLAPI)) && (o.getObject().equals(objectOWLAPI))){ remove = new RemoveAxiom(ontology, o); + } + } + changes.add(remove); @@ -422,8 +425,8 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual subjectOWLAPI = factory.getOWLIndividual( URI.create(subInd.getName())); - OWLIndividual objectOWLAPI = factory.getOWLIndividual( URI.create(objInd.getName())); + OWLIndividual subjectOWLAPI = factory.getOWLIndividual(URI.create(subInd.getName())); + OWLIndividual objectOWLAPI = factory.getOWLIndividual(URI.create(objInd.getName())); OWLObjectProperty propertyOWLAPI = factory.getOWLObjectProperty(URI.create(objSome.getRole().getName())); OWLObjectPropertyAssertionAxiom objAssertion = factory.getOWLObjectPropertyAssertionAxiom(subjectOWLAPI, propertyOWLAPI, objectOWLAPI); @@ -443,7 +446,7 @@ /** - * undo changes of type {@link OWLOntologyChange} + * undo changes of type {@link OWLOntologyChange}. * @param changes */ public void undoChanges(Collection<OWLOntologyChange> changes){ @@ -457,8 +460,7 @@ } catch (OWLOntologyChangeException e) { e.printStackTrace(); } - } - else if(change instanceof AddAxiom){ + } else if(change instanceof AddAxiom){ RemoveAxiom remove = new RemoveAxiom(ontology, change.getAxiom()); try { manager.applyChange(remove); @@ -508,7 +510,7 @@ for(OWLDescription o2 : superClasses2){ // System.out.println(o1 + " " + o2); OWLDescription negO2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o2.toString()))); - System.out.println(factory.getOWLDisjointClassesAxiom(o1, o2)); +// System.out.println(factory.getOWLDisjointClassesAxiom(o1, o2)); if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o1, o2).toString())){ return true; }else if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o2, o1).toString())){ @@ -530,7 +532,7 @@ } /** - * returns object properties for an individual + * Returns object properties for an individual. * @param ind * @return */ @@ -549,7 +551,7 @@ } /** - * returns the actual ontology + * Returns the actual ontology. * @return ontology */ public OWLOntology getOntology() { @@ -558,7 +560,7 @@ /** - * prints reasons for inconsistent classes + * Prints reasons for inconsistent classes. */ public void reason(){ // reasoner.getInconsistencyReasons(ontology); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -76,8 +76,8 @@ private StatsPanel statsPanel; private DescriptionPanel descPanel; - private JPanel ok_cancelPanel; - private JPanel action_stats_Panel; + private JPanel okCancelPanel; + private JPanel actionStatsPanel; private ChangesPanel changesPanel; private JScrollPane changesScroll; @@ -103,7 +103,7 @@ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { - if(allChanges.size() > 0 ){ + if(allChanges.size() > 0){ if (JOptionPane.showConfirmDialog(dialogd, "All changes will be lost!", "Warning!", JOptionPane.YES_NO_OPTION) @@ -116,8 +116,7 @@ setVisible(false); dispose(); } - } - else{ + } else{ returncode = CANCEL_RETURN_CODE; setVisible(false); dispose(); @@ -143,10 +142,11 @@ public int showDialog(){ baseURI = ore.getBaseURI(); prefixes = ore.getPrefixes(); - if(mode.equals("neg")) + if(mode.equals("neg")){ this.setTitle("Repair negative example"); - else if(mode.equals("pos")) + } else if(mode.equals("pos")){ this.setTitle("Repair positive example"); + } this.setSize(700, 700); this.setLayout(new BorderLayout()); @@ -164,43 +164,43 @@ changesScroll = new JScrollPane(); changesScroll.setViewportView(changesPanel); - action_stats_Panel = new JPanel(); + actionStatsPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); gbl.rowWeights = new double[] {0.0, 0.1, 0.1}; gbl.rowHeights = new int[] {64, 7, 7}; gbl.columnWeights = new double[] {0.1}; gbl.columnWidths = new int[] {7}; - action_stats_Panel.setLayout(gbl); + actionStatsPanel.setLayout(gbl); - action_stats_Panel.add(descScroll, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); - action_stats_Panel.add(statsScroll, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); - action_stats_Panel.add(changesScroll, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); + actionStatsPanel.add(descScroll, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + actionStatsPanel.add(statsScroll, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); + actionStatsPanel.add(changesScroll, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); JSeparator separator = new JSeparator(); Box buttonBox = new Box(BoxLayout.X_AXIS); - ok_cancelPanel = new JPanel(); - ok_cancelPanel.setLayout(new BorderLayout()); - ok_cancelPanel.add(separator, BorderLayout.NORTH); + okCancelPanel = new JPanel(); + okCancelPanel.setLayout(new BorderLayout()); + okCancelPanel.add(separator, BorderLayout.NORTH); okButton = new JButton("Ok"); okButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); - getContentPane().add(action_stats_Panel, java.awt.BorderLayout.CENTER); + getContentPane().add(actionStatsPanel, java.awt.BorderLayout.CENTER); buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10))); buttonBox.add(okButton); buttonBox.add(Box.createHorizontalStrut(10)); buttonBox.add(cancelButton); - ok_cancelPanel.add(buttonBox, BorderLayout.EAST); + okCancelPanel.add(buttonBox, BorderLayout.EAST); - getContentPane().add(ok_cancelPanel, BorderLayout.SOUTH); + getContentPane().add(okCancelPanel, BorderLayout.SOUTH); this.setModal(true); @@ -216,24 +216,23 @@ public void actionPerformed(ActionEvent e) { if(e.getSource() instanceof DescriptionMenuItem){ - DescriptionMenuItem item =(DescriptionMenuItem)e.getSource(); + DescriptionMenuItem item =(DescriptionMenuItem) e.getSource(); actualDesc = item.getDescription(); int action = item.getActionID(); if(action == 4){ Individual obj = new Individual(e.getActionCommand()); - List<OWLOntologyChange> changes = modifier.addObjectProperty(ind, (ObjectQuantorRestriction)actualDesc, obj); + List<OWLOntologyChange> changes = modifier.addObjectProperty(ind, (ObjectQuantorRestriction) actualDesc, obj); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("added property assertion " + ((ObjectQuantorRestriction)actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + changesPanel.add(new ChangePanel("added property assertion " + ((ObjectQuantorRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + " to " + obj.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 5){ - ObjectQuantorRestriction property = (ObjectQuantorRestriction)actualDesc; + } else if(action == 5){ + ObjectQuantorRestriction property = (ObjectQuantorRestriction) actualDesc; List<OWLOntologyChange> changes = null; for(Individual i : ore.getIndividualsInPropertyRange(property, ind)){ changes = modifier.removeObjectPropertyAssertion(ind, property, i); @@ -242,47 +241,42 @@ descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("removed property assertions " + - ((ObjectSomeRestriction)actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + - " to range " + ((ObjectSomeRestriction)actualDesc).getChild(0).toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("removed property assertions " + + ((ObjectSomeRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + + " to range " + ((ObjectSomeRestriction) actualDesc).getChild(0).toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 6){ - List<OWLOntologyChange> changes = modifier.deleteObjectProperty(ind, (ObjectQuantorRestriction)actualDesc); + } else if(action == 6){ + List<OWLOntologyChange> changes = modifier.deleteObjectProperty(ind, (ObjectQuantorRestriction) actualDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("deleted property " + ((ObjectQuantorRestriction)actualDesc).getRole().toKBSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("deleted property " + ((ObjectQuantorRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 0){ + } else if(action == 0){ newDesc = new NamedClass(item.getName()); List<OWLOntologyChange> changes = modifier.moveIndividual(ind, actualDesc, newDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("moved class assertion from " + actualDesc.toManchesterSyntaxString(baseURI, prefixes) + - " to " + newDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("moved class assertion from " + actualDesc.toManchesterSyntaxString(baseURI, prefixes) + + " to " + newDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 3){ + } else if(action == 3){ List<OWLOntologyChange> changes = modifier.removeClassAssertion(ind, actualDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); changesPanel.add(new ChangePanel("removed class assertion to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 2){ + } else if(action == 2){ List<OWLOntologyChange> changes = modifier.addClassAssertion(ind, actualDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); changesPanel.add(new ChangePanel("added class assertion to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 7){ - ObjectQuantorRestriction property = (ObjectQuantorRestriction)actualDesc; + } else if(action == 7){ + ObjectQuantorRestriction property = (ObjectQuantorRestriction) actualDesc; List<OWLOntologyChange> changes = null; for(Individual i : ore.getIndividualsNotInPropertyRange(property, ind)){ changes = modifier.removeObjectPropertyAssertion(ind, property, i); @@ -292,39 +286,30 @@ descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("removed property assertion " + property.getRole().toKBSyntaxString(baseURI, prefixes) + - " to " + ind.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("removed property assertion " + property.getRole().toKBSyntaxString(baseURI, prefixes) + + " to " + ind.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 1){ + } else if(action == 1){ Description oldDesc = new NamedClass(item.getName()); List<OWLO... [truncated message content] |
From: <jen...@us...> - 2008-09-22 14:51:04
|
Revision: 1236 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1236&view=rev Author: jenslehmann Date: 2008-09-22 14:50:35 +0000 (Mon, 22 Sep 2008) Log Message: ----------- - code improvements - string options with a fixed set of possible values now shown as combo boxes in GUI 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/configurators/BruteForceLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.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/OWLAPIOntologyConfigurator.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/PosNegDefinitionLPStrictConfigurator.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/PosOnlyInclusionLPConfigurator.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/SimpleSuggestionLearningAlgorithmConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java Modified: trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Jens Lehmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -21,27 +21,27 @@ /** + * A configuration option representing a boolean value. + * * @author Jens Lehmann * */ 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) { + super(name, description); } - + 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, 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/core/config/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -102,10 +102,18 @@ this.requiresInit = requiresInit; } + /** + * + * @return The name of this option. + */ public String getName() { return name; } + /** + * + * @return The textual description of this option. + */ public String getDescription() { return description; } @@ -125,16 +133,20 @@ } /** - * says, if this option is mandatory for the component - * @return + * Specifies whether this option is mandatory for the component. + * (Mandatory means that this component cannot be initialised + * without setting a value for this option.) + * @return True if option is mandatory for component, false otherwise. */ public boolean isMandatory() { return mandatory; } /** - * says, if this option requires that the componnent is reinitialized with init() - * @return + * Specifies whether setting this option requires that the + * component or any components depending on this component + * need to be (re-)initialised. + * @return True if option requires init, false otherwise. */ public boolean requiresInit() { return requiresInit; @@ -161,6 +173,13 @@ */ public abstract boolean checkType(Object object); + /** + * Checks whether the value is valid, e.g. passing 1985 as + * integer value for an option, which requires values between + * 0 and 1, is not valid. + * @param value A value for the option. + * @return True if the value is valid and false otherwise. + */ public abstract boolean isValidValue(T value); public abstract String getValueTypeAsJavaString(); Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; @@ -42,7 +42,6 @@ import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.learningproblems.PosOnlyInclusionLP; -import org.dllearner.learningproblems.RoleLearning; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -57,11 +56,10 @@ private 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) { -return KBFileConfigurator.getKBFile(filename); +public static KBFile getKBFile() { +return KBFileConfigurator.getKBFile(); } /** @@ -169,16 +167,6 @@ } /** -* @param positiveExamples positive examples -* @param negativeExamples negative examples -* @param reasoningService see ReasoningService -* @return a component ready for initialization RoleLearning -**/ -public static RoleLearning getRoleLearning(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { -return RoleLearningConfigurator.getRoleLearning(reasoningService, positiveExamples, negativeExamples); -} - -/** * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see Modified: trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; @@ -294,6 +294,15 @@ public String getStartClass() { return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "startClass") ; } +/** +* forceRefinementLengthIncrease specifies whether nodes should be expanded until only longer refinements are reached. +* mandatory: false| reinit necessary: true +* default value: null +* @return boolean +**/ +public boolean getForceRefinementLengthIncrease() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "forceRefinementLengthIncrease") ; +} /** * @param writeSearchTree specifies whether to write a search tree. @@ -529,6 +538,15 @@ ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "startClass", startClass); reinitNecessary = true; } +/** +* @param forceRefinementLengthIncrease specifies whether nodes should be expanded until only longer refinements are reached. +* mandatory: false| reinit necessary: true +* default value: null +**/ +public void setForceRefinementLengthIncrease(boolean forceRefinementLengthIncrease) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "forceRefinementLengthIncrease", forceRefinementLengthIncrease); +reinitNecessary = true; +} /** * true, if this component needs reinitializsation. Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; @@ -277,6 +277,15 @@ return (Integer) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "guaranteeXgoodDescriptions") ; } /** +* maxClassDescriptionTests The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.). +* mandatory: false| reinit necessary: true +* default value: 0 +* @return int +**/ +public int getMaxClassDescriptionTests() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "maxClassDescriptionTests") ; +} +/** * logLevel determines the logLevel for this component, can be {TRACE, DEBUG, INFO}. * mandatory: false| reinit necessary: true * default value: DEBUG @@ -321,6 +330,15 @@ public String getStartClass() { return (String) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "startClass") ; } +/** +* forceRefinementLengthIncrease specifies whether nodes should be expanded until only longer refinements are reached. +* mandatory: false| reinit necessary: true +* default value: null +* @return boolean +**/ +public boolean getForceRefinementLengthIncrease() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "forceRefinementLengthIncrease") ; +} /** * @param writeSearchTree specifies whether to write a search tree. @@ -539,6 +557,15 @@ reinitNecessary = true; } /** +* @param maxClassDescriptionTests The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.). +* mandatory: false| reinit necessary: true +* default value: 0 +**/ +public void setMaxClassDescriptionTests(int maxClassDescriptionTests) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "maxClassDescriptionTests", maxClassDescriptionTests); +reinitNecessary = true; +} +/** * @param logLevel determines the logLevel for this component, can be {TRACE, DEBUG, INFO}. * mandatory: false| reinit necessary: true * default value: DEBUG @@ -583,6 +610,15 @@ ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "startClass", startClass); reinitNecessary = true; } +/** +* @param forceRefinementLengthIncrease specifies whether nodes should be expanded until only longer refinements are reached. +* mandatory: false| reinit necessary: true +* default value: null +**/ +public void setForceRefinementLengthIncrease(boolean forceRefinementLengthIncrease) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "forceRefinementLengthIncrease", forceRefinementLengthIncrease); +reinitNecessary = true; +} /** * true, if this component needs reinitializsation. Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; @@ -61,6 +61,15 @@ public String getReasonerType() { return (String) ComponentManager.getInstance().getConfigOptionValue(fastInstanceChecker, "reasonerType") ; } +/** +* defaultNegation Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.. +* mandatory: false| reinit necessary: true +* default value: true +* @return boolean +**/ +public boolean getDefaultNegation() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fastInstanceChecker, "defaultNegation") ; +} /** * @param reasonerType FaCT++ or Pellet to dematerialize. @@ -71,6 +80,15 @@ ComponentManager.getInstance().applyConfigEntry(fastInstanceChecker, "reasonerType", reasonerType); reinitNecessary = true; } +/** +* @param defaultNegation Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.. +* mandatory: false| reinit necessary: true +* default value: true +**/ +public void setDefaultNegation(boolean defaultNegation) { +ComponentManager.getInstance().applyConfigEntry(fastInstanceChecker, "defaultNegation", defaultNegation); +reinitNecessary = true; +} /** * true, if this component needs reinitializsation. Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; @@ -43,25 +43,14 @@ } /** -* @param filename pointer to the KB file on local file system * @return KBFile **/ -public static KBFile getKBFile(String filename) { +public static KBFile getKBFile() { KBFile component = ComponentManager.getInstance().knowledgeSource(KBFile.class); -ComponentManager.getInstance().applyConfigEntry(component, "filename", filename); return component; } /** -* filename pointer to the KB file on local file system. -* mandatory: true| reinit necessary: true -* default value: null -* @return String -**/ -public String getFilename() { -return (String) ComponentManager.getInstance().getConfigOptionValue(kBFile, "filename") ; -} -/** * url URL pointer to the KB file. * mandatory: false| reinit necessary: true * default value: null @@ -72,15 +61,6 @@ } /** -* @param filename pointer to the KB file on local file system. -* mandatory: true| reinit necessary: true -* default value: null -**/ -public void setFilename(String filename) { -ComponentManager.getInstance().applyConfigEntry(kBFile, "filename", filename); -reinitNecessary = true; -} -/** * @param url URL pointer to the KB file. * mandatory: false| reinit necessary: true * default value: null Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -23,6 +23,7 @@ import java.awt.event.ActionListener; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JTextField; import org.dllearner.core.Component; @@ -45,6 +46,7 @@ private String value; private JTextField stringField; + private JComboBox comboBox; /** * Provides a widget for string options. @@ -62,6 +64,9 @@ // fire value changed event value = stringField.getText(); fireValueChanged(value); + } else if(e.getSource() == comboBox) { + value = (String) comboBox.getSelectedItem(); + fireValueChanged(value); } } @@ -76,18 +81,30 @@ value = ""; } - // text field for strings - stringField = new JTextField(35); - stringField.setText(value); - stringField.setToolTipText(configOption.getAllowedValuesDescription()); - - // set button (value is only updated when this button is pressed => - // would better without set) - setButton = new JButton("Set"); - setButton.addActionListener(this); - - add(stringField); - add(setButton); + StringConfigOption option = (StringConfigOption) configOption; + if(option.getAllowedValues().size() == 0) { + + // text field for strings + stringField = new JTextField(35); + stringField.setText(value); + stringField.setToolTipText(configOption.getAllowedValuesDescription()); + + // set button (value is only updated when this button is pressed => + // would better without set) + setButton = new JButton("Set"); + setButton.addActionListener(this); + + add(stringField); + add(setButton); + + // if there is a fixed set of strings available as options, we + // only offer those + } else { + comboBox = new JComboBox(option.getAllowedValues().toArray()); + comboBox.setSelectedItem(option.getDefaultValue()); + comboBox.addActionListener(this); + add(comboBox); + } } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-22 08:04:33 UTC (rev 1235) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-22 14:50:35 UTC (rev 1236) @@ -35,6 +35,7 @@ import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningMethodUnsupportedException; +import org.dllearner.core.config.BooleanConfigOption; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; @@ -89,14 +90,15 @@ private static Logger logger = Logger.getLogger(FastInstanceChecker.class); - private boolean defaultNegation = true; - +// private boolean defaultNegation = true; + private FastInstanceCheckerConfigurator configurator; + @Override - public FastInstanceCheckerConfigurator getConfigurator (){ + public FastInstanceCheckerConfigurator getConfigurator() { return configurator; } - + private Set<NamedClass> atomicConcepts; private Set<ObjectProperty> atomicRoles; private SortedSet<DatatypeProperty> datatypeProperties; @@ -105,7 +107,7 @@ private SortedSet<DatatypeProperty> intDatatypeProperties = new TreeSet<DatatypeProperty>(); private SortedSet<Individual> individuals; -// private ReasoningService rs; + // private ReasoningService rs; private OWLAPIReasoner rc; // we use sorted sets (map indices) here, because they have only log(n) @@ -125,22 +127,30 @@ private Map<DatatypeProperty, Map<Individual, SortedSet<Double>>> dd = new TreeMap<DatatypeProperty, Map<Individual, SortedSet<Double>>>(); private Map<DatatypeProperty, Map<Individual, SortedSet<Integer>>> id = new TreeMap<DatatypeProperty, Map<Individual, SortedSet<Integer>>>(); + /** + * Creates an instance of the fast instance checker. + * @param sources The knowledge sources used as input. + */ public FastInstanceChecker(Set<KnowledgeSource> sources) { super(sources); this.configurator = new FastInstanceCheckerConfigurator(this); } - + /** + * @return The options of this component. + */ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet to dematerialize", "pellet", false, true); - type.setAllowedValues(new String[] {"fact", "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 options.add(type); + options.add(new BooleanConfigOption("defaultNegation", "Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.", true, false, true)); return options; - } - + } + /* * (non-Javadoc) * @@ -150,10 +160,12 @@ public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { } + /** + * @return The name of this component. + */ public static String getName() { return "fast instance checker"; - } - + } /* * (non-Javadoc) @@ -162,7 +174,7 @@ */ @Override public void init() throws ComponentInitException { - //rc = new OWLAPIReasoner(sources); + // rc = new OWLAPIReasoner(sources); rc = ComponentFactory.getOWLAPIReasoner(sources); rc.getConfigurator().setReasonerType(configurator.getReasonerType()); rc.init(); @@ -176,7 +188,7 @@ atomicRoles = rc.getAtomicRoles(); individuals = rc.getIndividuals(); -// rs = new ReasoningService(rc); + // rs = new ReasoningService(rc); // TODO: some code taken from Helper.createFlatABox, but pasted here // because additional things need to @@ -185,46 +197,47 @@ long dematStartTime = System.currentTimeMillis(); logger.debug("dematerialising concepts"); - - for (NamedClass atomicConcept : rc.getAtomicConcepts()) { - + + for (NamedClass atomicConcept : rc.getAtomicConcepts()) { + SortedSet<Individual> pos = rc.retrieval(atomicConcept); classInstancesPos.put(atomicConcept, pos); - - if(defaultNegation) { - classInstancesNeg.put(atomicConcept, Helper.difference(individuals,pos)); + + if (configurator.getDefaultNegation()) { + classInstancesNeg.put(atomicConcept, Helper.difference(individuals, pos)); } else { - // Pellet needs approximately infinite time to answer negated queries - // on the carcinogenesis data set (and probably others), so we have to + // Pellet needs approximately infinite time to answer + // negated queries + // on the carcinogenesis data set (and probably others), so + // we have to // be careful here Negation negatedAtomicConcept = new Negation(atomicConcept); classInstancesNeg.put(atomicConcept, rc.retrieval(negatedAtomicConcept)); } - } logger.debug("dematerialising object properties"); - + for (ObjectProperty atomicRole : atomicRoles) { opPos.put(atomicRole, rc.getRoleMembers(atomicRole)); } logger.debug("dematerialising datatype properties"); - + for (DatatypeProperty dp : booleanDatatypeProperties) { bdPos.put(dp, rc.getTrueDatatypeMembers(dp)); bdNeg.put(dp, rc.getFalseDatatypeMembers(dp)); } - + for (DatatypeProperty dp : intDatatypeProperties) { id.put(dp, rc.getIntDatatypeMembers(dp)); - } - + } + for (DatatypeProperty dp : doubleDatatypeProperties) { dd.put(dp, rc.getDoubleDatatypeMembers(dp)); } - + long dematDuration = System.currentTimeMillis() - dematStartTime; logger.debug("TBox dematerialised in " + dematDuration + " ms"); @@ -237,9 +250,9 @@ @Override public boolean instanceCheck(Description description, Individual individual) throws ReasoningMethodUnsupportedException { - -// System.out.println(description + " " + individual); - + + // System.out.println(description + " " + individual); + if (description instanceof NamedClass) { return classInstancesPos.get((NamedClass) description).contains(individual); } else if (description instanceof Negation) { @@ -260,8 +273,9 @@ // the union, we return true List<Description> children = description.getChildren(); for (Description child : children) { - if (instanceCheck(child, individual)) + if (instanceCheck(child, individual)) { return true; + } } return false; } else if (description instanceof Intersection) { @@ -269,59 +283,67 @@ // the union, we return true List<Description> children = description.getChildren(); for (Description child : children) { - if (!instanceCheck(child, individual)) + if (!instanceCheck(child, individual)) { return false; + } } return true; } else if (description instanceof ObjectSomeRestriction) { ObjectPropertyExpression ope = ((ObjectSomeRestriction) description).getRole(); - if (!(ope instanceof ObjectProperty)) + if (!(ope instanceof ObjectProperty)) { throw new ReasoningMethodUnsupportedException("Instance check for description " + description + " unsupported. Inverse object properties not supported."); + } ObjectProperty op = (ObjectProperty) ope; Description child = description.getChild(0); Map<Individual, SortedSet<Individual>> mapping = opPos.get(op); - ; + if (mapping == null) { logger.warn("Instance check of a description with an undefinied property (" + op + ")."); return false; } SortedSet<Individual> roleFillers = opPos.get(op).get(individual); - if (roleFillers == null) + if (roleFillers == null) { return false; + } for (Individual roleFiller : roleFillers) { - if (instanceCheck(child, roleFiller)) + if (instanceCheck(child, roleFiller)) { return true; + } } return false; } else if (description instanceof ObjectAllRestriction) { ObjectPropertyExpression ope = ((ObjectAllRestriction) description).getRole(); - if (!(ope instanceof ObjectProperty)) + if (!(ope instanceof ObjectProperty)) { throw new ReasoningMethodUnsupportedException("Instance check for description " + description + " unsupported. Inverse object properties not supported."); + } ObjectProperty op = (ObjectProperty) ope; Description child = description.getChild(0); Map<Individual, SortedSet<Individual>> mapping = opPos.get(op); - ; + if (mapping == null) { logger.warn("Instance check of a description with an undefinied property (" + op + ")."); return true; } SortedSet<Individual> roleFillers = opPos.get(op).get(individual); - if (roleFillers == null) + if (roleFillers == null) { return true; + } for (Individual roleFiller : roleFillers) { - if (!instanceCheck(child, roleFiller)) + if (!instanceCheck(child, roleFiller)) { return false; + } } return true; } else if (description instanceof ObjectMinCardinalityRestriction) { ObjectPropertyExpression ope = ((ObjectCardinalityRestriction) description).getRole(); - if (!(ope instanceof ObjectProperty)) + if (!(ope instanceof ObjectProperty)) { throw new ReasoningMethodUnsupportedException("Instance check for description " + description + " unsupported. Inverse object properties not supported."); + } ObjectProperty op = (ObjectProperty) ope; Description child = description.getChild(0); Map<Individual, SortedSet<Individual>> mapping = opPos.get(op); @@ -331,38 +353,44 @@ + ")."); return true; } - + int number = ((ObjectCardinalityRestriction) description).getNumber(); - int nrOfFillers = 0; - + int nrOfFillers = 0; + SortedSet<Individual> roleFillers = opPos.get(op).get(individual); // special case: there are always at least zero fillers - if(number == 0) + if (number == 0) { return true; + } // return false if there are none or not enough role fillers - if (roleFillers == null || roleFillers.size() < number) + if (roleFillers == null || roleFillers.size() < number) { return false; - + } + int index = 0; for (Individual roleFiller : roleFillers) { index++; if (instanceCheck(child, roleFiller)) { nrOfFillers++; - if(nrOfFillers == number) + if (nrOfFillers == number) { return true; - // earyl abort: e.g. >= 10 hasStructure.Methyl; - // if there are 11 fillers and 2 are not Methyl, the result is false + } + // earyl abort: e.g. >= 10 hasStructure.Methyl; + // if there are 11 fillers and 2 are not Methyl, the result + // is false } else { - if(roleFillers.size() - index < number) + if (roleFillers.size() - index < number) { return false; + } } } return false; } else if (description instanceof ObjectMaxCardinalityRestriction) { ObjectPropertyExpression ope = ((ObjectCardinalityRestriction) description).getRole(); - if (!(ope instanceof ObjectProperty)) + if (!(ope instanceof ObjectProperty)) { throw new ReasoningMethodUnsupportedException("Instance check for description " + description + " unsupported. Inverse object properties not supported."); + } ObjectProperty op = (ObjectProperty) ope; Description child = description.getChild(0); Map<Individual, SortedSet<Individual>> mapping = opPos.get(op); @@ -372,38 +400,42 @@ + ")."); return true; } - + int number = ((ObjectCardinalityRestriction) description).getNumber(); - int nrOfFillers = 0; - + int nrOfFillers = 0; + SortedSet<Individual> roleFillers = opPos.get(op).get(individual); // return true if there are none or not enough role fillers - if (roleFillers == null || roleFillers.size() < number) + if (roleFillers == null || roleFillers.size() < number) { return true; - -// System.out.println(description + " " + individual); - + } + int index = 0; for (Individual roleFiller : roleFillers) { index++; if (instanceCheck(child, roleFiller)) { nrOfFillers++; - if(nrOfFillers > number) + if (nrOfFillers > number) { return false; - // earyl abort: e.g. <= 5 hasStructure.Methyl; - // if there are 6 fillers and 2 are not Methyl, the result is true + } + // early abort: e.g. <= 5 hasStructure.Methyl; + // if there are 6 fillers and 2 are not Methyl, the result + // is true } else { - if(roleFillers.size() - index <= number) + if (roleFillers.size() - index <= number) { return true; + } } } return true; } else if (description instanceof BooleanValueRestriction) { - DatatypeProperty dp = ((BooleanValueRestriction)description).getRestrictedPropertyExpresssion(); - boolean value = ((BooleanValueRestriction)description).getBooleanValue(); - - if(value) { - // check whether the individual is in the set of individuals mapped + DatatypeProperty dp = ((BooleanValueRestriction) description) + .getRestrictedPropertyExpresssion(); + boolean value = ((BooleanValueRestriction) description).getBooleanValue(); + + if (value) { + // check whether the individual is in the set of individuals + // mapped // to true by this datatype property return bdPos.get(dp).contains(individual); } else { @@ -414,23 +446,18 @@ DatatypeProperty dp = (DatatypeProperty) dsr.getRestrictedPropertyExpression(); DataRange dr = dsr.getDataRange(); SortedSet<Double> values = dd.get(dp).get(individual); - + // if there is no filler for this individual and property we // need to return false - if(values == null) + if (values == null) { return false; - - if(dr instanceof DoubleMaxValue) { - if(values.first() <= ((DoubleMaxValue)dr).getValue()) - return true; - else - return false; - } else if(dr instanceof DoubleMinValue) { - if(values.last() >= ((DoubleMinValue)dr).getValue()) - return true; - else - return false; } + + if (dr instanceof DoubleMaxValue) { + return (values.first() <= ((DoubleMaxValue) dr).getValue()); + } else if (dr instanceof DoubleMinValue) { + return (values.last() >= ((DoubleMinValue) dr).getValue()); + } } throw new ReasoningMethodUnsupportedException("Instance check for description " @@ -438,40 +465,46 @@ } @Override - public SortedSet<Individual> retrieval(Description concept) throws ReasoningMethodUnsupportedException { - if(concept instanceof NamedClass) - return classInstancesPos.get((NamedClass)concept); - else if(concept instanceof Negation && concept.getChild(0) instanceof NamedClass) - return classInstancesNeg.get((NamedClass)concept.getChild(0)); + public SortedSet<Individual> retrieval(Description concept) + throws ReasoningMethodUnsupportedException { + if (concept instanceof NamedClass) { + return classInstancesPos.get((NamedClass) concept); + } else if (concept instanceof Negation && concept.getChild(0) instanceof NamedClass) { + return classInstancesNeg.get((NamedClass) concept.getChild(0)); + } -// return rs.retrieval(concept); + // return rs.retrieval(concept); SortedSet<Individual> inds = new TreeSet<Individual>(); - for(Individual i : individuals) { - if(instanceCheck(concept,i)) + for (Individual i : individuals) { + if (instanceCheck(concept, i)) { inds.add(i); + } } return inds; - } - + } + /* * (non-Javadoc) * * @see org.dllearner.core.Reasoner#getAtomicConcepts() */ + @Override public Set<NamedClass> getAtomicConcepts() { return atomicConcepts; } @Override - public Map<Individual, SortedSet<Double>> getDoubleDatatypeMembers(DatatypeProperty datatypeProperty) throws ReasoningMethodUnsupportedException { + public Map<Individual, SortedSet<Double>> getDoubleDatatypeMembers( + DatatypeProperty datatypeProperty) throws ReasoningMethodUnsupportedException { return rc.getDoubleDatatypeMembers(datatypeProperty); } - + /* * (non-Javadoc) * * @see org.dllearner.core.Reasoner#getAtomicRoles() */ + @Override public Set<ObjectProperty> getAtomicRoles() { return atomicRoles; } @@ -501,6 +534,7 @@ * * @see org.dllearner.core.Reasoner#getIndividuals() */ + @Override public SortedSet<Individual> getIndividuals() { return individuals; } @@ -510,6 +544,7 @@ * * @see org.dllearner.core.Reasoner#getReasonerType() */ + @Override public ReasonerType getReasonerType() { return ReasonerType.FAST_INSTANCE_CHECKER; } @@ -519,6 +554,7 @@ * * @see org.dllearner.core.Reasoner#prepareSubsumptionHierarchy(java.util.Set) */ + @Override public void prepareSubsumptionHierarchy(Set<NamedClass> allowedConcepts) { rc.prepareSubsumptionHierarchy(allowedConcepts); } @@ -547,7 +583,7 @@ public DatatypePropertyHierarchy getDatatypePropertyHierarchy() { return rc.getDatatypePropertyHierarchy(); } - + @Override public boolean subsumes(Description superConcept, Description subConcept) { // Negation neg = new Negation(subConcept); @@ -561,9 +597,9 @@ * * @param args * No arguments supported. - * @throws ComponentInitException - * @throws ParseException - * @throws ReasoningMethodUnsupportedException + * @throws ComponentInitException Component cannot be initialised. + * @throws ParseException File cannot be parsed. + * @throws ReasoningMethodUnsupportedException Reasoning method not supported. */ public static void main(String[] args) throws ComponentInitException, ParseException, ReasoningMethodUnsupportedException { @@ -584,16 +620,22 @@ System.out.println(reasoner.instanceCheck(d, i)); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.dllearner.core.Reasoner#getBaseURI() */ + @Override public String getBaseURI() { return rc.getBaseURI(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.dllearner.core.Reasoner#getPrefixes() */ + @Override public Map<String, String> getPrefixes() { return rc.getPrefixes(); } @@ -602,38 +644,35 @@ public Description getDomain(ObjectProperty objectProperty) { return rc.getDomain(objectProperty); } - + @Override public Description getDomain(DatatypeProperty datatypeProperty) { return rc.getDomain(datatypeProperty); } - + @Override public Description getRange(ObjectProperty objectProperty) { return rc.getRange(objectProperty); } @Override - public Map<Individual, SortedSet<Individual>> getRoleMembers(ObjectProperty atomicRole) { + public Map<Individual, SortedSet<Individual>> getRoleMembers(ObjectProperty atomicRole) { return opPos.get(atomicRole); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.dllearner.core.ReasonerComponent#releaseKB() */ @Override public void releaseKB() { rc.releaseKB(); - } - - /*public void setReasonerType(String type){ - configurator.setReasonerType(type); - }*/ + } - @Override public boolean hasDatatypeSupport() { return true; } - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-22 08:04:53
|
Revision: 1235 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1235&view=rev Author: jenslehmann Date: 2008-09-22 08:04:33 +0000 (Mon, 22 Sep 2008) Log Message: ----------- - GUI fixes - added maxClassDescriptionTests as option to ExampleBasedROLComponent Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/RunPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -134,6 +134,7 @@ private int maxExecutionTimeInSeconds = CommonConfigOptions.maxExecutionTimeInSecondsDefault; private int minExecutionTimeInSeconds = CommonConfigOptions.minExecutionTimeInSecondsDefault; private int guaranteeXgoodDescriptions = CommonConfigOptions.guaranteeXgoodDescriptionsDefault; + private int maxClassDescriptionTests = CommonConfigOptions.maxClassDescriptionTestsDefault; // Variablen zur Einstellung der Protokollierung // boolean quiet = false; @@ -196,6 +197,7 @@ options.add(CommonConfigOptions.maxExecutionTimeInSeconds()); options.add(CommonConfigOptions.minExecutionTimeInSeconds()); options.add(CommonConfigOptions.guaranteeXgoodDescriptions()); + options.add(CommonConfigOptions.maxClassDescriptionTests()); options.add(CommonConfigOptions.getLogLevel()); 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" + @@ -274,6 +276,8 @@ minExecutionTimeInSeconds = (Integer) entry.getValue(); }else if(name.equals("guaranteeXgoodDescriptions")) { guaranteeXgoodDescriptions = (Integer) entry.getValue(); + } else if(name.equals("maxClassDescriptionTests")) { + maxClassDescriptionTests = (Integer) entry.getValue(); } else if(name.equals("logLevel")) { logLevel = ((String)entry.getValue()).toUpperCase(); } else if(name.equals("forceRefinementLengthIncrease")) { @@ -390,6 +394,7 @@ maxExecutionTimeInSeconds, minExecutionTimeInSeconds, guaranteeXgoodDescriptions, + maxClassDescriptionTests, forceRefinementLengthIncrease ); // note: used concepts and roles do not need to be passed Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -119,6 +119,7 @@ private boolean minExecutionTimeShown = false; private int guaranteeXgoodDescriptions = 1; private boolean guaranteeXgoodShown = false; + private int maxClassDescriptionTests; // if set to false we do not test properness; this may seem wrong // but the disadvantage of properness testing are additional reasoner @@ -242,7 +243,7 @@ boolean useTooWeakList, boolean useOverlyGeneralList, boolean useShortConceptConstruction, boolean usePropernessChecks, int maxPosOnlyExpansion, int maxExecutionTimeInSeconds, int minExecutionTimeInSeconds, - int guaranteeXgoodDescriptions, boolean forceRefinementLengthIncrease) { + int guaranteeXgoodDescriptions, int maxClassDescriptionTests, boolean forceRefinementLengthIncrease) { if (learningProblem instanceof PosNegLP) { PosNegLP lp = (PosNegLP) learningProblem; @@ -287,6 +288,7 @@ this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; this.minExecutionTimeInSeconds = minExecutionTimeInSeconds; this.guaranteeXgoodDescriptions = guaranteeXgoodDescriptions; + this.maxClassDescriptionTests = maxClassDescriptionTests; this.forceRefinementLengthIncrease = forceRefinementLengthIncrease; // logger.setLevel(Level.DEBUG); @@ -296,6 +298,29 @@ stop = false; isRunning = true; runtime = System.currentTimeMillis(); + + // reset values (algorithms may be started several times) + candidates.clear(); + candidatesStable.clear(); + newCandidates.clear(); + solutionFound = false; + solutions.clear(); + maxExecutionTimeShown = false; + minExecutionTimeShown = false; + guaranteeXgoodShown = false; + propernessTestsReasoner = 0; + propernessTestsAvoidedByShortConceptConstruction = 0; + propernessTestsAvoidedByTooWeakList = 0; + conceptTestsTooWeakList = 0; + conceptTestsOverlyGeneralList = 0; + propernessCalcTimeNs = 0; + propernessCalcReasoningTimeNs = 0; + childConceptsDeletionTimeNs = 0; + refinementCalcTimeNs = 0; + redundancyCheckTimeNs = 0; + evaluateSetCreationTimeNs = 0; + improperConceptsRemovalTimeNs = 0; + Monitor totalLearningTime = JamonMonitorLogger.getTimeMonitor(ExampleBasedROLComponent.class, "totalLearningTime") .start(); // TODO: write a JUnit test for this problem (long-lasting or infinite @@ -1327,6 +1352,10 @@ if (solutions.size() > 0) solutionFound = true; } + if(!solutionFound && maxClassDescriptionTests != 0) { + int conceptTests = conceptTestsReasoner + conceptTestsTooWeakList + conceptTestsOverlyGeneralList; + solutionFound = (conceptTests >= maxClassDescriptionTests); + } } private boolean guaranteeXgoodDescriptions() { Modified: trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -83,6 +83,15 @@ } /** + * Used for rewriting (simplification, beautification) of + * evaluated descriptions returned by the learning algorithm. + * @param description The description to set. + */ + public void setDescription(Description description) { + this.description = description; + } + + /** * @see org.dllearner.core.owl.Description#getLength() * @return Length of the description. */ @@ -202,4 +211,5 @@ } return j; } + } Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -249,7 +249,13 @@ if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed.getDescription())) { // before we add the description we replace EXISTS r.TOP with // EXISTS r.range(r) if range(r) is atomic - ConceptTransformation.replaceRange(ed.getDescription(), reasoningService); + // (we need to clone, otherwise we change descriptions which could + // be in the search of the learning algorith, which leads to + // unpredictable behaviour) + Description d = ed.getDescription().clone(); + ConceptTransformation.replaceRange(d, reasoningService); + ed.setDescription(d); + returnList.add(ed); } Modified: trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -47,6 +47,7 @@ public static int maxExecutionTimeInSecondsDefault = 0; public static int minExecutionTimeInSecondsDefault = 0; public static int guaranteeXgoodDescriptionsDefault = 1; + public static int maxClassDescriptionTestsDefault = 0; public static String logLevelDefault = "DEBUG"; //public static double noisePercentageDefault = 0.0; @@ -128,6 +129,11 @@ return new IntegerConfigOption("guaranteeXgoodDescriptions", "algorithm will run until X good (100%) concept descritpions are found",guaranteeXgoodDescriptionsDefault); } + public static IntegerConfigOption maxClassDescriptionTests() { + return new IntegerConfigOption("maxClassDescriptionTests", "The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. " + + "(The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.)",maxClassDescriptionTestsDefault); + } + public static StringConfigOption getLogLevel() { return new StringConfigOption("logLevel", "determines the logLevel for this component, can be {TRACE, DEBUG, INFO}",logLevelDefault); } Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -194,6 +194,10 @@ // // TODO Auto-generated catch block // e.printStackTrace(); // } + needsInit[0] = true; + needsInit[1] = true; + needsInit[2] = true; + needsInit[3] = true; return source; } @@ -236,6 +240,9 @@ rs = cm.reasoningService(reasoner); lp.changeReasoningService(rs); la.changeReasoningService(rs); + needsInit[1] = true; + needsInit[2] = true; + needsInit[3] = true; return reasoner; } @@ -276,6 +283,8 @@ public LearningProblem changeLearningProblem(Class<? extends LearningProblem> clazz) { lp = cm.learningProblem(clazz, rs); la.changeLearningProblem(lp); + needsInit[2] = true; + needsInit[3] = true; return lp; } @@ -313,6 +322,7 @@ public LearningAlgorithm changeLearningAlgorithm(Class<? extends LearningAlgorithm> clazz) throws LearningProblemUnsupportedException { la = cm.learningAlgorithm(clazz, lp, rs); + needsInit[3] = true; return la; } Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -66,7 +66,7 @@ private Config config; private StartGUI startGUI; - private long algorithmStartTime = 0; +// private long algorithmStartTime = 0; private GridBagLayout gridbag = new GridBagLayout(); private GridBagConstraints constraints = new GridBagConstraints(); @@ -86,8 +86,53 @@ private JLabel[] time = new JLabel[5]; private JLabel[] percent = new JLabel[5]; - + private class AlgorithmThread extends Thread { + private long startTime; + private long endTime; + + @Override + public void run() { + startTime = System.nanoTime(); +// setPriority(Thread.MIN_PRIORITY); + config.getLearningAlgorithm().start(); + endTime = System.nanoTime(); + } + + public long getRuntimeNanos() { + if(isAlive()) { + System.out.println("ALIVE"); + return System.nanoTime() - startTime; + } else { + System.out.println("NOT ALIVE"); + return endTime - startTime; + } + } + } + AlgorithmThread algorithmThread; + // separate thread for learning algorithm +// Thread algorithmThread = new Thread() { +// +// private long startTime; +// private long endTime; +// +// @Override +// public void run() { +// startTime = System.nanoTime(); +//// setPriority(Thread.MIN_PRIORITY); +// config.getLearningAlgorithm().start(); +// endTime = System.nanoTime(); +// } +// +// public long getRuntimeNanos() { +// if(isAlive()) { +// return System.nanoTime() - startTime; +// } else { +// return endTime - startTime; +// } +// } +// }; + RunPanel(Config config, StartGUI startGUI) { super(new BorderLayout()); @@ -172,19 +217,11 @@ public void actionPerformed(ActionEvent e) { // start if (e.getSource() == runButton) { - - // separate thread for learning algorithm - Thread algorithmThread = new Thread() { - @Override - public void run() { - setPriority(Thread.MIN_PRIORITY); - config.getLearningAlgorithm().start(); - } - }; - + algorithmThread = new AlgorithmThread(); config.getReasoningService().resetStatistics(); algorithmThread.start(); - algorithmStartTime = System.nanoTime(); +// algorithmStartTime = System.nanoTime(); +// algorithmThread. StatisticsThread threadStatistics = new StatisticsThread(config, this); threadStatistics.start(); runButton.setEnabled(false); @@ -230,8 +267,9 @@ // + config.getLearningAlgorithm().getSolutionScore().toString() // + "\n\n"); - // update algorith runtime - long algorithmRunTime = System.nanoTime() - algorithmStartTime; + // update algorithm runtime +// long algorithmRunTime = System.nanoTime() - algorithmStartTime; + long algorithmRunTime = algorithmThread.getRuntimeNanos(); bar[0].update(1.0); time[0].setText(makeTime(algorithmRunTime)); percent[0].setText("100%"); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -253,7 +253,7 @@ Logger rootLogger = Logger.getRootLogger(); rootLogger.removeAllAppenders(); rootLogger.addAppender(consoleAppender); - rootLogger.setLevel(Level.DEBUG); + rootLogger.setLevel(Level.TRACE); File file = null; if (args.length > 0) @@ -308,10 +308,17 @@ } }); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { - logger.info("Saving current configuration to " + fc.getSelectedFile() + "."); + File file = fc.getSelectedFile(); + // returns name without path to it + String name= file.getName(); + // if there is no extension, we append .conf + if(!name.contains(".")) { + file = new File(file.getAbsolutePath() + ".conf"); + } + logger.info("Saving current configuration to " + file + "."); ConfigSave save = new ConfigSave(config); try { - save.saveFile(fc.getSelectedFile()); + save.saveFile(file); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); Modified: trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -49,7 +49,7 @@ while (config.getLearningAlgorithm().isRunning()) { // update statistics every 3 seconds runPanel.showStats(); - sleep(3000); + sleep(2000); } // show final stats runPanel.showStats(); Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java 2008-09-21 12:50:24 UTC (rev 1234) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java 2008-09-22 08:04:33 UTC (rev 1235) @@ -71,7 +71,7 @@ // set cb-index String[] kbBoxItems = { "true", "false" }; cb = new JComboBox(kbBoxItems); - if (!value) { + if (value) { cb.setSelectedIndex(0); } else { cb.setSelectedIndex(1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2008-09-21 12:50:27
|
Revision: 1234 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1234&view=rev Author: lorenz_b Date: 2008-09-21 12:50:24 +0000 (Sun, 21 Sep 2008) Log Message: ----------- javadoc Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-09-21 12:48:48 UTC (rev 1233) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-09-21 12:50:24 UTC (rev 1234) @@ -25,14 +25,20 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; +import java.math.BigDecimal; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; -import org.dllearner.core.owl.Description; +import org.dllearner.core.EvaluatedDescription; +/** + * List cell renderer for 2 columns. + * @author Lorenz Buehmann + * + */ public class ColumnListCellRenderer extends JPanel implements ListCellRenderer { private static final long serialVersionUID = 3024913291199515567L; @@ -52,9 +58,12 @@ JLabel cor = new JLabel(); JLabel desc = new JLabel(); setLayout(new GridBagLayout()); - desc.setText(((Description) value).toManchesterSyntaxString( - ore.getBaseURI(), ore.getPrefixes())); - cor.setText((ore.computeAccuracy((Description) value)).toString()); + desc.setText(((EvaluatedDescription) value).getDescription().toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + //round accuracy to 2 digits + double accuracy = ((EvaluatedDescription) value).getAccuracy(); + BigDecimal roundedAccuracy = new BigDecimal( accuracy * 100 ); + roundedAccuracy = roundedAccuracy.setScale( 2, BigDecimal.ROUND_HALF_UP ); + cor.setText(roundedAccuracy.toString()); add(cor,new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); add(desc,new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |