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: <jen...@us...> - 2009-04-06 12:23:46
|
Revision: 1683 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1683&view=rev Author: jenslehmann Date: 2009-04-06 12:23:42 +0000 (Mon, 06 Apr 2009) Log Message: ----------- reasoning problem fixed (unit tests continued) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-06 10:58:30 UTC (rev 1682) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-06 12:23:42 UTC (rev 1683) @@ -638,7 +638,12 @@ if(set.size()==0) return new Thing(); OWLClass oc = (OWLClass) set.iterator().next().iterator().next(); - return new NamedClass(oc.getURI().toString()); + String str = oc.getURI().toString(); + if(str.equals("http://www.w3.org/2002/07/owl#Thing")) { + return new Thing(); + } else { + return new NamedClass(str); + } } catch (OWLReasonerException e) { throw new Error(e); } @@ -657,7 +662,12 @@ if(set.size()==0) return new Thing(); OWLClass oc = (OWLClass) set.iterator().next().iterator().next(); - return new NamedClass(oc.getURI().toString()); + String str = oc.getURI().toString(); + if(str.equals("http://www.w3.org/2002/07/owl#Thing")) { + return new Thing(); + } else { + return new NamedClass(str); + } } catch (OWLReasonerException e) { throw new Error(e); } Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-06 10:58:30 UTC (rev 1682) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-06 12:23:42 UTC (rev 1683) @@ -393,8 +393,9 @@ computeTopRefinements(maxLength); refinements = (TreeSet<Description>) topRefinementsCumulative.get(maxLength).clone(); } else { - if(maxLength>topARefinementsLength.get(currDomain)) + if(maxLength>topARefinementsLength.get(currDomain)) { computeTopRefinements(maxLength, (NamedClass) currDomain); + } refinements = (TreeSet<Description>) topARefinementsCumulative.get(currDomain).get(maxLength).clone(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-06 10:58:50
|
Revision: 1682 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1682&view=rev Author: jenslehmann Date: 2009-04-06 10:58:30 +0000 (Mon, 06 Apr 2009) Log Message: ----------- fixed some problems detected by unit tests Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -266,7 +266,7 @@ public boolean hasTypeImpl(Description description, Individual individual) throws ReasoningMethodUnsupportedException { -// System.out.println(description + " " + individual); +// System.out.println("FIC: " + description + " " + individual); if (description instanceof NamedClass) { return classInstancesPos.get((NamedClass) description).contains(individual); Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2009, 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.reasoning; import java.util.HashSet; @@ -22,6 +41,13 @@ import org.dllearner.utilities.Helper; import org.dllearner.utilities.datastructures.SortedSetTuple; +/** + * + * Reasoner for fast retrieval inference (other tasks redirected to OWL API reasoner). Not actively used anymore. + * + * @author Jens Lehmann + * + */ public class FastRetrievalReasoner extends ReasonerComponent { private FastRetrievalReasonerConfigurator configurator; @@ -36,16 +62,13 @@ Set<ObjectProperty> atomicRoles; SortedSet<Individual> individuals; - ReasonerComponent rs; ReasonerComponent rc; - - public FastRetrievalReasoner(Set<KnowledgeSource> sources) { super(sources); this.configurator = new FastRetrievalReasonerConfigurator(this); - rc = ComponentFactory.getDIGReasoner(sources); + rc = ComponentFactory.getOWLAPIReasoner(sources); try { rc.init(); } catch (ComponentInitException e1) { @@ -57,7 +80,7 @@ individuals = rc.getIndividuals(); // rs = new ReasonerComponent(rc); try { - abox = Helper.createFlatABox(rs); + abox = Helper.createFlatABox(rc); } catch (ReasoningMethodUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -130,7 +153,7 @@ // Negation neg = new Negation(subConcept); // Intersection c = new Intersection(neg,superConcept); // return fastRetrieval.calculateSets(c).getPosSet().isEmpty(); - return rs.isSuperClassOf(superConcept, subConcept); + return rc.isSuperClassOf(superConcept, subConcept); } // @Override @@ -154,7 +177,7 @@ @Override public boolean isSatisfiableImpl() { - return rs.isSatisfiable(); + return rc.isSatisfiable(); } @Override Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -185,6 +185,8 @@ public RhoDRDown(ReasonerComponent reasoningService) { // this(reasoningService, reasoningService.getClassHierarchy(), null, true, true, true, true, true, 3, true, true, true, true, null); this.rs = reasoningService; + this.subHierarchy = rs.getClassHierarchy(); + init(); } public RhoDRDown(ReasonerComponent reasoner, ClassHierarchy subHierarchy, Description startClass, RefinementOperatorConfigurator configurator) { Modified: trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/test/junit/AllTestsRunner.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -48,7 +48,12 @@ JUnitCore.main("org.dllearner.test.junit.ComponentTests", "org.dllearner.test.junit.ReasonerTests", - "org.dllearner.test.junit.RefinementOperatorTests"); + "org.dllearner.test.junit.RefinementOperatorTests", + "org.dllearner.test.junit.ELDescriptionTreeTests", + "org.dllearner.test.junit.ELDownTests", + "org.dllearner.test.junit.MinimizeTests", + "org.dllearner.test.junit.SimulationTests", + "org.dllearner.test.junit.UtilitiesTests"); } } Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -85,7 +85,7 @@ ConceptTransformation.cleanConcept(d); ELDescriptionTree tree = new ELDescriptionTree(rs, d); // clone performance (false for simple unit test, true for clone performance test) - boolean testPerformance = true; + boolean testPerformance = false; ELDescriptionTree treeCloned = null; if(testPerformance) { int runs = 1000000; Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -284,6 +284,7 @@ } } + // not part of the regular test suite, since Galen 2 is required // @Test public void test4() throws ComponentInitException, ParseException, IOException { @@ -312,6 +313,7 @@ } + // not part of the regular test suite, since Galen 2 is required // @Test public void asTest() throws ComponentInitException, MalformedURLException { Modified: trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -39,8 +39,8 @@ import org.dllearner.kb.OWLFile; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; +import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; -import org.dllearner.reasoning.OWLAPIReasoner; import org.junit.Test; /** @@ -78,8 +78,13 @@ * Performs an instance checks on all reasoner components to verify that * they all return the correct result. */ -// @Test + @Test public void instanceCheckTest() { + + // DIG can be excluded from test since it requires a separate DIG reasoner and is no + // longer the default reasoning mechanism + boolean excludeDIG = true; + try { ComponentManager cm = ComponentManager.getInstance(); KB kb = getSimpleKnowledgeBase(); @@ -91,6 +96,9 @@ Individual i = new Individual(KBParser.getInternalURI("stephen")); List<Class<? extends ReasonerComponent>> reasonerClasses = cm.getReasonerComponents(); for (Class<? extends ReasonerComponent> reasonerClass : reasonerClasses) { + if(excludeDIG && reasonerClass.equals(DIGReasoner.class)) { + continue; + } ReasonerComponent reasoner = cm.reasoner(reasonerClass, ks); reasoner.init(); // long startTime = System.nanoTime(); @@ -116,7 +124,7 @@ * @throws ComponentInitException * @throws ParseException */ -// @Test + @Test public void fastInstanceCheckTest() throws ComponentInitException, ParseException { String file = "examples/carcinogenesis/carcinogenesis.owl"; ComponentManager cm = ComponentManager.getInstance(); @@ -128,7 +136,7 @@ e.printStackTrace(); } ks.init(); - ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); + ReasonerComponent reasoner = cm.reasoner(FastInstanceChecker.class, ks); reasoner.init(); baseURI = reasoner.getBaseURI(); @@ -137,7 +145,7 @@ List<List<Individual>> negIndividuals = new LinkedList<List<Individual>>(); // TODO manually verify that the results are indeed correct - testDescriptions.add(KBParser.parseConcept("\"http://dl-learner.org/carcinogenesis#Compound\" AND (\"http://dl-learner.org/carcinogenesis#amesTestPositive\" = true OR >= 2 \"http://dl-learner.org/carcinogenesis#hasStructure\" \"http://dl-learner.org/carcinogenesis#Ar_halide\"))")); + testDescriptions.add(KBParser.parseConcept("(\"http://dl-learner.org/carcinogenesis#Compound\" AND ((\"http://dl-learner.org/carcinogenesis#amesTestPositive\" IS TRUE) OR >= 2 \"http://dl-learner.org/carcinogenesis#hasStructure\".\"http://dl-learner.org/carcinogenesis#Ar_halide\"))")); posIndividuals.add(getIndSet("d113","d133","d171","d262","d265","d294","d68","d77","d79")); negIndividuals.add(getIndSet("d139","d199","d202","d203","d283","d42")); @@ -150,16 +158,18 @@ List<Individual> neg = negIndividuals.get(i); for(Individual ind : pos) { + System.out.println("description: " + description.toString(baseURI, null) + " individual: " + ind.toString(baseURI, null)); assertTrue(reasoner.hasType(description, ind)); } for(Individual ind : neg) { + System.out.println("description: " + description.toString(baseURI, null) + " individual: " + ind.toString(baseURI, null)); assertTrue(!reasoner.hasType(description, ind)); } } } -// @Test + @Test public void fastInstanceCheck2() throws ComponentInitException, ParseException { String file = "examples/epc/sap_epc.owl"; ComponentManager cm = ComponentManager.getInstance(); @@ -217,7 +227,8 @@ } private String uri(String name) { - return "\""+baseURI+name+"\""; +// return "\""+baseURI+name+"\""; + return baseURI+name; } } Modified: trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -102,13 +102,13 @@ RhoDRDown op = new RhoDRDown(reasoner); Description concept = KBParser.parseConcept("(\"http://localhost/aris/sap_model.owl#EPC\" AND EXISTS \"http://localhost/aris/sap_model.owl#hasModelElements\".\"http://localhost/aris/sap_model.owl#Object\")"); - Set<Description> results = op.refine(concept, 6); + Set<Description> results = op.refine(concept,10); for(Description result : results) { - System.out.println(result); + System.out.println(result.toString("http://localhost/aris/sap_model.owl#",null)); } - int desiredResultSize = 141; + int desiredResultSize = 116; if(results.size() != desiredResultSize) { System.out.println(results.size() + " results found, but should be " + desiredResultSize + "."); } Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -122,10 +122,10 @@ KnowledgeSource source; // parse KB string if one has been specified - if(!kbString.isEmpty()) { + if(!kbString.isEmpty() || ont.equals(TestOntology.EMPTY)) { KB kb = KBParser.parseKBFile(kbString); source = new KBFile(kb); - // parse OWL file otherwise + // do nothing for empty ontology } else { source = cm.knowledgeSource(OWLFile.class); try { Modified: trunk/src/dl-learner/org/dllearner/utilities/Helper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2009-04-03 07:48:52 UTC (rev 1681) +++ trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2009-04-06 10:58:30 UTC (rev 1682) @@ -556,18 +556,22 @@ long dematStartTime = System.currentTimeMillis(); FlatABox aBox = new FlatABox(); // FlatABox.getInstance(); - for (NamedClass atomicConcept : rs.getNamedClasses()) { - aBox.atomicConceptsPos.put(atomicConcept.getName(), getStringSet(rs - .getIndividuals(atomicConcept))); - Negation negatedAtomicConcept = new Negation(atomicConcept); - aBox.atomicConceptsNeg.put(atomicConcept.getName(), getStringSet(rs - .getIndividuals(negatedAtomicConcept))); - aBox.concepts.add(atomicConcept.getName()); + if(!rs.getNamedClasses().isEmpty()) { + for (NamedClass atomicConcept : rs.getNamedClasses()) { + aBox.atomicConceptsPos.put(atomicConcept.getName(), getStringSet(rs + .getIndividuals(atomicConcept))); + Negation negatedAtomicConcept = new Negation(atomicConcept); + aBox.atomicConceptsNeg.put(atomicConcept.getName(), getStringSet(rs + .getIndividuals(negatedAtomicConcept))); + aBox.concepts.add(atomicConcept.getName()); + } } - for (ObjectProperty atomicRole : rs.getObjectProperties()) { - aBox.rolesPos.put(atomicRole.getName(), getStringMap(rs.getPropertyMembers(atomicRole))); - aBox.roles.add(atomicRole.getName()); + if(!rs.getObjectProperties().isEmpty()) { + for (ObjectProperty atomicRole : rs.getObjectProperties()) { + aBox.rolesPos.put(atomicRole.getName(), getStringMap(rs.getPropertyMembers(atomicRole))); + aBox.roles.add(atomicRole.getName()); + } } aBox.domain = getStringSet(rs.getIndividuals()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-03 07:49:04
|
Revision: 1681 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1681&view=rev Author: jenslehmann Date: 2009-04-03 07:48:52 +0000 (Fri, 03 Apr 2009) Log Message: ----------- small script to publish manual on dl-learner.org Added Paths: ----------- trunk/doc/manual/publish_manual.sh Added: trunk/doc/manual/publish_manual.sh =================================================================== --- trunk/doc/manual/publish_manual.sh (rev 0) +++ trunk/doc/manual/publish_manual.sh 2009-04-03 07:48:52 UTC (rev 1681) @@ -0,0 +1,3 @@ +# copies current PDF version of manual to dl-learner.org +scp -C manual.pdf ro...@pr...:/var/www/aksw.org/files/dl-learner-manual.pdf + Property changes on: trunk/doc/manual/publish_manual.sh ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-02 08:49:25
|
Revision: 1680 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1680&view=rev Author: lorenz_b Date: 2009-04-02 08:49:20 +0000 (Thu, 02 Apr 2009) Log Message: ----------- added classes used to compute precise explanations Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BetaGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BottomTester.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TauGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TopTester.java Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java 2009-04-02 08:49:20 UTC (rev 1680) @@ -0,0 +1,266 @@ + +package org.dllearner.tools.ore.explanation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataAllRestriction; +import org.semanticweb.owl.model.OWLDataExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataPropertyExpression; +import org.semanticweb.owl.model.OWLDataRange; +import org.semanticweb.owl.model.OWLDataSomeRestriction; +import org.semanticweb.owl.model.OWLDataValueRestriction; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLDescriptionVisitorEx; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObjectAllRestriction; +import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectIntersectionOf; +import org.semanticweb.owl.model.OWLObjectOneOf; +import org.semanticweb.owl.model.OWLObjectPropertyExpression; +import org.semanticweb.owl.model.OWLObjectSelfRestriction; +import org.semanticweb.owl.model.OWLObjectSomeRestriction; +import org.semanticweb.owl.model.OWLObjectUnionOf; +import org.semanticweb.owl.model.OWLObjectValueRestriction; + + + +public abstract class BaseDescriptionGenerator + implements OWLDescriptionVisitorEx<Set<OWLDescription>> +{ + private OWLDataFactory factory; + private static TopTester topChecker = new TopTester(); + private static BottomTester bottomChecker = new BottomTester(); + + public BaseDescriptionGenerator(OWLDataFactory factory) + { + this.factory = factory; + } + + public boolean isThing(OWLDescription description) + { + return ((Boolean)description.accept(topChecker)).booleanValue(); + } + + public boolean isNothing(OWLDescription description) + { + return ((Boolean)description.accept(bottomChecker)).booleanValue(); + } + + public OWLDataFactory getDataFactory() + { + return factory; + } + + public Set<OWLDescription> computeTau(OWLDescription desc) + { + TauGenerator gen = new TauGenerator(factory); + return desc.accept(gen); + } + + public Set<OWLDescription> computeBeta(OWLDescription desc) + { + BetaGenerator gen = new BetaGenerator(factory); + return (Set<OWLDescription>)desc.accept(gen); + } + + private Set<Set<OWLDescription>> computeReplacements(Set<OWLDescription> operands) + {System.out.println("Eingabe : " + operands); + Set<List<OWLDescription>> ps = new HashSet<List<OWLDescription>>(); + ps.add(new ArrayList()); + + for(OWLDescription op : operands) + { + Set<List<OWLDescription>> pscopy = new HashSet<List<OWLDescription>>(ps); + + for(OWLDescription d : (Set<OWLDescription>)op.accept(this)) { + for(List<OWLDescription> pselement : pscopy) { + ArrayList<OWLDescription> union = new ArrayList<OWLDescription>(); + union.addAll(pselement); + union.add(d); + ps.remove(pselement); + ps.add(union); + } + } + } + + Set<Set<OWLDescription>> result = new HashSet<Set<OWLDescription>>(); + + for(List<OWLDescription> desc : ps ){ + result.add(new HashSet<OWLDescription>(desc)); + }System.out.println("Ergebnis : " + result); + return result; + } + + public Set<OWLDescription> visit(OWLObjectIntersectionOf desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + Set<Set<OWLDescription>> conjunctions = computeReplacements(desc.getOperands()); + for(Set<OWLDescription> conjuncts : conjunctions){ + + for(OWLDescription conjunct : conjuncts){ + if(isThing(conjunct)){ + conjuncts.remove(conjunct); + } + } + + if(conjuncts.isEmpty()) + descs.add(factory.getOWLThing()); + else + if(conjuncts.size() != 1) + descs.add(factory.getOWLObjectIntersectionOf(conjuncts)); + else + descs.addAll(conjuncts); + } + + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectUnionOf desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + Set<Set<OWLDescription>> disjunctions = computeReplacements(desc.getOperands()); + for(Set<OWLDescription> disjuncts : disjunctions){ + + for(OWLDescription disjunct : disjuncts){ + if(isNothing(disjunct)){ + disjuncts.remove(disjunct); + } + } + if(disjuncts.size() != 1){ + descs.add(factory.getOWLObjectUnionOf(disjuncts)); + } else{ +// descs.add(disjuncts.iterator().next()); + descs.addAll(disjuncts); + } + } + + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectSomeRestriction desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + descs.add(desc); + for(OWLDescription filler : desc.getFiller().accept(this)){ + if(!isNothing(filler)) + descs.add(factory.getOWLObjectSomeRestriction((OWLObjectPropertyExpression)desc.getProperty(), filler)); + } + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectAllRestriction desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription filler : desc.getFiller().accept(this)){ + if(!isThing(filler)) + descs.add(factory.getOWLObjectAllRestriction((OWLObjectPropertyExpression)desc.getProperty(), filler)); + } + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectValueRestriction desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + descs.add(desc); + + for(OWLDescription filler : factory.getOWLObjectOneOf(new OWLIndividual[] {(OWLIndividual)desc.getValue()}).accept(this)){ + descs.add(factory.getOWLObjectSomeRestriction((OWLObjectPropertyExpression)desc.getProperty(), filler)); + } + + + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectExactCardinalityRestriction desc) + { + Set<OWLDescription> result = new HashSet<OWLDescription>(); + OWLDescription min = getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), (OWLDescription)desc.getFiller()); + result.addAll(min.accept(this)); + OWLDescription max = getDataFactory().getOWLObjectMaxCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), (OWLDescription)desc.getFiller()); + result.addAll(max.accept(this)); + result.add(getLimit()); + return result; + } + + public Set<OWLDescription> visit(OWLObjectSelfRestriction desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + descs.add(desc); + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectOneOf desc) + { + Set<OWLDescription> ops = new HashSet<OWLDescription>(); + if(desc.getIndividuals().size() == 1) + { + ops.add(desc); + ops.add(getLimit()); + return ops; + } + + for(OWLIndividual ind : desc.getIndividuals()){ + ops.add(factory.getOWLObjectOneOf(new OWLIndividual[] {ind})); + } + + OWLDescription rewrite = factory.getOWLObjectUnionOf(ops); + return rewrite.accept(this); + } + + protected abstract OWLClass getLimit(); + + protected abstract OWLDataRange getDataLimit(); + + public Set<OWLDescription> visit(OWLDataSomeRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + public Set<OWLDescription> visit(OWLDataAllRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + public Set<OWLDescription> visit(OWLDataValueRestriction desc) + { + Set<OWLDescription> result = new HashSet<OWLDescription>(2); + result.add(desc); + result.add(getDataFactory().getOWLDataSomeRestriction((OWLDataPropertyExpression)desc.getProperty(), getDataLimit())); + return result; + } + + public Set<OWLDescription> visit(OWLDataMinCardinalityRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + public Set<OWLDescription> visit(OWLDataExactCardinalityRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + public Set<OWLDescription> visit(OWLDataMaxCardinalityRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + + + + +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BetaGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BetaGenerator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BetaGenerator.java 2009-04-02 08:49:20 UTC (rev 1680) @@ -0,0 +1,115 @@ + + +package org.dllearner.tools.ore.explanation; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataRange; +import org.semanticweb.owl.model.OWLDataValueRestriction; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLObjectComplementOf; +import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectPropertyExpression; +import org.semanticweb.owl.model.OWLObjectUnionOf; + + + +public class BetaGenerator extends BaseDescriptionGenerator +{ + + public BetaGenerator(OWLDataFactory factory) + { + super(factory); + } + + public Set<OWLDescription> visit(OWLClass desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(3); + descs.add(desc); + descs.add(getDataFactory().getOWLNothing()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectComplementOf desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription d : computeTau(desc.getOperand())){ + descs.add(getDataFactory().getOWLObjectComplementOf(d)); + } + + return descs; + } + + protected Set<OWLDescription> compute(OWLDescription description) + { + return computeBeta(description); + } + + public Set<OWLDescription> visit(OWLObjectMaxCardinalityRestriction desc) + { + Set<OWLDescription> fillers = computeTau(desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + for(int n = desc.getCardinality(); n > 0; n--) + { + for(OWLDescription filler : fillers){ + result.add(getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), n, filler)); + } + } + + result.add(getLimit()); + return result; + } + + public Set<OWLDescription> visit(OWLObjectExactCardinalityRestriction desc) + { + Set<OWLDescription> fillers = computeBeta((OWLDescription)desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + + for(OWLDescription filler : fillers){ + result.add(getDataFactory().getOWLObjectExactCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), filler)); + } + result.add(getLimit()); + return result; + } + + public Set<OWLDescription> visit(OWLObjectUnionOf desc) + { + return super.visit(desc); + } + + public Set<OWLDescription> visit(OWLObjectMinCardinalityRestriction desc) + { + Set<OWLDescription> fillers = computeBeta((OWLDescription)desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + + for(OWLDescription filler : fillers){ + result.add(getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), filler)); + } + result.add(getLimit()); + return result; + } + + protected OWLClass getLimit() + { + return getDataFactory().getOWLNothing(); + } + + protected OWLDataRange getDataLimit() + { + return getDataFactory().getOWLDataComplementOf(getDataFactory().getTopDataType()); + } + + public Set<OWLDescription> visit(OWLDataValueRestriction desc) + { + return Collections.singleton((OWLDescription)desc); + } + + +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BottomTester.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BottomTester.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BottomTester.java 2009-04-02 08:49:20 UTC (rev 1680) @@ -0,0 +1,129 @@ + +package org.dllearner.tools.ore.explanation; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataAllRestriction; +import org.semanticweb.owl.model.OWLDataExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataSomeRestriction; +import org.semanticweb.owl.model.OWLDataValueRestriction; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLDescriptionVisitorEx; +import org.semanticweb.owl.model.OWLObjectAllRestriction; +import org.semanticweb.owl.model.OWLObjectComplementOf; +import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectIntersectionOf; +import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectOneOf; +import org.semanticweb.owl.model.OWLObjectSelfRestriction; +import org.semanticweb.owl.model.OWLObjectSomeRestriction; +import org.semanticweb.owl.model.OWLObjectUnionOf; +import org.semanticweb.owl.model.OWLObjectValueRestriction; + +public class BottomTester implements OWLDescriptionVisitorEx<Boolean> +{ + + @Override + public Boolean visit(OWLClass owlClass) { + + return Boolean.valueOf(owlClass.isOWLNothing()); + } + + @Override + public Boolean visit(OWLObjectIntersectionOf intersect) { + for(OWLDescription desc : intersect.getOperands()){ + if (((Boolean) desc.accept(this)).booleanValue()) { + return Boolean.valueOf(true); + } + } + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLObjectUnionOf union) { + for(OWLDescription desc : union.getOperands()){ + if (((Boolean) desc.accept(this)).booleanValue()) { + return Boolean.valueOf(true); + } + } + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLObjectComplementOf desc) { + return Boolean.valueOf(desc.isOWLThing()); + } + + @Override + public Boolean visit(OWLObjectSomeRestriction desc) { + return (Boolean) ((OWLDescription) desc.getFiller()).accept(this); + } + + @Override + public Boolean visit(OWLObjectAllRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLObjectValueRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLObjectMinCardinalityRestriction desc) { + return (Boolean) ((OWLDescription) desc.getFiller()).accept(this); + } + + @Override + public Boolean visit(OWLObjectExactCardinalityRestriction desc) { + return (Boolean) ((OWLDescription) desc.getFiller()).accept(this); + } + + @Override + public Boolean visit(OWLObjectMaxCardinalityRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLObjectSelfRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLObjectOneOf arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLDataSomeRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLDataAllRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLDataValueRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLDataMinCardinalityRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLDataExactCardinalityRestriction arg0) { + return Boolean.valueOf(false); + } + + @Override + public Boolean visit(OWLDataMaxCardinalityRestriction arg0) { + return Boolean.valueOf(false); + } + +} \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TauGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TauGenerator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TauGenerator.java 2009-04-02 08:49:20 UTC (rev 1680) @@ -0,0 +1,82 @@ + +package org.dllearner.tools.ore.explanation; + +import java.util.HashSet; +import java.util.Set; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataRange; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLObjectComplementOf; +import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectPropertyExpression; + + +public class TauGenerator extends BaseDescriptionGenerator +{ + + public TauGenerator(OWLDataFactory factory) + { + super(factory); + } + + public Set<OWLDescription> visit(OWLClass desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + descs.add(desc); + descs.add(getDataFactory().getOWLThing()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectComplementOf desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription d : computeBeta(desc.getOperand())){ + descs.add(getDataFactory().getOWLObjectComplementOf(d)); + } + return descs; + } + + public Set<OWLDescription> visit(OWLObjectMaxCardinalityRestriction desc) + { + Set<OWLDescription> descs = new HashSet<OWLDescription>(); + + for(OWLDescription filler : computeBeta(desc.getFiller())){ + descs.add(getDataFactory().getOWLObjectMaxCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), desc.getCardinality(), filler)); + } + descs.add(getLimit()); + return descs; + } + + public Set<OWLDescription> visit(OWLObjectMinCardinalityRestriction desc) + { + Set<OWLDescription> weakenedFillers = computeTau((OWLDescription)desc.getFiller()); + Set<OWLDescription> result = new HashSet<OWLDescription>(); + for(int n = desc.getCardinality(); n > 0; n--) + { + + for(OWLDescription filler : weakenedFillers ){ + result.add(getDataFactory().getOWLObjectMinCardinalityRestriction((OWLObjectPropertyExpression)desc.getProperty(), n, filler)); + } + + } + + result.add(getLimit()); + return result; + } + + protected OWLClass getLimit() + { + return getDataFactory().getOWLThing(); + } + + protected OWLDataRange getDataLimit() + { + return getDataFactory().getTopDataType(); + } + + +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TopTester.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TopTester.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TopTester.java 2009-04-02 08:49:20 UTC (rev 1680) @@ -0,0 +1,142 @@ + + +package org.dllearner.tools.ore.explanation; + +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataAllRestriction; +import org.semanticweb.owl.model.OWLDataExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLDataSomeRestriction; +import org.semanticweb.owl.model.OWLDataValueRestriction; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLDescriptionVisitorEx; +import org.semanticweb.owl.model.OWLObjectAllRestriction; +import org.semanticweb.owl.model.OWLObjectComplementOf; +import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectIntersectionOf; +import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; +import org.semanticweb.owl.model.OWLObjectOneOf; +import org.semanticweb.owl.model.OWLObjectSelfRestriction; +import org.semanticweb.owl.model.OWLObjectSomeRestriction; +import org.semanticweb.owl.model.OWLObjectUnionOf; +import org.semanticweb.owl.model.OWLObjectValueRestriction; + + + +public class TopTester + implements OWLDescriptionVisitorEx<Boolean> +{ + + public TopTester() + { + bottomChecker = new BottomTester(); + } + + public Boolean visit(OWLClass desc) + { + return Boolean.valueOf(desc.isOWLThing()); + } + + public Boolean visit(OWLObjectIntersectionOf desc) + { + for(OWLDescription op : desc.getOperands()){ + if(!((Boolean)op.accept(this)).booleanValue()){ + return Boolean.valueOf(false); + } + } + + return Boolean.valueOf(true); + } + + public Boolean visit(OWLObjectUnionOf desc) + { + for(OWLDescription op : desc.getOperands()){ + if(((Boolean)op.accept(this)).booleanValue()){ + return Boolean.valueOf(true); + } + } + + return Boolean.valueOf(false); + } + + public Boolean visit(OWLObjectComplementOf desc) + { + return (Boolean)desc.getOperand().accept(bottomChecker); + } + + public Boolean visit(OWLObjectSomeRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLObjectAllRestriction desc) + { + return (Boolean)((OWLDescription)desc.getFiller()).accept(this); + } + + public Boolean visit(OWLObjectValueRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLObjectMinCardinalityRestriction desc) + { + return Boolean.valueOf(desc.getCardinality() == 0); + } + + public Boolean visit(OWLObjectExactCardinalityRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLObjectMaxCardinalityRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLObjectSelfRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLObjectOneOf desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLDataSomeRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLDataAllRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLDataValueRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLDataMinCardinalityRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLDataExactCardinalityRestriction desc) + { + return Boolean.valueOf(false); + } + + public Boolean visit(OWLDataMaxCardinalityRestriction desc) + { + return Boolean.valueOf(false); + } + + + + private BottomTester bottomChecker; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-01 13:20:27
|
Revision: 1679 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1679&view=rev Author: jenslehmann Date: 2009-04-01 13:20:18 +0000 (Wed, 01 Apr 2009) Log Message: ----------- - continued manual => not in draft status anymore => please report any issues, typos, omissions you find Modified Paths: -------------- trunk/doc/manual/manual.tex trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java Modified: trunk/doc/manual/manual.tex =================================================================== --- trunk/doc/manual/manual.tex 2009-04-01 11:59:16 UTC (rev 1678) +++ trunk/doc/manual/manual.tex 2009-04-01 13:20:18 UTC (rev 1679) @@ -23,7 +23,7 @@ \urldef{\owlapi}{\url}{http://owlapi.sourceforge.net} \urldef{\dig}{\url}{http://dl.kr.org/dig/} -\title{DL-Learner Manual [Draft]} +\title{DL-Learner Manual} \author{Jens Lehmann} \pagestyle{scrheadings} @@ -81,7 +81,7 @@ more accurate (83,33%) class expression found: male solutions (at most 20 are shown): 1: (male and hasChild some Thing) (accuracy 100%, length 5, depth 3) -Algorithm terminated succesfully. +Algorithm terminated successfully. number of retrievals: 4 retrieval reasoning time: 0ms (0ms per retrieval) @@ -151,12 +151,12 @@ \subsection{Learning Problems} -In the introductory Sections \ref{sec:whatis} and \ref{sec:start}, we described a specific learning problem where positive and negative examples are given. In practice different variations of similar problems occur. You can switch between the different problems using \verb|problem=$value;|, where \verb|$value| is one of \verb|posNegDefinitionLP|, \verb|posOnlyDefinitionLP|, \verb|classLearning|. The default is \verb|posNegDefinitionLP|. \todo{Names may change in next release.} +In the introductory Sections \ref{sec:whatis} and \ref{sec:start}, we described a specific learning problem where positive and negative examples are given. In practice different variations of similar problems occur. You can switch between the different problems using \verb|problem=$value;|, where \verb|$value| is one of \verb|posNegLPStandard|, \verb|posOnlyLP|, \verb|classLearning|. The default is \verb|posNegLPStandard|. \begin{description} - \item[Positive and Negative Examples] Let the name of the background ontology be $\mathcal{O}$. The goal in this learning problem is to find an OWL class expression $C$ such that all/many positive examples are instances of $C$ w.r.t.~$\mathcal{O}$ and none/few negative examples are instances of $C$ w.r.t.~$\mathcal{O}$. As explained previously, $C$ should be learned such that it generalises to unseen individuals and is readable. The important configuration options of this component are obviously the positive and negative examples, which are often indicated with \verb|+| and \verb|-| signs in conf files as an optional shortcut to using e.g.~\verb|posNegDefinitionLP.positiveExamples = {...}|. + \item[Positive and Negative Examples] Let the name of the background ontology be $\mathcal{O}$. The goal in this learning problem is to find an OWL class expression $C$ such that all/many positive examples are instances of $C$ w.r.t.~$\mathcal{O}$ and none/few negative examples are instances of $C$ w.r.t.~$\mathcal{O}$. As explained previously, $C$ should be learned such that it generalises to unseen individuals and is readable. The important configuration options of this component are obviously the positive and negative examples, which are often indicated with \verb|+| and \verb|-| signs in conf files as an optional shortcut to using e.g.~\verb|posNegLPStandard.positiveExamples = {...}|. \item[Positive Examples] This learning problem is similar to the one before, but without negative examples. In this case, it is desirable to find a class expression which closely fits the positive examples while still generalising sufficiently well. For instance, you usually do not want to have \verb|owl:Thing| as a solution for this problem, but neither do you want to have an enumeration of all examples. - \item[Class Learning] In class learning, you are given an existing class $A$ within your ontology $\mathcal{O}$ and want to describe it. It is similar to the previous problem in that you can use the instances of the class as positive examples. However, there are some differences, e.g.~you do not want to have $A$ itself as a proposed solution of the problem, and since this is an ontology engineering task, the focus on short and readable class expressions is stronger than for the two problems mentioned before. \todo{This learning problem is under construction, but will be implemented soon.} + \item[Class Learning] In class learning, you are given an existing class $A$ within your ontology $\mathcal{O}$ and want to describe it. It is similar to the previous problem in that you can use the instances of the class as positive examples. However, there are some differences, e.g.~you do not want to have $A$ itself as a proposed solution of the problem, and since this is an ontology engineering task, the focus on short and readable class expressions is stronger than for the two problems mentioned before. The learner can also take advantage of existing knowledge about the class to describe. \end{description} \subsection{Learning Algorithms} @@ -178,8 +178,8 @@ \item maximum execution time: If there is no perfect solution of a given problem, the algorithm can potentially run forever (in practice it will run out of memory). It is therefore often interesting to limit the execution time. You can use e.g.~\verb|refinement.maxExecutionTimeInSeconds = 100| to say that the algorithm should run for at most 100 seconds. Often, it will run slightly longer than the maximum execution time since it waits for the next internal loop of the algorithm to stop gracefully. \end{itemize} The algorithm supports a range of further options. For instance, one can specify which classes and properties must not occur in resulting class expressions. - \item[Refinement II] The previous algorithm has been extended to make more sophisticated use of background knowledge and therefore run more efficiently on many problems. It also supports double datatypes and hasValue restrictions (which again can be turned on or off as desired). It also includes explicit noise handling through the \verb|noisePercentage| option. This is currently the default and recommend algorithm for learning from positive and negative examples. More than 30 options can be set to control its behaviour. However, apart from the target language the most important setting is noise, which should be optimised for the given problem. \todo{noisePercentage will be renamed to to minAccuracy which describes it better} - \item[Class Expression Learning for Ontology Engineering (CELOE)] \todo{This algorithm is under construction.} + \item[Refinement II] The previous algorithm has been extended to make more sophisticated use of background knowledge and therefore run more efficiently on many problems. It also supports double datatypes and hasValue restrictions (which again can be turned on or off as desired). It also includes explicit noise handling through the \verb|noisePercentage| option. This is currently the default and recommend algorithm for learning from positive and negative examples. More than 30 options can be set to control its behaviour. However, apart from the target language the most important setting is noise, which should be optimised for the given problem. + \item[Class Expression Learning for Ontology Engineering (CELOE)] Currently CELOE is the best class learning algorithm available within DL-Learner. It uses the same refinement operator as Refinement II, but a completely different heuristics. Furthermore, it guarantees that the returned class expressions are minimal in the sense that one cannot remove parts of them without getting an inequivalent expression. Furthermore, it makes use of existing background knowledge in coverage checks. Statistical methods are used to improve the efficiency of the algorithm such that it scales to large knowledge bases. While it was originally designed for ontology engineering, it can also be used for other learning problems and might even be superior to the other algorithms in many cases (not well-tested yet). Note that many configuration options of Refinement II were dropped for the sake of simplicity, but might be introduced if needed. \end{description} Please note that while components are interchangeable, it is not possible to arbitrarily combine them. For instance, the newer learning algorithms do not work with the DIG interface, since it does not provide the necessary inference tasks. Furthermore, a learning algorithm can specify which learning problems it can solve, i.e.~we do not require it to be able to solve each learning problem. Table \ref{tab:la_lp_comp} provides a compatibility matrix. Note that this can change in future releases, because algorithms may be extended to support new learning problems or drop support for them. @@ -209,7 +209,7 @@ Apart from the command line, there is also a prototypical graphical interface. You can use \verb|gui| (or \verb|gui.bat|) to start it. Optionally, a conf file can be passed as argument. The main GUI window has four tabs corresponding to the four different types of components and a run tab to execute the learning algorithm. Using the GUI, you can assemble the desired combination of components and options. The \verb|File| menu allows you to load a conf file or save the current configuration to a conf file. The GUI implementation is currently prototypical, so please report any bugs or feature requests you have (see Section \ref{sec:contact}). Since the GUI uses the component manager, it will automatically evolve when new components and options are added. -A third interface through which DL-Learner can be accessed programmatically is a web service. You can execute \verb|ws| (or \verb|ws.bat|) to start the web service. It is based on the Java API for XML Web Services (JAX-WS), which is included in Java 6 or higher. Executing the command will start a web server on port 8181 of your local machine. The WSDL can be accessed via \url{http://localhost:8181/services?wsdl}. You can use a WSDL viewer to see the supported operations or view the JavaDoc of the corresponding Java file\footnote{viewable online at \wsjavadoc}. Some examples for calling the web service from PHP can be found in the DL-Learner subversion repository\footnote{in the directory src/php-examples/:\\ \wsphpexamples}.\todo{Javadoc of web service needs to be improved} +A third interface through which DL-Learner can be accessed programmatically is a web service. You can execute \verb|ws| (or \verb|ws.bat|) to start the web service. It is based on the Java API for XML Web Services (JAX-WS), which is included in Java 6 or higher. Executing the command will start a web server on port 8181 of your local machine. The WSDL can be accessed via \url{http://localhost:8181/services?wsdl}. You can use a WSDL viewer to see the supported operations or view the JavaDoc of the corresponding Java file\footnote{viewable online at \wsjavadoc}. Some examples for calling the web service from PHP can be found in the DL-Learner subversion repository\footnote{in the directory src/php-examples/:\\ \wsphpexamples}. Another means to access DL-Learner, in particular for ontology engineering, is to use the OntoWiki and Protégé plugins. The OntoWiki plugin is not officially released yet, but can be used in the SVN version of OntoWiki. The Protégé 4 plugin can be installed either by downloading it from the DL-Learner download page or directly within Protégé 4 by clicking on ``File'', ``Preferences'', ``Plugins'', ``Check for Downloads'' now and selecting the DL-Learner plugin. For more information and a screencast see the Protégé plugin wiki page \footnote{\wikiprotplugin}. @@ -246,8 +246,8 @@ \item boolean, e.g. \verb|useCache| \item string (a set of allowed strings can be specified), e.g. \verb|cacheDir| \item URL, e.g. \verb|reasonerURL| - \item int (min and max value can be specifified), e.g. \verb|maxDepth| - \item double (min and max value can be specifified), e.g. \verb|noisePercentage| + \item int (min and max value can be specified), e.g. \verb|maxDepth| + \item double (min and max value can be specified), e.g. \verb|noisePercentage| \item set of strings, e.g. \verb|positiveExamples| \item list of string tuples, e.g. \verb|replaceObject| \end{itemize} Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2009-04-01 11:59:16 UTC (rev 1678) +++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2009-04-01 13:20:18 UTC (rev 1679) @@ -286,7 +286,7 @@ if (stop) { logger.info("Algorithm stopped ("+descriptionTests+" descriptions tested).\n"); } else { - logger.info("Algorithm terminated succesfully ("+descriptionTests+" descriptions tested).\n"); + logger.info("Algorithm terminated successfully ("+descriptionTests+" descriptions tested).\n"); } // print solution(s) Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java 2009-04-01 11:59:16 UTC (rev 1678) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java 2009-04-01 13:20:18 UTC (rev 1679) @@ -536,7 +536,7 @@ if (stop) { logger.info("Algorithm stopped ("+conceptTests+" descriptions tested).\n"); } else { - logger.info("Algorithm terminated succesfully ("+conceptTests+" descriptions tested).\n"); + logger.info("Algorithm terminated successfully ("+conceptTests+" descriptions tested).\n"); } totalLearningTime.stop(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-01 11:59:26
|
Revision: 1678 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1678&view=rev Author: jenslehmann Date: 2009-04-01 11:59:16 +0000 (Wed, 01 Apr 2009) Log Message: ----------- simple match finder for Auerbachs Keller Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-04-01 11:17:54 UTC (rev 1677) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-04-01 11:59:16 UTC (rev 1678) @@ -19,7 +19,12 @@ */ package org.dllearner.scripts.matching; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.net.URI; +import java.net.URL; +import java.net.URLConnection; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; @@ -36,13 +41,15 @@ */ public class DBpediaLinkedGeoData { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { // we start from the DBpedia URI and try to find the corresponding // OSM URI (assuming that each location having coordinates in Wikipedia also // exists in OSM) URI dbpediaURI = URI.create("http://dbpedia.org/resource/Auerbachs_Keller"); + int distanceThresholdMeters = 100; + // use official DBpedia endpoint (switch to db0 later) SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpedia(); SPARQLTasks st = new SPARQLTasks(endpoint); @@ -60,6 +67,27 @@ System.out.println("lat: " + geoLat + ", long: " + geoLong); + URL linkedGeoDataURL = new URL("http://linkedgeodata.org/triplify/near/"+geoLat+","+geoLong+"/"+distanceThresholdMeters); + + // TODO: replace by SPARQL query + + URLConnection conn = linkedGeoDataURL.openConnection(); + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); + StringBuffer sb = new StringBuffer(); + String line=""; +// int pointID = 0; + while ((line = rd.readLine()) != null) + { + if(line.contains("Auerbach")) { + System.out.println(line); + } + + sb.append(line); + } + rd.close(); + +// System.out.println(sb.toString()); + } } Added: trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/OSMPoint.java 2009-04-01 11:59:16 UTC (rev 1678) @@ -0,0 +1,96 @@ +/** + * Copyright (C) 2007-2009, 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.matching; + +/** + * @author Jens Lehmann + * + */ +public class OSMPoint { + + private long id; + + private double geoLat; + + private double geoLong; + + private double name; + + public OSMPoint(long id) { + this.id = id; + } + + /** + * @return the geoLat + */ + public double getGeoLat() { + return geoLat; + } + + /** + * @param geoLat the geoLat to set + */ + public void setGeoLat(double geoLat) { + this.geoLat = geoLat; + } + + /** + * @return the geoLong + */ + public double getGeoLong() { + return geoLong; + } + + /** + * @param geoLong the geoLong to set + */ + public void setGeoLong(double geoLong) { + this.geoLong = geoLong; + } + + /** + * @return the name + */ + public double getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(double name) { + this.name = name; + } + + /** + * @return the id + */ + public long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(long id) { + this.id = id; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-01 11:18:07
|
Revision: 1677 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1677&view=rev Author: jenslehmann Date: 2009-04-01 11:17:54 +0000 (Wed, 01 Apr 2009) Log Message: ----------- cleaned up SparqlQuery class (might break existing code) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/test/JenaQueryToResultSpeedTest.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2009-04-01 11:01:11 UTC (rev 1676) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2009-04-01 11:17:54 UTC (rev 1677) @@ -278,13 +278,13 @@ readTime.stop(); if (result != null) { - query.setJson(result); +// query.setJson(result); +// +// query.setRunning(false); +// SparqlQuery.writeToSparqlLog("***********\nJSON retrieved from cache"); +// SparqlQuery.writeToSparqlLog("wget -S -O - '\n"+query.getSparqlEndpoint().getHTTPRequest()); +// SparqlQuery.writeToSparqlLog(query.getSparqlQueryString()); - query.setRunning(false); - SparqlQuery.writeToSparqlLog("***********\nJSON retrieved from cache"); - SparqlQuery.writeToSparqlLog("wget -S -O - '\n"+query.getSparqlEndpoint().getHTTPRequest()); - SparqlQuery.writeToSparqlLog(query.getSparqlQueryString()); - //SparqlQuery.writeToSparqlLog("JSON: "+result); JamonMonitorLogger.increaseCount(Cache.class, "SuccessfulHits"); @@ -295,7 +295,8 @@ String json = query.getJson(); if (json!=null){ addToCache(query.getSparqlQueryString(), json); - SparqlQuery.writeToSparqlLog("result added to cache: "+json); +// SparqlQuery.writeToSparqlLog("result added to cache: "+json); + logger.debug("result added to SPARQL cache: "+json); result=json; //query.setJson(result); } else { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-04-01 11:01:11 UTC (rev 1676) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-04-01 11:17:54 UTC (rev 1677) @@ -479,14 +479,8 @@ * @return jena ResultSet */ public ResultSetRewindable queryAsResultSet(String sparqlQueryString) { - return SparqlQuery.convertJSONtoResultSet(query(sparqlQueryString)); - - } - - public ResultSet queryAsResultSet2(String sparqlQueryString) { SparqlQuery sq = new SparqlQuery(sparqlQueryString, sparqlEndpoint); - sq.send(); - return sq.getResultSet(); + return sq.send(); } /** Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2009-04-01 11:01:11 UTC (rev 1676) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2009-04-01 11:17:54 UTC (rev 1677) @@ -35,13 +35,13 @@ import com.hp.hpl.jena.query.ResultSetFactory; import com.hp.hpl.jena.query.ResultSetFormatter; import com.hp.hpl.jena.query.ResultSetRewindable; -import com.hp.hpl.jena.sparql.engine.http.HttpQuery; import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; import com.jamonapi.Monitor; /** * Represents one SPARQL query. It includes support for stopping the SPARQL - * query (which may be necessary if a timeout is reached). + * query (which may be necessary if a timeout is reached) and is designed to be + * able to run a query in a separate thread. * * @author Jens Lehmann * @author Sebastian Hellmann @@ -50,11 +50,16 @@ public class SparqlQuery { private static boolean logDeletedOnStart = false; - + private static Logger logger = Logger.getLogger(SparqlQuery.class); + + // additional file for logging SPARQL queries etc. + private static String sparqlLog = "log/sparql.txt"; + // whether the query is currently running private boolean isRunning = false; + // whether the query has been executed private boolean wasExecuted = false; private String sparqlQueryString; @@ -63,13 +68,15 @@ private SparqlEndpoint sparqlEndpoint; - private String json = null; + private ResultSetRewindable rs; /** * Standard constructor. * - * @param sparqlQueryString A SPARQL query string - * @param sparqlEndpoint An Endpoint object + * @param sparqlQueryString + * A SPARQL query string + * @param sparqlEndpoint + * An Endpoint object */ public SparqlQuery(String sparqlQueryString, SparqlEndpoint sparqlEndpoint) { // QUALITY there seems to be a bug in ontowiki @@ -78,81 +85,63 @@ } /** - * Sends a SPARQL query using the Jena library. main format is JSON, use - * method getasjson + * Sends a SPARQL query using the Jena library. * */ - public void send(){ - wasExecuted = true; - // isRunning = true; - - ResultSet rs; + public ResultSetRewindable send() { + isRunning = true; + String service = sparqlEndpoint.getURL().toString(); - + writeToSparqlLog("***********\nNew Query:"); - SparqlQuery.writeToSparqlLog("wget -S -O - '\n"+sparqlEndpoint.getHTTPRequest()); + SparqlQuery.writeToSparqlLog("wget -S -O - '\n" + sparqlEndpoint.getHTTPRequest()); writeToSparqlLog(sparqlQueryString); - - logger.trace("making queryExecution Object"); - // Jena access to SPARQL endpoint + queryExecution = new QueryEngineHTTP(service, sparqlQueryString); - //System.out.println(sparqlEndpoint.getDefaultGraphURIs()); - - + + // add default and named graphs for (String dgu : sparqlEndpoint.getDefaultGraphURIs()) { queryExecution.addDefaultGraph(dgu); } for (String ngu : sparqlEndpoint.getNamedGraphURIs()) { queryExecution.addNamedGraph(ngu); } - // TODO remove after overnext Jena release - HttpQuery.urlLimit = 3 * 1024; - Monitor httpTime = JamonMonitorLogger.getTimeMonitor(SparqlQuery.class, "httpTime").start(); - - //TODO correct Bug: when there is a & in the result like in the - //URL: http://www.discusmedia.com/catalog.php?catID=5.2.2&profile=map - //the XML Parser throws an error, because he thinks &profile is an html entitie - //but it doesn't end with an ; - //the & must be masked to an & but I am not sure at the moment how to do that - try{ - + + Monitor httpTime = JamonMonitorLogger.getTimeMonitor(SparqlQuery.class, "sparql query time").start(); + + try { logger.debug("sending query: length: " + sparqlQueryString.length() + " | ENDPOINT: " + sparqlEndpoint.getURL().toString()); - rs = queryExecution.execSelect(); - - logger.trace("query executed, converting to json"); - json = SparqlQuery.convertResultSetToJSON(ResultSetFactory.makeRewindable(rs)); - logger.trace(json); - //writeToSparqlLog("JSON: " + json); - //}catch (ResultSetException e) { + // we execute the query and store the result in a rewindable result set + ResultSet tmp = queryExecution.execSelect(); + rs = ResultSetFactory.makeRewindable(tmp); } catch (HTTPException e) { - logger.debug("HTTPException in SparqlQuery\n"+ e.toString()); - logger.debug("query was "+ sparqlQueryString); - writeToSparqlLog("ERROR: HTTPException occured"+ e.toString()); + logger.debug("HTTPException in SparqlQuery\n" + e.toString()); + logger.debug("query was " + sparqlQueryString); + writeToSparqlLog("ERROR: HTTPException occured" + e.toString()); isRunning = false; throw e; - - }catch (RuntimeException e) { - - if(logger.isDebugEnabled()) { - logger.debug("RuntimeException in SparqlQuery (see /log/sparql.txt): "+ e.toString()); - int length = Math.min(sparqlQueryString.length(), 300); - logger.debug("query was (max. 300 chars displayed) "+ sparqlQueryString.substring(0,length-1).replaceAll("\n", " ")); + // TODO: RuntimeException is very general; is it possible to catch more specific exceptions? + } catch (RuntimeException e) { + if (logger.isDebugEnabled()) { + logger.debug("RuntimeException in SparqlQuery (see /log/sparql.txt): " + + e.toString()); + int length = Math.min(sparqlQueryString.length(), 300); + logger.debug("query was (max. 300 chars displayed) " + + sparqlQueryString.substring(0, length - 1).replaceAll("\n", " ")); } - writeToSparqlLog("ERROR: HTTPException occured: "+ e.toString()); + writeToSparqlLog("ERROR: HTTPException occured: " + e.toString()); isRunning = false; throw e; } - - // there is a minor issue here: Jamon now also measures ResultsetConversion - // the code would need a second try catch block to handle it correctly + httpTime.stop(); - isRunning = false; + isRunning = false; + wasExecuted = true; + return rs; } - - /** * Stops the execution of the query. */ @@ -163,6 +152,7 @@ /** * Gets the String representation of the SPARQL query. + * * @return sparqlQueryString */ public String getSparqlQueryString() { @@ -185,111 +175,59 @@ } /** - * @return the Jena QueryEngineHTTP - */ - // ANY NEED TO GET THIS FROM OUTSIDE? - @Deprecated - public QueryEngineHTTP getExecution() { - return queryExecution; - } - - /** - * insert a result, e.g. from the cache - * @param json a jsonString - */ - // LOOKS LIKE A HACK - @Deprecated - public void setJson(String json) { - this.wasExecuted = true; - this.json = json; - } - - /** - * @param running s.e. - */ - // SHOULD NOT BE SET FROM OUTSIDE - @Deprecated - public void setRunning(boolean running) { - this.isRunning = running; - } - - /** - * returns the Result of the query as JSON string executes the query if it - * wasn't executed before. + * Return the result in JSON format. * - * @return a JSON string + * @return A JSON string converted from the result set or null + * if the query has not been executed. */ - // WHY NOT EXECUTE SEND() AND THEN CALL THIS METHOD? - // returning null seems safer instead of executing the query (again) - @Deprecated public String getJson() { - if (!wasExecuted) { - this.send(); + if(wasExecuted) { + return convertResultSetToJSON(rs); + } else { + return null; } - return json; } /** - * makes a ResultSet from the Json String, depends on getJSON. + * Converts the result set to an XML string. * - * @return a Jena ResultSet - */ - // SHOULD BE A SIMPLE GETTER SINCE RESULTSET IS MAIN JENA STRUCTURE - public ResultSet getResultSet() { - return (getJson() == null) ? null : convertJSONtoResultSet(json); - } - - /** - * makes an XML String from the Json String, depends on getJSON. - * * @return An XML String */ - // SHOULD CONVERT FROM RESULTSET public String getXMLString() { - return (getJson() == null) ? null : convertJSONtoXML(json); + if(wasExecuted) { + return convertResultSetToXMLString(rs); + } else { + return null; + } } /** - * Special log for debugging SPARQL query execution. - * It lives here: "log/sparql.txt" - * if the directory doesn't exist, there could be an error. - * @param s the String to log + * Special log for debugging SPARQL query execution. It lives here: + * "log/sparql.txt" if the directory doesn't exist, there could be an error. + * + * @param s + * the String to log */ - public static void writeToSparqlLog(String s) { - - if(!logDeletedOnStart){ - Files.createFile(new File("log/sparql.txt"),s+"\n"); + private static void writeToSparqlLog(String s) { + if (!logDeletedOnStart) { + Files.createFile(new File(sparqlLog), s + "\n"); logDeletedOnStart = true; - }else{ - Files.appendFile(new File("log/sparql.txt"), s+"\n"); + } else { + Files.appendFile(new File(sparqlLog), s + "\n"); } - - /*try { - - FileWriter fw = new FileWriter("log/sparql.txt", logDeletedOnStart); - logDeletedOnStart = true; - fw.write(s + "\n"); - fw.flush(); - fw.close(); - } catch (Exception e) { - e.printStackTrace(); - // make the e object more special FileNotFound?? - //new File("log").mkdir(); - //writeToSparqlLog(s); - }*/ } - /** - * Converts Jena result set to XML. - * To make a ResultSet rewindable use: - * ResultSetRewindable rsRewind = ResultSetFactory.makeRewindable(resultSet); - * @param resultSet The result set to transform, must be rewindable to prevent errors. + * Converts Jena result set to XML. To make a ResultSet rewindable use: + * ResultSetRewindable rsRewind = + * ResultSetFactory.makeRewindable(resultSet); + * + * @param resultSet + * The result set to transform, must be rewindable to prevent + * errors. * @return String xml */ public static String convertResultSetToXMLString(ResultSetRewindable resultSet) { - // if (rs == null) - // this.send(); String retVal = ResultSetFormatter.asXMLString(resultSet); resultSet.reset(); return retVal; @@ -297,11 +235,10 @@ /** * Converts Jena result set to JSON. - * To make a ResultSet rewindable use: - * ResultSetRewindable rsRewind = ResultSetFactory.makeRewindable(resultSet); * * @param resultSet - * The result set to transform, must be rewindable to prevent errors. + * The result set to transform, must be rewindable to prevent + * errors. * @return JSON representation of the result set. */ public static String convertResultSetToJSON(ResultSetRewindable resultSet) { @@ -340,5 +277,5 @@ public static String convertJSONtoXML(String json) { return convertResultSetToXMLString(convertJSONtoResultSet(json)); } - + } Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-04-01 11:01:11 UTC (rev 1676) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-04-01 11:17:54 UTC (rev 1677) @@ -23,7 +23,6 @@ import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; -import org.dllearner.kb.sparql.SparqlQuery; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; @@ -54,7 +53,7 @@ query += "<" + dbpediaURI + "> <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long . } LIMIT 1"; // perform query and read lat and long from results - ResultSet results = st.queryAsResultSet2(query); + ResultSet results = st.queryAsResultSet(query); QuerySolution qs = results.nextSolution(); String geoLat = qs.getLiteral("lat").getString(); String geoLong = qs.getLiteral("long").getString(); Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-04-01 11:01:11 UTC (rev 1676) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-04-01 11:17:54 UTC (rev 1677) @@ -828,15 +828,11 @@ @Override public void run() { if (ks.isUseCache()){ - state.getQuery(id).setRunning(true); Cache cache=new Cache(ks.getCacheDir()); cache.executeSparqlQuery(state.getQuery(id)); - state.getQuery(id).setRunning(false); } else{ - state.getQuery(id).setRunning(true); state.getQuery(id).send(); - state.getQuery(id).setRunning(false); } } }; Modified: trunk/src/dl-learner/org/dllearner/test/JenaQueryToResultSpeedTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/JenaQueryToResultSpeedTest.java 2009-04-01 11:01:11 UTC (rev 1676) +++ trunk/src/dl-learner/org/dllearner/test/JenaQueryToResultSpeedTest.java 2009-04-01 11:17:54 UTC (rev 1677) @@ -22,6 +22,7 @@ import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlQuery; +import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSetFormatter; @@ -82,8 +83,8 @@ for (int i = 0; i < howOften; i++) { // sqJena.getAsList(); - sqJena.send(); - ResultSetFormatter.toList(sqJena.getResultSet()); + ResultSet rs = sqJena.send(); + ResultSetFormatter.toList(rs); p("Jena as List needed: " + (System.currentTimeMillis() - tmp)); tmp = System.currentTimeMillis(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-01 11:01:22
|
Revision: 1676 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1676&view=rev Author: lorenz_b Date: 2009-04-01 11:01:11 +0000 (Wed, 01 Apr 2009) Log Message: ----------- classification output on console disabled for pellet Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-01 10:14:48 UTC (rev 1675) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-01 11:01:11 UTC (rev 1676) @@ -69,6 +69,7 @@ import org.dllearner.utilities.owl.OWLAPIConverter; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.dllearner.utilities.owl.RoleComparator; +import org.mindswap.pellet.PelletOptions; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasoner; import org.semanticweb.owl.inference.OWLReasonerException; @@ -293,6 +294,8 @@ // instantiate Pellet reasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + //set classification output to "none", while default is "console" + PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.valueOf("NONE"); // change log level to WARN for Pellet, because otherwise log // output will be very large Logger pelletLogger = Logger.getLogger("org.mindswap.pellet"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-01 10:14:59
|
Revision: 1675 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1675&view=rev Author: jenslehmann Date: 2009-04-01 10:14:48 +0000 (Wed, 01 Apr 2009) Log Message: ----------- - unified component names of web service and command line (script updates may be needed) - started Javadoc of web service Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java trunk/src/dl-learner/org/dllearner/server/ClientState.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-examples/LearningSimple.php trunk/src/php-examples/LearningThreaded.php Modified: trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java 2009-04-01 09:45:26 UTC (rev 1674) +++ trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java 2009-04-01 10:14:48 UTC (rev 1675) @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; +import java.util.TreeSet; import java.util.Map.Entry; import org.dllearner.algorithms.BruteForceLearner; @@ -53,6 +54,10 @@ * Developer please edit the buildMappings() function to add new * CLI mappings. * + * TODO: For the web service, it may be interesting to hide some components + * and/or configuration options or even limit the maximum value of certain + * options. + * * @author Jens Lehmann * */ @@ -70,6 +75,9 @@ private static Map<String,Class<? extends Component>> componentTypeMapping = new TreeMap<String,Class<? extends Component>>(); private static Map<Class<? extends Component>, String> inverseTypeMapping = new HashMap<Class<? extends Component>,String>(); + // set of available components + private static Set<String> components = new TreeSet<String>(); + public ConfMapper() { buildMappings(); buildKeys(); @@ -107,6 +115,8 @@ for(Entry<String, Class<? extends Component>> entry : componentMapping.entrySet()) { inverseMapping.put(entry.getValue(), entry.getKey()); } + + components = componentTypeMapping.keySet(); } private static void buildKeys() { @@ -172,7 +182,7 @@ } public Set<String> getComponents() { - return componentMapping.keySet(); + return components; } } Modified: trunk/src/dl-learner/org/dllearner/server/ClientState.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/ClientState.java 2009-04-01 09:45:26 UTC (rev 1674) +++ trunk/src/dl-learner/org/dllearner/server/ClientState.java 2009-04-01 10:14:48 UTC (rev 1675) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-04-01 09:45:26 UTC (rev 1674) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-04-01 10:14:48 UTC (rev 1675) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -39,11 +39,7 @@ import org.apache.log4j.Logger; import org.dllearner.Info; -import org.dllearner.algorithms.BruteForceLearner; -import org.dllearner.algorithms.RandomGuesser; -import org.dllearner.algorithms.gp.GP; -import org.dllearner.algorithms.refinement.ROLearner; -import org.dllearner.algorithms.refinement2.ROLComponent2; +import org.dllearner.cli.ConfMapper; import org.dllearner.core.Component; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; @@ -58,7 +54,6 @@ import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.Cache; import org.dllearner.kb.sparql.NaturalLanguageDescriptionConvertVisitor; import org.dllearner.kb.sparql.SPARQLTasks; @@ -66,19 +61,17 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.kb.sparql.SparqlQueryDescriptionConvertVisitor; import org.dllearner.kb.sparql.SparqlQueryException; -import org.dllearner.learningproblems.PosNegLPStandard; -import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; -import org.dllearner.reasoning.DIGReasoner; -import org.dllearner.reasoning.FastInstanceChecker; -import org.dllearner.reasoning.OWLAPIReasoner; -import org.dllearner.utilities.Helper; import org.dllearner.utilities.datastructures.Datastructures; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; /** - * DL-Learner web service interface. + * DL-Learner web service interface. The web service makes use of the component + * architecture of DL-Learner (see + * <a href="http://dl-learner.org/wiki/Architecture">architecture wiki page</a>), + * i.e. it allows to create, configure and run components. In addition, it provides + * access to some reasoning and querying methods. * * @author Jens Lehmann * @@ -87,41 +80,13 @@ @SOAPBinding(style = SOAPBinding.Style.RPC) public class DLLearnerWS { - @SuppressWarnings("unused") - private static Logger logger = Logger - .getLogger(DLLearnerWS.class); + private static Logger logger = Logger.getLogger(DLLearnerWS.class); private Map<Integer, ClientState> clients = new TreeMap<Integer,ClientState>(); private Random rand=new Random(); private static ComponentManager cm = ComponentManager.getInstance(); + private static ConfMapper confMapper = new ConfMapper(); - // defines the components, which are accessible for the web service - private static Map<String,Class<? extends KnowledgeSource>> knowledgeSourceMapping = new TreeMap<String,Class<? extends KnowledgeSource>>(); - private static Map<String,Class<? extends ReasonerComponent>> reasonerMapping = new TreeMap<String,Class<? extends ReasonerComponent>>(); - private static Map<String,Class<? extends LearningProblem>> learningProblemMapping = new TreeMap<String,Class<? extends LearningProblem>>(); - private static Map<String,Class<? extends LearningAlgorithm>> learningAlgorithmMapping = new TreeMap<String,Class<? extends LearningAlgorithm>>(); - private static Set<String> components; - - public DLLearnerWS() { - // TODO maybe use ConfMapper (one could add methods there for removing - // certain components, which should not be accessible by the web service) - knowledgeSourceMapping.put("owlfile", OWLFile.class); - knowledgeSourceMapping.put("sparql", SparqlKnowledgeSource.class); - reasonerMapping.put("dig", DIGReasoner.class); - reasonerMapping.put("owlapi", OWLAPIReasoner.class); - reasonerMapping.put("fastInstanceChecker", FastInstanceChecker.class); - learningProblemMapping.put("posNegDefinition", PosNegLPStandard.class); - learningProblemMapping.put("posOnlyDefinition", PosOnlyLP.class); - learningAlgorithmMapping.put("random", RandomGuesser.class); - learningAlgorithmMapping.put("bruteForce", BruteForceLearner.class); - learningAlgorithmMapping.put("gp", GP.class); - learningAlgorithmMapping.put("refinement", ROLearner.class); - learningAlgorithmMapping.put("refexamples", ROLComponent2.class); - components = Helper.union(knowledgeSourceMapping.keySet(),reasonerMapping.keySet()); - components = Helper.union(components, learningProblemMapping.keySet()); - components = Helper.union(components, learningAlgorithmMapping.keySet()); - } - /** * Returns the DL-Learner version this web service is based on. * @return DL-Learner-Build. @@ -132,6 +97,16 @@ } /** + * Method to check whether web service is online and how fast it responses. + * This method simply returns true. + * @return Always returns true. + */ + @WebMethod + public boolean ping() { + return true; + } + + /** * Generates a unique ID for the client and initialises a session. * Using the ID the client can call the other web service methods. * Two calls to this method are guaranteed to return different results. @@ -142,70 +117,78 @@ public int generateID() { int id; do { - id = rand.nextInt(); + id = Math.abs(rand.nextInt()); } while(clients.containsKey(id)); clients.put(id, new ClientState()); + logger.info("New client " + id + " at DL-Learner web service."); return id; } - // returns session state or throws client not known exception - private ClientState getState(int id) throws ClientNotKnownException { - ClientState state = clients.get(id); - if(state==null) - throw new ClientNotKnownException(id); - return state; - } - - // returns the class which is referred to by the string - private Class<? extends Component> getComponent(String component) throws UnknownComponentException { - if(knowledgeSourceMapping.containsKey(component)) - return knowledgeSourceMapping.get(component); - else if(reasonerMapping.containsKey(component)) - return reasonerMapping.get(component); - else if(learningProblemMapping.containsKey(component)) - return learningProblemMapping.get(component); - else if(learningAlgorithmMapping.containsKey(component)) - return learningAlgorithmMapping.get(component); - else - throw new UnknownComponentException(component); - } - /////////////////////////////////////// // methods for basic component setup // /////////////////////////////////////// + /** + * Gets a list of all DL-Learner components accessible via this web service. + * @return All components accessible via this web service. + */ @WebMethod public String[] getComponents() { + Set<String> components = confMapper.getComponents(); return components.toArray(new String[components.size()]); } + /** + * Gets a list of all DL-Learner knowledge source components accessible via this web service. + * @return All knowledge source components accessible via this web service. + */ @WebMethod public String[] getKnowledgeSources() { - Set<String> knowledgeSources = knowledgeSourceMapping.keySet(); + Set<String> knowledgeSources = confMapper.getKnowledgeSources(); return knowledgeSources.toArray(new String[knowledgeSources.size()]); } + /** + * Gets a list of all DL-Learner reasoner components accessible via this web service. + * @return All reasoner components accessible via this web service. + */ @WebMethod public String[] getReasoners() { - Set<String> reasoners = reasonerMapping.keySet(); + Set<String> reasoners = confMapper.getReasoners(); return reasoners.toArray(new String[reasoners.size()]); } + /** + * Gets a list of all DL-Learner learning problem components accessible via this web service. + * @return All learning problem components accessible via this web service. + */ @WebMethod public String[] getLearningProblems() { - Set<String> learningProblems = learningProblemMapping.keySet(); + Set<String> learningProblems = confMapper.getLearningProblems(); return learningProblems.toArray(new String[learningProblems.size()]); } + /** + * Gets a list of all DL-Learner learning algorithm components accessible via this web service. + * @return All learning algorithm components accessible via this web service. + */ @WebMethod public String[] getLearningAlgorithms() { - Set<String> learningAlgorithms = learningAlgorithmMapping.keySet(); + Set<String> learningAlgorithms = confMapper.getLearningAlgorithms(); return learningAlgorithms.toArray(new String[learningAlgorithms.size()]); } + /** + * Gets the configuration options supported by the component. This allows e.g. to + * automatically build user interfaces for configuring components. + * @param component Name of the component. + * @param allInfo Whether or not complete information is desired (including option description, allowed values, default value). + * @return A list of configuration options supported by the component. + * @throws UnknownComponentException Thrown if component is not known (see {@link #getComponents()}). + */ @WebMethod public String[] getConfigOptions(String component, boolean allInfo) throws UnknownComponentException { - Class<? extends Component> componentClass = getComponent(component); + Class<? extends Component> componentClass = confMapper.getComponentClass(component); List<ConfigOption<?>> options = ComponentManager.getConfigOptions(componentClass); String[] optionsString = new String[options.size()]; for(int i=0; i<options.size(); i++) { @@ -223,13 +206,18 @@ /** * Adds a knowledge source. * + * @param id The session ID. + * @param component The name of the component. + * @param url The URL of the knowledge source. * @return An identifier for the component. - * @throws MalformedURLException + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException Thrown if component is not known (see {@link #getComponents()}). + * @throws MalformedURLException Thrown if passed URL is malformed. */ @WebMethod public int addKnowledgeSource(int id, String component, String url) throws ClientNotKnownException, UnknownComponentException, MalformedURLException { ClientState state = getState(id); - Class<? extends KnowledgeSource> ksClass = knowledgeSourceMapping.get(component); + Class<? extends KnowledgeSource> ksClass = confMapper.getKnowledgeSourceClass(component); if(ksClass == null) throw new UnknownComponentException(component); KnowledgeSource ks = cm.knowledgeSource(ksClass); @@ -237,15 +225,31 @@ return state.addKnowledgeSource(ks); } + /** + * Removes a knowledge source. + * + * @param id The session ID. + * @param componentID ID of knowledge source to remove. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public void removeKnowledgeSource(int id, int componentID) throws ClientNotKnownException { getState(id).removeKnowledgeSource(componentID); } + /** + * Sets the reasoner to use. + * + * @param id The session ID. + * @param component The name of the component. + * @return An identifier for the component. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException Thrown if component is not known (see {@link #getComponents()}). + */ @WebMethod public int setReasoner(int id, String component) throws ClientNotKnownException, UnknownComponentException { ClientState state = getState(id); - Class<? extends ReasonerComponent> rcClass = reasonerMapping.get(component); + Class<? extends ReasonerComponent> rcClass = confMapper.getReasonerComponentClass(component); if(rcClass == null) throw new UnknownComponentException(component); @@ -253,10 +257,19 @@ return state.setReasonerComponent(rc); } + /** + * Sets the learning problem to use. + * + * @param id The session ID. + * @param component The name of the component. + * @return An identifier for the component. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException Thrown if component is not known (see {@link #getComponents()}). + */ @WebMethod public int setLearningProblem(int id, String component) throws ClientNotKnownException, UnknownComponentException { ClientState state = getState(id); - Class<? extends LearningProblem> lpClass = learningProblemMapping.get(component); + Class<? extends LearningProblem> lpClass = confMapper.getLearningProblemClass(component); if(lpClass == null) throw new UnknownComponentException(component); @@ -264,10 +277,20 @@ return state.setLearningProblem(lp); } + /** + * Sets the learning algorithm to use. + * + * @param id The session ID. + * @param component The name of the component. + * @return An identifier for the component. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException Thrown if component is not known (see {@link #getComponents()}). + * @throws LearningProblemUnsupportedException Thrown if the learning problem is not supported by the specified learning algorithm. + */ @WebMethod public int setLearningAlgorithm(int id, String component) throws ClientNotKnownException, UnknownComponentException, LearningProblemUnsupportedException { ClientState state = getState(id); - Class<? extends LearningAlgorithm> laClass = learningAlgorithmMapping.get(component); + Class<? extends LearningAlgorithm> laClass = confMapper.getLearningAlgorithmClass(component); if(laClass == null) throw new UnknownComponentException(component); @@ -278,7 +301,7 @@ /** * Initialise all components. * @param id Session ID. - * @throws ComponentInitException + * @throws ComponentInitException Thrown if an error occurs during component initialisation. */ @WebMethod public void initAll(int id) throws ClientNotKnownException, ComponentInitException { @@ -294,7 +317,7 @@ * Initialise the specified component. * @param id Session-ID. * @param componentID Component-ID. - * @throws ClientNotKnownException Thrown if the client ID is nor registered. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. * @throws UnknownComponentException Thrown if the component is unknown. * @throws ComponentInitException */ @@ -312,7 +335,7 @@ * @param id Session ID. * @param format The format of the result string: "manchester", "kb", "dl". * @return The best solution found. - * @throws ClientNotKnownException + * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod public String learn(int id, String format) throws ClientNotKnownException { @@ -327,6 +350,16 @@ return solution.toString(); } + /** + * Returns a list of JSON encoded description including extra information + * (which partially depends on the learning problem) such as the accuracy + * of the learned description. + * + * @param id The session ID. + * @param limit Maximum number of results desired. + * @return A JSON string encoding learned descriptions. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public String learnDescriptionsEvaluated(int id, int limit) throws ClientNotKnownException { ClientState state = getState(id); @@ -349,7 +382,7 @@ * controlled using other Web Service methods. * * @param id Session ID. - * @throws ClientNotKnownException + * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod public void learnThreaded(int id) throws ClientNotKnownException { @@ -365,12 +398,26 @@ learningThread.start(); } + /** + * + * @param id The session ID. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public String getCurrentlyBestConcept(int id) throws ClientNotKnownException { ClientState state = getState(id); return state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescription().toString(); } + /** + * + * @param id The session ID. + * @param nrOfConcepts + * @param format + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public String[] getCurrentlyBestConcepts(int id, int nrOfConcepts, String format) throws ClientNotKnownException { ClientState state = getState(id); @@ -387,17 +434,42 @@ return conc.toArray(new String[conc.size()]); } + /** + * + * @param id The session ID. + * @param limit + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public String getCurrentlyBestEvaluatedDescriptions(int id, int limit) throws ClientNotKnownException{ return currentlyBestEvaluatedDescriptions(id,limit,-1,false); } + /** + * + * @param id The session ID. + * @param nrOfDescriptions + * @param accuracyThreshold + * @param filterNonMinimalDescriptions + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public String getCurrentlyBestEvaluatedDescriptionsFiltered(int id,int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions) throws ClientNotKnownException { return currentlyBestEvaluatedDescriptions(id,nrOfDescriptions,accuracyThreshold,filterNonMinimalDescriptions); } + /** + * + * @param id The session ID. + * @param nrOfDescriptions + * @param accuracyThreshold + * @param filterNonMinimalDescriptions + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ private String currentlyBestEvaluatedDescriptions(int id,int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions) throws ClientNotKnownException { ClientState state = getState(id); @@ -415,6 +487,12 @@ return json; } + /** + * + * @param id The session ID. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public boolean isAlgorithmRunning(int id) throws ClientNotKnownException { return getState(id).getLearningAlgorithm().isRunning(); @@ -422,8 +500,8 @@ /** * Stops the learning algorithm smoothly. - * @param id - * @throws ClientNotKnownException + * @param id The session ID. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod public void stop(int id) throws ClientNotKnownException { @@ -434,6 +512,12 @@ // methods for component configuration // ///////////////////////////////////////// + /** + * + * @param id The session ID. + * @param positiveExamples + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public void setPositiveExamples(int id, String[] positiveExamples) throws ClientNotKnownException { ClientState state = getState(id); @@ -441,6 +525,13 @@ cm.applyConfigEntry(state.getLearningProblem(), "positiveExamples", posExamples); } + + /** + * + * @param id The session ID. + * @param negativeExamples + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ @WebMethod public void setNegativeExamples(int id, String[] negativeExamples) throws ClientNotKnownException { ClientState state = getState(id); @@ -448,16 +539,44 @@ cm.applyConfigEntry(state.getLearningProblem(), "negativeExamples", negExamples); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @param value + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + */ @WebMethod public void applyConfigEntryInt(int sessionID, int componentID, String optionName, Integer value) throws ClientNotKnownException, UnknownComponentException { applyConfigEntry(sessionID, componentID,optionName,value); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @param value + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + */ @WebMethod public void applyConfigEntryString(int sessionID, int componentID, String optionName, String value) throws ClientNotKnownException, UnknownComponentException { applyConfigEntry(sessionID, componentID,optionName,value); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @param value + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws MalformedURLException + */ @WebMethod public void applyConfigEntryURL(int sessionID, int componentID, String optionName, String value) throws ClientNotKnownException, UnknownComponentException, MalformedURLException { // URLs are passed as String and then converted @@ -465,69 +584,141 @@ applyConfigEntry(sessionID, componentID,optionName,url); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @param value + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + */ @WebMethod public void applyConfigEntryStringArray(int sessionID, int componentID, String optionName, String[] value) throws ClientNotKnownException, UnknownComponentException { Set<String> stringSet = new TreeSet<String>(Arrays.asList(value)); applyConfigEntry(sessionID, componentID,optionName,stringSet); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @param value + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + */ @WebMethod public void applyConfigEntryBoolean(int sessionID, int componentID, String optionName, Boolean value) throws ClientNotKnownException, UnknownComponentException { applyConfigEntry(sessionID, componentID,optionName,value); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @param value + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + */ private void applyConfigEntry(int sessionID, int componentID, String optionName, Object value) throws ClientNotKnownException, UnknownComponentException { ClientState state = getState(sessionID); Component component = state.getComponent(componentID); cm.applyConfigEntry(component, optionName, value); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws ConfigOptionTypeException + */ @WebMethod public String[] getConfigOptionValueStringArray(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { return getConfigOptionValue(sessionID, componentID, optionName, String[].class); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws ConfigOptionTypeException + */ @WebMethod public String getConfigOptionValueString(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { return getConfigOptionValue(sessionID, componentID, optionName, String.class); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws ConfigOptionTypeException + */ @WebMethod public String getConfigOptionValueURL(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { URL url = getConfigOptionValue(sessionID, componentID, optionName, URL.class); return url.toString(); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws ConfigOptionTypeException + */ @WebMethod public Double getConfigOptionValueDouble(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { return getConfigOptionValue(sessionID, componentID, optionName, Double.class); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws ConfigOptionTypeException + */ @WebMethod public Boolean getConfigOptionValueBoolean(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { return getConfigOptionValue(sessionID, componentID, optionName, Boolean.class); } + /** + * + * @param sessionID The session ID. + * @param componentID The componentID. + * @param optionName The name of the configuration option. + * @return + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + * @throws UnknownComponentException + * @throws ConfigOptionTypeException + */ @WebMethod public Integer getConfigOptionValueInt(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { return getConfigOptionValue(sessionID, componentID, optionName, Integer.class); } - @SuppressWarnings({"unchecked"}) - private <T> T getConfigOptionValue(int sessionID, int componentID, String optionName, Class<T> clazz) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { - Object value = getConfigOptionValue(sessionID, componentID, optionName); - if(clazz.isInstance(value)) - return (T) value; - else - throw new ConfigOptionTypeException(optionName, clazz, value.getClass()); - } - - private Object getConfigOptionValue(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException { - ClientState state = getState(sessionID); - Component component = state.getComponent(componentID); - return cm.getConfigOptionValue(component, optionName); - } - //////////////////////////////////// // reasoning and querying methods // //////////////////////////////////// @@ -778,9 +969,31 @@ return negExamples.toArray(new String[negExamples.size()]); } - @WebMethod - public void debug(String deb) - { - System.out.println(deb); + ///////////////////////////// + // private utility methods // + ///////////////////////////// + + // returns session state or throws client not known exception + private ClientState getState(int id) throws ClientNotKnownException { + ClientState state = clients.get(id); + if(state==null) + throw new ClientNotKnownException(id); + return state; } + + @SuppressWarnings({"unchecked"}) + private <T> T getConfigOptionValue(int sessionID, int componentID, String optionName, Class<T> clazz) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + Object value = getConfigOptionValue(sessionID, componentID, optionName); + if(clazz.isInstance(value)) + return (T) value; + else + throw new ConfigOptionTypeException(optionName, clazz, value.getClass()); + } + + private Object getConfigOptionValue(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException { + ClientState state = getState(sessionID); + Component component = state.getComponent(componentID); + return cm.getConfigOptionValue(component, optionName); + } + } Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2009-04-01 09:45:26 UTC (rev 1674) +++ trunk/src/php-examples/LearningSimple.php 2009-04-01 10:14:48 UTC (rev 1675) @@ -51,7 +51,7 @@ $negExamples = array('http://example.com/father#heinz', 'http://example.com/father#anna', 'http://example.com/father#michelle'); -$client->setLearningProblem($id, "posNegDefinition"); +$client->setLearningProblem($id, "posNegLPStandard"); $client->setPositiveExamples($id, $posExamples); $client->setNegativeExamples($id, $negExamples); Modified: trunk/src/php-examples/LearningThreaded.php =================================================================== --- trunk/src/php-examples/LearningThreaded.php 2009-04-01 09:45:26 UTC (rev 1674) +++ trunk/src/php-examples/LearningThreaded.php 2009-04-01 10:14:48 UTC (rev 1675) @@ -41,6 +41,12 @@ // load owl file in reasoner $id = $client->generateID(); + +$state = $client->getState($id); + +var_dump($state); +echo 'STATE END'; + $ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); $rID = $client->setReasoner($id, "owlapi"); @@ -62,7 +68,7 @@ 'http://localhost/foo#mandy', 'http://localhost/foo#miriam', 'http://localhost/foo#hanna'); -$client->setLearningProblem($id, "posNegDefinition"); +$client->setLearningProblem($id, "posNegLPStandard"); $client->setPositiveExamples($id, $posExamples); $client->setNegativeExamples($id, $negExamples); @@ -94,7 +100,7 @@ } while($running); -// print best concepts found (not all of are +// print best concepts found (not all of which are // necessarily perfect solutions) echo '<br />Algorithm finished. Best concepts: '; echo '<pre>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-01 09:45:41
|
Revision: 1674 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1674&view=rev Author: lorenz_b Date: 2009-04-01 09:45:26 +0000 (Wed, 01 Apr 2009) Log Message: ----------- fixed methods getDomainImpl() according to type cast exceptions from HashSet to OWLClass Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-01 08:50:07 UTC (rev 1673) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-01 09:45:26 UTC (rev 1674) @@ -634,7 +634,7 @@ Set<Set<OWLDescription>> set = reasoner.getDomains(prop); if(set.size()==0) return new Thing(); - OWLClass oc = (OWLClass) set.iterator().next(); + OWLClass oc = (OWLClass) set.iterator().next().iterator().next(); return new NamedClass(oc.getURI().toString()); } catch (OWLReasonerException e) { throw new Error(e); @@ -653,7 +653,7 @@ Set<Set<OWLDescription>> set = reasoner.getDomains(prop); if(set.size()==0) return new Thing(); - OWLClass oc = (OWLClass) set.iterator().next(); + OWLClass oc = (OWLClass) set.iterator().next().iterator().next(); return new NamedClass(oc.getURI().toString()); } catch (OWLReasonerException e) { throw new Error(e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-01 08:50:18
|
Revision: 1673 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1673&view=rev Author: jenslehmann Date: 2009-04-01 08:50:07 +0000 (Wed, 01 Apr 2009) Log Message: ----------- - started DBpedia -> OSM mapping - added secondstring library for various string metrics Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java Added Paths: ----------- trunk/lib/secondstring-20060615.jar trunk/src/dl-learner/org/dllearner/scripts/matching/ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Added: trunk/lib/secondstring-20060615.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/secondstring-20060615.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-04-01 05:14:44 UTC (rev 1672) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2009-04-01 08:50:07 UTC (rev 1673) @@ -472,6 +472,7 @@ /** * low level, executes query returns ResultSet. + * TODO: Why convert from result set to JSON and back? See method below. * * @param sparqlQueryString * The query @@ -482,6 +483,12 @@ } + public ResultSet queryAsResultSet2(String sparqlQueryString) { + SparqlQuery sq = new SparqlQuery(sparqlQueryString, sparqlEndpoint); + sq.send(); + return sq.getResultSet(); + } + /** * low level, executes query returns JSON. * Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2009-04-01 05:14:44 UTC (rev 1672) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2009-04-01 08:50:07 UTC (rev 1673) @@ -138,7 +138,8 @@ public static SparqlEndpoint getEndpointDBpedia() { URL u = null; try { - u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); + u = new URL("http://dbpedia.org/sparql"); +// u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); } catch (Exception e) { e.printStackTrace(); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2009-04-01 05:14:44 UTC (rev 1672) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2009-04-01 08:50:07 UTC (rev 1673) @@ -187,6 +187,8 @@ /** * @return the Jena QueryEngineHTTP */ + // ANY NEED TO GET THIS FROM OUTSIDE? + @Deprecated public QueryEngineHTTP getExecution() { return queryExecution; } @@ -195,6 +197,8 @@ * insert a result, e.g. from the cache * @param json a jsonString */ + // LOOKS LIKE A HACK + @Deprecated public void setJson(String json) { this.wasExecuted = true; this.json = json; @@ -203,6 +207,8 @@ /** * @param running s.e. */ + // SHOULD NOT BE SET FROM OUTSIDE + @Deprecated public void setRunning(boolean running) { this.isRunning = running; } @@ -213,6 +219,9 @@ * * @return a JSON string */ + // WHY NOT EXECUTE SEND() AND THEN CALL THIS METHOD? + // returning null seems safer instead of executing the query (again) + @Deprecated public String getJson() { if (!wasExecuted) { this.send(); @@ -225,6 +234,7 @@ * * @return a Jena ResultSet */ + // SHOULD BE A SIMPLE GETTER SINCE RESULTSET IS MAIN JENA STRUCTURE public ResultSet getResultSet() { return (getJson() == null) ? null : convertJSONtoResultSet(json); } @@ -234,6 +244,7 @@ * * @return An XML String */ + // SHOULD CONVERT FROM RESULTSET public String getXMLString() { return (getJson() == null) ? null : convertJSONtoXML(json); } @@ -330,71 +341,4 @@ return convertResultSetToXMLString(convertJSONtoResultSet(json)); } - - /*** - public static String sendGetRequest(String urlStr) - { - String result = null; - - - try - { - StringBuffer data = new StringBuffer(); - - //String urlStr = endpoint; - // if (requestParameters != null && requestParameters.length () > 0) - //{ - //urlStr += "?" + requestParameters; - //} - //urlStr = "http://www.klappstuhlclub.de"; - URL url = new URL(urlStr); - System.out.println(urlStr); - URLConnection conn = url.openConnection (); - - // Get the response - BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); - StringBuffer sb = new StringBuffer(); - String line=""; - System.out.println("aa"+line); - while ((line = rd.readLine()) != null) - { - System.out.println("aa"+line); - sb.append(line); - } - rd.close(); - result = sb.toString(); - } catch (Exception e) - { - e.printStackTrace(); - } - - return result; - } - - public String fallback(){ - System.out.println("TEST"); - try{ - String urlStr = (sparqlEndpoint.getURL().toString()+"?query="+sparqlQueryString); - //URLConnection con = url.openConnection(); - System.out.println(sendGetRequest(urlStr)); - System.out.println("f"); - //System.out.println(con.getContentLength()); - //con.connect(); - System.out.println("sdf"); - String a = "12345"; - byte[] b = a.getBytes(); - //con.getInputStream().read(b); - System.out.println(new String (b)); - //Object o = con.getContent(); - //System.out.println(o+o.getClass().getCanonicalName()); - }catch (Exception ea) { - // TODO: handle exception - } - return ""; - } - - - - */ - } Added: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-04-01 08:50:07 UTC (rev 1673) @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2007-2009, 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.matching; + +import java.net.URI; + +import org.dllearner.kb.sparql.SPARQLTasks; +import org.dllearner.kb.sparql.SparqlEndpoint; +import org.dllearner.kb.sparql.SparqlQuery; + +import com.hp.hpl.jena.query.QuerySolution; +import com.hp.hpl.jena.query.ResultSet; + +/** + * Computes owl:sameAs links between DBpedia and LinkedGeoData + * (or Wikipedia and OSM). + * + * @author Jens Lehmann + * + */ +public class DBpediaLinkedGeoData { + + public static void main(String[] args) { + + // we start from the DBpedia URI and try to find the corresponding + // OSM URI (assuming that each location having coordinates in Wikipedia also + // exists in OSM) + URI dbpediaURI = URI.create("http://dbpedia.org/resource/Auerbachs_Keller"); + + // use official DBpedia endpoint (switch to db0 later) + SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpedia(); + SPARQLTasks st = new SPARQLTasks(endpoint); + + // query latitude and longitude + String query = "SELECT ?lat ?long WHERE { "; + query += "<" + dbpediaURI + "> <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat ."; + query += "<" + dbpediaURI + "> <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long . } LIMIT 1"; + + // perform query and read lat and long from results + ResultSet results = st.queryAsResultSet2(query); + QuerySolution qs = results.nextSolution(); + String geoLat = qs.getLiteral("lat").getString(); + String geoLong = qs.getLiteral("long").getString(); + + System.out.println("lat: " + geoLat + ", long: " + geoLong); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-01 05:14:52
|
Revision: 1672 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1672&view=rev Author: lorenz_b Date: 2009-04-01 05:14:44 +0000 (Wed, 01 Apr 2009) Log Message: ----------- changed pellet-libs and owl-api lib for precise explanations Modified Paths: -------------- trunk/lib/owlapi/owlapi-bin.jar trunk/lib/pellet/pellet-explanation.jar Added Paths: ----------- trunk/lib/pellet/pellet-core.jar trunk/lib/pellet/pellet-datatypes.jar trunk/lib/pellet/pellet-el.jar trunk/lib/pellet/pellet-owlapi.jar trunk/lib/pellet/pellet-rules.jar Removed Paths: ------------- trunk/lib/pellet/pellet.jar Modified: trunk/lib/owlapi/owlapi-bin.jar =================================================================== (Binary files differ) Added: trunk/lib/pellet/pellet-core.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/pellet/pellet-core.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lib/pellet/pellet-datatypes.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/pellet/pellet-datatypes.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lib/pellet/pellet-el.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/pellet/pellet-el.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/lib/pellet/pellet-explanation.jar =================================================================== (Binary files differ) Added: trunk/lib/pellet/pellet-owlapi.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/pellet/pellet-owlapi.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lib/pellet/pellet-rules.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/pellet/pellet-rules.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: trunk/lib/pellet/pellet.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-28 10:50:36
|
Revision: 1671 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1671&view=rev Author: jenslehmann Date: 2009-03-28 10:50:31 +0000 (Sat, 28 Mar 2009) Log Message: ----------- small improvement Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-03-27 21:43:54 UTC (rev 1670) +++ trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-03-28 10:50:31 UTC (rev 1671) @@ -153,7 +153,9 @@ double coverage = coveredInstances.size()/(double)classInstances.size(); double protusion = (additionalInstances.size() + coveredInstances.size() == 0) ? 0 : coveredInstances.size()/(double)(coveredInstances.size()+additionalInstances.size()); - boolean isConsistent = isConsistent(description); + // for each description with less than 100% coverage, we check whether it is + // leads to an inconsistent knowledge base + boolean isConsistent = coverage >= 0.999999 || isConsistent(description); return new ClassScore(coveredInstances, coverage, additionalInstances, protusion, getAccuracy(coverage, protusion), isConsistent); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-03-27 21:44:12
|
Revision: 1670 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1670&view=rev Author: lorenz_b Date: 2009-03-27 21:43:54 +0000 (Fri, 27 Mar 2009) Log Message: ----------- implemented method remainsSatisfiable(Axiom axiom) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-03-27 11:16:11 UTC (rev 1669) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-03-27 21:43:54 UTC (rev 1670) @@ -72,6 +72,7 @@ import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasoner; import org.semanticweb.owl.inference.OWLReasonerException; +import org.semanticweb.owl.model.AddAxiom; import org.semanticweb.owl.model.OWLAnnotation; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; @@ -87,12 +88,14 @@ import org.semanticweb.owl.model.OWLNamedObject; import org.semanticweb.owl.model.OWLObjectProperty; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyCreationException; import org.semanticweb.owl.model.OWLOntologyFormat; import org.semanticweb.owl.model.OWLOntologyManager; import org.semanticweb.owl.model.OWLOntologyStorageException; import org.semanticweb.owl.model.OWLTypedConstant; import org.semanticweb.owl.model.OWLUntypedConstant; +import org.semanticweb.owl.model.RemoveAxiom; import org.semanticweb.owl.model.UnknownOWLOntologyException; import org.semanticweb.owl.util.SimpleURIMapper; import org.semanticweb.owl.vocab.NamespaceOWLOntologyFormat; @@ -119,6 +122,8 @@ } private OWLReasoner reasoner; + private OWLOntologyManager manager; + private OWLOntology ontology; // the data factory is used to generate OWL API objects private OWLDataFactory factory; // static factory @@ -188,7 +193,7 @@ individuals = new TreeSet<Individual>(); // create OWL API ontology manager - OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + manager = OWLManager.createOWLOntologyManager(); // it is a bit cumbersome to obtain all classes, because there // are no reasoner queries to obtain them => hence we query them @@ -216,7 +221,7 @@ } try { - OWLOntology ontology; + if(source instanceof OWLAPIOntology) { ontology = ((OWLAPIOntology)source).getOWLOntolgy(); } else if (source instanceof SparqlKnowledgeSource) { @@ -996,7 +1001,7 @@ return reasoner.getInconsistentClasses(); } catch (OWLReasonerException e) { e.printStackTrace(); - throw new Error("Inconsistens classes check error in OWL API."); + throw new Error("Inconsistent classes check error in OWL API."); } } @@ -1019,10 +1024,22 @@ */ @Override public boolean remainsSatisfiableImpl(Axiom axiom) { + boolean consistent = true; OWLAxiom axiomOWLAPI = OWLAPIAxiomConvertVisitor.convertAxiom(axiom); + try { + manager.applyChange(new AddAxiom(ontology, axiomOWLAPI)); + consistent = reasoner.isConsistent(ontology); + manager.applyChange(new RemoveAxiom(ontology, axiomOWLAPI)); + + } catch (OWLOntologyChangeException e) { + + e.printStackTrace(); + } catch (OWLReasonerException e) { + + e.printStackTrace(); + } - // TODO Auto-generated method stub - return false; + return consistent; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-27 11:16:23
|
Revision: 1669 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1669&view=rev Author: jenslehmann Date: 2009-03-27 11:16:11 +0000 (Fri, 27 Mar 2009) Log Message: ----------- started implementing consistency check for added axiom Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/BaseReasoner.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java trunk/src/dl-learner/org/dllearner/learningproblems/ClassScore.java trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/core/BaseReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/BaseReasoner.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/core/BaseReasoner.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -23,6 +23,7 @@ import java.util.Set; import java.util.SortedSet; +import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.Constant; import org.dllearner.core.owl.DatatypeProperty; import org.dllearner.core.owl.Entity; @@ -51,6 +52,13 @@ public boolean isSatisfiable(); /** + * Checks whether adding the specified axiom leads to an inconsistency. + * @param axiom The axiom to be added to the knowledge base. + * @return True of the knowledge base including the axiom is satisfiable. False otherwise. + */ + public boolean remainsSatisfiable(Axiom axiom); + + /** * Gets all named classes in the knowledge base, e.g. Person, City, Car. * @return All named classes in KB. */ Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -30,6 +30,7 @@ import java.util.Map.Entry; import org.apache.log4j.Logger; +import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.Constant; import org.dllearner.core.owl.DataRange; import org.dllearner.core.owl.DatatypeProperty; @@ -398,6 +399,26 @@ } @Override + public final boolean remainsSatisfiable(Axiom axiom) { + reasoningStartTimeTmp = System.nanoTime(); + boolean result; + try { + result = remainsSatisfiableImpl(axiom); + } catch (ReasoningMethodUnsupportedException e) { + handleExceptions(e); + return false; + } + reasoningDurationTmp = System.nanoTime() - reasoningStartTimeTmp; + otherReasoningTimeNs += reasoningDurationTmp; + overallReasoningTimeNs += reasoningDurationTmp; + return result; + } + + protected boolean remainsSatisfiableImpl(Axiom axiom) throws ReasoningMethodUnsupportedException { + throw new ReasoningMethodUnsupportedException(); + } + + @Override public final Map<ObjectProperty,Set<Individual>> getObjectPropertyRelationships(Individual individual) { try { return getObjectPropertyRelationshipsImpl(individual); Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -33,9 +33,12 @@ import org.dllearner.core.configurators.ClassLearningProblemConfigurator; import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.StringConfigOption; +import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.EquivalentClassesAxiom; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.SubClassAxiom; /** * The problem of learning the description of an existing class @@ -150,8 +153,9 @@ double coverage = coveredInstances.size()/(double)classInstances.size(); double protusion = (additionalInstances.size() + coveredInstances.size() == 0) ? 0 : coveredInstances.size()/(double)(coveredInstances.size()+additionalInstances.size()); + boolean isConsistent = isConsistent(description); - return new ClassScore(coveredInstances, coverage, additionalInstances, protusion, getAccuracy(coverage, protusion)); + return new ClassScore(coveredInstances, coverage, additionalInstances, protusion, getAccuracy(coverage, protusion), isConsistent); } public boolean isEquivalenceProblem() { @@ -367,4 +371,17 @@ ClassScore score = computeScore(description); return new EvaluatedDescriptionClass(description, score); } + + /** + * @return the isConsistent + */ + public boolean isConsistent(Description description) { + Axiom axiom; + if(equivalence) { + axiom = new EquivalentClassesAxiom(classToDescribe, description); + } else { + axiom = new SubClassAxiom(classToDescribe, description); + } + return reasoner.remainsSatisfiable(axiom); + } } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ClassScore.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/ClassScore.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/learningproblems/ClassScore.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -39,12 +39,15 @@ private double addition; private double accuracy; - public ClassScore(Set<Individual> coveredInstances, double coverage, Set<Individual> additionalInstances, double protusion, double accuracy) { + private boolean isConsistent; + + public ClassScore(Set<Individual> coveredInstances, double coverage, Set<Individual> additionalInstances, double protusion, double accuracy, boolean isConsistent) { this.coveredInstances = coveredInstances; this.additionalInstances = additionalInstances; this.coverage = coverage; this.addition = protusion; this.accuracy = accuracy; + this.isConsistent = isConsistent; } /** @@ -85,6 +88,13 @@ */ public Set<Individual> getAdditionalInstances() { return additionalInstances; + } + + /** + * @return the isConsistent + */ + public boolean isConsistent() { + return isConsistent; } } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -78,5 +78,13 @@ public Set<Individual> getCoveredInstances() { return classScore.getCoveredInstances(); } + + /** + * + * @return True if adding the axiom to the knowledge base leads to an inconsistent knowledge base. False otherwise. + */ + public boolean isConsistent() { + return classScore.isConsistent(); + } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -43,6 +43,7 @@ import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.InvalidConfigOptionValueException; import org.dllearner.core.options.StringConfigOption; +import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.BooleanValueRestriction; import org.dllearner.core.owl.Constant; import org.dllearner.core.owl.DataRange; @@ -1002,4 +1003,12 @@ return rc.getTypesImpl(individual); } + /* (non-Javadoc) + * @see org.dllearner.core.BaseReasoner#remainsSatisfiable(org.dllearner.core.owl.Axiom) + */ + @Override + public boolean remainsSatisfiableImpl(Axiom axiom) { + return rc.remainsSatisfiableImpl(axiom); + } + } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -208,6 +208,7 @@ rc.releaseKB(); } + // @Override // public boolean hasDatatypeSupport() { // return true; Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-03-27 10:53:47 UTC (rev 1668) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-03-27 11:16:11 UTC (rev 1669) @@ -47,6 +47,7 @@ import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.InvalidConfigOptionValueException; import org.dllearner.core.options.StringConfigOption; +import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.Constant; import org.dllearner.core.owl.Datatype; import org.dllearner.core.owl.DatatypeProperty; @@ -72,6 +73,7 @@ import org.semanticweb.owl.inference.OWLReasoner; import org.semanticweb.owl.inference.OWLReasonerException; import org.semanticweb.owl.model.OWLAnnotation; +import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLConstant; import org.semanticweb.owl.model.OWLDataFactory; @@ -1011,6 +1013,17 @@ } return annotations; } + + /* (non-Javadoc) + * @see org.dllearner.core.BaseReasoner#remainsSatisfiable(org.dllearner.core.owl.Axiom) + */ + @Override + public boolean remainsSatisfiableImpl(Axiom axiom) { + OWLAxiom axiomOWLAPI = OWLAPIAxiomConvertVisitor.convertAxiom(axiom); + + // TODO Auto-generated method stub + return false; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-27 10:53:53
|
Revision: 1668 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1668&view=rev Author: jenslehmann Date: 2009-03-27 10:53:47 +0000 (Fri, 27 Mar 2009) Log Message: ----------- - README file for DBpedia Navigator - renamed Protege build tasks in ant script Modified Paths: -------------- trunk/build.xml trunk/src/dbpedia-navigator/Settings.php.dist trunk/src/dl-learner/org/dllearner/scripts/CalculatePageRank.java Added Paths: ----------- trunk/src/dbpedia-navigator/LICENSE trunk/src/dbpedia-navigator/README Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2009-03-26 14:26:46 UTC (rev 1667) +++ trunk/build.xml 2009-03-27 10:53:47 UTC (rev 1668) @@ -304,7 +304,7 @@ </target> <!-- copy all necessary files in a folder to build the jar or a release bundle --> - <target name="protege"> + <target name="buildProtegePlugin"> <property name="source" value="src/dl-learner/org/dllearner/tools/protege" /> <property name="temp" value="${source}/temp" /> <property name="release" value="${source}/release" /> @@ -349,7 +349,7 @@ </target> <!--Copy the DL-Learner-Protege-plugin jar file into the Protege plugin folder --> - <target name="copyProtegePluginToProtegeDir" depends="protege"> + <target name="copyProtegePluginToProtegeDir" depends="buildProtegePlugin"> <copy toDir="${protege_dir}" > <fileset dir="${release}" includes="DL-Learner-protege-plugin.jar" /> </copy> @@ -358,7 +358,7 @@ </target> <!--Builds the Releasebundle --> - <target name="buildProtegePlugin" depends="protege"> + <target name="buildProtegePluginRelease" depends="buildProtegePlugin"> <copy file="LICENSE" toDir="${release}" /> <copy toDir="${release}" > <fileset dir="${source}" includes="INSTALL,README" excludes="**/*.java,**/*.gif" /> Added: trunk/src/dbpedia-navigator/LICENSE =================================================================== --- trunk/src/dbpedia-navigator/LICENSE (rev 0) +++ trunk/src/dbpedia-navigator/LICENSE 2009-03-27 10:53:47 UTC (rev 1668) @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program 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. + + This program 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/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/src/dbpedia-navigator/README =================================================================== --- trunk/src/dbpedia-navigator/README (rev 0) +++ trunk/src/dbpedia-navigator/README 2009-03-27 10:53:47 UTC (rev 1668) @@ -0,0 +1,43 @@ +General Notes: +============== + +DBpedia Navigator is an application written in PHP using Javascript, HTML, and +CSS. It connects to the DL-Learner web service for getting navigation suggestions +and posing SPARQL queries against a triple strore containing DBpedia. Furthermore, +a temporary MySQL database is used to allow for efficient search and traversal of +the class hierarchy. Ideally, DBpedia Navigator, DL-Learner, the SPARQL endpoint, +and the MySQL database should all be on the same machine for performance reasons. + +Installation of DBpedia Navigator: +================================== + +Prerequisites: +- Apache +- PHP +- DL-Learner Web Service +- DBpedia SPARQL endpoint +- MySQL + +Installation Steps: + +1. Get DBpedia Navigator +Checkout from SVN: +co http://dl-learner.svn.sourceforge.net/svnroot/dl-learner/trunk/src/dbpedia-navigator/ +Place it under the web server root. + +2. Configure DBpedia Navigator +Change settings.ini.dist and Settings.php.dist (the latter will be removed at some point of time) +according to your system, i.e. set the database connection. + +3. Create DBpedia Navigator database +- create an empty database +- import database.sql (contains structure) +- create directory "data" under $datasetDir (see settings.ini) and download the + following DBpedia data sets "pagelinks_en.nt", "articles_label_en.nt", + "dbpedia-ontology-schema.nt", "dbpedia-ontology-types.nt" +- execute org.dllearner.scripts.CalculatePageRank + +Now you can use DBpedia Navigator by starting the DL-Learner web service and the calling the +DBpedia Navigator in your browser. + +Send questions to le...@in.... Modified: trunk/src/dbpedia-navigator/Settings.php.dist =================================================================== --- trunk/src/dbpedia-navigator/Settings.php.dist 2009-03-26 14:26:46 UTC (rev 1667) +++ trunk/src/dbpedia-navigator/Settings.php.dist 2009-03-27 10:53:47 UTC (rev 1668) @@ -1,4 +1,10 @@ <?php + +// +// TODO: +// - move configuration for settings.ini +// - ignoredConcepts and ignoredRoles are not working yet + /** * Copyright (C) 2007-2008, Jens Lehmann * @@ -59,11 +65,11 @@ public $ignoredConcepts=array(); public $ignoredRoles=array(); - public $classSystem="YAGO"; - //public $classSystem="DBpedia"; + //public $classSystem="YAGO"; + public $classSystem="DBpedia"; //the name of the used database - public $database_name='navigator_db'; - //public $database_name='navigator_db_new'; + //public $database_name='navigator_db'; + public $database_name='navigator_db_new'; //the type of database server public $database_type='mysql'; @@ -76,4 +82,4 @@ } -?> \ No newline at end of file +?> Modified: trunk/src/dl-learner/org/dllearner/scripts/CalculatePageRank.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/CalculatePageRank.java 2009-03-26 14:26:46 UTC (rev 1667) +++ trunk/src/dl-learner/org/dllearner/scripts/CalculatePageRank.java 2009-03-27 10:53:47 UTC (rev 1668) @@ -340,11 +340,11 @@ con = DriverManager.getConnection( url, dbUser, dbPass); - //cal.calculateLinks(); - //cal.addLabels(); + cal.calculateLinks(); + cal.addLabels(); //cal.calculateCategories(); cal.calculateCategoriesNewOntology(); - //cal.copyNumbers(); + cal.copyNumbers(); con.close(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-26 14:26:56
|
Revision: 1667 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1667&view=rev Author: heeroyuy Date: 2009-03-26 14:26:46 +0000 (Thu, 26 Mar 2009) Log Message: ----------- -fixed plus misplacing -set more space between slider in the option panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -229,9 +229,11 @@ public void setIconToggled(boolean toggled) { if (toggled) { advanced.setIcon(toggledIcon); + learnerPanel.setPreferredSize(new Dimension(575, 400)); } if (!toggled) { advanced.setIcon(icon); + learnerPanel.setPreferredSize(new Dimension(575, 350)); } } @@ -249,7 +251,7 @@ learner.add(advanced); learner.add(posPanel); learner.add(detail); - learnerPanel.setPreferredSize(new Dimension(575, 560)); + learnerPanel.setPreferredSize(new Dimension(575, 620)); learnerPanel.removeAll(); learnerPanel.add(learner); learnerScroll.setViewportView(learnerPanel); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -151,12 +151,14 @@ g2D.setColor(darkGreen); g2D.drawString("*", 310, p+3); g2D.setColor(Color.BLACK); - g2D.drawString("positive Example", 320, p); + g2D.drawString("individuals covered by the new", 320, p); p = p + 20; + g2D.drawString("class expression", 320, p); + p = p + 20; g2D.setColor(darkRed); g2D.drawString("*", 310, p+3); g2D.setColor(Color.BLACK); - g2D.drawString("negative Example", 320, p); + g2D.drawString("additional or not covered individuals", 320, p); g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); g2D.fillOval(310, 0, 9, 9); @@ -278,23 +280,17 @@ for (int i = 0; i < posCovIndVector.size(); i++) { g2D.setColor(darkGreen); - g2D.drawString(posCovIndVector.get(i).getPoint(), - posCovIndVector.get(i).getXAxis(), posCovIndVector.get( - i).getYAxis()); + g2D.draw(posCovIndVector.get(i).getIndividualPoint()); } for (int i = 0; i < posNotCovIndVector.size(); i++) { g2D.setColor(darkRed); - g2D.drawString(posNotCovIndVector.get(i).getPoint(), - posNotCovIndVector.get(i).getXAxis(), - posNotCovIndVector.get(i).getYAxis()); + g2D.draw(posNotCovIndVector.get(i).getIndividualPoint()); } for (int i = 0; i < additionalIndividuals.size(); i++) { g2D.setColor(Color.BLACK); - g2D.drawString(additionalIndividuals.get(i).getPoint(), - additionalIndividuals.get(i).getXAxis(), - additionalIndividuals.get(i).getYAxis()); + g2D.draw(additionalIndividuals.get(i).getIndividualPoint()); } this.setVisible(true); panel.repaint(); @@ -319,7 +315,8 @@ centerY = (int) old.getCenterY(); double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); - if (additionalIndividualSize != 0) { + + if (additionalIndividualSize != 0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0 && ((EvaluatedDescriptionClass) eval).getAddition() < 1.0) { distortionOld = (int) Math.round(WIDTH * 0.3); Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, ELLIPSE_Y_AXIS, WIDTH, HEIGHT); @@ -345,12 +342,13 @@ shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcepts); } else if (additionalIndividualSize != coveredIndividualSize) { shiftNewConcept = (int) Math.round((WIDTH / 2.0) - * (newConcepts + (1 - oldConcepts))); + * (1.0 + (1.0 - oldConcepts))); shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcepts); shiftCovered = (int) Math.round((WIDTH / 2.0) * (1 - oldConcepts)); } - if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval) + .getCoverage() == 1.0) { shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); shiftNewConceptX = shiftCovered; shiftNewConcept = 2 * shiftNewConceptX; @@ -647,15 +645,4 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } - - public boolean isInCircle(double x, double y, Ellipse2D ell) { - int r = (WIDTH / 2) * (WIDTH / 2); - int n = (int) ((x - ell.getCenterX()) * (x - ell.getCenterX())) - + (int) ((y - ell.getCenterY()-5) * (y - ell.getCenterY()-5)); - if (n <= r) { - return true; - } else { - return false; - } - } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -19,6 +19,8 @@ */ package org.dllearner.tools.protege; +import java.awt.geom.Ellipse2D; + /** * This class is a datastructure for one individual shown in * the GraphicalCoveragePanel. @@ -31,6 +33,7 @@ private int xAxis; private int yAxis; private final String individual; + private final Ellipse2D circlePoint; /** * Constructor of the class. @@ -43,6 +46,7 @@ this.point = p; this.xAxis = x; this.yAxis = y; + this.circlePoint = new Ellipse2D.Double(x - 1, y - 1, 3, 3); this.individual = ind; } @@ -101,5 +105,8 @@ public String getIndividualName() { return individual; } - + + public Ellipse2D getIndividualPoint() { + return circlePoint; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -44,14 +44,14 @@ * Constructor for the Option Panel. */ public OptionPanel() { - setPreferredSize(new Dimension(490, 100)); + setPreferredSize(new Dimension(490, 150)); setLayout(null); minAccuracyLabel = new JLabel("noise in %"); minAccuracyLabel.setBounds(5, 0, 150, 40); maxExecutionTimeLabel = new JLabel("maximum execution time"); - maxExecutionTimeLabel.setBounds(5, 40, 150, 40); + maxExecutionTimeLabel.setBounds(5, 60, 150, 40); nrOfConceptsLabel = new JLabel("max. number of results"); - nrOfConceptsLabel.setBounds(5, 80, 150, 40); + nrOfConceptsLabel.setBounds(5, 120, 150, 40); minAccuracy = new JSlider(0, 50, 5); minAccuracy.setPaintTicks(true); @@ -66,7 +66,7 @@ maxExecutionTime.setMajorTickSpacing(10); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); - maxExecutionTime.setBounds(200, 40, 200, 40); + maxExecutionTime.setBounds(200, 60, 200, 40); nrOfConcepts = new JSlider(2, 20, 10); @@ -74,7 +74,7 @@ nrOfConcepts.setMajorTickSpacing(2); nrOfConcepts.setMinorTickSpacing(1); nrOfConcepts.setPaintLabels(true); - nrOfConcepts.setBounds(200, 80, 200, 40); + nrOfConcepts.setBounds(200, 120, 200, 40); add(minAccuracyLabel); add(minAccuracy); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-26 11:26:47
|
Revision: 1666 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1666&view=rev Author: jenslehmann Date: 2009-03-26 11:26:36 +0000 (Thu, 26 Mar 2009) Log Message: ----------- render OWLAxiom in Manchester OWL Syntax Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIRenderers.java Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIRenderers.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIRenderers.java 2009-03-25 11:23:17 UTC (rev 1665) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIRenderers.java 2009-03-26 11:26:36 UTC (rev 1666) @@ -26,6 +26,7 @@ import org.coode.owlapi.owlxml.renderer.OWLXMLWriter; import org.coode.xml.XMLWriterNamespaceManager; import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLObjectProperty; @@ -43,6 +44,19 @@ public class OWLAPIRenderers { /** + * Converts an OWL API axiom to a Manchester OWL syntax string. + * + * @param description Input OWLAxiom. + * @return Manchester OWL syntax string. + */ + public static String toManchesterOWLSyntax(OWLAxiom description) { + StringWriter sw = new StringWriter(); + ManchesterOWLSyntaxObjectRenderer renderer = new ManchesterOWLSyntaxObjectRenderer(sw); + description.accept(renderer); + return sw.toString(); + } + + /** * Converts an OWL API description to a Manchester OWL syntax string. * * @param description Input OWLDescription. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-25 11:23:20
|
Revision: 1665 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1665&view=rev Author: jenslehmann Date: 2009-03-25 11:23:17 +0000 (Wed, 25 Mar 2009) Log Message: ----------- modified ellipse test such that it is working correctly Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-03-25 10:57:36 UTC (rev 1664) +++ trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-03-25 11:23:17 UTC (rev 1665) @@ -10,19 +10,23 @@ import javax.swing.JDialog; import javax.swing.JPanel; -public class EllipseTest extends JPanel{ -private Ellipse2D te; -private Random random; +public class EllipseTest extends JPanel { + + private static final long serialVersionUID = -5676466024192284648L; + private Ellipse2D te; + private Random random; + public EllipseTest() { - te = new Ellipse2D.Double(0,0,150,150); + te = new Ellipse2D.Double(0, 0, 150, 150); this.setSize(500, 500); random = new Random(); JDialog dialog = new JDialog(); - dialog.add(this); - dialog.setSize(600, 600); - dialog.setVisible(true); + dialog.add(this); + dialog.setSize(600, 600); + dialog.setVisible(true); } - + + @Override protected void paintComponent(Graphics g) { Graphics2D g2D; g2D = (Graphics2D) g; @@ -32,9 +36,12 @@ double x = random.nextInt(500); double y = random.nextInt(500); int i = 0; - while(i < 10000) { - if(te.contains(new Point2D.Double(x, y))) { - g2D.drawString("*", ((int)x), ((int) y)); + while (i < 1000) { + Point2D point = new Point2D.Double(x, y); + if (te.contains(point)) { + Ellipse2D circlePoint = new Ellipse2D.Double(x - 1, y - 1, 3, 3); + g2D.draw(circlePoint); + // g2D.drawString("*", ((int)x), ((int) y)); x = random.nextInt(500); y = random.nextInt(500); i++; @@ -44,8 +51,8 @@ } } } - + public static void main(String[] args) { - EllipseTest te = new EllipseTest(); + new EllipseTest(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-25 10:57:43
|
Revision: 1664 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1664&view=rev Author: heeroyuy Date: 2009-03-25 10:57:36 +0000 (Wed, 25 Mar 2009) Log Message: ----------- added ellipse test Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java Added: trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-03-25 10:57:36 UTC (rev 1664) @@ -0,0 +1,51 @@ +package org.dllearner.tools.protege; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Point2D; +import java.util.Random; + +import javax.swing.JDialog; +import javax.swing.JPanel; + +public class EllipseTest extends JPanel{ +private Ellipse2D te; +private Random random; + public EllipseTest() { + te = new Ellipse2D.Double(0,0,150,150); + this.setSize(500, 500); + random = new Random(); + JDialog dialog = new JDialog(); + dialog.add(this); + dialog.setSize(600, 600); + dialog.setVisible(true); + } + + protected void paintComponent(Graphics g) { + Graphics2D g2D; + g2D = (Graphics2D) g; + g2D.setColor(Color.YELLOW); + g2D.fill(te); + g2D.setColor(Color.RED); + double x = random.nextInt(500); + double y = random.nextInt(500); + int i = 0; + while(i < 10000) { + if(te.contains(new Point2D.Double(x, y))) { + g2D.drawString("*", ((int)x), ((int) y)); + x = random.nextInt(500); + y = random.nextInt(500); + i++; + } else { + x = random.nextInt(500); + y = random.nextInt(500); + } + } + } + + public static void main(String[] args) { + EllipseTest te = new EllipseTest(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-24 15:55:26
|
Revision: 1663 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1663&view=rev Author: heeroyuy Date: 2009-03-24 15:55:16 +0000 (Tue, 24 Mar 2009) Log Message: ----------- -small changes in option panel and graphical panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 13:59:23 UTC (rev 1662) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 15:55:16 UTC (rev 1663) @@ -57,7 +57,7 @@ private int shiftXAxis; private int distortionOld; private final Ellipse2D oldConcept; - private Ellipse2D newConcept; + private final Ellipse2D newConcept; private EvaluatedDescription eval; private final DLLearnerModel model; @@ -120,9 +120,9 @@ points = new Vector<IndividualPoint>(); this.computeGraphics(); handler = new GraphicalCoveragePanelHandler(this, desc, model); - oldConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + (2 * adjustment), + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), ELLIPSE_Y_AXIS, WIDTH, HEIGHT); - newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + distortionOld); this.computeIndividualPoints(); @@ -148,7 +148,15 @@ g2D.drawString(conceptVector.get(i), 320, p); p = p + 20; } - + g2D.setColor(darkGreen); + g2D.drawString("*", 310, p+3); + g2D.setColor(Color.BLACK); + g2D.drawString("positive Example", 320, p); + p = p + 20; + g2D.setColor(darkRed); + g2D.drawString("*", 310, p+3); + g2D.setColor(Color.BLACK); + g2D.drawString("negative Example", 320, p); g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); g2D.fillOval(310, 0, 9, 9); @@ -301,7 +309,7 @@ .getAdditionalInstances().size(); distortionOld = 0; adjustment = 0; - Ellipse2D old = new Ellipse2D.Float(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, + Ellipse2D old = new Ellipse2D.Double(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, WIDTH, HEIGHT); x1 = (int) old.getCenterX() - PLUS_SIZE; x2 = (int) old.getCenterX() + PLUS_SIZE; @@ -313,9 +321,9 @@ shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); if (additionalIndividualSize != 0) { distortionOld = (int) Math.round(WIDTH * 0.3); - newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis, + Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, ELLIPSE_Y_AXIS, WIDTH, HEIGHT); - adjustment = (int) Math.round(newConcept.getCenterY() / 4); + adjustment = (int) Math.round(newer.getCenterY() / 4); } this.renderPlus(); } @@ -353,24 +361,27 @@ while (i > 0) { int sub = conceptNew.indexOf(" "); String subString = conceptNew.substring(0, sub) + " "; - conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); - while(sub < SUBSTRING_SIZE) { - if(conceptNew.length() > 0 && conceptNew.contains(" ")) { - sub = conceptNew.indexOf(" "); - if(subString.length() + sub < SUBSTRING_SIZE) { - subString = subString + conceptNew.substring(0, sub) + " "; - conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); - System.out.println("string: " + subString + " lenght: " + subString.length()); - sub = subString.length(); + conceptNew = conceptNew.replace(conceptNew.substring(0, sub + 1), + ""); + while (sub < SUBSTRING_SIZE) { + if (conceptNew.length() > 0 && conceptNew.contains(" ")) { + sub = conceptNew.indexOf(" "); + if (subString.length() + sub < SUBSTRING_SIZE) { + subString = subString + conceptNew.substring(0, sub) + + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, + sub + 1), ""); + sub = subString.length(); + } else { + break; + } } else { - break; - } - } else { - if(subString.length() + conceptNew.length() > SUBSTRING_SIZE + SPACE_SIZE) { - conceptVector.add(subString); - subString = conceptNew; - conceptNew = ""; - break; + if (subString.length() + conceptNew.length() > SUBSTRING_SIZE + + SPACE_SIZE) { + conceptVector.add(subString); + subString = conceptNew; + conceptNew = ""; + break; } else { subString = subString + conceptNew; conceptNew = ""; @@ -395,16 +406,20 @@ flag = true; if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (this.isInCircle(x, y, newConcept) - && this.isInCircle(x, y, oldConcept) + if (newConcept.contains(x, y) + && oldConcept.contains(x, y) && !(x >= this.getX1() + this.getShiftCovered() - - 5 && x <= this.getX2() - + this.getShiftCovered() + 5 - && y >= this.getY1() - 5 && y <= this - .getY2() + 5)) { - posCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); + + this.getShiftCovered() + && y >= this.getY1() && y <= this + .getY2())) { + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + posCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } i++; flag = false; @@ -429,29 +444,38 @@ flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (!this.isInCircle(x, y, oldConcept) - && this.isInCircle(x, y, newConcept) + if (!oldConcept.contains(x, y) + && newConcept.contains(x, y) && !(x >= this.getX1() - + this.getShiftNewConcept() - 5 + + this.getShiftNewConcept() && x <= this.getX2() - + this.getShiftNewConcept() + 5 - && y >= this.getY1() - 5 && y <= this - .getY2() + 5) + + this.getShiftNewConcept() + && y >= this.getY1() && y <= this + .getY2()) && !(x >= this.getX1() - + this.getShiftNewConceptX() - 5 + + this.getShiftNewConceptX() && x <= this.getX2() + this.getShiftNewConceptX() - + 5 && y >= this.getY1() - + this.getShiftNewConcept() - 5 && y <= this + + this.getShiftNewConcept() && y <= this .getY2() - + 5 + this.getShiftNewConcept())) { + + this.getShiftNewConcept())) { if (id.equals(EQUI_STRING)) { - posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } } else { - additionalIndividuals.add(new IndividualPoint( - "*", (int) x, (int) y, ind.toString())); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + additionalIndividuals.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } } j++; flag = false; @@ -477,16 +501,21 @@ flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (this.isInCircle(x, y, oldConcept) - && !this.isInCircle(x, y, newConcept) - && !(x >= this.getX1() - 5 + if (oldConcept.contains(x, y) + && !newConcept.contains(x, y) + && !(x >= this.getX1() - this.getShiftOldConcept() - && x <= this.getX2() + 5 + && x <= this.getX2() - this.getShiftOldConcept() - && y >= this.getY1() - 5 && y <= this - .getY2() + 5)) { - posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); + && y >= this.getY1() && y <= this + .getY2())) { + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } k++; flag = false; x = random.nextInt(300); @@ -622,7 +651,7 @@ public boolean isInCircle(double x, double y, Ellipse2D ell) { int r = (WIDTH / 2) * (WIDTH / 2); int n = (int) ((x - ell.getCenterX()) * (x - ell.getCenterX())) - + (int) ((y - ell.getCenterY()) * (y - ell.getCenterY())); + + (int) ((y - ell.getCenterY()-5) * (y - ell.getCenterY()-5)); if (n <= r) { return true; } else { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-24 13:59:23 UTC (rev 1662) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-24 15:55:16 UTC (rev 1663) @@ -93,8 +93,6 @@ && m.getY() >= panel.getY1() && m.getY() <= panel.getY2()) { panel.getGraphicalCoveragePanel().setToolTipText( "To view all Individuals please click on the plus"); - } else { - panel.getGraphicalCoveragePanel().setToolTipText(null); } Vector<IndividualPoint> v = panel.getIndividualVector(); @@ -131,7 +129,12 @@ int i = covInd.size(); if (i > 0) { for (Individual ind : covInd) { - individualComboBox.add(ind.toString()); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + } + } } indiBox = new JComboBox(individualComboBox); scrollPopup = new BasicComboPopup(indiBox); @@ -162,7 +165,12 @@ int i = addInd.size(); if (i > 0) { for (Individual ind : addInd) { - individualComboBox.add(ind.toString()); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + } + } } indiBox = new JComboBox(individualComboBox); scrollPopup = new BasicComboPopup(indiBox); @@ -187,7 +195,12 @@ int i = notCovInd.size(); if (i > 0) { for (Individual ind : notCovInd) { - individualComboBox.add(ind.toString()); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + } + } } indiBox = new JComboBox(individualComboBox); scrollPopup = new BasicComboPopup(indiBox); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 13:59:23 UTC (rev 1662) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 15:55:16 UTC (rev 1663) @@ -50,7 +50,7 @@ minAccuracyLabel.setBounds(5, 0, 150, 40); maxExecutionTimeLabel = new JLabel("maximum execution time"); maxExecutionTimeLabel.setBounds(5, 40, 150, 40); - nrOfConceptsLabel = new JLabel("maximum number of results"); + nrOfConceptsLabel = new JLabel("max. number of results"); nrOfConceptsLabel.setBounds(5, 80, 150, 40); minAccuracy = new JSlider(0, 50, 5); @@ -61,9 +61,9 @@ minAccuracy.setBounds(200, 0, 200, 40); - maxExecutionTime = new JSlider(2, 20, 8); + maxExecutionTime = new JSlider(0, 40, 8); maxExecutionTime.setPaintTicks(true); - maxExecutionTime.setMajorTickSpacing(5); + maxExecutionTime.setMajorTickSpacing(10); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); maxExecutionTime.setBounds(200, 40, 200, 40); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-24 13:59:28
|
Revision: 1662 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1662&view=rev Author: heeroyuy Date: 2009-03-24 13:59:23 +0000 (Tue, 24 Mar 2009) Log Message: ----------- -split concept string on spaces -small changes on option panel -add own method to calculate if point is in ellipse Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -102,7 +102,7 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("Suggest " + id +" description")) { + if (z.getActionCommand().equals("suggest class expression")) { model.setKnowledgeSource(); model.setReasoner(); model.setLearningProblem(); @@ -126,7 +126,7 @@ .getSuggestClassPanel().getSuggestList() .getSelectedValue()); } - String message = "class description\nadded"; + String message = "class expression\nadded"; view.renderErrorMessage(message); } if (z.getActionCommand().equals("")) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -290,7 +290,7 @@ e.printStackTrace(); } cm.applyConfigEntry(la, "useNegation", false); - cm.applyConfigEntry(la, "noisePercentage", 5.0); + cm.applyConfigEntry(la, "noisePercentage", view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy()); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -108,6 +108,7 @@ private final OWLEditorKit editorKit; private final JPanel learnerPanel; private final JScrollPane learnerScroll; + private static final int SCROLL_SPPED = 10; /** * The constructor for the DL-Learner tab in the class description @@ -133,7 +134,7 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - run = new JButton("Suggest " + label + " description"); + run = new JButton("suggest class expression"); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -141,13 +142,14 @@ errorMessage.setEditable(false); hint = new JTextArea(); hint.setEditable(false); - hint.setText("To get suggestions for class descriptions, please click the button above."); + hint.setText("To get suggestions for class expression, please click the button above."); learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(null); accept.setPreferredSize(new Dimension(260, 50)); advanced.setName("Advanced"); learnerScroll.setPreferredSize(new Dimension(600, 400)); + learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPPED); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); this.addAcceptButtonListener(this.action); @@ -388,9 +390,9 @@ String error = "learning\nsuccessful"; String message = ""; if(isInconsistent) { - message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; + message = "Class expressions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; } else { - message = "To view details about why a class description was suggested, please click on it."; + message = "To view details about why a class expression was suggested, please click on it."; } run.setEnabled(true); // start the algorithm and print the best concept found Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -50,6 +50,8 @@ private static final int ELLIPSE_Y_AXIS = 5; private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; private static final int PLUS_SIZE = 5; + private static final int SUBSTRING_SIZE = 25; + private static final int SPACE_SIZE = 7; private static final String EQUI_STRING = "equivalent class"; private final String id; private int shiftXAxis; @@ -80,6 +82,8 @@ private int centerX; private int centerY; private final Random random; + private final Color darkGreen; + private final Color darkRed; private final MoreDetailForSuggestedConceptsPanel panel; /** @@ -103,8 +107,10 @@ this.repaint(); eval = desc; model = m; - panel = p;; + panel = p; id = model.getID(); + darkGreen = new Color(0, 100, 0); + darkRed = new Color(205, 0, 0); random = new Random(); conceptNew = concept; conceptVector = new Vector<String>(); @@ -132,15 +138,21 @@ AlphaComposite ac = AlphaComposite.getInstance( AlphaComposite.SRC_OVER, 0.5f); - g2D.setColor(Color.YELLOW); - g2D.fill(oldConcept); - g2D.drawString(model.getOldConceptOWLAPI().toString(), 310, 10); + g2D.setColor(Color.BLACK); + g2D.drawString(model.getOldConceptOWLAPI().toString(), 320, 10); g2D.setColor(Color.ORANGE); + g2D.fillOval(310, 20, 9, 9); + g2D.setColor(Color.black); int p = 30; for (int i = 0; i < conceptVector.size(); i++) { - g2D.drawString(conceptVector.get(i), 310, p); + g2D.drawString(conceptVector.get(i), 320, p); p = p + 20; } + + g2D.setColor(Color.YELLOW); + g2D.fill(oldConcept); + g2D.fillOval(310, 0, 9, 9); + g2D.setColor(Color.ORANGE); g2D.setComposite(ac); g2D.fill(newConcept); g2D.setColor(Color.BLACK); @@ -223,7 +235,8 @@ + shiftNewConcept, y2 + 1); } - if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0) { + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 + && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0) { g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + shiftNewConcept, x2 + 1 + shiftNewConceptX, y1 - 1 + shiftNewConcept); @@ -256,14 +269,14 @@ } for (int i = 0; i < posCovIndVector.size(); i++) { - g2D.setColor(Color.GREEN); + g2D.setColor(darkGreen); g2D.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get( i).getYAxis()); } for (int i = 0; i < posNotCovIndVector.size(); i++) { - g2D.setColor(Color.RED); + g2D.setColor(darkRed); g2D.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); @@ -335,17 +348,37 @@ shiftNewConcept = 2 * shiftNewConceptX; } } - + int i = conceptNew.length(); - int z = 0; - while(i > 0) { - if(i >= 39 ) { - z = 39; - } else { - z = conceptNew.length(); + while (i > 0) { + int sub = conceptNew.indexOf(" "); + String subString = conceptNew.substring(0, sub) + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); + while(sub < SUBSTRING_SIZE) { + if(conceptNew.length() > 0 && conceptNew.contains(" ")) { + sub = conceptNew.indexOf(" "); + if(subString.length() + sub < SUBSTRING_SIZE) { + subString = subString + conceptNew.substring(0, sub) + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); + System.out.println("string: " + subString + " lenght: " + subString.length()); + sub = subString.length(); + } else { + break; + } + } else { + if(subString.length() + conceptNew.length() > SUBSTRING_SIZE + SPACE_SIZE) { + conceptVector.add(subString); + subString = conceptNew; + conceptNew = ""; + break; + } else { + subString = subString + conceptNew; + conceptNew = ""; + break; + } + } } - conceptVector.add(conceptNew.substring(0, z)); - conceptNew = conceptNew.replace(conceptNew.substring(0, z), ""); + conceptVector.add(subString); i = conceptNew.length(); } } @@ -362,13 +395,14 @@ flag = true; if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (newConcept.contains(x, y) - && oldConcept.contains(x, y) - && !(x >= this.getX1() + this.getShiftCovered()-5 + if (this.isInCircle(x, y, newConcept) + && this.isInCircle(x, y, oldConcept) + && !(x >= this.getX1() + this.getShiftCovered() + - 5 && x <= this.getX2() - + this.getShiftCovered()+5 - && y >= this.getY1()-5 && y <= this - .getY2()+5)) { + + this.getShiftCovered() + 5 + && y >= this.getY1() - 5 && y <= this + .getY2() + 5)) { posCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); i++; @@ -395,21 +429,23 @@ flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (!oldConcept.contains(x, y) - && newConcept.contains(x, y) + if (!this.isInCircle(x, y, oldConcept) + && this.isInCircle(x, y, newConcept) && !(x >= this.getX1() - + this.getShiftNewConcept()-5 + + this.getShiftNewConcept() - 5 && x <= this.getX2() - + this.getShiftNewConcept()+5 - && y >= this.getY1()-5 && y <= this - .getY2()+5) && !(x >= this.getX1() - + this.getShiftNewConceptX()-5 + + this.getShiftNewConcept() + 5 + && y >= this.getY1() - 5 && y <= this + .getY2() + 5) + && !(x >= this.getX1() + + this.getShiftNewConceptX() - 5 && x <= this.getX2() - + this.getShiftNewConceptX()+5 + + this.getShiftNewConceptX() + + 5 && y >= this.getY1() - + this.getShiftNewConcept()-5 && y <= this - .getY2()+5 - + this.getShiftNewConcept())) { + + this.getShiftNewConcept() - 5 && y <= this + .getY2() + + 5 + this.getShiftNewConcept())) { if (id.equals(EQUI_STRING)) { posNotCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); @@ -441,14 +477,14 @@ flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (oldConcept.contains(x, y) - && !newConcept.contains(x, y) - && !(x >= this.getX1()-5 + if (this.isInCircle(x, y, oldConcept) + && !this.isInCircle(x, y, newConcept) + && !(x >= this.getX1() - 5 - this.getShiftOldConcept() - && x <= this.getX2()+5 + && x <= this.getX2() + 5 - this.getShiftOldConcept() - && y >= this.getY1()-5 && y <= this - .getY2()+5)) { + && y >= this.getY1() - 5 && y <= this + .getY2() + 5)) { posNotCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); k++; @@ -582,4 +618,15 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } + + public boolean isInCircle(double x, double y, Ellipse2D ell) { + int r = (WIDTH / 2) * (WIDTH / 2); + int n = (int) ((x - ell.getCenterX()) * (x - ell.getCenterX())) + + (int) ((y - ell.getCenterY()) * (y - ell.getCenterY())); + if (n <= r) { + return true; + } else { + return false; + } + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -53,12 +53,12 @@ nrOfConceptsLabel = new JLabel("maximum number of results"); nrOfConceptsLabel.setBounds(5, 80, 150, 40); - minAccuracy = new JSlider(50, 100, 90); + minAccuracy = new JSlider(0, 50, 5); minAccuracy.setPaintTicks(true); minAccuracy.setMajorTickSpacing(10); minAccuracy.setMinorTickSpacing(1); minAccuracy.setPaintLabels(true); - minAccuracy.setBounds(160, 0, 200, 40); + minAccuracy.setBounds(200, 0, 200, 40); maxExecutionTime = new JSlider(2, 20, 8); @@ -66,7 +66,7 @@ maxExecutionTime.setMajorTickSpacing(5); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); - maxExecutionTime.setBounds(160, 40, 200, 40); + maxExecutionTime.setBounds(200, 40, 200, 40); nrOfConcepts = new JSlider(2, 20, 10); @@ -74,7 +74,7 @@ nrOfConcepts.setMajorTickSpacing(2); nrOfConcepts.setMinorTickSpacing(1); nrOfConcepts.setPaintLabels(true); - nrOfConcepts.setBounds(160, 80, 200, 40); + nrOfConcepts.setBounds(200, 80, 200, 40); add(minAccuracyLabel); add(minAccuracy); @@ -89,7 +89,7 @@ * @return double minAccuracy */ public double getMinAccuracy() { - int acc = minAccuracy.getValue(); + double acc = minAccuracy.getValue(); accuracy = (acc/100.0); return accuracy; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-24 09:14:55
|
Revision: 1661 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1661&view=rev Author: jenslehmann Date: 2009-03-24 09:14:51 +0000 (Tue, 24 Mar 2009) Log Message: ----------- manual reference to KB EBNF definition Modified Paths: -------------- trunk/doc/manual/manual.tex Modified: trunk/doc/manual/manual.tex =================================================================== --- trunk/doc/manual/manual.tex 2009-03-23 15:36:15 UTC (rev 1660) +++ trunk/doc/manual/manual.tex 2009-03-24 09:14:51 UTC (rev 1661) @@ -124,7 +124,7 @@ \begin{description} \item[OWL File] DL-Learner supports OWL files in different formats, e.g. RDF/XML or N-Triples. If there is a standard OWL format, you want to use, but is not supported by DL-Learner please let us know. We use the OWL API for parsing, so all formats supported by it can be used\footnote{ for a list see \owlapi}. - \item[KB File] KB files are an internal non-standardised knowledge representation format, which corresponds to description logic syntax except that the special symbols have been replaced by ASCII strings, e.g.~\verb|AND| instead of $\sqcap$. You can find several KB files in the examples folder. + \item[KB File] KB files are an internal non-standardised knowledge representation format, which corresponds to description logic syntax except that the special symbols have been replaced by ASCII strings, e.g.~\verb|AND| instead of $\sqcap$. You can find several KB files in the examples folder. The \verb|doc/kbFileSyntax.txt| contains an EBNF description of the language. \item[SPARQL Endpoint] DL-Learner allows to use SPARQL endpoints as background knowledge source, which enables the incorporation of very large knowledge bases, e.g. DBpedia\cite{2008_dbpedia}, in DL-Learner. This works by using a set of start instances, which usually correspond to the examples in a learning problem, and then retrieving knowledge about these instances via SPARQL queries. The obtained knowledge base fragment can be converted to OWL and consumed by a reasoner later since it is now sufficiently small to be processed in reasonable time. Please see \cite{2009_ijswis} for details about the knowledge fragment extraction algorithm. Some options of the SPARQL component are: \begin{itemize} \item instances: Set of individuals to use for starting the knowledge fragment extraction. Example use in conf file: \begin{verbatim}sparql.instances = {"http://dbpedia.org/resource/Matt_Stone", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-23 15:36:23
|
Revision: 1660 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1660&view=rev Author: jenslehmann Date: 2009-03-23 15:36:15 +0000 (Mon, 23 Mar 2009) Log Message: ----------- fixed Manchester syntax for value restrictions Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/Annotation.java trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java trunk/src/dl-learner/org/dllearner/core/owl/BooleanDatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java trunk/src/dl-learner/org/dllearner/core/owl/DifferentIndividualsAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/DisjointClassesAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java Modified: trunk/src/dl-learner/org/dllearner/core/owl/Annotation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Annotation.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/Annotation.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -84,4 +84,13 @@ return annotationValue; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/BooleanDataRange.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -68,5 +68,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/BooleanDatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/BooleanDatatypePropertyAssertion.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/BooleanDatatypePropertyAssertion.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -54,6 +54,15 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassAssertionAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -70,5 +70,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -61,5 +61,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -86,5 +86,14 @@ @Override public int hashCode() { return name.hashCode(); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyDomainAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -73,6 +73,15 @@ */ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyRangeAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -69,6 +69,15 @@ */ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeValueRestriction.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -40,8 +40,7 @@ */ @Override public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) { - // TODO Auto-generated method stub - return null; + return restrictedPropertyExpression.toString(baseURI, prefixes) + " value " + value.toManchesterSyntaxString(baseURI, prefixes); } /* (non-Javadoc) @@ -66,7 +65,7 @@ * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map) */ public String toString(String baseURI, Map<String, String> prefixes) { - return restrictedPropertyExpression.toString(baseURI, prefixes) + " = " + value.toString(baseURI, prefixes); + return restrictedPropertyExpression.toString(baseURI, prefixes) + " value " + value.toString(baseURI, prefixes); } public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/DifferentIndividualsAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DifferentIndividualsAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DifferentIndividualsAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -65,6 +65,15 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DisjointClassesAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DisjointClassesAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DisjointClassesAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -73,6 +73,15 @@ */ public Set<Description> getDescriptions() { return descriptions; + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleDatatypePropertyAssertion.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -59,5 +59,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleMaxValue.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -63,6 +63,15 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/DoubleMinValue.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -63,5 +63,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/EquivalentClassesAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -39,5 +39,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/FunctionalObjectPropertyAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -39,5 +39,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/InverseObjectPropertyAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -39,5 +39,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -304,4 +304,13 @@ e.printStackTrace(); } } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/KBElement.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -26,5 +26,8 @@ public String toKBSyntaxString(String baseURI, Map<String,String> prefixes); + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes); + public void accept(KBElementVisitor visitor); + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -77,5 +77,14 @@ @Override public int hashCode() { return name.hashCode(); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyAssertion.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -71,5 +71,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -65,6 +65,15 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyInverse.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -56,5 +56,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -71,5 +71,14 @@ visitor.visit(this); } + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; + } + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/SubClassAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -39,5 +39,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/SubObjectPropertyAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -39,5 +39,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/SymmetricObjectPropertyAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -33,5 +33,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/TransitiveObjectPropertyAxiom.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -33,5 +33,14 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); + } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + // TODO Auto-generated method stub + return null; } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -55,6 +55,14 @@ return literal; // return literal + "^^" + datatype; } + + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + return literal; + } /** * @return the datatype @@ -88,4 +96,6 @@ return literal + "^^" + datatype; } + + } Modified: trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java 2009-03-23 14:03:26 UTC (rev 1659) +++ trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java 2009-03-23 15:36:15 UTC (rev 1660) @@ -69,6 +69,17 @@ return literal; } + /* (non-Javadoc) + * @see org.dllearner.core.owl.KBElement#toManchesterSyntaxString(java.lang.String, java.util.Map) + */ + @Override + public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) { + if(hasLang) + return literal + "@" + lang; + else + return literal; + } + /** * @return the lang */ @@ -97,5 +108,7 @@ } else { return literal; } - } + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-03-23 14:03:37
|
Revision: 1659 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1659&view=rev Author: jenslehmann Date: 2009-03-23 14:03:26 +0000 (Mon, 23 Mar 2009) Log Message: ----------- fixed incorrect handling of borderline case in accuracy computation Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-03-23 10:35:06 UTC (rev 1658) +++ trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-03-23 14:03:26 UTC (rev 1659) @@ -149,7 +149,7 @@ } double coverage = coveredInstances.size()/(double)classInstances.size(); - double protusion = additionalInstances.size() == 0 ? 0 : coveredInstances.size()/(double)(coveredInstances.size()+additionalInstances.size()); + double protusion = (additionalInstances.size() + coveredInstances.size() == 0) ? 0 : coveredInstances.size()/(double)(coveredInstances.size()+additionalInstances.size()); return new ClassScore(coveredInstances, coverage, additionalInstances, protusion, getAccuracy(coverage, protusion)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |