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-16 18:12:12
|
Revision: 1708 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1708&view=rev Author: jenslehmann Date: 2009-04-16 18:12:06 +0000 (Thu, 16 Apr 2009) Log Message: ----------- - fixed bug occurring in KRK examples - added corresponding unit test Modified Paths: -------------- trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java Modified: trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf =================================================================== --- trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf 2009-04-16 18:12:06 UTC (rev 1708) @@ -1,38 +1,23 @@ /* -DEBUG - --- loop 5279 started --- -INFO - best node EXISTS "hasPiece".EXISTS "hasLowerRankThan".("WRook" AND ALL "fileDistanceLessThan1"."WKing") [acc:100% h:0,853 q:0p-0n (REASONER), he:8 c:0] -INFO - -solutions: -INFO - EXISTS "http://www.test.de/test#hasPiece".EXISTS "http://www.test.de/test#hasLowerRankThan".("http://www.test.de/test#WRook" AND ALL "http://www.test.de/test#fileDistanceLessThan1"."http://www.test.de/test#WKing") (length 9, depth 5) -INFO - MANCHESTER: hasPiece some hasLowerRankThan some (WRook and fileDistanceLessThan1 only WKing) -DEBUG - size of candidate set: 50434 -DEBUG - properness tests (reasoner/short concept/too weak list): 0/3/56 -DEBUG - concept tests (reasoner/too weak list/overly general list/redundant concepts): 12609/56/38684/4153 -INFO - Algorithm terminated succesfully. -number of retrievals: 12 -retrieval reasoning time: 0ms ( 0ms per retrieval) -number of instance checks: 1232144 (0 multiple) -instance check reasoning time: 9s 613ms ( 0ms per instance check) -subsumption hierarchy queries: 14 -(complex) subsumption checks: 8 (0 multiple) -subsumption reasoning time: 17ms ( 2ms per subsumption check) -overall reasoning time: 9s 630ms (24,91% of overall runtime) -overall algorithm runtime: 38s 662ms + * Chess - King and Rook vs. lone King + * + * Here, we learn the difference between mate and mate in 1. + * + * Solutions: + * + * 1: hasPiece some hasLowerRankThan some (WRook and fileDistance0 only WKing) + * 2: hasPiece some hasLowerRankThan some (WRook and fileDistanceLessThan1 only WKing) + */ - - -*/ - import("KRK_ZERO_ONE.owl"); + refexamples.ignoredConcepts={ "http://www.test.de/test#ONE", "http://www.test.de/test#ZERO"}; - algorithm = refexamples; reasoner=fastInstanceChecker; - +"http://www.test.de/test#game100" +"http://www.test.de/test#game101" +"http://www.test.de/test#game102" Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -205,8 +205,6 @@ options.add(CommonConfigOptions.maxClassDescriptionTests()); options.add(CommonConfigOptions.getLogLevel()); options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)",usePropernessChecksDefault)); - options.add(new IntegerConfigOption("maxPosOnlyExpansion", "specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is" + - " considered as solution candidate",maxPosOnlyExpansionDefault)); options.add(CommonConfigOptions.getNoisePercentage()); options.add(CommonConfigOptions.getTerminateOnNoiseReached()); options.add(new StringConfigOption("startClass", "the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)")); @@ -366,6 +364,9 @@ if(improveSubsumptionHierarchy) classHierarchy.thinOutSubsumptionHierarchy(); +// System.out.println(classHierarchy); +// System.exit(0); + // reasoner.prepareRoleHierarchy(usedRoles); // prepare datatype hierarchy only if necessary // if(reasoner.hasDatatypeSupport()) Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -44,8 +44,6 @@ import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.ScorePosNeg; -import org.dllearner.parser.KBParser; -import org.dllearner.parser.ParseException; import org.dllearner.refinementoperators.RefinementOperator; import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Files; @@ -85,15 +83,6 @@ private double noise = 0.0; private int allowedMisclassifications = 0; - // positive only learning options: - // if no negatives are given, then one possible strategy is to find a very - // special concept still entailing all positive examples; - // this is realised by changing the termination criterion: a concept is a - // solution if it has been expanded x times (x is - // configurable) but no more special concept is found (all are either - // equivalent or too weak) - private int maxPosOnlyExpansion; - // search tree options private boolean writeSearchTree; private File searchTreeFile; @@ -266,7 +255,6 @@ this.usePropernessChecks = usePropernessChecks; baseURI = rs.getBaseURI(); prefixes = rs.getPrefixes(); - this.maxPosOnlyExpansion = maxPosOnlyExpansion; this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; this.minExecutionTimeInSeconds = minExecutionTimeInSeconds; this.guaranteeXgoodDescriptions = guaranteeXgoodDescriptions; @@ -467,38 +455,6 @@ Files.appendFile(searchTreeFile, treeString); } - // special situation for positive only learning: the expanded node - // can become a solution (see explanations - // for maxPosOnlyExpansion above) - - // DEPRECATED CODE - if (false - && bestNode.isPosOnlyCandidate() - && (bestNode.getHorizontalExpansion() - bestNode.getConcept().getLength() >= maxPosOnlyExpansion)) { - - boolean solution = checkSubtreePosOnly(bestNode); - - if (solution) { - solutions.add(bestNode); - ExampleBasedNode bestChild = bestNode.getChildren().last(); - System.out.println("solution: " + bestNode.getConcept()); - System.out.println("maxPosOnlyExpansion: " + maxPosOnlyExpansion); - System.out.println("best child of this node: " + bestChild); - if(bestNode.getChildConcepts().size()<100) { - System.out.println(bestNode.getChildConcepts()); - } - System.out.println("TODO: needs to be integrated with other stopping criteria"); - System.out - .println("You tried to use this algorithm for positive only learning, which is not recommended (yet)."); - // System.out.println("Exiting."); - // System.exit(0); - } else { - // tag as non-candidate so we do not need to search again - bestNode.setPosOnlyCandidate(false); - } - - } - // Anzahl Schleifendurchläufe loop++; }// end while @@ -571,6 +527,7 @@ // System.out.println("node: " + node); // System.out.println("concept: " + concept); +// System.out.println("max length: " + maxLength); // do not execute methods if algorithm has been stopped (this means that // the algorithm @@ -896,26 +853,6 @@ // System.out.println("node " + node); // System.out.println("refinement " + refinement); - /* - try { - Description c = KBParser.parseConcept("EXISTS \"http://www.test.de/test#hasPiece\".EXISTS \"http://www.test.de/test#hasLowerRankThan\".\"http://www.test.de/test#WRook\""); - if(conceptComparator.compare(c, node.getConcept()) == 0) { - System.out.println("TEST"); - Set<Description> refs = operator.refine(c, 8, null); - for(Description d : refs) { - System.out.println(" " + d); - } - System.out.println(); - System.exit(0); - } - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - */ - - - extendNodeProper(node, refinement, maxLength, recDepth + 1); } @@ -1322,45 +1259,9 @@ public ExampleBasedNode getStartNode() { return startNode; } - - // returns true if there is any meaningful node in the subtree - private boolean checkSubtreePosOnly(ExampleBasedNode node) { - for (ExampleBasedNode refinement : node.getChildren()) { - - if (!node.isTooWeak()) { - // refinement meaningful - if (isPosOnlyRefinementMeaningful(node, refinement)) - return true; - - // subtree with refinement as root contains a meaningful node - if (checkSubtreePosOnly(refinement)) - return true; - } - - } - return false; - } - - // returns whether the refinement is "meaningful", i.e. the refinement - // actually represents a different concept - // than its parent; this is needed to determine when a positive only - // learning algorithm should stop (when a node - // has been expaned x times without yielding any meaningful refinements, it - // is considered a possible solution) - private boolean isPosOnlyRefinementMeaningful(ExampleBasedNode node, ExampleBasedNode refinement) { - Description d1 = node.getConcept(); - Description d2 = refinement.getConcept(); - // check whether d2 can be shortened, e.g. male AND male => male - Description shortConcept = ConceptTransformation.getShortConcept(d2, conceptComparator); - if (conceptComparator.compare(d1, shortConcept) != 0) - return false; - return true; - } - - /** - * In this function it is calculated if the algorithm should stop. + * In this function it is calculated whether the algorithm should stop. * This is not always depends whether an actual solution was found * The algorithm stops if: * 1. the object attribute stop is set to true (possibly by an outside source) Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class ROLComponent2Configurator implements Configurator { +public class ROLComponent2Configurator extends RefinementOperatorConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -372,7 +372,7 @@ public Set<Description> refine(Description description, int maxLength, List<Description> knownRefinements, Description currDomain) { -// logger.trace(description + " " + currDomain + " " + maxLength); +// System.out.println("|- " + description + " " + currDomain + " " + maxLength); // actions needing to be performed if this is the first time the // current domain is used @@ -399,7 +399,6 @@ } refinements = (TreeSet<Description>) topARefinementsCumulative.get(currDomain).get(maxLength).clone(); } - // refinements.addAll(subHierarchy.getMoreSpecialConcepts(description)); } else if(description instanceof Nothing) { // cannot be further refined @@ -881,7 +880,9 @@ if(useNegation) { Set<Description> m2tmp = subHierarchy.getSuperClasses(new Nothing()); for(Description c : m2tmp) { - m2.add(new Negation(c)); + if(!(c instanceof Thing)) { + m2.add(new Negation(c)); + } } } @@ -968,9 +969,11 @@ SortedSet<Description> m2tmp = subHierarchy.getSuperClasses(new Nothing()); for(Description c : m2tmp) { - if(c instanceof Thing) - m2.add(c); - else { +// if(c instanceof Thing) +// m2.add(c); +// else { + // we obviously do not add \top (\top refines \top does not make sense) + if(!(c instanceof Thing)) { NamedClass a = (NamedClass) c; if(!isNotADisjoint(a, nc) && isNotAMeaningful(a, nc)) m2.add(new Negation(a)); Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -39,6 +39,7 @@ import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.configurators.CELOEConfigurator; +import org.dllearner.core.configurators.ROLComponent2Configurator; import org.dllearner.core.configurators.ROLearnerConfigurator; import org.dllearner.core.configurators.RefinementOperatorConfigurator; import org.dllearner.core.options.ConfigOption; @@ -65,6 +66,7 @@ private static final SortedSet<String> EXTENDSREFINEMENTOPERATOR = new TreeSet<String>(Arrays.asList(new String[]{ ROLearnerConfigurator.class.getSimpleName(), + ROLComponent2Configurator.class.getSimpleName(), CELOEConfigurator.class.getSimpleName(), })); Modified: trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -24,18 +24,27 @@ import java.io.File; import java.net.MalformedURLException; import java.util.Set; +import java.util.TreeSet; +import org.dllearner.algorithms.refinement2.ROLComponent2; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.owl.ClassHierarchy; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Thing; import org.dllearner.kb.OWLFile; +import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.test.junit.TestOntologies.TestOntology; +import org.dllearner.utilities.Helper; import org.junit.Test; /** @@ -115,6 +124,56 @@ assertTrue(results.size()==desiredResultSize); } + @Test + public void rhoDRDownTest3() throws ParseException, LearningProblemUnsupportedException { + ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.KRK_ZERO_ONE); + baseURI = reasoner.getBaseURI(); + + // create learning algorithm in order to test under similar conditions than + // within a learning algorithm + ComponentManager cm = ComponentManager.getInstance(); + LearningProblem lp = cm.learningProblem(PosNegLPStandard.class, reasoner); + ROLComponent2 la = cm.learningAlgorithm(ROLComponent2.class, lp, reasoner); + + Set<NamedClass> ignoredConcepts = new TreeSet<NamedClass>(); + ignoredConcepts.add(new NamedClass("http://www.test.de/test#ZERO")); + ignoredConcepts.add(new NamedClass("http://www.test.de/test#ONE")); + Set<NamedClass> usedConcepts = Helper.computeConceptsUsingIgnoreList(reasoner, ignoredConcepts); + + ClassHierarchy classHierarchy = reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts); + classHierarchy.thinOutSubsumptionHierarchy(); + RhoDRDown op = new RhoDRDown( + reasoner, + classHierarchy, + Thing.instance, + la.getConfigurator() + ); + + Description concept = KBParser.parseConcept("EXISTS \"http://www.test.de/test#hasPiece\".EXISTS \"http://www.test.de/test#hasLowerRankThan\".(\"http://www.test.de/test#WRook\" AND TOP)"); + Set<Description> results = op.refine(concept,8); + + for(Description result : results) { + System.out.println(result.toString("http://www.test.de/test#",null)); + } + + int desiredResultSize = 8; + if(results.size() != desiredResultSize) { + System.out.println(results.size() + " results found, but should be " + desiredResultSize + "."); + } + + // the 8 refinements found on 2009/04/16 are as follows: + // EXISTS hasPiece.EXISTS hasLowerRankThan.(BKing AND WRook) + // EXISTS hasPiece.EXISTS hasLowerRankThan.(WKing AND WRook) + // EXISTS hasPiece.EXISTS hasLowerRankThan.(WRook AND WRook) + // EXISTS hasPiece.EXISTS hasLowerRankThan.(WRook AND (NOT BKing)) + // EXISTS hasPiece.EXISTS hasLowerRankThan.(WRook AND (NOT WKing)) + // EXISTS hasPiece.EXISTS hasLowerRankThan.(WRook AND (NOT WRook)) + // EXISTS hasPiece.>= 2 hasLowerRankThan.(WRook AND TOP) + // >= 2 hasPiece.EXISTS hasLowerRankThan.(WRook AND TOP) + + assertTrue(results.size()==desiredResultSize); + } + private String uri(String name) { return "\""+baseURI+name+"\""; } Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2009-04-16 14:21:43 UTC (rev 1707) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2009-04-16 18:12:06 UTC (rev 1708) @@ -41,7 +41,7 @@ */ public final class TestOntologies { - public enum TestOntology { EMPTY, SIMPLE, SIMPLE_NO_DR, SIMPLE_NO_DISJOINT, SIMPLE_NO_DR_DISJOINT, SIMPLE2, SIMPLE3, R1SUBR2, DATA1, FIVE_ROLES, FATHER_OE, CARCINOGENESIS, EPC_OE }; + public enum TestOntology { EMPTY, SIMPLE, SIMPLE_NO_DR, SIMPLE_NO_DISJOINT, SIMPLE_NO_DR_DISJOINT, SIMPLE2, SIMPLE3, R1SUBR2, DATA1, FIVE_ROLES, FATHER_OE, CARCINOGENESIS, EPC_OE, KRK_ZERO_ONE }; public static ReasonerComponent getTestOntology(TestOntology ont) { String kbString = ""; @@ -115,7 +115,9 @@ owlFile = "examples/carcinogenesis/carcinogenesis.owl"; } else if(ont.equals(TestOntology.EPC_OE)) { owlFile = "examples/epc/sap_epc_oe.owl"; - } + } else if(ont.equals(TestOntology.KRK_ZERO_ONE)) { + owlFile = "examples/krk/KRK_ZERO_ONE.owl"; + } try { ComponentManager cm = ComponentManager.getInstance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-16 14:21:58
|
Revision: 1707 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1707&view=rev Author: jenslehmann Date: 2009-04-16 14:21:43 +0000 (Thu, 16 Apr 2009) Log Message: ----------- deleted deprecated example Modified Paths: -------------- trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf trunk/examples/sparql/Aristotle.conf trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java Removed Paths: ------------- trunk/examples/sparql/Aristotle_local.conf Modified: trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf =================================================================== --- trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf 2009-04-16 09:42:26 UTC (rev 1706) +++ trunk/examples/krk/KRK_ONE_ZERO_fastInstance.conf 2009-04-16 14:21:43 UTC (rev 1707) @@ -139,4 +139,4 @@ -"http://www.test.de/test#game6" -"http://www.test.de/test#game7" -"http://www.test.de/test#game8" --"http://www.test.de/test#game9" \ No newline at end of file +-"http://www.test.de/test#game9" Modified: trunk/examples/sparql/Aristotle.conf =================================================================== --- trunk/examples/sparql/Aristotle.conf 2009-04-16 09:42:26 UTC (rev 1706) +++ trunk/examples/sparql/Aristotle.conf 2009-04-16 14:21:43 UTC (rev 1707) @@ -14,7 +14,7 @@ sparql.predefinedFilter = "YAGO"; sparql.predefinedEndpoint = "DBPEDIA"; -import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL"); +import("http://dbpedia.org/sparql","SPARQL"); algorithm = refexamples; reasoner = fastInstanceChecker; Deleted: trunk/examples/sparql/Aristotle_local.conf =================================================================== --- trunk/examples/sparql/Aristotle_local.conf 2009-04-16 09:42:26 UTC (rev 1706) +++ trunk/examples/sparql/Aristotle_local.conf 2009-04-16 14:21:43 UTC (rev 1707) @@ -1,39 +0,0 @@ -/** - * Some people from Greece. - * Note: DBpedia is always subject to change, solutions will change over time - - * Possible Solution: - * Theorist OR (Mathematician AND Physicist) - * - */ - -// SPARQL options -sparql.recursionDepth = 1; - -//predefined filter (1 = YAGO based learning) -sparql.predefinedFilter = "YAGO"; -sparql.predefinedEndpoint = "LOCALDBPEDIA"; - -import("http://139.18.2.37:8890/sparql","SPARQL"); -algorithm = refexamples; -reasoner = fastInstanceChecker; - -refexamples.ignoredConcepts={"http://dbpedia.org/class/yago/Abstainer109758173"}; - -sparql.instances = { - "http://dbpedia.org/resource/Democritus", - "http://dbpedia.org/resource/Zeno_of_Elea", - "http://dbpedia.org/resource/Plato", - "http://dbpedia.org/resource/Socrates", - "http://dbpedia.org/resource/Archytas", - "http://dbpedia.org/resource/Pythagoras", - "http://dbpedia.org/resource/Philolaus" -}; - -+"http://dbpedia.org/resource/Pythagoras" -+"http://dbpedia.org/resource/Philolaus" -+"http://dbpedia.org/resource/Archytas" --"http://dbpedia.org/resource/Socrates" --"http://dbpedia.org/resource/Plato" --"http://dbpedia.org/resource/Zeno_of_Elea" --"http://dbpedia.org/resource/Democritus" Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java 2009-04-16 09:42:26 UTC (rev 1706) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLearner2.java 2009-04-16 14:21:43 UTC (rev 1707) @@ -44,6 +44,8 @@ import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.ScorePosNeg; +import org.dllearner.parser.KBParser; +import org.dllearner.parser.ParseException; import org.dllearner.refinementoperators.RefinementOperator; import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Files; @@ -894,6 +896,26 @@ // System.out.println("node " + node); // System.out.println("refinement " + refinement); + /* + try { + Description c = KBParser.parseConcept("EXISTS \"http://www.test.de/test#hasPiece\".EXISTS \"http://www.test.de/test#hasLowerRankThan\".\"http://www.test.de/test#WRook\""); + if(conceptComparator.compare(c, node.getConcept()) == 0) { + System.out.println("TEST"); + Set<Description> refs = operator.refine(c, 8, null); + for(Description d : refs) { + System.out.println(" " + d); + } + System.out.println(); + System.exit(0); + } + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + */ + + + extendNodeProper(node, refinement, maxLength, recDepth + 1); } @@ -905,6 +927,8 @@ } } + + private void printStatistics(boolean finalStats) { // TODO: viele Tests haben ergeben, dass man nie 100% mit der // Zeitmessung abdecken Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-16 09:42:26 UTC (rev 1706) +++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-16 14:21:43 UTC (rev 1707) @@ -131,7 +131,6 @@ // ignore.add("examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // stack overflow // ignore.add("examples/krk/KRK_ONE_ZERO_fastInstance.conf"); // stack overflow ignore.add("examples/krk/"); // too many stack overflows - ignore.add("examples/sparql/Aristotle_local.conf"); // null pointer int failedCounter = 0; int counter = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-16 09:42:33
|
Revision: 1706 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1706&view=rev Author: heeroyuy Date: 2009-04-16 09:42:26 +0000 (Thu, 16 Apr 2009) Log Message: ----------- -update protege plugin build task Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2009-04-16 09:41:39 UTC (rev 1705) +++ trunk/build.xml 2009-04-16 09:42:26 UTC (rev 1706) @@ -4,7 +4,7 @@ <!-- directory settings --> <property name="lib_dir" value="lib" /> <property name="source_dir" value="src/dl-learner" /> - <property name="protege_dir" value="/home/jl/programme/Protege_4.0_beta/plugins" /> + <property name="protege_dir" value="C:\Program Files\Protege_4.0_beta\plugins" /> <property name="class_dir" value="classes" /> <property name="php_client_dir" value="src/php-client" /> @@ -326,7 +326,7 @@ <fileset dir="${lib_dir}" includes="junit-4.4.jar,jamon-2.7.jar" /> </copy> <copy toDir="${temp}/lib/pellet" > - <fileset dir="${lib_dir}/pellet" includes="pellet.jar,aterm-java-1.6.jar,relaxngDatatype.jar,xsdlib.jar" /> + <fileset dir="${lib_dir}/pellet" includes="**/*.jar" /> </copy> <copy toDir="${temp}/lib/jena" > <fileset dir="${lib_dir}/jena" includes="commons-logging-1.1.1.jar,json.jar" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-16 09:41:54
|
Revision: 1705 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1705&view=rev Author: heeroyuy Date: 2009-04-16 09:41:39 +0000 (Thu, 16 Apr 2009) Log Message: ----------- -update manifest file -some changes on main 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/META-INF/MANIFEST.MF trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-15 20:08:39 UTC (rev 1704) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-16 09:41:39 UTC (rev 1705) @@ -155,6 +155,7 @@ hint = new JTextArea(); hint.setEditable(false); hint.setText("To get suggestions for class expression, please click the button above."); + hint.setPreferredSize(new Dimension(485, 30)); learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(new GridBagLayout()); @@ -197,25 +198,23 @@ runPanel.add(BorderLayout.WEST, run); runPanel.add(BorderLayout.EAST, wikiPane); run.setEnabled(false); + c.anchor = GridBagConstraints.FIRST_LINE_START; c.gridx = 0; c.weightx = 0.0; c.weighty = 0.0; c.gridy = 0; c.gridwidth = 3; - c.ipady = 0; learner.add(runPanel, c); sugPanel.setSuggestList(new DefaultListModel()); - sugPanel = sugPanel.updateSuggestClassList(); - c.gridwidth = GridBagConstraints.RELATIVE; - c.fill = GridBagConstraints.BOTH; + c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 1; c.weightx = 1.0; c.weighty = 1.0; c.gridwidth = 2; - c.ipady = 0; + sugPanel.setSuggestList(model.getSuggestModel()); learner.add(sugPanel, c); accept.setEnabled(false); @@ -224,44 +223,39 @@ c.weightx = 0.0; c.weighty = 0.0; c.gridwidth = 1; - c.ipady = 0; addButtonPanel.add("North", accept); - c.gridwidth = GridBagConstraints.REMAINDER; + //c.gridwidth = GridBagConstraints.REMAINDER; learner.add(addButtonPanel, c); c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; - c.ipady = 20; c.gridx = 0; c.weightx = 0.0; c.weighty = 0.0; c.gridy = 2; - c.gridwidth = 3; learner.add(hint, c); advancedPanel.add(advanced); advancedPanel.add(adv); advanced.setIcon(icon); advanced.setSelected(false); - c.ipady = 5; c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; c.weightx = 0.0; c.weighty = 0.0; c.gridy = 3; - c.gridwidth = 3; learner.add(advancedPanel, c); posPanel.setVisible(false); c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; + c.gridheight = GridBagConstraints.RELATIVE; c.gridx = 0; c.gridy = 4; - c.weightx = 1.0; - c.weighty = 1.0; + c.weightx = 0.0; + c.weighty = 0.0; c.gridwidth = 3; - c.ipady = 65; learner.add(posPanel, c); @@ -274,8 +268,6 @@ readThread.start(); hint.setVisible(true); action.resetToggled(); - addButtonPanel.setBounds(485, 40, 80, 70); - detail.setBounds(10, 195, 600, 300); detail.setVisible(true); sugPanel.setVisible(true); learnerScroll.setViewportView(learner); @@ -305,35 +297,32 @@ GridBagConstraints c = new GridBagConstraints(); learner.remove(posPanel); learner.remove(advancedPanel); - learner.repaint(); + //learner.removeAll(); detail.setVisible(true); - c.fill = GridBagConstraints.BOTH; - c.gridx = 0; - c.gridy = 3; - c.weightx = 1.0; - c.weighty = 1.0; - c.gridwidth = 3; - c.ipady = 60; - learner.add(detail, c); - c.ipady = 5; c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; + c.gridy = 3; c.weightx = 0.0; c.weighty = 0.0; + learner.add(detail, c); + + + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.gridwidth = GridBagConstraints.REMAINDER; + c.gridx = 0; c.gridy = 4; - c.gridwidth = 3; learner.add(advancedPanel, c); c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; c.gridx = 0; c.gridy = 5; - c.gridwidth = 3; - c.ipady = 70; - c.weightx = 1.0; - c.weighty = 1.0; + c.gridwidth = GridBagConstraints.REMAINDER; learner.add(posPanel, c); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); learnerScroll.setViewportView(learner); learnerScroll.repaint(); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-04-15 20:08:39 UTC (rev 1704) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-04-16 09:41:39 UTC (rev 1705) @@ -101,7 +101,7 @@ */ public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, String concept, MoreDetailForSuggestedConceptsPanel p) { - this.setPreferredSize(new Dimension(WIDTH, HEIGHT + 100)); + this.setPreferredSize(new Dimension(600, 220)); this.setVisible(false); this.setForeground(Color.GREEN); this.repaint(); @@ -120,11 +120,23 @@ points = new Vector<IndividualPoint>(); this.computeGraphics(0, 0); handler = new GraphicalCoveragePanelHandler(this, desc, model); - oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), - ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + if(shiftXAxis == 0) { + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment)+3, + ELLIPSE_Y_AXIS+3, WIDTH, HEIGHT); + } else { + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), + ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + } + + if(shiftXAxis == 0){ newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis - + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT - + distortionOld); + + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld+6, HEIGHT + + distortionOld+6); + } else { + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + + distortionOld); + } this.computeIndividualPoints(300); this.addMouseMotionListener(handler); this.addMouseListener(handler); @@ -152,16 +164,18 @@ Ellipse2D circlePoint = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); g2D.draw(circlePoint); g2D.setColor(Color.BLACK); - g2D.drawString("individuals covered by the new", 320, p); + g2D.drawString("individuals covered by the", 320, p); p = p + 20; - g2D.drawString("class expression", 320, p); + g2D.drawString("new class expression", 320, p); p = p + 20; if(id.equals(EQUI_STRING)) { g2D.setColor(darkRed); Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); g2D.draw(circlePoint2); g2D.setColor(Color.BLACK); - g2D.drawString("additional or not covered individuals", 320, p); + g2D.drawString("additional or not covered", 320, p); + p = p + 20; + g2D.drawString("individuals", 320, p); } else { g2D.setColor(darkRed); Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF 2009-04-15 20:08:39 UTC (rev 1704) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF 2009-04-16 09:41:39 UTC (rev 1705) @@ -6,7 +6,7 @@ Bundle-Description: blablabla Bundle-Vendor: blablabla Bundle-DocURL: blablabla -Bundle-ClassPath: .,lib/junit-4.4.jar,lib/jamon-2.7.jar,lib/pellet/pellet.jar,lib/pellet/aterm-java-1.6.jar,lib/jena/json.jar,lib/pellet/relaxngDatatype.jar,lib/pellet/xsdlib.jar,lib/jena/commons-logging-1.1.1.jar,lib/ore-tool/swingx-0.9.2.jar +Bundle-ClassPath: .,lib/junit-4.4.jar,lib/jamon-2.7.jar,lib/pellet/pellet-core.jar,lib/pellet/pellet-datatypes.jar,lib/pellet/pellet-el.jar,lib/pellet/pellet-explanation.jar,lib/pellet/pellet-owlapi.jar,lib/pellet/pellet-rules.jar,lib/pellet/aterm-java-1.6.jar,lib/jena/json.jar,lib/pellet/relaxngDatatype.jar,lib/pellet/xsdlib.jar,lib/jena/commons-logging-1.1.1.jar,lib/ore-tool/swingx-0.9.2.jar Import-Package: org.osgi.framework,org.apache.log4j Export-Package: lib Bundle-Version: 1.0.0 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-04-15 20:08:39 UTC (rev 1704) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-04-16 09:41:39 UTC (rev 1705) @@ -59,8 +59,8 @@ private final JTextArea concept; private Set<String> ontologiesStrings; private final JTextArea conceptText; - private static final int HEIGHT = 350; - private static final int WIDTH = 600; + private static final int HEIGHT = 220; + private static final int WIDTH = 485; private GraphicalCoveragePanel p; private final MoreDetailForSuggestedConceptsPanelHandler handler; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-04-15 20:08:39 UTC (rev 1704) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-04-16 09:41:39 UTC (rev 1705) @@ -49,7 +49,7 @@ //set layout for parent Panel super(); setLayout(new GridLayout(0, 1)); - setPreferredSize(new Dimension(490, 100)); + setPreferredSize(new Dimension(485, 170)); optionPanel = new OptionPanel(); add(optionPanel); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-04-15 20:08:39 UTC (rev 1704) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-04-16 09:41:39 UTC (rev 1705) @@ -56,6 +56,7 @@ */ public SuggestClassPanel() { super(); + this.setPreferredSize(new Dimension(470, 120)); //renders scroll bars if necessary suggestScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); descriptions = new JList(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-15 20:08:50
|
Revision: 1704 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1704&view=rev Author: jenslehmann Date: 2009-04-15 20:08:39 +0000 (Wed, 15 Apr 2009) Log Message: ----------- unit test changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-15 13:33:41 UTC (rev 1703) +++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-15 20:08:39 UTC (rev 1704) @@ -36,6 +36,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; +import org.dllearner.algorithms.gp.GP; import org.dllearner.cli.QuickStart; import org.dllearner.cli.Start; import org.dllearner.core.ComponentInitException; @@ -68,6 +69,9 @@ // it runs the examples in alphabetical order boolean randomize = true; + // GPs can be excluded temporarily (because those tests are very time-consuming) + boolean testGP = false; + // we use a logger, which outputs few messages (warnings, errors) SimpleLayout layout = new SimpleLayout(); ConsoleAppender consoleAppender = new ConsoleAppender(layout); @@ -124,15 +128,23 @@ //also working fine ignore.add("./examples/sparql/SilentBobWorking2.conf"); // Out of Memory Error // ignore.add("./examples/sparql/difference/DBPediaSKOS_kohl_vs_angela.conf"); // Pellet: literal cannot be cast to individual // ignore.add("./examples/family-benchmark/Aunt.conf"); // did not terminate so far (waited 45 minutes) => disallowing ALL helps (TODO find out details) - ignore.add("examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // stack overflow - ignore.add("examples/krk/KRK_ONE_ZERO_fastInstance.conf"); // stack overflow +// ignore.add("examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // stack overflow +// ignore.add("examples/krk/KRK_ONE_ZERO_fastInstance.conf"); // stack overflow ignore.add("examples/krk/"); // too many stack overflows + ignore.add("examples/sparql/Aristotle_local.conf"); // null pointer int failedCounter = 0; int counter = 1; int total = examples.size(); for(String conf : examples) { - if(ignore.contains(conf)) { + boolean ignored = false; + for(String ignoredConfExpression : ignore) { + if(conf.contains(ignoredConfExpression)) { + ignored = true; + break; + } + } + if(ignored) { System.out.println("Skipping " + conf + " (is on ignore list)."); } else { System.out.println("Testing " + conf + " (example " + counter + " of " + total + ", time: " + sdf.format(new Date()) + ")."); @@ -141,11 +153,13 @@ try { // start example Start start = new Start(new File(conf)); - start.start(false); - // test is successful if a concept was learned - assert (start.getLearningAlgorithm().getCurrentlyBestDescription() != null); - start.getReasonerComponent().releaseKB(); - success = true; + if(testGP || !(start.getLearningAlgorithm() instanceof GP)) { + start.start(false); + // test is successful if a concept was learned + assert (start.getLearningAlgorithm().getCurrentlyBestDescription() != null); + start.getReasonerComponent().releaseKB(); + success = true; + } } catch (Exception e) { // unit test not succesful (exceptions are caught explicitly to find assert ( false ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-15 13:50:58
|
Revision: 1703 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1703&view=rev Author: jenslehmann Date: 2009-04-15 13:33:41 +0000 (Wed, 15 Apr 2009) Log Message: ----------- extended example unit test Modified Paths: -------------- trunk/examples/sparql/README.txt trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java Added Paths: ----------- trunk/examples/sparql/britishPrimeMinisters.conf Removed Paths: ------------- trunk/examples/sparql/britishPrimeMinisters_local.conf Modified: trunk/examples/sparql/README.txt =================================================================== --- trunk/examples/sparql/README.txt 2009-04-15 09:22:46 UTC (rev 1702) +++ trunk/examples/sparql/README.txt 2009-04-15 13:33:41 UTC (rev 1703) @@ -4,8 +4,8 @@ When using the SPARQL component, files are written into the directory /cache to avoid performing the same queries more than once. +Predefined Filters: -***predefined Filters all predefined filters remove references to hompage, etc during the extraction YAGO allows yago, SKOS allows skos, Copied: trunk/examples/sparql/britishPrimeMinisters.conf (from rev 1697, trunk/examples/sparql/britishPrimeMinisters_local.conf) =================================================================== --- trunk/examples/sparql/britishPrimeMinisters.conf (rev 0) +++ trunk/examples/sparql/britishPrimeMinisters.conf 2009-04-15 13:33:41 UTC (rev 1703) @@ -0,0 +1,75 @@ +/** + * Some people which are/were Prime Ministers of the UK and some random negative Examples. + * Note: DBpedia is always subject to change, solutions will change over time + + * Possible Solutions: + +1: (http://dbpedia.org/class/yago/PrimeMinistersOfTheUnitedKingdom OR EXISTS http://dbpedia.org/property/termStart.TOP) (length 5, depth 3) +2: (http://dbpedia.org/class/yago/LeadersOfTheBritishConservativeParty OR EXISTS http://dbpedia.org/property/termStart.TOP) (length 5, depth 3) + + * + */ + +// SPARQL options +sparql.recursionDepth = 1; + + +//for a list of predefined Filters and Endpoints see examples/sparql/README.txt +sparql.predefinedFilter = "YAGO"; +sparql.predefinedEndpoint = "DBPEDIA"; +// sparql.predefinedEndpoint = "LOCALDBPEDIA"; + +// import("http://139.18.2.37:8890/sparql","SPARQL"); +import("http://dbpedia.org/sparql","SPARQL"); +algorithm = refexamples; +reasoner = fastInstanceChecker; + +refexamples.useAllConstructor = false; +refexamples.useExistsConstructor = true; +refexamples.useCardinalityRestrictions = false; +refexamples.useNegation = false; +refexamples.maxExecutionTimeInSeconds = 10; + +//refexamples.ignoredConcepts={"http://dbpedia.org/class/yago/Abstainer109758173"}; + +sparql.instances = { + "http://dbpedia.org/resource/Benjamin_Netanyahu" + ,"http://dbpedia.org/resource/Brant_Brown" + ,"http://dbpedia.org/resource/David_Blunkett" + ,"http://dbpedia.org/resource/Democritus" + ,"http://dbpedia.org/resource/Dick_Grayson" + ,"http://dbpedia.org/resource/Edward_Marjoribanks%2C_2nd_Baron_Tweedmouth" + ,"http://dbpedia.org/resource/Elizabeth_Dole" + ,"http://dbpedia.org/resource/Franklin_Pierce" + ,"http://dbpedia.org/resource/Kurt_Waldheim" + ,"http://dbpedia.org/resource/Lamberto_Dini" + ,"http://dbpedia.org/resource/Laurence_Foley" + ,"http://dbpedia.org/resource/Philip_Stanhope%2C_4th_Earl_of_Chesterfield" + ,"http://dbpedia.org/resource/Alec_Douglas-Home" + ,"http://dbpedia.org/resource/Andrew_Bonar_Law" + ,"http://dbpedia.org/resource/Anthony_Eden" + ,"http://dbpedia.org/resource/Anthony_Eden_hat" + ,"http://dbpedia.org/resource/Archibald_Primrose%2C_5th_Earl_of_Rosebery" +,"http://dbpedia.org/resource/Arthur_Balfour" +}; + + + +-"http://dbpedia.org/resource/Benjamin_Netanyahu" +-"http://dbpedia.org/resource/Brant_Brown" +-"http://dbpedia.org/resource/David_Blunkett" +-"http://dbpedia.org/resource/Democritus" +-"http://dbpedia.org/resource/Dick_Grayson" +-"http://dbpedia.org/resource/Edward_Marjoribanks%2C_2nd_Baron_Tweedmouth" +-"http://dbpedia.org/resource/Elizabeth_Dole" +-"http://dbpedia.org/resource/Franklin_Pierce" +-"http://dbpedia.org/resource/Kurt_Waldheim" +-"http://dbpedia.org/resource/Lamberto_Dini" +-"http://dbpedia.org/resource/Laurence_Foley" +-"http://dbpedia.org/resource/Philip_Stanhope%2C_4th_Earl_of_Chesterfield" ++"http://dbpedia.org/resource/Alec_Douglas-Home" ++"http://dbpedia.org/resource/Andrew_Bonar_Law" ++"http://dbpedia.org/resource/Anthony_Eden" ++"http://dbpedia.org/resource/Anthony_Eden_hat" ++"http://dbpedia.org/resource/Archibald_Primrose%2C_5th_Earl_of_Rosebery" ++"http://dbpedia.org/resource/Arthur_Balfour" Deleted: trunk/examples/sparql/britishPrimeMinisters_local.conf =================================================================== --- trunk/examples/sparql/britishPrimeMinisters_local.conf 2009-04-15 09:22:46 UTC (rev 1702) +++ trunk/examples/sparql/britishPrimeMinisters_local.conf 2009-04-15 13:33:41 UTC (rev 1703) @@ -1,72 +0,0 @@ -/** - * Some people which are/were Prime Ministers of the UK and some random negative Examples. - * Note: DBpedia is always subject to change, solutions will change over time - - * Possible Solutions: - -1: (http://dbpedia.org/class/yago/PrimeMinistersOfTheUnitedKingdom OR EXISTS http://dbpedia.org/property/termStart.TOP) (length 5, depth 3) -2: (http://dbpedia.org/class/yago/LeadersOfTheBritishConservativeParty OR EXISTS http://dbpedia.org/property/termStart.TOP) (length 5, depth 3) - - * - */ - -// SPARQL options -sparql.recursionDepth = 1; - - -//for a list of predefined Filters and Endpoints see examples/sparql/README.txt -sparql.predefinedFilter = "YAGO"; -sparql.predefinedEndpoint = "LOCALDBPEDIA"; - -import("http://139.18.2.37:8890/sparql","SPARQL"); -algorithm = refexamples; -reasoner = fastInstanceChecker; - -refexamples.useAllConstructor = false; -refexamples.useExistsConstructor = true; -refexamples.useCardinalityRestrictions = false; -refexamples.useNegation = false; - -//refexamples.ignoredConcepts={"http://dbpedia.org/class/yago/Abstainer109758173"}; - -sparql.instances = { - "http://dbpedia.org/resource/Benjamin_Netanyahu" - ,"http://dbpedia.org/resource/Brant_Brown" - ,"http://dbpedia.org/resource/David_Blunkett" - ,"http://dbpedia.org/resource/Democritus" - ,"http://dbpedia.org/resource/Dick_Grayson" - ,"http://dbpedia.org/resource/Edward_Marjoribanks%2C_2nd_Baron_Tweedmouth" - ,"http://dbpedia.org/resource/Elizabeth_Dole" - ,"http://dbpedia.org/resource/Franklin_Pierce" - ,"http://dbpedia.org/resource/Kurt_Waldheim" - ,"http://dbpedia.org/resource/Lamberto_Dini" - ,"http://dbpedia.org/resource/Laurence_Foley" - ,"http://dbpedia.org/resource/Philip_Stanhope%2C_4th_Earl_of_Chesterfield" - ,"http://dbpedia.org/resource/Alec_Douglas-Home" - ,"http://dbpedia.org/resource/Andrew_Bonar_Law" - ,"http://dbpedia.org/resource/Anthony_Eden" - ,"http://dbpedia.org/resource/Anthony_Eden_hat" - ,"http://dbpedia.org/resource/Archibald_Primrose%2C_5th_Earl_of_Rosebery" -,"http://dbpedia.org/resource/Arthur_Balfour" -}; - - - --"http://dbpedia.org/resource/Benjamin_Netanyahu" --"http://dbpedia.org/resource/Brant_Brown" --"http://dbpedia.org/resource/David_Blunkett" --"http://dbpedia.org/resource/Democritus" --"http://dbpedia.org/resource/Dick_Grayson" --"http://dbpedia.org/resource/Edward_Marjoribanks%2C_2nd_Baron_Tweedmouth" --"http://dbpedia.org/resource/Elizabeth_Dole" --"http://dbpedia.org/resource/Franklin_Pierce" --"http://dbpedia.org/resource/Kurt_Waldheim" --"http://dbpedia.org/resource/Lamberto_Dini" --"http://dbpedia.org/resource/Laurence_Foley" --"http://dbpedia.org/resource/Philip_Stanhope%2C_4th_Earl_of_Chesterfield" -+"http://dbpedia.org/resource/Alec_Douglas-Home" -+"http://dbpedia.org/resource/Andrew_Bonar_Law" -+"http://dbpedia.org/resource/Anthony_Eden" -+"http://dbpedia.org/resource/Anthony_Eden_hat" -+"http://dbpedia.org/resource/Archibald_Primrose%2C_5th_Earl_of_Rosebery" -+"http://dbpedia.org/resource/Arthur_Balfour" Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-15 09:22:46 UTC (rev 1702) +++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-15 13:33:41 UTC (rev 1703) @@ -22,8 +22,13 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; import java.util.Set; import java.util.TreeSet; @@ -57,6 +62,12 @@ */ @Test public void testAllConfFiles() throws ComponentInitException { + + // if true, then examples are executed in random order (avoids the problem + // that the same examples are tested first on several runs); otherwise + // it runs the examples in alphabetical order + boolean randomize = true; + // we use a logger, which outputs few messages (warnings, errors) SimpleLayout layout = new SimpleLayout(); ConsoleAppender consoleAppender = new ConsoleAppender(layout); @@ -71,6 +82,20 @@ File f = new File(exampleDir); QuickStart.getAllConfs(f, exampleDir, confFiles); + // put all examples in a flat list + List<String> examples = new LinkedList<String>(); + for(Map.Entry<String,ArrayList<String>> entry : confFiles.entrySet()) { + for(String file : entry.getValue()) { + examples.add(entry.getKey() + file + ".conf"); + } + } + + if(randomize) { + Collections.shuffle(examples, new Random()); + } else { + Collections.sort(examples); + } + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); // ignore list (examples which are temporarily not working due @@ -99,41 +124,50 @@ //also working fine ignore.add("./examples/sparql/SilentBobWorking2.conf"); // Out of Memory Error // ignore.add("./examples/sparql/difference/DBPediaSKOS_kohl_vs_angela.conf"); // Pellet: literal cannot be cast to individual // ignore.add("./examples/family-benchmark/Aunt.conf"); // did not terminate so far (waited 45 minutes) => disallowing ALL helps (TODO find out details) - ignore.add("./examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // Out of Memory Error + ignore.add("examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // stack overflow + ignore.add("examples/krk/KRK_ONE_ZERO_fastInstance.conf"); // stack overflow + ignore.add("examples/krk/"); // too many stack overflows int failedCounter = 0; - for (String path : confFiles.keySet()) { - for (String file : confFiles.get(path)) { - String conf = path + file + ".conf"; - if(ignore.contains(conf)) { - System.out.println("Skipping " + conf + " (is on ignore list)."); - } else { - System.out.println("Testing " + conf + " (time: " + sdf.format(new Date()) + ")."); - long startTime = System.nanoTime(); - boolean success = false; - try { - // start example - Start start = new Start(new File(conf)); - start.start(false); - // test is successful if a concept was learned - assert (start.getLearningAlgorithm().getCurrentlyBestDescription() != null); - start.getReasonerComponent().releaseKB(); - success = true; - } catch (Exception e) { - // unit test not succesful (exceptions are caught explicitly to find - assert ( false ); - e.printStackTrace(); - failedCounter++; - } - long timeNeeded = System.nanoTime() - startTime; - ComponentManager.getInstance().freeAllComponents(); - if(!success) { - System.out.println("TEST FAILED."); - } - System.out.println("Test of " + conf + " completed in " + Helper.prettyPrintNanoSeconds(timeNeeded) + "."); + int counter = 1; + int total = examples.size(); + for(String conf : examples) { + if(ignore.contains(conf)) { + System.out.println("Skipping " + conf + " (is on ignore list)."); + } else { + System.out.println("Testing " + conf + " (example " + counter + " of " + total + ", time: " + sdf.format(new Date()) + ")."); + long startTime = System.nanoTime(); + boolean success = false; + try { + // start example + Start start = new Start(new File(conf)); + start.start(false); + // test is successful if a concept was learned + assert (start.getLearningAlgorithm().getCurrentlyBestDescription() != null); + start.getReasonerComponent().releaseKB(); + success = true; + } catch (Exception e) { + // unit test not succesful (exceptions are caught explicitly to find + assert ( false ); + e.printStackTrace(); + failedCounter++; } - } + long timeNeeded = System.nanoTime() - startTime; + ComponentManager.getInstance().freeAllComponents(); + if(!success) { + System.out.println("TEST FAILED."); + } + System.out.println("Test of " + conf + " completed in " + Helper.prettyPrintNanoSeconds(timeNeeded) + "."); + } + counter++; } + +// for (String path : confFiles.keySet()) { +// for (String file : confFiles.get(path)) { +// String conf = path + file + ".conf"; +// +// } +// } System.out.println("Finished. " + failedCounter + " tests failed."); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-15 09:22:51
|
Revision: 1702 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1702&view=rev Author: heeroyuy Date: 2009-04-15 09:22:46 +0000 (Wed, 15 Apr 2009) Log Message: ----------- -small change in main panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-15 07:26:58 UTC (rev 1701) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-15 09:22:46 UTC (rev 1702) @@ -199,6 +199,8 @@ run.setEnabled(false); c.anchor = GridBagConstraints.FIRST_LINE_START; c.gridx = 0; + c.weightx = 0.0; + c.weighty = 0.0; c.gridy = 0; c.gridwidth = 3; c.ipady = 0; @@ -207,9 +209,11 @@ sugPanel.setSuggestList(new DefaultListModel()); sugPanel = sugPanel.updateSuggestClassList(); c.gridwidth = GridBagConstraints.RELATIVE; - c.fill = GridBagConstraints.NONE; + c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; + c.weightx = 1.0; + c.weighty = 1.0; c.gridwidth = 2; c.ipady = 0; learner.add(sugPanel, c); @@ -217,6 +221,8 @@ accept.setEnabled(false); c.gridx = 2; c.gridy = 1; + c.weightx = 0.0; + c.weighty = 0.0; c.gridwidth = 1; c.ipady = 0; addButtonPanel.add("North", accept); @@ -227,6 +233,8 @@ c.gridwidth = GridBagConstraints.REMAINDER; c.ipady = 20; c.gridx = 0; + c.weightx = 0.0; + c.weighty = 0.0; c.gridy = 2; c.gridwidth = 3; learner.add(hint, c); @@ -239,6 +247,8 @@ c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; + c.weightx = 0.0; + c.weighty = 0.0; c.gridy = 3; c.gridwidth = 3; learner.add(advancedPanel, c); @@ -248,6 +258,8 @@ c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; c.gridy = 4; + c.weightx = 1.0; + c.weighty = 1.0; c.gridwidth = 3; c.ipady = 65; learner.add(posPanel, c); @@ -295,10 +307,11 @@ learner.remove(advancedPanel); learner.repaint(); detail.setVisible(true); - - c.fill = GridBagConstraints.NONE; + c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 3; + c.weightx = 1.0; + c.weighty = 1.0; c.gridwidth = 3; c.ipady = 60; learner.add(detail, c); @@ -307,6 +320,8 @@ c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; + c.weightx = 0.0; + c.weighty = 0.0; c.gridy = 4; c.gridwidth = 3; learner.add(advancedPanel, c); @@ -316,6 +331,8 @@ c.gridy = 5; c.gridwidth = 3; c.ipady = 70; + c.weightx = 1.0; + c.weighty = 1.0; learner.add(posPanel, c); learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); learnerScroll.setViewportView(learner); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-15 07:27:04
|
Revision: 1701 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1701&view=rev Author: lorenz_b Date: 2009-04-15 07:26:58 +0000 (Wed, 15 Apr 2009) Log Message: ----------- added generator for laconic/precise explanations and some test cases Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationException.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java 2009-04-14 17:58:43 UTC (rev 1700) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java 2009-04-15 07:26:58 UTC (rev 1701) @@ -61,20 +61,20 @@ public Set<OWLDescription> computeTau(OWLDescription desc) { - TauGenerator gen = new TauGenerator(factory); + Tau gen = new Tau(factory); return desc.accept(gen); } public Set<OWLDescription> computeBeta(OWLDescription desc) { - BetaGenerator gen = new BetaGenerator(factory); + Beta gen = new Beta(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()); + ps.add(new ArrayList<OWLDescription>()); for(OWLDescription op : operands) { @@ -95,7 +95,7 @@ for(List<OWLDescription> desc : ps ){ result.add(new HashSet<OWLDescription>(desc)); - }System.out.println("Ergebnis : " + result); + } return result; } Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationException.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationException.java 2009-04-15 07:26:58 UTC (rev 1701) @@ -0,0 +1,29 @@ + + +package org.dllearner.tools.ore.explanation; + +import org.semanticweb.owl.model.OWLException; + +public class ExplanationException extends OWLException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ExplanationException(Throwable cause) + { + super(cause); + } + + public ExplanationException(String message) + { + super(message); + } + + public ExplanationException(String message, Throwable cause) + { + super(message, cause); + } +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java 2009-04-15 07:26:58 UTC (rev 1701) @@ -0,0 +1,308 @@ + +package org.dllearner.tools.ore.explanation; +import java.net.URI; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.inference.OWLReasonerFactory; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLException; +import org.semanticweb.owl.model.OWLLogicalAxiom; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.OWLSubClassAxiom; + +import com.clarkparsia.explanation.PelletExplanation; + +public class LaconicExplanationGenerator +{ + + private PelletExplanation pelletExplanation; + private OWLOntologyManager manager; + private OWLOntology ontology; + private Set<Set<OWLAxiom>> lastRegularJusts; + private Set<Set<OWLAxiom>> allPreviouslyFoundJustifications; + private OPlus oPlus; + + public LaconicExplanationGenerator(OWLOntologyManager manager, + OWLReasonerFactory reasonerFactory, Set<OWLOntology> ontologies) { + + this.manager = manager; + + try { + ontology = manager.createOntology(URI.create(new StringBuilder().append( + "http://laconic").append(System.nanoTime()).toString()), + ontologies, true); + } catch (OWLOntologyCreationException e) { + e.printStackTrace(); + } catch (OWLOntologyChangeException e) { + e.printStackTrace(); + } + + pelletExplanation = new PelletExplanation(manager, ontologies); + lastRegularJusts = new HashSet<Set<OWLAxiom>>(); + } + + /** + * Computes a more fine grained representation for a set of axioms, which means to split them + * e.g. for A \sqsubseteq B \sqcap C returning A \sqsubseteq B and A \sqsubseteq C + * @param axioms to split + * @return splitted axioms + */ + public Set<OWLAxiom> computeOPlus(Set<OWLAxiom> axioms) { + oPlus = new OPlus(manager.getOWLDataFactory()); + Set<OWLAxiom> oPlusAxioms = new HashSet<OWLAxiom>(); + + for(OWLAxiom ax : axioms){ + Set<OWLAxiom> weakenedAxioms = ax.accept(oPlus); + oPlusAxioms.addAll(weakenedAxioms); + } + return oPlusAxioms; + } + + + public Set<Set<OWLAxiom>> getLastRegularJustifications() { + return lastRegularJusts; + } + + /** + * Computes the precise explanations + * @param entailment + * @param limit + * @return + * @throws OWLException + */ + public Set<Set<OWLAxiom>> computePreciseJusts(OWLAxiom entailment, int limit) throws OWLException { + + Set<Set<OWLAxiom>> regularJusts = pelletExplanation.getEntailmentExplanations((OWLAxiom)entailment); + + System.out.println(new StringBuilder().append + ("Got regular justifications: ").append + (regularJusts.size()).toString()); + lastRegularJusts.clear(); + lastRegularJusts.addAll(regularJusts); + allPreviouslyFoundJustifications = new HashSet<Set<OWLAxiom>>(); + allPreviouslyFoundJustifications.addAll(regularJusts); + Set<Set<OWLAxiom>> nonLaconicJusts = new HashSet<Set<OWLAxiom>>(); + Set<Set<OWLAxiom>> laconicJusts = new HashSet<Set<OWLAxiom>>(); + Set<OWLAxiom> axiomsInPreviousOntology = new HashSet<OWLAxiom>(); + long counter = 0L; + for (;;) { + counter++; + System.out.println(new StringBuilder().append("Count ").append + (counter).toString()); + Set<OWLAxiom> unionOfAllJustifications = new HashSet<OWLAxiom>(); + for(Set<OWLAxiom> just : allPreviouslyFoundJustifications){ + unionOfAllJustifications.addAll(just); + } + + +// Set<OWLAxiom> lastOPlus = new HashSet<OWLAxiom>(computeOPlus(unionOfAllJustifications)); + Set<OWLAxiom> oPlus = computeOPlus(unionOfAllJustifications); + OWLOntologyManager man2 = OWLManager.createOWLOntologyManager(); + OWLOntology extendedOnt = man2.createOntology(oPlus); + for(OWLLogicalAxiom logAx : ontology.getLogicalAxioms()){ + if (!unionOfAllJustifications.contains(logAx) || oPlus.contains(logAx)){ + man2.addAxiom(extendedOnt, logAx); + } + } + + if (extendedOnt.getLogicalAxioms().equals(axiomsInPreviousOntology)) { + System.out.println("\t ***** No change in ontology. Early termination."); + break; + } + + axiomsInPreviousOntology.clear(); + axiomsInPreviousOntology.addAll(extendedOnt.getLogicalAxioms()); + Set<Set<OWLAxiom>> allPrevJustsCopy = new HashSet<Set<OWLAxiom>>(allPreviouslyFoundJustifications); + + + Set<OWLOntology> ont2 = new HashSet<OWLOntology>(); + ont2.add(extendedOnt); + PelletExplanation expGen = new PelletExplanation(man2, ont2); + Set<Set<OWLAxiom>> currentJustifications = expGen.getEntailmentExplanations((OWLAxiom)entailment); + + + allPreviouslyFoundJustifications.addAll(currentJustifications); + if (allPreviouslyFoundJustifications.equals(allPrevJustsCopy)){ + break; + } + for(Set<OWLAxiom> currentJust : currentJustifications){ + if(!laconicJusts.contains(currentJust) && !nonLaconicJusts.contains(currentJust)){ + if(isLaconic(currentJust, entailment)){ + laconicJusts.add(currentJust); + } else{ + nonLaconicJusts.add(currentJust); + } + if(laconicJusts.size() == limit){ + return retrieveAxioms(laconicJusts); + } + } + } + + } + Set<Set<OWLAxiom>> laconicJustifications = new HashSet<Set<OWLAxiom>>(); + for(Set<OWLAxiom> just : allPreviouslyFoundJustifications){ + if(!nonLaconicJusts.contains(just)){ + if(laconicJusts.contains(just)){ + laconicJustifications.add(just); + } else if(isLaconic(just, entailment)){ + laconicJustifications.add(just); + } + } + } + + + return retrieveAxioms(laconicJustifications); + } + + public boolean isLaconic(Set<OWLAxiom> justification, OWLAxiom entailment) + throws ExplanationException { + boolean laconic; + try { + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + + Set<OWLAxiom> justificationSigmaClosure = computeOPlus(justification); + + OWLOntology justificationSigmaClosureOnt = manager + .createOntology(justificationSigmaClosure); + + PelletExplanation expGen2 = new PelletExplanation(manager, + Collections.singleton(justificationSigmaClosureOnt)); + Set<Set<OWLAxiom>> exps = expGen2.getEntailmentExplanations( + entailment, Integer.MAX_VALUE); + + laconic = Collections.singleton(justification).equals(exps); + + } catch (OWLOntologyCreationException e) { + throw new ExplanationException(e); + } catch (OWLOntologyChangeException e) { + throw new ExplanationException(e); + } + return laconic; + } + + private Set<Set<OWLAxiom>> retrieveAxioms(Set<Set<OWLAxiom>> explanations) { + + Map<OWLAxiom, Set<OWLAxiom>> sourceAxioms2OPlus = new HashMap<OWLAxiom, Set<OWLAxiom>>(); + + for (Set<OWLAxiom> just : allPreviouslyFoundJustifications) { + for (OWLAxiom ax : just) { + if (ontology.containsAxiom(ax)) { + sourceAxioms2OPlus.put(ax, computeOPlus(Collections.singleton(ax))); + } + } + } + Set<Set<OWLAxiom>> reconstituedExplanations = new HashSet<Set<OWLAxiom>>(); + + for (Set<OWLAxiom> expl : explanations) { + Map<OWLClass, Map<OWLAxiom, Set<OWLSubClassAxiom>>> lhs2SubClassAxiom = new HashMap<OWLClass, Map<OWLAxiom, Set<OWLSubClassAxiom>>>(); + Set<OWLAxiom> reconstituedAxioms = new HashSet<OWLAxiom>(); + for (OWLAxiom laconicAx : expl) { + if (laconicAx instanceof OWLSubClassAxiom) { + OWLSubClassAxiom subAx = (OWLSubClassAxiom) laconicAx; + if (subAx.getSubClass().isAnonymous()) { + reconstituedAxioms.add(subAx); + } else { + Map<OWLAxiom, Set<OWLSubClassAxiom>> source2AxiomMap = lhs2SubClassAxiom.get(subAx.getSubClass().asOWLClass()); + if (source2AxiomMap == null) { + source2AxiomMap = new HashMap<OWLAxiom, Set<OWLSubClassAxiom>>(); + lhs2SubClassAxiom.put(subAx.getSubClass().asOWLClass(), source2AxiomMap); + } + + for (OWLAxiom sourceAxiom : sourceAxioms2OPlus.keySet()) { + if ((sourceAxioms2OPlus.get(sourceAxiom)).contains(subAx)) { + Set<OWLSubClassAxiom> subClassAxioms = source2AxiomMap.get(sourceAxiom); + if (subClassAxioms == null) { + subClassAxioms = new HashSet<OWLSubClassAxiom>(); + source2AxiomMap.put(sourceAxiom, subClassAxioms); + } + subClassAxioms.add(subAx); + } + } + } + } else { + reconstituedAxioms.add(laconicAx); + } + } + Set<OWLAxiom> consumedAxioms = new HashSet<OWLAxiom>(); + for (OWLClass lhs : (Set<OWLClass>) lhs2SubClassAxiom.keySet()) { + Map<OWLAxiom, Set<OWLSubClassAxiom>> source2SubClassAxiom = lhs2SubClassAxiom.get(lhs); + for (OWLAxiom source : source2SubClassAxiom.keySet()) { + Set<OWLDescription> rightHandSides = new HashSet<OWLDescription>(); + for (OWLSubClassAxiom sub : source2SubClassAxiom.get(source)) { + if (!consumedAxioms.contains(sub)) { + rightHandSides.add(sub.getSuperClass()); + consumedAxioms.add(sub); + } + } + + if (rightHandSides.size() == 1) + reconstituedAxioms.add(manager.getOWLDataFactory().getOWLSubClassAxiom((OWLDescription) lhs,((OWLDescription) rightHandSides.iterator().next()))); + else if (rightHandSides.size() > 1) { + org.semanticweb.owl.model.OWLObjectIntersectionOf conjunction = manager.getOWLDataFactory().getOWLObjectIntersectionOf(rightHandSides); + reconstituedAxioms.add(manager.getOWLDataFactory().getOWLSubClassAxiom((OWLDescription) lhs,conjunction)); + } + } + } + + reconstituedExplanations.add(reconstituedAxioms); + + } + + return reconstituedExplanations; + } + + + + public Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException { + Set<Set<OWLAxiom>> set; + try { + set = computePreciseJusts(entailment, 2147483647); + } catch (OWLException e) { + throw new ExplanationException(e); + } + return set; + } + + public Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit) + throws ExplanationException { + Set<Set<OWLAxiom>> set; + try { + set = computePreciseJusts(entailment, limit); + } catch (OWLException e) { + throw new ExplanationException(e); + } + return set; + } + + public Set<Set<OWLAxiom>> getRegularExplanations(OWLAxiom entailment) throws ExplanationException { + Set<Set<OWLAxiom>> regularJusts; + + regularJusts = pelletExplanation.getEntailmentExplanations((OWLAxiom)entailment); + lastRegularJusts.addAll(regularJusts); + return regularJusts; + } + + public void returnSourceAxioms(Set<Set<OWLAxiom>> explanations){ + Map<OWLAxiom, Set<OWLAxiom>> sourceMap = oPlus.getAxiomsMap(); + System.out.println(sourceMap); + for(Set<OWLAxiom> explanation: explanations){ + for(OWLAxiom ax : explanation){ + System.out.println(ax + " gehört zu " + sourceMap.get(ax)); + + } + } + } + + + +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2009-04-15 07:26:58 UTC (rev 1701) @@ -0,0 +1,197 @@ +package org.dllearner.tools.ore.explanation; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URI; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.mindswap.pellet.owlapi.PelletReasonerFactory; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.inference.OWLReasoner; +import org.semanticweb.owl.inference.OWLReasonerException; +import org.semanticweb.owl.inference.OWLReasonerFactory; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLException; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.OWLSubClassAxiom; + +import com.clarkparsia.explanation.io.manchester.ManchesterSyntaxExplanationRenderer; + +public class LaconicTest { + + + + public static void main(String[] args) { + + miniTest(); + miniEconomyTest(); + universityTest(); + } + + public static void miniEconomyTest() { + String file = "file:examples/ore/miniEconomy.owl"; + + try { + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); + PrintWriter pw = new PrintWriter(System.out); + renderer.startRendering(pw); + + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI + .create(file)); + Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); + ontologies.add(ontology); + OWLReasonerFactory resonerFact = new PelletReasonerFactory(); + OWLDataFactory dataFactory = manager.getOWLDataFactory(); + + OWLReasoner reasoner = resonerFact.createReasoner(manager); + reasoner.loadOntologies(ontologies); + reasoner.classify(); + + + LaconicExplanationGenerator expGen = new LaconicExplanationGenerator( + manager, resonerFact, ontologies); + + + + Set<OWLClass> unsatClasses = reasoner.getInconsistentClasses(); + OWLSubClassAxiom unsatAxiom; + for (OWLClass unsat : unsatClasses) { + unsatAxiom = dataFactory.getOWLSubClassAxiom(unsat, dataFactory + .getOWLNothing()); + Set<Set<OWLAxiom>> preciseJusts = expGen + .getExplanations(unsatAxiom); + renderer.render(unsatAxiom, preciseJusts); + } + + renderer.endRendering(); + + } catch (OWLOntologyCreationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedOperationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void miniTest(){ + try { + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLDataFactory factory = manager.getOWLDataFactory(); + ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); + PrintWriter pw = new PrintWriter(System.out); + renderer.startRendering(pw); + OWLClass c = factory.getOWLClass(URI.create("c")); + OWLClass d = factory.getOWLClass(URI.create("d")); + OWLClass e = factory.getOWLClass(URI.create("e")); + OWLAxiom axiom = factory.getOWLSubClassAxiom(c, + factory.getOWLObjectIntersectionOf(d, factory.getOWLObjectComplementOf(d), e)); + OWLOntology ontology = manager.createOntology(Collections.singleton(axiom)); + OWLReasonerFactory resonerFact = new PelletReasonerFactory(); + OWLReasoner reasoner = resonerFact.createReasoner(manager); + reasoner.loadOntologies(Collections.singleton(ontology)); + + OWLSubClassAxiom unsatAxiom = factory.getOWLSubClassAxiom(c, factory.getOWLNothing()); + + LaconicExplanationGenerator expGen = new LaconicExplanationGenerator(manager, resonerFact, Collections.singleton(ontology)); + Set<Set<OWLAxiom>> preciseJusts = expGen.getExplanations(unsatAxiom); + renderer.render(unsatAxiom, preciseJusts); + renderer.endRendering(); + + } catch (OWLOntologyCreationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLOntologyChangeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLReasonerException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExplanationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public static void universityTest(){ + String file = "file:examples/ore/university.owl"; + + try { + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); + PrintWriter pw = new PrintWriter(System.out); + renderer.startRendering(pw); + + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI + .create(file)); + + OWLReasonerFactory resonerFact = new PelletReasonerFactory(); + OWLDataFactory dataFactory = manager.getOWLDataFactory(); + + OWLReasoner reasoner = resonerFact.createReasoner(manager); + reasoner.loadOntologies(Collections.singleton(ontology)); + + OWLSubClassAxiom axiom = dataFactory + .getOWLSubClassAxiom( + dataFactory + .getOWLClass(URI + .create("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Employee")), + dataFactory + .getOWLClass(URI + .create("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Person"))); + LaconicExplanationGenerator expGen = new LaconicExplanationGenerator( + manager, resonerFact, Collections.singleton(ontology)); + + + + Set<Set<OWLAxiom>> regularJusts = expGen.getRegularExplanations(axiom); + System.out.println("Regular explanations:"); + renderer.render(axiom, regularJusts); + + Set<Set<OWLAxiom>> preciseJusts = expGen.getExplanations(axiom); + System.out.println("Precise explanations:"); + renderer.render(axiom, preciseJusts); + + + renderer.endRendering(); + + } catch (OWLOntologyCreationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedOperationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java 2009-04-14 17:58:43 UTC (rev 1700) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java 2009-04-15 07:26:58 UTC (rev 1701) @@ -329,7 +329,7 @@ } @Override - public Set<OWLAxiom> visit(OWLObjectSubPropertyAxiom axiom) {System.out.println("jo" + axiom); + public Set<OWLAxiom> visit(OWLObjectSubPropertyAxiom axiom) { return archive(axiom); } @@ -435,7 +435,7 @@ @Override public Set<OWLAxiom> visit(OWLInverseObjectPropertiesAxiom axiom) { - Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();System.out.println(axiom); + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); axioms.add(dataFactory.getOWLSubObjectPropertyAxiom(axiom.getFirstProperty(), dataFactory.getOWLObjectPropertyInverse(axiom.getSecondProperty()))); axioms.add(dataFactory.getOWLSubObjectPropertyAxiom(axiom.getSecondProperty(), dataFactory.getOWLObjectPropertyInverse(axiom.getFirstProperty()))); return archive(axiom, axioms); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-14 17:58:59
|
Revision: 1700 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1700&view=rev Author: jenslehmann Date: 2009-04-14 17:58:43 +0000 (Tue, 14 Apr 2009) Log Message: ----------- small change (unit tests) Modified Paths: -------------- trunk/examples/lymphography/lymphography_Class2.conf trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java Modified: trunk/examples/lymphography/lymphography_Class2.conf =================================================================== --- trunk/examples/lymphography/lymphography_Class2.conf 2009-04-14 09:51:30 UTC (rev 1699) +++ trunk/examples/lymphography/lymphography_Class2.conf 2009-04-14 17:58:43 UTC (rev 1700) @@ -23,10 +23,10 @@ "http://www.example.org/lymphography#Target4_Fibrosis" }; -refexamples.useAllConstructor = false; -refexamples.useExistsConstructor = true; -refexamples.useNegation = false; -refexamples.noisePercentage = 13.0; +//refexamples.useAllConstructor = false; +//refexamples.useExistsConstructor = true; +//refexamples.useNegation = false; +refexamples.noisePercentage = 16.0; import("lymphography.owl"); Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-14 09:51:30 UTC (rev 1699) +++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2009-04-14 17:58:43 UTC (rev 1700) @@ -84,7 +84,7 @@ ignore.add("./examples/semantic_bible/sparqlbible.conf"); // requires local Joseki // temporarily not working (have a look at those before next release) - ignore.add("./examples/family/father_posonly.conf"); // ArrayOutOfBoundsException in Pellet - main problem: pos only not working/supported + // ignore.add("./examples/family/father_posonly.conf"); // ArrayOutOfBoundsException in Pellet - main problem: pos only not working/supported // ignored due to errors (should be fixed; in case of long running problems or // our of memory, it is better to increase the noise parameter and add comments @@ -99,7 +99,7 @@ //also working fine ignore.add("./examples/sparql/SilentBobWorking2.conf"); // Out of Memory Error // ignore.add("./examples/sparql/difference/DBPediaSKOS_kohl_vs_angela.conf"); // Pellet: literal cannot be cast to individual // ignore.add("./examples/family-benchmark/Aunt.conf"); // did not terminate so far (waited 45 minutes) => disallowing ALL helps (TODO find out details) - // ignore.add("./examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // Out of Memory Error + ignore.add("./examples/krk/KRK_ZERO_against_1to5_fastInstance.conf"); // Out of Memory Error int failedCounter = 0; for (String path : confFiles.keySet()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-14 09:51:35
|
Revision: 1699 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1699&view=rev Author: jenslehmann Date: 2009-04-14 09:51:30 +0000 (Tue, 14 Apr 2009) Log Message: ----------- learning example for moosique.net Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java Added Paths: ----------- trunk/examples/sparql/jamendo.owl trunk/examples/sparql/moosique.conf Added: trunk/examples/sparql/jamendo.owl =================================================================== --- trunk/examples/sparql/jamendo.owl (rev 0) +++ trunk/examples/sparql/jamendo.owl 2009-04-14 09:51:30 UTC (rev 1699) @@ -0,0 +1,79 @@ +@prefix : <http://dl-learner.org/jamendo/> . +@prefix tags: <http://dbtune.org/jamendo/tags/70> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix owl2xml: <http://www.w3.org/2006/12/owl2-xml#> . +@prefix mo: <http://purl.org/ontology/mo/> . +@prefix tag: <http://dbtune.org/jamendo/tag/> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix tags2: <http://dbtune.org/jamendo/tags/> . +@base <http://dl-learner.org/jamendo/> . + +<http://dl-learner.org/jamendo/> rdf:type owl:Ontology . + + +################################################################# +# +# Classes +# +################################################################# + + +### http://dbtune.org/jamendo/tag/guitare + +tag:guitare rdf:type owl:Class ; + + rdfs:subClassOf mo:Record . + + + +### http://dbtune.org/jamendo/tag/idm + +tag:idm rdf:type owl:Class ; + + rdfs:subClassOf mo:Record . + + + +### http://dbtune.org/jamendo/tags/70s + +tags:s rdf:type owl:Class ; + + rdfs:subClassOf mo:Record . + + + +### http://dbtune.org/jamendo/tags/electro + +tags2:electro rdf:type owl:Class ; + + rdfs:subClassOf mo:Record . + + + +### http://dbtune.org/jamendo/tags/house + +tags2:house rdf:type owl:Class ; + + rdfs:subClassOf tags2:electro . + + + +### http://purl.org/ontology/mo/Record + +mo:Record rdf:type owl:Class ; + + rdfs:subClassOf owl:Thing . + + + +### http://www.w3.org/2002/07/owl#Thing + +owl:Thing rdf:type owl:Class . + + + + +### Generated by the OWL API (version 2.2.1.1042) http://owlapi.sourceforge.net + Added: trunk/examples/sparql/moosique.conf =================================================================== --- trunk/examples/sparql/moosique.conf (rev 0) +++ trunk/examples/sparql/moosique.conf 2009-04-14 09:51:30 UTC (rev 1699) @@ -0,0 +1,70 @@ +/** + * moosique.net test example + */ + +// select the Jamendo endpoint as knowledge source +// import("http://dbtune.org:2105/sparql/","SPARQL"); +import("http://dbtune.org/jamendo/sparql/","SPARQL"); + +// select a set of "starting instances" => this includes positive examples (tracks/albums/artists +// last heard) as well as randomly selected objects of the same type (track/album/artist) - +// preferably those which have at least e.g. 3 tags; +// starting from these instances, DL-Learner extracts a fragment of the Jamendo knowledge base +sparql.instances = { +"http://dbtune.org/jamendo/record/1059", +"http://dbtune.org/jamendo/record/1162", +"http://dbtune.org/jamendo/record/1262", +"http://dbtune.org/jamendo/record/1363", +"http://dbtune.org/jamendo/record/1465", +"http://dbtune.org/jamendo/record/1568", +"http://dbtune.org/jamendo/record/1668", +"http://dbtune.org/jamendo/record/1769", +"http://dbtune.org/jamendo/record/1869", +"http://dbtune.org/jamendo/record/1970" +}; + +// recursion depth => the maximum distance of an object in the fragment from one of +// the starting instances +sparql.recursionDepth = 2; + +// we transform tags to classes (such that we can build a taxonomy of tags) on the fly; +// => later we may send the taxonomy to Yves if he is interested in using a taxonomy instead +// of plain tags +sparql.replacePredicate=[( +"http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag", +"http://www.w3.org/1999/02/22-rdf-syntax-ns#type")]; + +// whether to save the extracted fragment (use e.g. Protege to view it); +// by default this goes to fragmentOntology.owl in the DL-Learner directory +sparql.saveExtractedFragment = true; + +// we now import the background knowledge including the taxonomy of tags +// (but you can specify any additional knowledge in this file - the more +// knowledge available, the better the suggestions) +// you can use e.g. Protege to create the taxonomy +// (set File >> Preferences >> Renderer to qnames) or a plain text editor +import("jamendo.owl"); + +// we want to learn from positive examples only +problem = posOnlyLP; +// positive examples = records liked/listened to by user ++"http://dbtune.org/jamendo/record/1059" ++"http://dbtune.org/jamendo/record/1162" ++"http://dbtune.org/jamendo/record/1262" + +// we use the new CELOE algorithm +algorithm = celoe; +// set the start class to the correct type (Record in this case) - not supported yet +// celoe.startClass = "http://purl.org/ontology/mo/Record"; +// let it run for a short amount of time (we only want simple expressions) +celoe.maxExecutionTimeInSeconds = 2; +// use owl:hasValue if appropriate +// see: http://www.w3.org/TR/2008/WD-owl2-syntax-20081202/#Individual_Value_Restriction +// not sure whether this greatly influences the results +celoe.useHasValueConstructor = true; +celoe.valueFrequencyThreshold = 2; + +// the conversion to natural language is not yet covered here; +// you can use the class org.dllearner.sparql.NaturalLanguageDescriptionConverter for this, +// but the implementation is quite bad at the moment; +// the web service contains a method getNaturalDescription() using the class above Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2009-04-14 08:11:55 UTC (rev 1698) +++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2009-04-14 09:51:30 UTC (rev 1699) @@ -116,7 +116,7 @@ private String baseURI; private Map<String, String> prefixes; private DecimalFormat dfPercent = new DecimalFormat("0.00%"); -// private ConceptComparator descriptionComparator = new ConceptComparator(); + private ConceptComparator descriptionComparator = new ConceptComparator(); // statistical variables private int descriptionTests = 0; @@ -377,6 +377,8 @@ if(isCandidate) { Description niceDescription = rewriteNode(node); + ConceptTransformation.transformToOrderedForm(niceDescription, descriptionComparator); +// Description niceDescription = node.getDescription(); // another test: none of the other suggested descriptions should be // a subdescription of this one unless accuracy is different This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-14 08:12:00
|
Revision: 1698 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1698&view=rev Author: jenslehmann Date: 2009-04-14 08:11:55 +0000 (Tue, 14 Apr 2009) Log Message: ----------- workaround for Pellet bug in 2.0RC5 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-14 07:50:37 UTC (rev 1697) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-14 08:11:55 UTC (rev 1698) @@ -1059,7 +1059,12 @@ } try { - consistent = reasoner.isConsistent(ontology); + // workaround due to a bug in Pellet 2.0RC (see PelletBug.java und PelletBug2.java) + if(configurator.getReasonerType().equals("pellet")) { + consistent = ((org.mindswap.pellet.owlapi.Reasoner)reasoner).isConsistent(); + } else { + consistent = reasoner.isConsistent(ontology); + } } catch (OWLReasonerException e) { e.printStackTrace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-14 07:50:42
|
Revision: 1697 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1697&view=rev Author: lorenz_b Date: 2009-04-14 07:50:37 +0000 (Tue, 14 Apr 2009) Log Message: ----------- another test of pellet consistency check, which works fine Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/PelletBug2.java Added: trunk/src/dl-learner/org/dllearner/test/PelletBug2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/PelletBug2.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/PelletBug2.java 2009-04-14 07:50:37 UTC (rev 1697) @@ -0,0 +1,92 @@ +package org.dllearner.test; + +import java.io.File; +import java.net.URI; + +import org.mindswap.pellet.PelletOptions; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.inference.OWLReasonerException; +import org.semanticweb.owl.model.AddAxiom; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.OWLOntologyStorageException; +import org.semanticweb.owl.model.RemoveAxiom; +import org.semanticweb.owl.model.UnknownOWLOntologyException; + +public class PelletBug2 { + + public static void main(String[] args) throws OWLOntologyCreationException, + OWLReasonerException, UnknownOWLOntologyException, + OWLOntologyStorageException { + + // Set flags for incremental consistency + PelletOptions.USE_COMPLETION_QUEUE = true; + PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; + PelletOptions.USE_SMART_RESTORE = false; + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + File f = new File("examples/family/father_oe.owl"); + URI physicalURI = f.toURI(); + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(physicalURI); + OWLDataFactory factory = manager.getOWLDataFactory(); + + // create a view class expressions and an axiom + String ontologyURI = "http://example.com/father#"; + OWLClass male = factory.getOWLClass(URI.create(ontologyURI + "male")); + OWLClass female = factory.getOWLClass(URI + .create(ontologyURI + "female")); + OWLClass father = factory.getOWLClass(URI + .create(ontologyURI + "father")); + OWLDescription insat = factory.getOWLObjectIntersectionOf(male, female); + OWLDescription test = factory.getOWLObjectComplementOf(male); + OWLAxiom axiom = factory.getOWLEquivalentClassesAxiom(father, test); + + + // create reasoner from pellet libs + org.mindswap.pellet.owlapi.Reasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + + // load ontology + reasoner.loadOntology(ontology); + + manager.addOntologyChangeListener( reasoner ); + + // first subsumption check => everything runs smoothly + boolean result = reasoner.isSubClassOf(female, insat); + System.out.println("subsumption before: " + result); + + // add axiom causing the ontology to be inconsistent + try { + manager.applyChange(new AddAxiom(ontology, axiom)); + } catch (OWLOntologyChangeException e1) { + e1.printStackTrace(); + } + + // Pellet correctly detects the inconsistency + System.out.println("consistent: " + reasoner.isConsistent()); + + + // remove axiom + try { + manager.applyChange(new RemoveAxiom(ontology, axiom)); + } catch (OWLOntologyChangeException e) { + e.printStackTrace(); + } + + // save file to verify that it remained unchanged (it is unchanged) + manager.saveOntology(ontology, new File("test.owl").toURI()); + + // perform subsumption check => Pellet now fails due to an + // inconsistency, although the ontology is unchanged from the + // point of view of the OWL API + result = reasoner.isSubClassOf(female, insat); + System.out.println("subsumption after: " + result); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-14 07:10:51
|
Revision: 1696 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1696&view=rev Author: jenslehmann Date: 2009-04-14 07:10:46 +0000 (Tue, 14 Apr 2009) Log Message: ----------- small formatting fix Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/test/PelletBug.java Modified: trunk/src/dl-learner/org/dllearner/test/PelletBug.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/PelletBug.java 2009-04-14 07:01:50 UTC (rev 1695) +++ trunk/src/dl-learner/org/dllearner/test/PelletBug.java 2009-04-14 07:10:46 UTC (rev 1696) @@ -23,62 +23,64 @@ public class PelletBug { - public static void main(String[] args) throws OWLOntologyCreationException, OWLReasonerException, UnknownOWLOntologyException, OWLOntologyStorageException { - + public static void main(String[] args) throws OWLOntologyCreationException, + OWLReasonerException, UnknownOWLOntologyException, OWLOntologyStorageException { + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); File f = new File("examples/family/father_oe.owl"); URI physicalURI = f.toURI(); OWLOntology ontology = manager.loadOntologyFromPhysicalURI(physicalURI); OWLDataFactory factory = manager.getOWLDataFactory(); - + // create a view class expressions and an axiom String ontologyURI = "http://example.com/father#"; OWLClass male = factory.getOWLClass(URI.create(ontologyURI + "male")); OWLClass female = factory.getOWLClass(URI.create(ontologyURI + "female")); OWLClass father = factory.getOWLClass(URI.create(ontologyURI + "father")); OWLDescription insat = factory.getOWLObjectIntersectionOf(male, female); - OWLDescription test = factory.getOWLObjectComplementOf(male); - OWLAxiom axiom = factory.getOWLEquivalentClassesAxiom(father, test); - - // load ontology - Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); - ontologies.add(ontology); - OWLReasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); - reasoner.loadOntologies(ontologies); - - // first subsumption check => everything runs smoothly - boolean result = reasoner.isSubClassOf(female, insat); - System.out.println("subsumption before: " + result); - - // add axiom causing the ontology to be inconsistent - try { + OWLDescription test = factory.getOWLObjectComplementOf(male); + OWLAxiom axiom = factory.getOWLEquivalentClassesAxiom(father, test); + + // load ontology + Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); + ontologies.add(ontology); + OWLReasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + reasoner.loadOntologies(ontologies); + + // first subsumption check => everything runs smoothly + boolean result = reasoner.isSubClassOf(female, insat); + System.out.println("subsumption before: " + result); + + // add axiom causing the ontology to be inconsistent + try { manager.applyChange(new AddAxiom(ontology, axiom)); } catch (OWLOntologyChangeException e1) { e1.printStackTrace(); } - + // Pellet correctly detects the inconsistency - try { - System.out.println("consistent: " + reasoner.isConsistent(ontology)); - } catch (OWLReasonerException e) { - e.printStackTrace(); - } - - // remove axiom - try { + try { + System.out.println("consistent: " + reasoner.isConsistent(ontology)); + } catch (OWLReasonerException e) { + e.printStackTrace(); + } + + // remove axiom + try { manager.applyChange(new RemoveAxiom(ontology, axiom)); } catch (OWLOntologyChangeException e) { e.printStackTrace(); } - + // save file to verify that it remained unchanged (it is unchanged) - manager.saveOntology(ontology, new File("test.owl").toURI()); - - // perform subsumption check => Pellet now fails due to an inconsistency, - // although the ontology is unchanged from the point of view of the OWL API - result = reasoner.isSubClassOf(female, insat); - System.out.println("subsumption after: " + result); - + manager.saveOntology(ontology, new File("test.owl").toURI()); + + // perform subsumption check => Pellet now fails due to an + // inconsistency, although the ontology is unchanged from the + // point of view of the OWL API + result = reasoner.isSubClassOf(female, insat); + System.out.println("subsumption after: " + result); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-14 07:01:54
|
Revision: 1695 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1695&view=rev Author: jenslehmann Date: 2009-04-14 07:01:50 +0000 (Tue, 14 Apr 2009) Log Message: ----------- test case showing a bug in Pellet Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/PelletBug.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-09 16:36:41 UTC (rev 1694) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-14 07:01:50 UTC (rev 1695) @@ -1051,17 +1051,23 @@ public boolean remainsSatisfiableImpl(Axiom axiom) { boolean consistent = true; OWLAxiom axiomOWLAPI = OWLAPIAxiomConvertVisitor.convertAxiom(axiom); + try { manager.applyChange(new AddAxiom(ontology, axiomOWLAPI)); + } catch (OWLOntologyChangeException e1) { + e1.printStackTrace(); + } + + try { consistent = reasoner.isConsistent(ontology); + } catch (OWLReasonerException e) { + e.printStackTrace(); + } + + try { manager.applyChange(new RemoveAxiom(ontology, axiomOWLAPI)); - } catch (OWLOntologyChangeException e) { - e.printStackTrace(); - } catch (OWLReasonerException e) { - - e.printStackTrace(); } return consistent; Modified: trunk/src/dl-learner/org/dllearner/test/PelletBug.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/PelletBug.java 2009-04-09 16:36:41 UTC (rev 1694) +++ trunk/src/dl-learner/org/dllearner/test/PelletBug.java 2009-04-14 07:01:50 UTC (rev 1695) @@ -8,16 +8,22 @@ 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.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyCreationException; import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.OWLOntologyStorageException; +import org.semanticweb.owl.model.RemoveAxiom; +import org.semanticweb.owl.model.UnknownOWLOntologyException; public class PelletBug { - public static void main(String[] args) throws OWLOntologyCreationException, OWLReasonerException { + public static void main(String[] args) throws OWLOntologyCreationException, OWLReasonerException, UnknownOWLOntologyException, OWLOntologyStorageException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); File f = new File("examples/family/father_oe.owl"); @@ -25,26 +31,54 @@ OWLOntology ontology = manager.loadOntologyFromPhysicalURI(physicalURI); OWLDataFactory factory = manager.getOWLDataFactory(); + // create a view class expressions and an axiom String ontologyURI = "http://example.com/father#"; - - // super: (http://example.com/father#female AND http://example.com/father#male); sub: http://example.com/father#female - OWLClass male = factory.getOWLClass(URI.create(ontologyURI + "male")); OWLClass female = factory.getOWLClass(URI.create(ontologyURI + "female")); -// OWLDescription negA = factory.getOWLObjectComplementOf(a); + OWLClass father = factory.getOWLClass(URI.create(ontologyURI + "father")); OWLDescription insat = factory.getOWLObjectIntersectionOf(male, female); -// OWLClass d = factory.getOWLClass(URI.create(ontologyURI + "#b")); + OWLDescription test = factory.getOWLObjectComplementOf(male); + OWLAxiom axiom = factory.getOWLEquivalentClassesAxiom(father, test); + // load ontology Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); ontologies.add(ontology); - OWLReasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); reasoner.loadOntologies(ontologies); + // first subsumption check => everything runs smoothly boolean result = reasoner.isSubClassOf(female, insat); - System.out.println(result); + System.out.println("subsumption before: " + result); + + // add axiom causing the ontology to be inconsistent + try { + manager.applyChange(new AddAxiom(ontology, axiom)); + } catch (OWLOntologyChangeException e1) { + e1.printStackTrace(); + } -// System.out.println(reasoner.getIndividuals(female, true)); + // Pellet correctly detects the inconsistency + try { + System.out.println("consistent: " + reasoner.isConsistent(ontology)); + } catch (OWLReasonerException e) { + e.printStackTrace(); + } + + // remove axiom + try { + manager.applyChange(new RemoveAxiom(ontology, axiom)); + } catch (OWLOntologyChangeException e) { + e.printStackTrace(); + } + + // save file to verify that it remained unchanged (it is unchanged) + manager.saveOntology(ontology, new File("test.owl").toURI()); + + // perform subsumption check => Pellet now fails due to an inconsistency, + // although the ontology is unchanged from the point of view of the OWL API + result = reasoner.isSubClassOf(female, insat); + System.out.println("subsumption after: " + result); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-09 16:36:51
|
Revision: 1694 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1694&view=rev Author: lorenz_b Date: 2009-04-09 16:36:41 +0000 (Thu, 09 Apr 2009) Log Message: ----------- renamed Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java Copied: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java (from rev 1680, trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BetaGenerator.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java 2009-04-09 16:36:41 UTC (rev 1694) @@ -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 Beta extends BaseDescriptionGenerator +{ + + public Beta(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); + } + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java (from rev 1680, trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TauGenerator.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java 2009-04-09 16:36:41 UTC (rev 1694) @@ -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 Tau extends BaseDescriptionGenerator +{ + + public Tau(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(); + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-09 12:53:12
|
Revision: 1693 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1693&view=rev Author: jenslehmann Date: 2009-04-09 12:53:04 +0000 (Thu, 09 Apr 2009) Log Message: ----------- test case Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/PelletBug.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-09 11:47:12 UTC (rev 1692) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-09 12:53:04 UTC (rev 1693) @@ -495,6 +495,7 @@ @Override public boolean isSuperClassOfImpl(Description superConcept, Description subConcept) { try { +// System.out.println("super: " + superConcept + "; sub: " + subConcept); return reasoner.isSubClassOf(OWLAPIDescriptionConvertVisitor.getOWLDescription(subConcept), OWLAPIDescriptionConvertVisitor.getOWLDescription(superConcept)); } catch (OWLReasonerException e) { e.printStackTrace(); Added: trunk/src/dl-learner/org/dllearner/test/PelletBug.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/PelletBug.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/PelletBug.java 2009-04-09 12:53:04 UTC (rev 1693) @@ -0,0 +1,50 @@ +package org.dllearner.test; + +import java.io.File; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; + +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.inference.OWLReasoner; +import org.semanticweb.owl.inference.OWLReasonerException; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; + +public class PelletBug { + + public static void main(String[] args) throws OWLOntologyCreationException, OWLReasonerException { + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + File f = new File("examples/family/father_oe.owl"); + URI physicalURI = f.toURI(); + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(physicalURI); + OWLDataFactory factory = manager.getOWLDataFactory(); + + String ontologyURI = "http://example.com/father#"; + + // super: (http://example.com/father#female AND http://example.com/father#male); sub: http://example.com/father#female + + OWLClass male = factory.getOWLClass(URI.create(ontologyURI + "male")); + OWLClass female = factory.getOWLClass(URI.create(ontologyURI + "female")); +// OWLDescription negA = factory.getOWLObjectComplementOf(a); + OWLDescription insat = factory.getOWLObjectIntersectionOf(male, female); +// OWLClass d = factory.getOWLClass(URI.create(ontologyURI + "#b")); + + Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); + ontologies.add(ontology); + + OWLReasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + reasoner.loadOntologies(ontologies); + + boolean result = reasoner.isSubClassOf(female, insat); + System.out.println(result); + +// System.out.println(reasoner.getIndividuals(female, true)); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-09 11:47:21
|
Revision: 1692 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1692&view=rev Author: jenslehmann Date: 2009-04-09 11:47:12 +0000 (Thu, 09 Apr 2009) Log Message: ----------- added missing start class assignment in refinement operator Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-09 09:44:15 UTC (rev 1691) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2009-04-09 11:47:12 UTC (rev 1692) @@ -224,6 +224,9 @@ this.useNegation = useNegation; this.useBooleanDatatypes = useBooleanDatatypes; this.useDoubleDatatypes = useDoubleDatatypes; + if(startClass != null) { + this.startClass = startClass; + } init(); } @@ -337,8 +340,6 @@ System.exit(0); */ -// if(startClass != null) -// this.startClass = startClass; } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-09 09:44:26
|
Revision: 1691 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1691&view=rev Author: heeroyuy Date: 2009-04-09 09:44:15 +0000 (Thu, 09 Apr 2009) Log Message: ----------- -small changes in plugin view Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-04-09 09:31:24 UTC (rev 1690) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-04-09 09:44:15 UTC (rev 1691) @@ -100,7 +100,7 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("suggest class expression")) { + if (z.getActionCommand().equals("suggest equivalent class expression") || z.getActionCommand().equals("suggest super class expression")) { model.setKnowledgeSource(); model.setReasoner(); model.setLearningProblem(); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-09 09:31:24 UTC (rev 1690) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-09 09:44:15 UTC (rev 1691) @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionListener; @@ -103,6 +104,8 @@ private final JLabel wikiPane; private final ImageIcon toggledIcon; private final JTextArea hint; + private final JPanel runPanel; + private final JPanel advancedPanel; private boolean isInconsistent; // This is the Panel for more details of the suggested concept private final MoreDetailForSuggestedConceptsPanel detail; @@ -141,9 +144,9 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - - run = new JButton("suggest class expression"); - + advancedPanel = new JPanel(); + run = new JButton(); + runPanel = new JPanel(new FlowLayout()); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -156,7 +159,7 @@ advanced.setSize(20, 20); learner.setLayout(new GridBagLayout()); accept.setPreferredSize(new Dimension(90, 50)); - run.setPreferredSize(new Dimension(130, 30)); + run.setPreferredSize(new Dimension(220, 50)); advanced.setName("Advanced"); learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPEED); @@ -187,27 +190,35 @@ * This Method renders the view of the plugin. */ public void makeView(String label) { + run.setText("suggest " + label + " expression"); GridBagConstraints c = new GridBagConstraints(); learner.remove(detail); model.setID(label); - + runPanel.add(BorderLayout.WEST, run); + runPanel.add(BorderLayout.EAST, wikiPane); run.setEnabled(false); - c.fill = GridBagConstraints.NONE; - c.gridwidth = GridBagConstraints.RELATIVE; c.anchor = GridBagConstraints.FIRST_LINE_START; - learner.add(run, c); + c.gridx = 0; + c.gridy = 0; + c.gridwidth = 3; + c.ipady = 0; + learner.add(runPanel, c); - c.fill = GridBagConstraints.HORIZONTAL; - c.gridwidth = GridBagConstraints.REMAINDER; - learner.add(wikiPane, c); - sugPanel.setSuggestList(new DefaultListModel()); sugPanel = sugPanel.updateSuggestClassList(); c.gridwidth = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.NONE; + c.gridx = 0; + c.gridy = 1; + c.gridwidth = 2; + c.ipady = 0; learner.add(sugPanel, c); accept.setEnabled(false); + c.gridx = 2; + c.gridy = 1; + c.gridwidth = 1; + c.ipady = 0; addButtonPanel.add("North", accept); c.gridwidth = GridBagConstraints.REMAINDER; learner.add(addButtonPanel, c); @@ -215,28 +226,30 @@ c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.ipady = 20; + c.gridx = 0; + c.gridy = 2; + c.gridwidth = 3; learner.add(hint, c); - + advancedPanel.add(advanced); + advancedPanel.add(adv); advanced.setIcon(icon); advanced.setSelected(false); - c.ipady = 0; + c.ipady = 5; c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; - learner.add(advanced, c); + c.gridx = 0; + c.gridy = 3; + c.gridwidth = 3; + learner.add(advancedPanel, c); - c.fill = GridBagConstraints.NONE; - c.gridwidth = GridBagConstraints.REMAINDER; - c.ipady = 20; - learner.add(adv, c); - posPanel.setVisible(false); c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; c.gridy = 4; c.gridwidth = 3; - c.ipady = 80; + c.ipady = 65; learner.add(posPanel, c); @@ -279,8 +292,7 @@ public void setGraphicalPanel() { GridBagConstraints c = new GridBagConstraints(); learner.remove(posPanel); - learner.remove(advanced); - learner.remove(adv); + learner.remove(advancedPanel); learner.repaint(); detail.setVisible(true); @@ -288,26 +300,22 @@ c.gridx = 0; c.gridy = 3; c.gridwidth = 3; - c.ipady = 80; + c.ipady = 60; learner.add(detail, c); - c.fill = GridBagConstraints.HORIZONTAL; + c.ipady = 5; + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; c.gridx = 0; c.gridy = 4; - c.gridwidth = 1; - learner.add(advanced, c); + c.gridwidth = 3; + learner.add(advancedPanel, c); - c.fill = GridBagConstraints.HORIZONTAL; - c.gridx = 1; - c.gridy = 4; - c.gridwidth = GridBagConstraints.REMAINDER; - learner.add(adv, c); - c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 5; c.gridwidth = 3; - c.ipady = 80; + c.ipady = 70; learner.add(posPanel, c); learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); learnerScroll.setViewportView(learner); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-09 09:31:29
|
Revision: 1690 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1690&view=rev Author: jenslehmann Date: 2009-04-09 09:31:24 +0000 (Thu, 09 Apr 2009) Log Message: ----------- possibility to switch between own implentation of retrieval and standard reasoner Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-04-08 14:18:01 UTC (rev 1689) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2009-04-09 09:31:24 UTC (rev 1690) @@ -496,8 +496,30 @@ } @Override + public SortedSet<Individual> getIndividualsImpl(Description concept) throws ReasoningMethodUnsupportedException { + return getIndividualsImplFast(concept); + } + + public SortedSet<Individual> getIndividualsImplStandard(Description concept) + throws ReasoningMethodUnsupportedException { + if (concept instanceof NamedClass) { + return classInstancesPos.get((NamedClass) concept); + } else if (concept instanceof Negation && concept.getChild(0) instanceof NamedClass) { + return classInstancesNeg.get((NamedClass) concept.getChild(0)); + } + + // return rs.retrieval(concept); + SortedSet<Individual> inds = new TreeSet<Individual>(); + for (Individual i : individuals) { + if (hasType(concept, i)) { + inds.add(i); + } + } + return inds; + } + @SuppressWarnings("unchecked") - public SortedSet<Individual> getIndividualsImpl(Description description) + public SortedSet<Individual> getIndividualsImplFast(Description description) throws ReasoningMethodUnsupportedException { // policy: returned sets are clones, i.e. can be modified // (of course we only have to clone the leafs of a class description tree) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-04-08 14:18:11
|
Revision: 1689 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1689&view=rev Author: jenslehmann Date: 2009-04-08 14:18:01 +0000 (Wed, 08 Apr 2009) Log Message: ----------- moved domain to description conversion to separate method Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-08 14:00:46 UTC (rev 1688) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2009-04-08 14:18:01 UTC (rev 1689) @@ -48,7 +48,6 @@ import org.dllearner.core.options.InvalidConfigOptionValueException; import org.dllearner.core.options.StringConfigOption; import org.dllearner.core.owl.Axiom; -import org.dllearner.core.owl.ClassHierarchy; import org.dllearner.core.owl.Constant; import org.dllearner.core.owl.Datatype; import org.dllearner.core.owl.DatatypeProperty; @@ -102,8 +101,6 @@ import org.semanticweb.owl.util.SimpleURIMapper; import org.semanticweb.owl.vocab.NamespaceOWLOntologyFormat; -import uk.ac.manchester.cs.owl.OWLPropertyAxiomImpl; - /** * Mapping to OWL API reasoner interface. The OWL API currently * supports two reasoners: FaCT++ and Pellet. FaCT++ is connected @@ -632,45 +629,10 @@ public Description getDomainImpl(ObjectProperty objectProperty) { OWLObjectProperty prop = OWLAPIConverter.getOWLAPIObjectProperty(objectProperty); try { - // TODO: look up why OWL API return a two dimensional set here - // instead of only one description (probably there can be several - // domain axiom for one property and the inner set is a conjunction - // of descriptions (?)) - // Answer: this function is just horribly broken in OWL API + // Pellet returns a set of sets of named class, which are more + // general than the actual domain/range Set<Set<OWLDescription>> set = reasoner.getDomains(prop); - - - if(set.size()==0) - return new Thing(); - - Set<OWLDescription> union = new HashSet<OWLDescription>(); - Set<OWLDescription> domains = new HashSet<OWLDescription>(); - - for(Set<OWLDescription> descs : set){ - for(OWLDescription desc : descs){ - union.add(desc); - } - } - for(OWLDescription desc : union){ - boolean isSuperClass = false; - for(Description d : getClassHierarchy().getSubClasses(OWLAPIConverter.convertClass(desc.asOWLClass()))){ - if(union.contains(OWLAPIConverter.getOWLAPIDescription(d))){ - isSuperClass = true; - break; - } - } - if(!isSuperClass){ - domains.add(desc); - } - } - - OWLClass oc = (OWLClass) domains.iterator().next(); - String str = oc.getURI().toString(); - if(str.equals("http://www.w3.org/2002/07/owl#Thing")) { - return new Thing(); - } else { - return new NamedClass(str); - } + return getDescriptionFromReturnedDomain(set); } catch (OWLReasonerException e) { throw new Error(e); } @@ -680,43 +642,9 @@ public Description getDomainImpl(DatatypeProperty datatypeProperty) { OWLDataProperty prop = OWLAPIConverter.getOWLAPIDataProperty(datatypeProperty); try { - // TODO: look up why OWL API return a two dimensional set here - // instead of only one description (probably there can be several - // domain axiom for one property and the inner set is a conjunction - // of descriptions (?)) - // Answer: this function is just horribly broken in OWL API Set<Set<OWLDescription>> set = reasoner.getDomains(prop); - if(set.size()==0) - return new Thing(); - - Set<OWLDescription> union = new HashSet<OWLDescription>(); - Set<OWLDescription> domains = new HashSet<OWLDescription>(); - - for(Set<OWLDescription> descs : set){ - for(OWLDescription desc : descs){ - union.add(desc); - } - } - for(OWLDescription desc : union){ - boolean isSuperClass = false; - for(Description d : getClassHierarchy().getSubClasses(OWLAPIConverter.convertClass(desc.asOWLClass()))){ - if(union.contains(OWLAPIConverter.getOWLAPIDescription(d))){ - isSuperClass = true; - break; - } - } - if(!isSuperClass){ - domains.add(desc); - } - } - - OWLClass oc = (OWLClass) domains.iterator().next(); - String str = oc.getURI().toString(); - if(str.equals("http://www.w3.org/2002/07/owl#Thing")) { - return new Thing(); - } else { - return new NamedClass(str); - } + return getDescriptionFromReturnedDomain(set); + } catch (OWLReasonerException e) { throw new Error(e); } @@ -736,6 +664,40 @@ } } + private Description getDescriptionFromReturnedDomain(Set<Set<OWLDescription>> set) { + if(set.size()==0) + return new Thing(); + + Set<OWLDescription> union = new HashSet<OWLDescription>(); + Set<OWLDescription> domains = new HashSet<OWLDescription>(); + + for(Set<OWLDescription> descs : set){ + for(OWLDescription desc : descs){ + union.add(desc); + } + } + for(OWLDescription desc : union){ + boolean isSuperClass = false; + for(Description d : getClassHierarchy().getSubClasses(OWLAPIConverter.convertClass(desc.asOWLClass()))){ + if(union.contains(OWLAPIConverter.getOWLAPIDescription(d))){ + isSuperClass = true; + break; + } + } + if(!isSuperClass){ + domains.add(desc); + } + } + + OWLClass oc = (OWLClass) domains.iterator().next(); + String str = oc.getURI().toString(); + if(str.equals("http://www.w3.org/2002/07/owl#Thing")) { + return new Thing(); + } else { + return new NamedClass(str); + } + } + @Override public Map<Individual, SortedSet<Individual>> getPropertyMembersImpl(ObjectProperty atomicRole) { OWLObjectProperty prop = OWLAPIConverter.getOWLAPIObjectProperty(atomicRole); Modified: trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2009-04-08 14:00:46 UTC (rev 1688) +++ trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2009-04-08 14:18:01 UTC (rev 1689) @@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue; import java.io.File; -import java.io.IOException; import java.net.MalformedURLException; import java.util.LinkedList; import java.util.List; @@ -39,7 +38,6 @@ import org.dllearner.core.owl.KB; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.Thing; import org.dllearner.kb.KBFile; import org.dllearner.kb.OWLFile; import org.dllearner.parser.KBParser; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-08 14:00:57
|
Revision: 1688 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1688&view=rev Author: lorenz_b Date: 2009-04-08 14:00:46 +0000 (Wed, 08 Apr 2009) Log Message: ----------- added new class to compute filtered sigma-closure of an ontology Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java 2009-04-08 14:00:46 UTC (rev 1688) @@ -0,0 +1,449 @@ + + +package org.dllearner.tools.ore.explanation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.semanticweb.owl.model.OWLAntiSymmetricObjectPropertyAxiom; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom; +import org.semanticweb.owl.model.OWLAxiomVisitorEx; +import org.semanticweb.owl.model.OWLClassAssertionAxiom; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataPropertyAssertionAxiom; +import org.semanticweb.owl.model.OWLDataPropertyDomainAxiom; +import org.semanticweb.owl.model.OWLDataPropertyRangeAxiom; +import org.semanticweb.owl.model.OWLDataSubPropertyAxiom; +import org.semanticweb.owl.model.OWLDeclarationAxiom; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom; +import org.semanticweb.owl.model.OWLDisjointClassesAxiom; +import org.semanticweb.owl.model.OWLDisjointDataPropertiesAxiom; +import org.semanticweb.owl.model.OWLDisjointObjectPropertiesAxiom; +import org.semanticweb.owl.model.OWLDisjointUnionAxiom; +import org.semanticweb.owl.model.OWLEntityAnnotationAxiom; +import org.semanticweb.owl.model.OWLEquivalentClassesAxiom; +import org.semanticweb.owl.model.OWLEquivalentDataPropertiesAxiom; +import org.semanticweb.owl.model.OWLEquivalentObjectPropertiesAxiom; +import org.semanticweb.owl.model.OWLFunctionalDataPropertyAxiom; +import org.semanticweb.owl.model.OWLFunctionalObjectPropertyAxiom; +import org.semanticweb.owl.model.OWLImportsDeclaration; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLInverseFunctionalObjectPropertyAxiom; +import org.semanticweb.owl.model.OWLInverseObjectPropertiesAxiom; +import org.semanticweb.owl.model.OWLIrreflexiveObjectPropertyAxiom; +import org.semanticweb.owl.model.OWLNegativeDataPropertyAssertionAxiom; +import org.semanticweb.owl.model.OWLNegativeObjectPropertyAssertionAxiom; +import org.semanticweb.owl.model.OWLObjectIntersectionOf; +import org.semanticweb.owl.model.OWLObjectPropertyAssertionAxiom; +import org.semanticweb.owl.model.OWLObjectPropertyChainSubPropertyAxiom; +import org.semanticweb.owl.model.OWLObjectPropertyDomainAxiom; +import org.semanticweb.owl.model.OWLObjectPropertyExpression; +import org.semanticweb.owl.model.OWLObjectPropertyRangeAxiom; +import org.semanticweb.owl.model.OWLObjectSubPropertyAxiom; +import org.semanticweb.owl.model.OWLObjectUnionOf; +import org.semanticweb.owl.model.OWLOntologyAnnotationAxiom; +import org.semanticweb.owl.model.OWLReflexiveObjectPropertyAxiom; +import org.semanticweb.owl.model.OWLSameIndividualsAxiom; +import org.semanticweb.owl.model.OWLSubClassAxiom; +import org.semanticweb.owl.model.OWLSymmetricObjectPropertyAxiom; +import org.semanticweb.owl.model.OWLTransitiveObjectPropertyAxiom; +import org.semanticweb.owl.model.SWRLRule; + + + +public class OPlus + implements OWLAxiomVisitorEx<Set<OWLAxiom>> +{ + private OWLDataFactory dataFactory; + private Beta beta; + private Tau tau; + private BottomTester bottomChecker; + private TopTester topChecker; + private Map<OWLAxiom,Set<OWLAxiom>> axiomsMap; + + public OPlus(OWLDataFactory dataFactory) + { + axiomsMap = new HashMap<OWLAxiom,Set<OWLAxiom>>(); + this.dataFactory = dataFactory; + beta = new Beta(dataFactory); + tau = new Tau(dataFactory); + bottomChecker = new BottomTester(); + topChecker = new TopTester(); + } + + public boolean isNothing(OWLDescription desc) + { + return ((Boolean)desc.accept(bottomChecker)).booleanValue(); + } + + public boolean isThing(OWLDescription desc) + { + return ((Boolean)desc.accept(topChecker)).booleanValue(); + } + + public void reset() + { + axiomsMap.clear(); + } + + public Map<OWLAxiom,Set<OWLAxiom>> getAxiomsMap() + { + return axiomsMap; + } + + public Set<OWLAxiom> archive(OWLAxiom source, Set<OWLAxiom> axioms) + { + for(OWLAxiom axiom : axioms){ + + + if(!axiom.equals(source)) + { + Set<OWLAxiom> existing = (Set<OWLAxiom>)axiomsMap.get(axiom); + if(existing == null) + { + existing = new HashSet<OWLAxiom>(); + axiomsMap.put(axiom, existing); + } + existing.add(source); + } + } + return axioms; + } + + public Set<OWLAxiom> archive(OWLAxiom source) + { + return archive(source, Collections.singleton(source)); + } + + + + + @Override + public Set<OWLAxiom> visit(OWLSubClassAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + Set<OWLDescription> tauAxioms = new HashSet<OWLDescription>(); + if(axiom.getSuperClass() instanceof OWLObjectIntersectionOf) + { + tauAxioms = new HashSet<OWLDescription>(); + for(OWLDescription desc : ((OWLObjectIntersectionOf)axiom.getSuperClass()).getOperands()) + { + + if(desc.isAnonymous()){ + tauAxioms.addAll(desc.accept(tau)); + } + else{ + tauAxioms.add(desc); + } + } + + tauAxioms.add(dataFactory.getOWLThing()); + } else + if(axiom.getSuperClass() instanceof OWLObjectUnionOf) + { + boolean allNamed = true; + for(OWLDescription desc : ((OWLObjectUnionOf)axiom.getSuperClass()).getOperands()){ + + if(!desc.isAnonymous()) + continue; + allNamed = false; + break; + } + if(allNamed){ + tauAxioms.add(axiom.getSuperClass()); + } else { + tauAxioms = axiom.getSuperClass().accept(tau); + } + } else { + tauAxioms = axiom.getSuperClass().accept(tau); + } + Set<OWLDescription> betaAxioms; + if(axiom.getSubClass() instanceof OWLObjectUnionOf) + { + betaAxioms = new HashSet<OWLDescription>(); + for(OWLDescription desc : ((OWLObjectUnionOf)axiom.getSubClass()).getOperands()){ + + if(desc.isAnonymous()) { + betaAxioms.addAll(desc.accept(beta)); + } else { + betaAxioms.add(desc); + } + } + + betaAxioms.add(dataFactory.getOWLNothing()); + } else { + betaAxioms = axiom.getSubClass().accept(beta); + } + for(OWLDescription tauDesc : tauAxioms){ + + if(!isThing(tauDesc)){ + for(OWLDescription betaDesc : betaAxioms){ + + if(!isNothing(betaDesc) && !(tauDesc instanceof OWLObjectIntersectionOf) && !(betaDesc instanceof OWLObjectUnionOf)) + { + axioms.add(dataFactory.getOWLSubClassAxiom(betaDesc, tauDesc)); + } + } + } + } + + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLNegativeObjectPropertyAssertionAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLAntiSymmetricObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLReflexiveObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDisjointClassesAxiom axiom) { + boolean containAnonDescriptions = false; + for(OWLDescription desc : axiom.getDescriptions()){ + + if(!desc.isAnonymous()) + continue; + containAnonDescriptions = true; + break; + } + if(!containAnonDescriptions) + return archive(axiom); + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + List<OWLDescription> descs = new ArrayList<OWLDescription>(axiom.getDescriptions()); + for(int i = 0; i < descs.size(); i++) + { + for(int j = i + 1; j < descs.size(); j++) + axioms.addAll(dataFactory.getOWLSubClassAxiom(descs.get(i), dataFactory.getOWLObjectComplementOf(descs.get(j))).accept(this)); + + } + + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLDataPropertyDomainAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLImportsDeclaration axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLAxiomAnnotationAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLObjectPropertyDomainAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + for(OWLDescription desc : (Set<OWLDescription>)axiom.getDomain().accept(tau)){ + + + if(!isThing(desc)){ + axioms.add(dataFactory.getOWLObjectPropertyDomainAxiom((OWLObjectPropertyExpression)axiom.getProperty(), desc)); + } + } + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLEquivalentObjectPropertiesAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + for(OWLObjectPropertyExpression prop1 : axiom.getProperties()){ + for(OWLObjectPropertyExpression prop2 : axiom.getProperties()){ + if(!prop1.equals(prop2)){ + axioms.add(dataFactory.getOWLSubObjectPropertyAxiom(prop1, prop2)); + } + } + } + + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLNegativeDataPropertyAssertionAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDifferentIndividualsAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + for(OWLIndividual ind1 : axiom.getIndividuals()){ + for(OWLIndividual ind2 : axiom.getIndividuals()){ + if(!ind1.equals(ind2)){ + axioms.add(dataFactory.getOWLDifferentIndividualsAxiom(new OWLIndividual[] { + ind1, ind2})); + } + } + } + + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLDisjointDataPropertiesAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDisjointObjectPropertiesAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLObjectPropertyRangeAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + for(OWLDescription range : axiom.getRange().accept(tau)){ + if(!isThing(range)){ + axioms.add(dataFactory.getOWLObjectPropertyRangeAxiom((OWLObjectPropertyExpression)axiom.getProperty(), range)); + } + } + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLObjectPropertyAssertionAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLFunctionalObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLObjectSubPropertyAxiom axiom) {System.out.println("jo" + axiom); + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDisjointUnionAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDeclarationAxiom axiom) { + return Collections.singleton((OWLAxiom)axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLEntityAnnotationAxiom axiom) { + return Collections.singleton((OWLAxiom)axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLOntologyAnnotationAxiom axiom) { + return Collections.singleton((OWLAxiom)axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLSymmetricObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDataPropertyRangeAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLFunctionalDataPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLEquivalentDataPropertiesAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLClassAssertionAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + for(OWLDescription desc : axiom.getDescription().accept(tau)){ + if(!isThing(desc)){ + axioms.add(dataFactory.getOWLClassAssertionAxiom(axiom.getIndividual(), desc)); + } + } + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLEquivalentClassesAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); + for(OWLDescription desc1 : axiom.getDescriptions()){ + for(OWLDescription desc2 : axiom.getDescriptions()){ + if(!desc1.equals(desc2)){ + axioms.addAll(dataFactory.getOWLSubClassAxiom(desc1, desc2).accept(this)); + } + } + } + + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(OWLDataPropertyAssertionAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLTransitiveObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLIrreflexiveObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLDataSubPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLInverseFunctionalObjectPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLSameIndividualsAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLObjectPropertyChainSubPropertyAxiom axiom) { + return archive(axiom); + } + + @Override + public Set<OWLAxiom> visit(OWLInverseObjectPropertiesAxiom axiom) { + Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();System.out.println(axiom); + axioms.add(dataFactory.getOWLSubObjectPropertyAxiom(axiom.getFirstProperty(), dataFactory.getOWLObjectPropertyInverse(axiom.getSecondProperty()))); + axioms.add(dataFactory.getOWLSubObjectPropertyAxiom(axiom.getSecondProperty(), dataFactory.getOWLObjectPropertyInverse(axiom.getFirstProperty()))); + return archive(axiom, axioms); + } + + @Override + public Set<OWLAxiom> visit(SWRLRule axiom) { + // TODO Auto-generated method stub + return null; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-04-08 08:14:50
|
Revision: 1687 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1687&view=rev Author: lorenz_b Date: 2009-04-08 08:14:39 +0000 (Wed, 08 Apr 2009) Log Message: ----------- added some examples modified getDomainImpl() methods. now they return the most particular domain added unit test Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java Added Paths: ----------- trunk/examples/ore/example.owl trunk/examples/ore/koala.owl trunk/examples/ore/koala_inc.owl trunk/examples/ore/madcow.owl trunk/examples/ore/miniEconomy.owl trunk/examples/ore/university.owl Added: trunk/examples/ore/example.owl =================================================================== --- trunk/examples/ore/example.owl (rev 0) +++ trunk/examples/ore/example.owl 2009-04-08 08:14:39 UTC (rev 1687) @@ -0,0 +1,98 @@ +<?xml version="1.0"?> + + +<!DOCTYPE Ontology [ + <!ENTITY p1 "http://www.owl-ontologies.com/assert.owl#" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > +]> + + +<Ontology xmlns="http://www.w3.org/2006/12/owl2-xml#" + xml:base="http://www.w3.org/2006/12/owl2-xml#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:p1="http://www.owl-ontologies.com/assert.owl#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + URI="file:examples/ore/miniexample.owl"> + <SubClassOf> + <Class URI="A1"/> + <ObjectIntersectionOf> + <Class URI="A2"/> + <Class URI="A3"/> + <ObjectComplementOf> + <Class URI="A"/> + </ObjectComplementOf> + </ObjectIntersectionOf> + </SubClassOf> + <SubClassOf> + <Class URI="A2"/> + <ObjectIntersectionOf> + <Class URI="A"/> + <Class URI="A4"/> + </ObjectIntersectionOf> + </SubClassOf> + <SubClassOf> + <Class URI="A3"/> + <ObjectIntersectionOf> + <Class URI="A4"/> + <Class URI="A5"/> + </ObjectIntersectionOf> + </SubClassOf> + <SubClassOf> + <Class URI="A4"/> + <ObjectIntersectionOf> + <Class URI="C"/> + <ObjectAllValuesFrom> + <ObjectProperty URI="S"/> + <Class URI="B"/> + </ObjectAllValuesFrom> + </ObjectIntersectionOf> + </SubClassOf> + <SubClassOf> + <Class URI="A5"/> + <ObjectSomeValuesFrom> + <ObjectProperty URI="S"/> + <ObjectComplementOf> + <Class URI="B"/> + </ObjectComplementOf> + </ObjectSomeValuesFrom> + </SubClassOf> + <EquivalentClasses> + <Class URI="A6"/> + <Class URI="D"/> + </EquivalentClasses> + <ClassAssertion> + <Class URI="t#A1"/> + <Individual URI="a"/> + </ClassAssertion> + <ClassAssertion> + <Class URI="t#A3"/> + <Individual URI="b"/> + </ClassAssertion> + <SubClassOf> + <ObjectUnionOf> + <Class URI="D"/> + <ObjectComplementOf> + <Class URI="D"/> + </ObjectComplementOf> + </ObjectUnionOf> + <ObjectIntersectionOf> + <Class URI="D"/> + <ObjectComplementOf> + <Class URI="D"/> + </ObjectComplementOf> + </ObjectIntersectionOf> + </SubClassOf> +</Ontology> + + + +<!-- Generated by the OWL API (version 2.2.1.913) http://owlapi.sourceforge.net --> + Added: trunk/examples/ore/koala.owl =================================================================== --- trunk/examples/ore/koala.owl (rev 0) +++ trunk/examples/ore/koala.owl 2009-04-08 08:14:39 UTC (rev 1687) @@ -0,0 +1,250 @@ +<?xml version="1.0"?> +<rdf:RDF + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns="http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#" + xml:base="http://protege.stanford.edu/plugins/owl/owl-library/koala.owl"> + <owl:Ontology rdf:about=""/> + <owl:Class rdf:ID="Female"> + <owl:equivalentClass> + <owl:Restriction> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#hasGender"/> + </owl:onProperty> + <owl:hasValue> + <Gender rdf:ID="female"/> + </owl:hasValue> + </owl:Restriction> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:ID="Marsupials"> + <owl:disjointWith> + <owl:Class rdf:about="#Person"/> + </owl:disjointWith> + <rdfs:subClassOf> + <owl:Class rdf:about="#Animal"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:ID="Student"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#Person"/> + <owl:Restriction> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#isHardWorking"/> + </owl:onProperty> + <owl:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean" + >true</owl:hasValue> + </owl:Restriction> + <owl:Restriction> + <owl:someValuesFrom> + <owl:Class rdf:about="#University"/> + </owl:someValuesFrom> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasHabitat"/> + </owl:onProperty> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:ID="KoalaWithPhD"> + <owl:versionInfo>1.2</owl:versionInfo> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:hasValue> + <Degree rdf:ID="PhD"/> + </owl:hasValue> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasDegree"/> + </owl:onProperty> + </owl:Restriction> + <owl:Class rdf:about="#Koala"/> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:ID="University"> + <rdfs:subClassOf> + <owl:Class rdf:ID="Habitat"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:ID="Koala"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean" + >false</owl:hasValue> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#isHardWorking"/> + </owl:onProperty> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:someValuesFrom> + <owl:Class rdf:about="#DryEucalyptForest"/> + </owl:someValuesFrom> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasHabitat"/> + </owl:onProperty> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf rdf:resource="#Marsupials"/> + </owl:Class> + <owl:Class rdf:ID="Animal"> + <rdfs:seeAlso>Male</rdfs:seeAlso> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasHabitat"/> + </owl:onProperty> + <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#int" + >1</owl:minCardinality> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#int" + >1</owl:cardinality> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#hasGender"/> + </owl:onProperty> + </owl:Restriction> + </rdfs:subClassOf> + <owl:versionInfo>1.1</owl:versionInfo> + </owl:Class> + <owl:Class rdf:ID="Forest"> + <rdfs:subClassOf rdf:resource="#Habitat"/> + </owl:Class> + <owl:Class rdf:ID="Rainforest"> + <rdfs:subClassOf rdf:resource="#Forest"/> + </owl:Class> + <owl:Class rdf:ID="GraduateStudent"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasDegree"/> + </owl:onProperty> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <Degree rdf:ID="BA"/> + <Degree rdf:ID="BS"/> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf rdf:resource="#Student"/> + </owl:Class> + <owl:Class rdf:ID="Parent"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#Animal"/> + <owl:Restriction> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasChildren"/> + </owl:onProperty> + <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#int" + >1</owl:minCardinality> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + <rdfs:subClassOf rdf:resource="#Animal"/> + </owl:Class> + <owl:Class rdf:ID="DryEucalyptForest"> + <rdfs:subClassOf rdf:resource="#Forest"/> + </owl:Class> + <owl:Class rdf:ID="Quokka"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean" + >true</owl:hasValue> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#isHardWorking"/> + </owl:onProperty> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf rdf:resource="#Marsupials"/> + </owl:Class> + <owl:Class rdf:ID="TasmanianDevil"> + <rdfs:subClassOf rdf:resource="#Marsupials"/> + </owl:Class> + <owl:Class rdf:ID="MaleStudentWith3Daughters"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#Student"/> + <owl:Restriction> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#hasGender"/> + </owl:onProperty> + <owl:hasValue> + <Gender rdf:ID="male"/> + </owl:hasValue> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasChildren"/> + </owl:onProperty> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#int" + >3</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:allValuesFrom rdf:resource="#Female"/> + <owl:onProperty> + <owl:ObjectProperty rdf:about="#hasChildren"/> + </owl:onProperty> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:ID="Degree"/> + <owl:Class rdf:ID="Male"> + <owl:equivalentClass> + <owl:Restriction> + <owl:hasValue rdf:resource="#male"/> + <owl:onProperty> + <owl:FunctionalProperty rdf:about="#hasGender"/> + </owl:onProperty> + </owl:Restriction> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:ID="Gender"/> + <owl:Class rdf:ID="Person"> + <rdfs:subClassOf rdf:resource="#Animal"/> + <owl:disjointWith rdf:resource="#Marsupials"/> + </owl:Class> + <owl:ObjectProperty rdf:ID="hasHabitat"> + <rdfs:range rdf:resource="#Habitat"/> + <rdfs:domain rdf:resource="#Animal"/> + </owl:ObjectProperty> + <owl:ObjectProperty rdf:ID="hasDegree"> + <rdfs:domain rdf:resource="#Person"/> + <rdfs:range rdf:resource="#Degree"/> + </owl:ObjectProperty> + <owl:ObjectProperty rdf:ID="hasChildren"> + <rdfs:range rdf:resource="#Animal"/> + <rdfs:domain rdf:resource="#Animal"/> + </owl:ObjectProperty> + <owl:FunctionalProperty rdf:ID="hasGender"> + <rdfs:range rdf:resource="#Gender"/> + <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> + <rdfs:domain rdf:resource="#Animal"/> + </owl:FunctionalProperty> + <owl:FunctionalProperty rdf:ID="isHardWorking"> + <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/> + <rdfs:domain rdf:resource="#Person"/> + <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/> + </owl:FunctionalProperty> + <Degree rdf:ID="MA"/> +</rdf:RDF> + +<!-- Created with Protege (with OWL Plugin, Build 60) http://protege.stanford.edu --> Added: trunk/examples/ore/koala_inc.owl =================================================================== --- trunk/examples/ore/koala_inc.owl (rev 0) +++ trunk/examples/ore/koala_inc.owl 2009-04-08 08:14:39 UTC (rev 1687) @@ -0,0 +1,443 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY dc "http://purl.org/dc/elements/1.1/" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > + <!ENTITY koala "http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#" > +]> + + +<rdf:RDF xmlns="http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#" + xml:base="http://protege.stanford.edu/plugins/owl/owl-library/koala.owl" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:koala="http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <owl:Ontology rdf:about=""/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#hasChildren --> + + <owl:ObjectProperty rdf:about="#hasChildren"> + <rdfs:range rdf:resource="#Animal"/> + <rdfs:domain rdf:resource="#Animal"/> + </owl:ObjectProperty> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#hasDegree --> + + <owl:ObjectProperty rdf:about="#hasDegree"> + <rdfs:range rdf:resource="#Degree"/> + <rdfs:domain rdf:resource="#Person"/> + </owl:ObjectProperty> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#hasGender --> + + <owl:ObjectProperty rdf:about="#hasGender"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> + <rdfs:domain rdf:resource="#Animal"/> + <rdfs:range rdf:resource="#Gender"/> + </owl:ObjectProperty> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#hasHabitat --> + + <owl:ObjectProperty rdf:about="#hasHabitat"> + <rdfs:domain rdf:resource="#Animal"/> + <rdfs:range rdf:resource="#Habitat"/> + </owl:ObjectProperty> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Data properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#isHardWorking --> + + <owl:DatatypeProperty rdf:about="#isHardWorking"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> + <rdfs:domain rdf:resource="#Person"/> + <rdfs:range rdf:resource="&xsd;boolean"/> + </owl:DatatypeProperty> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Animal --> + + <owl:Class rdf:about="#Animal"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasGender"/> + <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasHabitat"/> + <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + </rdfs:subClassOf> + <owl:versionInfo>1.1</owl:versionInfo> + <rdfs:seeAlso>Male</rdfs:seeAlso> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Degree --> + + <owl:Class rdf:about="#Degree"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#DryEucalyptForest --> + + <owl:Class rdf:about="#DryEucalyptForest"> + <rdfs:subClassOf rdf:resource="#Forest"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Female --> + + <owl:Class rdf:about="#Female"> + <owl:equivalentClass> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasGender"/> + <owl:hasValue rdf:resource="#female"/> + </owl:Restriction> + </owl:equivalentClass> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Forest --> + + <owl:Class rdf:about="#Forest"> + <rdfs:subClassOf rdf:resource="#Habitat"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Gender --> + + <owl:Class rdf:about="#Gender"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#GraduateStudent --> + + <owl:Class rdf:about="#GraduateStudent"> + <rdfs:subClassOf rdf:resource="#Student"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasDegree"/> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <rdf:Description rdf:about="#BS"/> + <rdf:Description rdf:about="#BA"/> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Habitat --> + + <owl:Class rdf:about="#Habitat"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Koala --> + + <owl:Class rdf:about="#Koala"> + <rdfs:subClassOf rdf:resource="#Marsupials"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#isHardWorking"/> + <owl:hasValue rdf:datatype="&xsd;boolean">false</owl:hasValue> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasHabitat"/> + <owl:someValuesFrom rdf:resource="#DryEucalyptForest"/> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#KoalaWithPhD --> + + <owl:Class rdf:about="#KoalaWithPhD"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="#Koala"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasDegree"/> + <owl:hasValue rdf:resource="#PhD"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + <owl:versionInfo>1.2</owl:versionInfo> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Male --> + + <owl:Class rdf:about="#Male"> + <owl:equivalentClass> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasGender"/> + <owl:hasValue rdf:resource="#male"/> + </owl:Restriction> + </owl:equivalentClass> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#MaleStudentWith3Daughters --> + + <owl:Class rdf:about="#MaleStudentWith3Daughters"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="#Student"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasChildren"/> + <owl:allValuesFrom rdf:resource="#Female"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasGender"/> + <owl:hasValue rdf:resource="#male"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasChildren"/> + <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">3</owl:cardinality> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Marsupials --> + + <owl:Class rdf:about="#Marsupials"> + <rdfs:subClassOf rdf:resource="#Animal"/> + <owl:disjointWith rdf:resource="#Person"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Parent --> + + <owl:Class rdf:about="#Parent"> + <owl:equivalentClass> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasChildren"/> + <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + </owl:equivalentClass> + <rdfs:subClassOf rdf:resource="#Animal"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Person --> + + <owl:Class rdf:about="#Person"> + <rdfs:subClassOf rdf:resource="#Animal"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Quokka --> + + <owl:Class rdf:about="#Quokka"> + <rdfs:subClassOf rdf:resource="#Marsupials"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#isHardWorking"/> + <owl:hasValue rdf:datatype="&xsd;boolean">true</owl:hasValue> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Rainforest --> + + <owl:Class rdf:about="#Rainforest"> + <rdfs:subClassOf rdf:resource="#Forest"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Student --> + + <owl:Class rdf:about="#Student"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="#Person"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#hasHabitat"/> + <owl:someValuesFrom rdf:resource="#University"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#isHardWorking"/> + <owl:hasValue rdf:datatype="&xsd;boolean">true</owl:hasValue> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#TasmanianDevil --> + + <owl:Class rdf:about="#TasmanianDevil"> + <rdfs:subClassOf rdf:resource="#Marsupials"/> + </owl:Class> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#University --> + + <owl:Class rdf:about="#University"> + <rdfs:subClassOf rdf:resource="#Habitat"/> + </owl:Class> + + + + <!-- http://www.w3.org/2002/07/owl#Thing --> + + <owl:Class rdf:about="&owl;Thing"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#BA --> + + <Degree rdf:about="#BA"> + <rdf:type rdf:resource="&owl;Thing"/> + </Degree> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#BS --> + + <Degree rdf:about="#BS"> + <rdf:type rdf:resource="&owl;Thing"/> + </Degree> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Lizzy --> + + <KoalaWithPhD rdf:about="#Lizzy"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#MA --> + + <Degree rdf:about="#MA"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Pan --> + + <Quokka rdf:about="#Pan"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#PhD --> + + <Degree rdf:about="#PhD"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#Suzy --> + + <Koala rdf:about="#Suzy"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#female --> + + <Gender rdf:about="#female"/> + + + + <!-- http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#male --> + + <Gender rdf:about="#male"/> +</rdf:RDF> + + + +<!-- Generated by the OWL API (version 2.2.1.913) http://owlapi.sourceforge.net --> + Added: trunk/examples/ore/madcow.owl =================================================================== --- trunk/examples/ore/madcow.owl (rev 0) +++ trunk/examples/ore/madcow.owl 2009-04-08 08:14:39 UTC (rev 1687) @@ -0,0 +1,1076 @@ +<?xml version="1.0"?> +<!DOCTYPE owl [ +<!ENTITY owl "http://www.w3.org/2002/07/owl#"> +<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"> +<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> +<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#"> +]> +<rdf:RDF + xmlns:old="http://cohse.semanticweb.org/ontologies/people#old+" + xmlns:has="http://cohse.semanticweb.org/ontologies/people#has+" + xmlns:people="http://cohse.semanticweb.org/ontologies/people#" + xmlns:mad="http://cohse.semanticweb.org/ontologies/people#mad+" + xmlns:red="http://cohse.semanticweb.org/ontologies/people#red+" + xmlns:cat="http://cohse.semanticweb.org/ontologies/people#cat+" + xmlns:animal="http://cohse.semanticweb.org/ontologies/people#animal+" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:haulage="http://cohse.semanticweb.org/ontologies/people#haulage+" + xmlns:lorry="http://cohse.semanticweb.org/ontologies/people#lorry+" + xmlns:quality="http://cohse.semanticweb.org/ontologies/people#quality+" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:bus="http://cohse.semanticweb.org/ontologies/people#bus+" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:van0="http://cohse.semanticweb.org/ontologies/people#white+van+" + xmlns:part="http://cohse.semanticweb.org/ontologies/people#part+" + xmlns:truck="http://cohse.semanticweb.org/ontologies/people#haulage+truck+" + xmlns:pet="http://cohse.semanticweb.org/ontologies/people#pet+" + xmlns:dog="http://cohse.semanticweb.org/ontologies/people#dog+" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:van="http://cohse.semanticweb.org/ontologies/people#van+" + xmlns:eaten="http://cohse.semanticweb.org/ontologies/people#eaten+" + xmlns:works="http://cohse.semanticweb.org/ontologies/people#works+" +> +<owl:Ontology rdf:about="http://www.cs.man.ac.uk/~horrocks/OWL/Ontologies/mad_cows.owl"> +</owl:Ontology> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Thing"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal+lover"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+pet" /> + <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">3</owl:minCardinality> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bicycle"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bone"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#boy"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#sex" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#male"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#young"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#brain"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#broadsheet"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#newspaper"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bus"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bus+company"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#company"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bus+driver"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#drives" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bus"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + <rdfs:subClassOf> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#reads" /> + <owl:allValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#broadsheet"> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Class> + <owl:complementOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#likes" /> + <owl:someValuesFrom> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#young"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:complementOf> + </owl:Class> + </owl:unionOf> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#car"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat+liker"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#likes" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat+owner"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+pet" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#colour"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#company"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cow"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vegetarian"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#dog"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#bone"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#dog+liker"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#likes" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#dog"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#dog+owner"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+pet" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#dog"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#driver"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#drives" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#giraffe"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:allValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#leaf"> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#girl"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#sex" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#female"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#young"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#grass"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#plant"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#grownup"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#adult"> + </owl:Thing> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#elderly"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#haulage+company"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#haulage+truck+driver"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#works+for" /> + <owl:someValuesFrom> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#part+of" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#haulage+company"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#drives" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#truck"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#haulage+worker"> + <owl:equivalentClass> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#works+for" /> + <owl:someValuesFrom> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#part+of" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#haulage+company"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#haulage+company"> + </owl:Class> + </owl:unionOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#kid"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#young"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#leaf"> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#part+of" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#tree"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#lorry"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#lorry+driver"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#drives" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#lorry"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#mad+cow"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cow"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:someValuesFrom> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#brain"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#part+of" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#sheep"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#magazine"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#publication"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#man"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#adult"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#sex" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#male"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#newspaper"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#publication"> + </owl:Class> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#tabloid"> + </owl:Class> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#broadsheet"> + </owl:Class> + </owl:unionOf> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#old+lady"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#age" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#elderly"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#sex" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#female"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + <rdfs:subClassOf> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+pet" /> + <owl:allValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat"> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+pet" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#pet+owner"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+pet" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#plant"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#publication"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#quality+broadsheet"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#broadsheet"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#red+top"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#tabloid"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#sheep"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:allValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#grass"> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#tabloid"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#newspaper"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#tree"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#plant"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#truck"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#van"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> + </owl:Class> + </rdfs:subClassOf> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#van+driver"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#person"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#drives" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#van"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vegetarian"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:allValuesFrom> + <owl:Class> + <owl:complementOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#part+of" /> + <owl:someValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:complementOf> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#eats" /> + <owl:allValuesFrom> + <owl:Class> + <owl:complementOf> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#animal"> + </owl:Class> + </owl:complementOf> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#vehicle"> +</owl:Class> +<owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#white+van+man"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#man"> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#drives" /> + <owl:someValuesFrom> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has+colour" /> + <owl:someValuesFrom> + <owl:Class> + <owl:oneOf rdf:parseType="Collection"> + <owl:Thing rdf:about="http://cohse.semanticweb.org/ontologies/people#white"> + </owl:Thing> + </owl:oneOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#van"> + </owl:Class> + </owl:intersectionOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#reads" /> + <owl:allValuesFrom> + <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#tabloid"> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction... [truncated message content] |
From: <neb...@us...> - 2009-04-07 21:25:51
|
Revision: 1686 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1686&view=rev Author: nebelschwade Date: 2009-04-07 21:25:36 +0000 (Tue, 07 Apr 2009) Log Message: ----------- Changed GUI of moosique.net * added Search, Recommendations and Information Tabs * CSS-Tweaks, CSS-Sprites, bandwidth reduction SPARQL problems: see testJamendo.php Modified Paths: -------------- trunk/src/moosique.net/css/default.css trunk/src/moosique.net/css/style.css trunk/src/moosique.net/index.php trunk/src/moosique.net/js/ajax.js trunk/src/moosique.net/js/player.js trunk/src/moosique.net/php/DllearnerConnection.php trunk/src/moosique.net/php/SparqlQueryBuilder.php trunk/src/moosique.net/php/ajaxer.php trunk/src/moosique.net/php/config.ini trunk/src/moosique.net/php/config.php trunk/src/moosique.net/php/testJamendo.php Added Paths: ----------- trunk/src/moosique.net/img/controls.png trunk/src/moosique.net/js/interface.js trunk/src/moosique.net/php/LastFM.php Property Changed: ---------------- trunk/src/moosique.net/ Property changes on: trunk/src/moosique.net ___________________________________________________________________ Modified: svn:ignore - .git + .git moosique.net.esproj Modified: trunk/src/moosique.net/css/default.css =================================================================== --- trunk/src/moosique.net/css/default.css 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/css/default.css 2009-04-07 21:25:36 UTC (rev 1686) @@ -1,33 +1,44 @@ @charset 'utf-8'; -@media all { - -/* based loosely on CSS-Reset Style from Eric Meyer and Stefan Nietzsche */ +@media all { /* Yes we want to reset this for print-Styles too */ +/* Based on various Reset-Styles, included own stuff and added mediabox-Style */ +/* Reset all elements except form stuff */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td - { margin: 0; padding: 0; border: 0; outline: 0; vertical-align: baseline; } -:focus { outline: 0; } +small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; vertical-align: baseline; +} + html { height: 100%; } -body { height: 101%; line-height: 1; background: #fff; } +body { height: 101%; background-color: #fff; color: #000; line-height: 1; } ol, ul { list-style: none; } table { border-collapse: collapse; border-spacing: 0; } caption, th, td { text-align: left; font-weight: normal; } blockquote:before, blockquote:after, q:before, q:after { content: ""; } blockquote, q { quotes: "" ""; } +strong, b { font-weight: bold; } +em, i { font-style: italic; } label, input[type=button], input[type=submit], button { cursor: pointer; } -q:lang(de) { quotes: '„' '“' '‚' '‘'; } -q:lang(en) { quotes: '“' '”' "‘" "’"; } abbr[title] { border-bottom: 1px dotted #888 !important; cursor: help; } a abbr { cursor: pointer !important; } + +/* General purpose-Classes */ +.hidden { position: absolute; left: -9999999em; top: -9999999em;} + +/* Clearfix hack */ .clearfix:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; } .clearfix { display: inline-block; } -.hidden { position: absolute; left: -9999em; top: -9999em; } +* html .clearfix { height: 1%; } +.clearfix { display: block; } -/* =================================================================== */ +/* Special Stuff */ +:focus { outline: 0; } +a { text-decoration: none; } +a:hover { text-decoration: underline; } +a:active { position: relative; top: 1px; } +input:focus, textarea:focus, select:focus { background: #eee; } fieldset { border: 1px solid #333; padding: 9px; } fieldset legend { padding: 0 9px; } -h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal;} +h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal; } - } /* End @media all */ \ No newline at end of file Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/css/style.css 2009-04-07 21:25:36 UTC (rev 1686) @@ -3,16 +3,12 @@ /* moosique.net * - * Overall width: 955px -- golden ratio: 590px & 365px - * * Semiblack: #131313 * Dark Grey: #383838 * Light Grey: #545454 * White: #fff * Yellowish: #ffbc00 - * Border: #272727 * - * */ @media screen { @@ -27,15 +23,10 @@ } body { - background: url(../img/bg_body.png) top left repeat-x #383838; + background: #333; } -a { - text-decoration: none; -} - a:hover { - text-decoration: underline; color: #ffbc00; } @@ -46,39 +37,30 @@ /* Default Container Positioning */ /* =================================================================== */ - #container, #header, #mainContainer, #content { position: relative; } -#container { - width: 955px; - margin: 0 auto; +#headerContainer { + height: 140px; + background: #131313; + border-top: 1px solid #999; + border-bottom: 10px solid #ffbc00; } #header { - height: 132px; + width: 960px; + margin: 0 auto; } -#content { - /* width: 590px; */ - top: 4px; - width: 557px; - padding: 30px 30px 30px 0; - border-right: 3px solid #272727; - min-height: 300px; - height: auto !important; - height: 300px; +#container { + border-top: 1px solid #1a1a1a; } -#sidebar { - /* width: 365px; */ - width: 335px; - position: absolute; - right: 0; - top: 4px; - padding: 30px 0 30px 30px; - +#mainContainer { + width: 960px; + margin: 0 auto; + padding: 30px 0; } #footer { @@ -86,19 +68,18 @@ text-align: center; } - -/* Header Area */ +/* header Area */ /* =================================================================== */ #header h1 a { font-size: 36px; - line-height: 120px; + line-height: 90px; font-family: Georgia, "Times New Roman", Times, serif; text-decoration: none; } #now { position: absolute; - top: 30px; + top: 20px; left: 280px; width: 410px; height: 37px; @@ -131,7 +112,7 @@ #status { position: absolute; - top: 93px; + top: 83px; left: 300px; width: 410px; font-size: 11px; @@ -141,7 +122,7 @@ position: absolute; width: 116px; height: 37px; - top: 30px; + top: 20px; right: 0; padding: 10px 20px; background: #545454; @@ -159,6 +140,10 @@ margin-right: 10px; } +#playPause { + width: 26px; +} + #next { margin-right: 0; } @@ -170,26 +155,16 @@ } #prev { - + background: url(../img/controls.png) 0px -160px no-repeat; } - -#playPause { - width: 26px; -} - -/* TODO Sprites */ -#prev { - background: url(../img/prev.png) center center no-repeat; -} #next { - background: url(../img/next.png) center center no-repeat; + background: url(../img/controls.png) 0px -120px no-repeat; } -/* Will be changed by JavaScript onclick */ #playPause { - background: url(../img/play.png) center center no-repeat; + background: url(../img/controls.png) 0px 0px no-repeat; } #stop { - background: url(../img/stop.png) center center no-repeat; + background: url(../img/controls.png) 0px -80px no-repeat; } #toggles { @@ -211,20 +186,19 @@ } - /* Playlist Area */ /* =================================================================== */ #playlistContainer { position: absolute; width: 368px; - /* top: 132px; */ - top: 450px; + top: 30px; right: 0; background: #000; -moz-border-radius: 10px; -webkit-border-radius: 10px; z-index: 100; + display: none; } #playlistHeader { @@ -253,12 +227,12 @@ #closePlaylist { position: absolute; - width: 20px; + width: 100px; height: 20px; top: 5px; right: 10px; text-align: right; - font-weight: bold; + font-size: 10px; } #playlist { @@ -287,28 +261,53 @@ width: 14px; height: 14px; line-height: 14px; - color: #131313; - background: #fff; - font-weight: bold; - text-align: center; margin-right: -19px; z-index: 1000; + text-indent: -99999999px; + background: url(../img/controls.png) 0px -200px no-repeat; } -/* Samples */ -#samples li { - cursor: move; - padding: 3px; +/* mainMenu */ +/* =================================================================== */ + +#mainMenu ul { + position: absolute; + top: -46px; + left: 0; } +#mainMenu ul li { + float: left; + -moz-border-radius-topleft: 10px; + -moz-border-radius-topright: 10px; + -webkit-border-top-left-radius: 10px; + -webkit-border-top-right-radius: 10px; + padding: 0 15px; + background: #545454; + margin: 5px 5px 0 0; + height: 30px; + line-height: 30px; +} -/* Content Area */ -/* =================================================================== */ -#searchContainer * { +#mainMenu ul li a { color: #131313; } +#mainMenu ul li.active { + height: 35px; + line-height: 35px; + margin-top: 0; + background: #ffbc00; +} +#mainMenu ul li.active a { + font-weight: bold; +} + + +/* Content Area Default Styles */ +/* =================================================================== */ + #mainContainer h2 { font-size: 20px; line-height: 28px; @@ -321,32 +320,57 @@ font-family: "Courier New", Courier, monospace; } -/* Recommendations and Samples */ -#content ol { + +/* search */ +/* =================================================================== */ +#searchForm * { + color: #131313; +} + + +/* Recommendations */ +/* =================================================================== */ +#recommendations { + display: none; /* Initial Hide */ +} + +#recommendations ol { list-style: decimal; margin-left: 24px; + width: 50%; } -#content ol li a { +#recommendations ol li a { cursor: move; text-decoration: none; } -#content ol li a:hover { +#recommendations ol li a:hover { text-decoration: none; color: #fff; } +#recommendations li:hover { + border: 1px solid #ffbc00; +} + /* Draggable li-Items */ -#playlist li.moving, #samples li.moving, #recommendations li.moving { +#playlist li.moving, #recommendations li.moving { background: #666; border: 3px solid #ffbc00; color: #000; font-weight: bold; } +/* information */ +/* =================================================================== */ +#information { + display: none; /* Initial Hide */ +} + + /* Sidebar Area */ /* =================================================================== */ @@ -359,22 +383,4 @@ } - - -/* =================================================================== */ -/* ======================== IE 7 Styles ============================== */ -/* =================================================================== */ -.ie7 .class { - -} - - -/* =================================================================== */ -/* ================= IE 6 (and below) Styles ======================== */ -/* =================================================================== */ -.ie6 .class { - -} - - } /* end @media screen \ No newline at end of file Added: trunk/src/moosique.net/img/controls.png =================================================================== (Binary files differ) Property changes on: trunk/src/moosique.net/img/controls.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/index.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -13,8 +13,7 @@ <!--[if lte IE 6]><body class="ie6"><![endif]--> <!--[if !IE]><!--><body><!-- <![endif]--> - <div id="container"> - + <div id="headerContainer"> <div id="header"> <h1><a href="index.php">moosique.net</a></h1> <div id="now"> @@ -38,22 +37,28 @@ <a href="#" id="togglePlaylist" title="Show/Hide Playlist">Playlist</a> </div> </div> + </div> - - <div id="playlistContainer"> - <div id="playlistHeader"> - Playlist - <a href="#" id="closePlaylist" title="Close Playlist Window">X</a> - </div> - <ol id="playlist"> - <li><a href="mp3/moosique.mp3" class="htrack">Welcome to moosique</a></li> - </ol> - <div id="playlistFooter"> </div> - </div> + <div id="container"> <div id="mainContainer"> + <div id="mainMenu"> + <ul class="clearfix"> + <li class="active"><a href="#" class="search">Search</a></li> + <li><a href="#" class="recommendations">Recommendations</a></li> + <li><a href="#" class="information">Information</a></li> + </ul> + </div> <div id="content"> - <div id="searchContainer"> + + + <div id="search"> + <h2>Welcome to moosique.net!</h2> + <p> + Want to listen to some good free music? Just enter an artist or song + name, search for tags or enter your last.fm username and let the moogic + happen... + </p> <form id="searchForm" method="post" action="php/ajaxer.php"> <div> <select name="typeOfSearch" id="typeOfSearch"> @@ -62,66 +67,71 @@ <option value="tag">Tag</option> <option value="lastfm">Last.fm-User</option> </select> - <input id="search" name="search" type="text" /> + <input id="searchValue" name="searchValue" type="text" /> <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" /> </div> </form> + <div id="results"> + + </div> </div> - <div id="info"> - <h2>Welcome to moosique.net!</h2> - <p> - Want to listen to some good free music? Just enter an artist or song - name, search for tags or enter your last.fm username and let the moogic - happen... - </p> - <p> - Or fill your Playlist with these Samples...<br /> - (Drag them to the Playlist) - </p> - <ol id="samples"> + <div id="recommendations"> + <h2>Try dragging these samples to the playlist</h2> + <ol> <li><a href="http://stream6-3.jamendo.com/8654/mp31/01%20-%20Low%20Earth%20Orbit%20-%20My%20Mistakes.mp3">Low Earth Orbit - My Mistakes</a></li> <li><a href="http://stream6-3.jamendo.com/8654/mp31/02%20-%20Low%20Earth%20Orbit%20-%20Like%20Mud.mp3">Low Earth Orbit - Like Mud</a></li> <li><a href="http://stream6-3.jamendo.com/8654/mp31/03%20-%20Low%20Earth%20Orbit%20-%20Defend.mp3">Low Earth Orbit - Defend</a></li> <li><a href="http://stream6-3.jamendo.com/8654/mp31/04%20-%20Low%20Earth%20Orbit%20-%20What%20Can%20I%20Say.mp3">Low Earth Orbit - What Can I Say</a></li> </ol> + </div> - </div> - - - <div id="sidebar"> - <div id="moreInfo"> - <h2>About the Artist</h2> - <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> - <p> - Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat - duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil - imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis - dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus - qui nobis videntur parum. - </p> + <div id="information"> + <div id="sidebar"> + <div id="moreInfo"> + <h2>About the Artist</h2> + <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> + <p> + Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat + duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil + imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis + dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus + qui nobis videntur parum. + </p> + </div> + </div> </div> </div> + + <div id="playlistContainer"> + <div id="playlistHeader"> + Playlist + <a href="#" id="closePlaylist" title="Close Playlist Window">Close Window</a> + </div> + <ol id="playlist"> + <li><a href="mp3/moosique.mp3" class="htrack">Welcome to moosique</a></li> + </ol> + <div id="playlistFooter"> </div> + </div> <div id="footer"> <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> | <a href="http://aksw.org/Projects/DLLearner">Powered by DL-Learner</a> </div> - - </div> - </div> + + <!-- JS at the bottom, faster loading pages --> <script type="text/javascript" src="js/mootools-core.js"></script> <script type="text/javascript" src="js/mootools-more.js"></script> <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> <script type="text/javascript" src="js/player.js"></script> + <script type="text/javascript" src="js/interface.js"></script> <script type="text/javascript" src="js/ajax.js"></script> - <!--[if lte IE 6]><script type="text/javascript" src="js/ie6fixes.js"></script><![endif]--> </body> </html> \ No newline at end of file Modified: trunk/src/moosique.net/js/ajax.js =================================================================== --- trunk/src/moosique.net/js/ajax.js 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/js/ajax.js 2009-04-07 21:25:36 UTC (rev 1686) @@ -5,7 +5,7 @@ // handle search requests $('searchForm').addEvent('submit', function(e) { - var info = $('info'); + var results = $('results'); var submit = $('searchSubmit'); e.stop(); // prevent form submitting the non-ajax way @@ -13,18 +13,18 @@ onRequest: function(response) { submit.set('disabled', 'disabled'); // disable submit button until request complete - info.set('html', '<h2>Processing your search request...</h2>'); + results.set('html', '<h2>Processing your search request...</h2>'); }, onFailure: function(response) { - info.set('html', '<h2>Unable to process your search. Try again.</h2>'); + results.set('html', '<h2>Unable to process your search. Try again.</h2>'); }, onSuccess: function(response) { submit.erase('disabled'); // reenable submitbutton responseObject = JSON.decode(response); // info.set('text', response); - info.set('html', '<h2>Done.</h2>'); + results.set('html', '<h2>Done.</h2>'); // Firebug needed console.log(responseObject); Added: trunk/src/moosique.net/js/interface.js =================================================================== --- trunk/src/moosique.net/js/interface.js (rev 0) +++ trunk/src/moosique.net/js/interface.js 2009-04-07 21:25:36 UTC (rev 1686) @@ -0,0 +1,17 @@ +window.addEvent('domready', function() { + +// switching between search, recommendation and information + +$$('#mainMenu ul li a').each(function(a) { + a.addEvent('click', function(e) { + e.stop(); // dont follow link + $$('#mainMenu ul li').removeClass('active'); + a.getParent().toggleClass('active'); + console.log(a.get('class')); + $('content').getChildren().setStyle('display', 'none') + $(a.get('class')).setStyle('display', 'block'); + }); + +}); + +}); \ No newline at end of file Modified: trunk/src/moosique.net/js/player.js =================================================================== --- trunk/src/moosique.net/js/player.js 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/js/player.js 2009-04-07 21:25:36 UTC (rev 1686) @@ -66,7 +66,7 @@ */ var trackPause = function() { $$('#now h2').set('text', 'Player Paused'); - $('playPause').setStyle('background-image', 'url(img/play.png)'); + $('playPause').setStyle('background-position', '0px 0px'); } /** @@ -76,14 +76,14 @@ var trackStart = function() { $$('#now h2').set('text', 'You are listening to:'); $$('#now h3').set('text', y.getMetaData().title); - $('playPause').setStyle('background-image', 'url(img/pause.png)'); + $('playPause').setStyle('background-position', '0px -40px'); } /** * trackComplete: we change the Pause-Button to a Play-Button */ var trackComplete = function() { - $('playPause').setStyle('background-image', 'url(img/play.png)'); + $('playPause').setStyle('background-position', '0px 0px'); /* TODO * Nice, someone listened a track until the end, this is a good thing, * we can assume our recommendation was not that bad... @@ -196,7 +196,7 @@ // the Stop-Playing Button that.stop.addEvent('click', function() { console.log('Clicked Stop Button'); - that.playPause.setStyle('background-image', 'url(img/play.png)'); + that.playPause.setStyle('background-position', '0px 0px'); that.nowPlayingHeader.set('text', 'Player stopped'); that.nowPlayingTrack.set('text', '...'); that.nowPlayingTime.set('text', '0:00 / 0:00'); @@ -251,9 +251,9 @@ // this.playlistContainer.setStyle('display', 'none'); // Make the playlist, samples and recommendations sortable - that.makeSortableLists($$('#playlist, #samples, #recommendations')); + that.makeSortableLists($$('#playlist, #recommendations ol')); // make links unclickable for recommendations and samples - that.makeLinksUnclickable($$('#recommendations li a, #samples li a')); + that.makeLinksUnclickable($$('#recommendations li a')); }, Modified: trunk/src/moosique.net/php/DllearnerConnection.php =================================================================== --- trunk/src/moosique.net/php/DllearnerConnection.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/DllearnerConnection.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -5,28 +5,41 @@ */ class dllearnerConnection { - private $conf; + private $config; private $client; private $endpoint; - function __construct($conf) { - $this->conf = $conf; + /** + * + * @return + * @param object $config + */ + function __construct($config) { + $this->config = $config; // we use jamendo as the default sparql-endpoint - $this->setEndpoint($this->conf->getUrl('jamendo')); + $this->setEndpoint($this->config->getUrl('jamendo')); $this->connect(); } + /** + * + * @return + */ private function connect() { // connect to DL-Learner-Web-Service - $this->client = new SoapClient( - $this->conf->getUrl('wsdlLocal') - ); + $this->client = new SoapClient($this->config->getUrl('wsdlLocal')); } + /** + * + * @return + * @param object $endpoint + */ public function setEndpoint($endpoint) { $this->endpoint = $endpoint; } + public function getEndpoint() { return $this->endpoint; } Added: trunk/src/moosique.net/php/LastFM.php =================================================================== --- trunk/src/moosique.net/php/LastFM.php (rev 0) +++ trunk/src/moosique.net/php/LastFM.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -0,0 +1,82 @@ +<?php + +/** + * TODO: UGLY! Use Sparql-Querys instead?! + * + * Later. + */ +class LastFM { + + private $data; + private $config; + private $username; + + function __construct($config, $username) { + $this->config = $config; + $this->username = $username; + $this->getData(); + } + + function getData() { + include_once('arc/ARC2.php'); + $rdfParser = ARC2::getRDFParser(); + $lastfmResource = $this->config->getUrl('lastfm') . urlencode($this->username); + $rdfParser->parse($lastfmResource); + // parse, non simple array + $index = $rdfParser->getSimpleIndex(0); + $this->data = $index; + } + + function getRecentTracks() { + $playedTracks = array(); + $trackNodes = array(); + + echo '<pre>'; + // print_r($this->data); + + if (is_array($this->data) && !empty($this->data)) { + foreach($this->data as $rootItem => $rootValue) { + // only process further if the rootitem ist no uri + if (!preg_match('/http:\/\//i', $rootItem)) { + foreach($rootValue as $childItem => $childValue) { + // if there is a childitem :track_played, we can use the information + if ($childItem == $this->config->getPrefix('played')) { + $trackNodes[] = $childValue[0]['value']; + } + } + } + } + } else { + echo 'Data-Array empty.'; + } + + if (!empty($trackNodes)) { + foreach($trackNodes as $trackNode) { + $track = $this->data[$trackNode][$this->config->getPrefix('title')][0]['value']; + $artistNode = $this->data[$trackNode][$this->config->getPrefix('maker')][0]['value']; + $artist = $this->data[$artistNode][$this->config->getPrefix('name')][0]['value']; + $artistZitgist = $this->data[$artistNode][$this->config->getPrefix('same')][0]['value']; + $album = ''; + $albumZitgist = ''; + + $playedTracks[] = array($artist, $track, $album, $artistZitgist, $albumZitgist); + + } + } else { + echo "No recently played tracks avaiable from last.fm."; + } + + print_r($trackNodes); + print_r($playedTracks); + echo '</pre>'; + } + + +} + +include('config.php'); + +$lastfm = new LastFM($conf, 'nebelschwade'); +$lastfm->getRecentTracks(); + +?> \ No newline at end of file Modified: trunk/src/moosique.net/php/SparqlQueryBuilder.php =================================================================== --- trunk/src/moosique.net/php/SparqlQueryBuilder.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/SparqlQueryBuilder.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -29,8 +29,8 @@ private function sparqlPrefixes() { $prefixes = ''; - foreach($this->config->getPrefixes() as $prefix => $resource) { - $prefixes .= 'PREFIX ' . $prefix . ': ' . $resource . "\n"; + foreach($this->config->getAllPrefixes() as $prefix => $resource) { + $prefixes .= 'PREFIX ' . $prefix . ': <' . $resource . '>' . "\n"; } return $prefixes; } Modified: trunk/src/moosique.net/php/ajaxer.php =================================================================== --- trunk/src/moosique.net/php/ajaxer.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/ajaxer.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -6,11 +6,11 @@ include_once('arc/ARC2.php'); $rdfParser = ARC2::getRDFParser(); - if (isset($_POST['search']) && !empty($_POST['search'])) { + if (isset($_POST['searchValue']) && !empty($_POST['searchValue'])) { if ($_POST['typeOfSearch'] === 'lastfm') { $lastfmContent = ''; - $lastfmResource = 'http://dbtune.org/last-fm/' . urlencode($_POST['search']); + $lastfmResource = 'http://dbtune.org/last-fm/' . urlencode($_POST['searchValue']); $rdfParser->parse($lastfmResource); Modified: trunk/src/moosique.net/php/config.ini =================================================================== --- trunk/src/moosique.net/php/config.ini 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/config.ini 2009-04-07 21:25:36 UTC (rev 1686) @@ -1,32 +1,38 @@ ; Config file for moosique.net ; Define Prefixes and global URLs here -[general] -path = "./" - [url] -wsdl = "http://localhost:8181/services?wsdl" -wsdlLocal = "main.wsdl" +jamendo = "http://dbtune.org/jamendo/sparql/" +lastfm = "http://dbtune.org/last-fm/" +local = "http://127.0.0.1/" musicbrainz = "http://dbtune.org/musicbrainz/sparql/" -jamendo = "http://dbtune.org/jamendo/sparql/" +wsdl = "http://localhost:8181/services?wsdl" +wsdlLocal = "main.wsdl" [prefix] -; map = "<file:/home/moustaki/work/motools/musicbrainz/d2r-server-0.4/mbz_mapping_raw.n3#>" -rdfs = "<http://www.w3.org/2000/01/rdf-schema#>" -owl = "<http://www.w3.org/2002/07/owl#>" -event = "<http://purl.org/NET/c4dm/event.owl#>" -rel = "<http://purl.org/vocab/relationship/>" -lingvoj = "<http://www.lingvoj.org/ontology#>" -foaf = "<http://xmlns.com/foaf/0.1/>" -rdf = "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>" -tags = "<http://www.holygoat.co.uk/owl/redwood/0.1/tags/>" -db = "<http://dbtune.org/musicbrainz/resource/>" -dc = "<http://purl.org/dc/elements/1.1/>" -geo = "<http://www.geonames.org/ontology#>" -bio = "<http://purl.org/vocab/bio/0.1/>" -mo = "<http://purl.org/ontology/mo/>" -vocab = "<http://dbtune.org/musicbrainz/resource/vocab/>" -xsd = "<http://www.w3.org/2001/XMLSchema#>" -mbz = "<http://purl.org/ontology/mbz#>" +bio = "http://purl.org/vocab/bio/0.1/" +db = "http://dbtune.org/musicbrainz/resource/" +dc = "http://purl.org/dc/elements/1.1/" +event = "http://purl.org/NET/c4dm/event.owl#" +foaf = "http://xmlns.com/foaf/0.1/" +geo = "http://www.geonames.org/ontology#" +lingvoj = "http://www.lingvoj.org/ontology#" +mbz = "http://purl.org/ontology/mbz#" +mo = "http://purl.org/ontology/mo/" +owl = "http://www.w3.org/2002/07/owl#" +rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +rdfs = "http://www.w3.org/2000/01/rdf-schema#" +rel = "http://purl.org/vocab/relationship/" +tags = "http://www.holygoat.co.uk/owl/redwood/0.1/tags/" +vocab = "http://dbtune.org/musicbrainz/resource/vocab/" +xsd = "http://www.w3.org/2001/XMLSchema#" ; -; \ No newline at end of file +; Last.fm-related Stuff +; +account = "http://xmlns.com/foaf/0.1/accountName" +maker = "http://xmlns.com/foaf/0.1/maker" +name = "http://xmlns.com/foaf/0.1/name" +played = "http://purl.org/ontology/last-fm/track_played" +title = "http://purl.org/dc/elements/1.1/title" +track = "http://purl.org/ontology/mo/track" +same = "http://www.w3.org/2002/07/owl#sameAs" \ No newline at end of file Modified: trunk/src/moosique.net/php/config.php =================================================================== --- trunk/src/moosique.net/php/config.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/config.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -12,37 +12,42 @@ * the config values and hand them to $this->config */ function __construct() { + $this->createConfig(); + } + + /** + * + * @return + */ + private function createConfig() { $this->config = parse_ini_file('config.ini', true); // load WSDL files (has to be done due to a Java web service bug) include('Utilities.php'); ini_set('soap.wsdl_cache_enabled', '0'); - Utilities::loadWSDLfiles($this->getUrl('wsdl')); + Utilities::loadWSDLfiles($this->getUrl('wsdl')); } /** * - * @return - * @param String $value */ - function getGeneral($value) { - return $this->config['general'][$value]; + public function getUrl($value) { + return $this->config['url'][$value]; } - + /** * * @return * @param object $value */ - function getUrl($value) { - return $this->config['url'][$value]; + public function getPrefix($value) { + return $this->config['prefix'][$value]; } - /** * * @return */ - function getPrefixes() { + public function getAllPrefixes() { return $this->config['prefix']; } } Modified: trunk/src/moosique.net/php/testJamendo.php =================================================================== --- trunk/src/moosique.net/php/testJamendo.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/testJamendo.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -6,23 +6,37 @@ $connection = new DllearnerConnection($conf); -$query = ' -SELECT ?artist ?album -WHERE -{ ?a - a mo:MusicArtist; - foaf:name ?artist; - foaf:made ?album. - ?album tags:taggedWithTag <http://dbtune.org/jamendo/tag/stonerrock>. - } +$queryWorking = ' +select ?artist ?album where { + +?artistLink rdf:type mo:MusicArtist ; + foaf:name ?artist ; + foaf:made ?album ; + +} LIMIT 10 '; + +$queryNOTworking = ' +select ?artist ?album where { + +?artistLink rdf:type mo:MusicArtist ; + foaf:name ?artist ; + foaf:made ?album ; + +FILTER (regex(str(?artist), "vin", "i")) . + +} LIMIT 10 +'; + + /* TODO $spargel = new SparqlQueryBuilder($conf, 'Low Earth Orbit', 'artist', array('artist', 'title', 'image')); $query = $spargel->getQuery(); */ -$json = $connection->sparqlQuery($query); +$json = $connection->sparqlQuery($queryWorking); +// $json = $connection->sparqlQuery($queryNOTworking); $result = json_decode($json); $bindings = $result->results->bindings; @@ -30,4 +44,5 @@ print_r($bindings); echo '</pre>'; -?> \ No newline at end of file +?> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-07 18:47:37
|
Revision: 1685 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1685&view=rev Author: heeroyuy Date: 2009-04-07 18:47:26 +0000 (Tue, 07 Apr 2009) Log Message: ----------- -update libraries Modified Paths: -------------- trunk/lib/protege/org.protege.editor.core.application.jar trunk/lib/protege/org.protege.editor.owl.jar Modified: trunk/lib/protege/org.protege.editor.core.application.jar =================================================================== (Binary files differ) Modified: trunk/lib/protege/org.protege.editor.owl.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-07 09:46:51
|
Revision: 1684 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1684&view=rev Author: heeroyuy Date: 2009-04-07 09:45:11 +0000 (Tue, 07 Apr 2009) Log Message: ----------- -fixed some bugs -started gridbaglayout for dllearnerview -added axiom types when plugin should displayed to plugin.xml (plugin now incompatible to protege beta build 109) 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/EllipseTest.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -60,7 +60,6 @@ // This is the id that checks if the equivalent class or subclass button is // pressed in protege - private final String id; // this is a boolean that checked if the advanced button was pressed or not. private boolean toggled; // This is the Tread of the DL-Learner @@ -86,9 +85,8 @@ * id if it is a subclass or an equivalent class * */ - public ActionHandler(DLLearnerModel m, DLLearnerView view, String i) { + public ActionHandler(DLLearnerModel m, DLLearnerView view) { this.view = view; - this.id = i; this.model = m; toggled = false; @@ -142,13 +140,6 @@ } } - /** - * - * @return id StringID if it is a Subclass or an equivalent class. - */ - public String getID() { - return id; - } /** * select/deselect the Check boxes. @@ -385,7 +376,7 @@ // (ontology, null), // ((EvaluatedDescriptionClass) // eval).getAccuracy()*100)); - if (model.isConsistent(eval)) { + if (((EvaluatedDescriptionClass) eval).isConsistent()) { dm.add(i, new SuggestListItem(colorGreen, eval.getDescription() .toManchesterSyntaxString( Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -39,7 +39,6 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.kb.OWLAPIOntology; import org.dllearner.learningproblems.ClassLearningProblem; -import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.mindswap.pellet.exceptions.InconsistentOntologyException; @@ -79,7 +78,7 @@ private final ComponentManager cm; private static final String EQUIVALENT_CLASS_AXIOM_STRING = "equivalent class"; - private static final String SUPER_CLASS_AXIOM_STRING = "Suggest super class"; + private static final String SUPER_CLASS_AXIOM_STRING = "super class"; private static final String EQUIVALENT_CLASS_LEARNING = "equivalence"; private static final String SUPER_CLASS_LEARNING = "superClass"; @@ -137,8 +136,6 @@ // The Individuals of the Ontology private Set<Individual> individual; - private int instancesCount; - // The error message which is rendered when an error occured @@ -174,7 +171,6 @@ this.view = view; ontologyConsistent = true; - instancesCount = 0; owlDescription = new HashSet<OWLDescription>(); ComponentManager.setComponentClasses(componenten); cm = ComponentManager.getInstance(); @@ -454,24 +450,6 @@ } /** - * This Method checks if after inserting of this concept the ontology is - * still consistent. - * - * @param eDescription - * EvauatedDescription - * @return isConsistent boolean - */ - public boolean isConsistent(EvaluatedDescription eDescription) { - boolean isConsistent = false; - if (((EvaluatedDescriptionClass) eDescription).getCoveredInstances().size() < instancesCount) { - isConsistent = false; - } else { - isConsistent = true; - } - return isConsistent; - } - - /** * This method sets the suggestion list. * * @param list @@ -513,14 +491,6 @@ return individual; } - /** - * This method sets the number of instances. - * @param i number of instances - */ - public void setInstancesCount(int i) { - instancesCount = i; - } - public String getID() { return id; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -22,6 +22,8 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.event.ActionListener; import java.net.URL; import java.util.Set; @@ -108,7 +110,13 @@ private final OWLEditorKit editorKit; private final JPanel learnerPanel; private final JScrollPane learnerScroll; - private static final int SCROLL_SPPED = 10; + private static final int SCROLL_SPEED = 10; + private static final int WIDTH = 575; + private static final int HEIGHT = 350; + private static final int OPTION_HEIGHT = 400; + private static final int SCROLL_WIDTH = 600; + private static final int SCROLL_HEIGHT = 400; + private boolean toogled = false; /** * The constructor for the DL-Learner tab in the class description @@ -117,15 +125,14 @@ * @param editor OWLEditorKit * @param label String */ - public DLLearnerView(String label, OWLEditorKit editor) { + public DLLearnerView(OWLEditorKit editor) { editorKit = editor; model = new DLLearnerModel(editorKit, this); - model.setID(label); sugPanel = new SuggestClassPanel(); learnerPanel = new JPanel(); learnerPanel.setLayout(new BorderLayout()); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - action = new ActionHandler(model, this, label); + action = new ActionHandler(model, this); wikiPane = new JLabel("<html>See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for an introduction.</html>"); URL iconUrl = this.getClass().getResource("arrow.gif"); icon = new ImageIcon(iconUrl); @@ -134,7 +141,9 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); + run = new JButton("suggest class expression"); + accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -145,19 +154,20 @@ 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)); + learner.setLayout(new GridBagLayout()); + accept.setPreferredSize(new Dimension(90, 50)); + run.setPreferredSize(new Dimension(130, 30)); advanced.setName("Advanced"); - learnerScroll.setPreferredSize(new Dimension(600, 400)); - learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPPED); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); + learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPEED); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); this.addAcceptButtonListener(this.action); this.addRunButtonListener(this.action); - this.addAdvancedButtonListener(this.action); - + this.addAdvancedButtonListener(this.action); } + /** * This method returns the SuggestClassPanel. * @return SuggestClassPanel @@ -176,88 +186,132 @@ /** * This Method renders the view of the plugin. */ - public void makeView() { + public void makeView(String label) { + GridBagConstraints c = new GridBagConstraints(); learner.remove(detail); + model.setID(label); + run.setEnabled(false); + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; + c.anchor = GridBagConstraints.FIRST_LINE_START; + learner.add(run, c); + + c.fill = GridBagConstraints.HORIZONTAL; + c.gridwidth = GridBagConstraints.REMAINDER; + learner.add(wikiPane, c); + + sugPanel.setSuggestList(new DefaultListModel()); + sugPanel = sugPanel.updateSuggestClassList(); + c.gridwidth = GridBagConstraints.RELATIVE; + c.fill = GridBagConstraints.NONE; + learner.add(sugPanel, c); + + accept.setEnabled(false); + addButtonPanel.add("North", accept); + c.gridwidth = GridBagConstraints.REMAINDER; + learner.add(addButtonPanel, c); + + c.fill = GridBagConstraints.HORIZONTAL; + c.gridwidth = GridBagConstraints.REMAINDER; + c.ipady = 20; + learner.add(hint, c); + + + advanced.setIcon(icon); + advanced.setSelected(false); + c.ipady = 0; + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; + learner.add(advanced, c); + + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.REMAINDER; + c.ipady = 20; + learner.add(adv, c); + + posPanel.setVisible(false); + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; + c.gridx = 0; + c.gridy = 4; + c.gridwidth = 3; + c.ipady = 80; + learner.add(posPanel, c); + + detail.unsetPanel(); - learnerPanel.setPreferredSize(new Dimension(575, 350)); + learnerPanel.setPreferredSize(new Dimension(WIDTH, HEIGHT)); detail.setVisible(false); hint.setText(""); isInconsistent = false; readThread = new ReadingOntologyThread(editorKit, this, model); readThread.start(); hint.setVisible(true); - advanced.setIcon(icon); - accept.setEnabled(false); action.resetToggled(); - addButtonPanel.add("North", accept); - sugPanel.setSuggestList(new DefaultListModel()); - sugPanel = sugPanel.updateSuggestClassList(); - advanced.setSelected(false); - sugPanel.setBounds(10, 35, 470, 110); - adv.setBounds(40, 195, 200, 20); - wikiPane.setBounds(220, 0, 350, 30); addButtonPanel.setBounds(485, 40, 80, 70); - run.setBounds(10, 0, 200, 30); - advanced.setBounds(10, 195, 20, 20); detail.setBounds(10, 195, 600, 300); detail.setVisible(true); sugPanel.setVisible(true); - posPanel.setVisible(false); - posPanel.setBounds(10, 225, 490, 250); - accept.setBounds(510, 40, 80, 80); - hint.setBounds(10, 150, 490, 35); - errorMessage.setBounds(485, 110, 80, 80); - learner.add(run); - learner.add(wikiPane); - learner.add(adv); - learner.add(advanced); - learner.add(sugPanel); - learner.add(addButtonPanel); - learner.add(hint); - learner.add(errorMessage); - learner.add(posPanel); - learnerPanel.add(learner); - learnerScroll.setViewportView(learnerPanel); + learnerScroll.setViewportView(learner); this.renderErrorMessage(""); } + /** * This method sets the right icon for the advanced Panel. * @param toggled boolean */ public void setIconToggled(boolean toggled) { - if (toggled) { + this.toogled = toggled; + if (this.toogled) { advanced.setIcon(toggledIcon); - learnerPanel.setPreferredSize(new Dimension(575, 400)); + learnerPanel.setPreferredSize(new Dimension(WIDTH, OPTION_HEIGHT)); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); } - if (!toggled) { + if (!this.toogled) { advanced.setIcon(icon); - learnerPanel.setPreferredSize(new Dimension(575, 350)); + learnerPanel.setPreferredSize(new Dimension(WIDTH, HEIGHT)); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); } } public void setGraphicalPanel() { + GridBagConstraints c = new GridBagConstraints(); learner.remove(posPanel); learner.remove(advanced); learner.remove(adv); learner.repaint(); - posPanel.setBounds(10, 435, 490, 250); - adv.setBounds(40, 405, 200, 20); - advanced.setBounds(10, 405, 20, 20); - detail.setBounds(10, 195, 590, 200); detail.setVisible(true); - learner.add(adv); - learner.add(advanced); - learner.add(posPanel); - learner.add(detail); - learnerPanel.setPreferredSize(new Dimension(575, 620)); - learnerPanel.removeAll(); - learnerPanel.add(learner); - learnerScroll.setViewportView(learnerPanel); - learnerScroll.repaint(); + c.fill = GridBagConstraints.NONE; + c.gridx = 0; + c.gridy = 3; + c.gridwidth = 3; + c.ipady = 80; + learner.add(detail, c); + c.fill = GridBagConstraints.HORIZONTAL; + c.gridx = 0; + c.gridy = 4; + c.gridwidth = 1; + learner.add(advanced, c); + + c.fill = GridBagConstraints.HORIZONTAL; + c.gridx = 1; + c.gridy = 4; + c.gridwidth = GridBagConstraints.REMAINDER; + learner.add(adv, c); + + c.fill = GridBagConstraints.NONE; + c.gridx = 0; + c.gridy = 5; + c.gridwidth = 3; + c.ipady = 80; + learner.add(posPanel, c); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); + learnerScroll.setViewportView(learner); + learnerScroll.repaint(); } /** * This Method changes the hint message. Modified: trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -13,8 +13,8 @@ public class EllipseTest extends JPanel { private static final long serialVersionUID = -5676466024192284648L; - private Ellipse2D te; - private Random random; + private final Ellipse2D te; + private final Random random; public EllipseTest() { te = new Ellipse2D.Double(0, 0, 150, 150); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -56,8 +56,8 @@ private final String id; private int shiftXAxis; private int distortionOld; - private final Ellipse2D oldConcept; - private final Ellipse2D newConcept; + private Ellipse2D oldConcept; + private Ellipse2D newConcept; private EvaluatedDescription eval; private final DLLearnerModel model; @@ -118,14 +118,14 @@ posNotCovIndVector = new Vector<IndividualPoint>(); additionalIndividuals = new Vector<IndividualPoint>(); points = new Vector<IndividualPoint>(); - this.computeGraphics(); + this.computeGraphics(0, 0); handler = new GraphicalCoveragePanelHandler(this, desc, model); oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), ELLIPSE_Y_AXIS, WIDTH, HEIGHT); newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + distortionOld); - this.computeIndividualPoints(); + this.computeIndividualPoints(300); this.addMouseMotionListener(handler); this.addMouseListener(handler); } @@ -149,16 +149,33 @@ p = p + 20; } g2D.setColor(darkGreen); - g2D.drawString("*", 310, p+3); + Ellipse2D circlePoint = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint); g2D.setColor(Color.BLACK); 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("additional or not covered individuals", 320, p); + if(id.equals(EQUI_STRING)) { + g2D.setColor(darkRed); + Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint2); + g2D.setColor(Color.BLACK); + g2D.drawString("additional or not covered individuals", 320, p); + } else { + g2D.setColor(darkRed); + Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint2); + g2D.setColor(Color.BLACK); + g2D.drawString("not covered individuals", 320, p); + p = p + 20; + g2D.setColor(Color.BLACK); + Ellipse2D circlePoint3 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint3); + g2D.setColor(Color.BLACK); + g2D.drawString("additional individuals", 320, p); + } + g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); g2D.fillOval(310, 0, 9, 9); @@ -297,7 +314,7 @@ } } - private void computeGraphics() { + private void computeGraphics(int w, int h) { if (eval != null) { this.setVisible(true); panel.repaint(); @@ -306,7 +323,7 @@ distortionOld = 0; adjustment = 0; Ellipse2D old = new Ellipse2D.Double(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, - WIDTH, HEIGHT); + WIDTH + w, HEIGHT + h); x1 = (int) old.getCenterX() - PLUS_SIZE; x2 = (int) old.getCenterX() + PLUS_SIZE; y1 = (int) old.getCenterY() - PLUS_SIZE; @@ -314,19 +331,19 @@ centerX = (int) old.getCenterX(); centerY = (int) old.getCenterY(); double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); - shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); + shiftXAxis = (int) Math.round((WIDTH + w) * (1 - coverage)); if (additionalIndividualSize != 0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0 && ((EvaluatedDescriptionClass) eval).getAddition() < 1.0) { - distortionOld = (int) Math.round(WIDTH * 0.3); + distortionOld = (int) Math.round((WIDTH + w) * 0.3); Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, - ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + ELLIPSE_Y_AXIS, (WIDTH + w), HEIGHT + h); adjustment = (int) Math.round(newer.getCenterY() / 4); } - this.renderPlus(); + this.renderPlus(w); } } - private void renderPlus() { + private void renderPlus(int w) { if (eval != null) { coveredIndividualSize = ((EvaluatedDescriptionClass) eval) .getCoveredInstances().size(); @@ -339,17 +356,17 @@ shiftNewConceptX = 0; shiftCovered = 0; if (coveredIndividualSize == 0) { - shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcepts); + shiftNewConcept = (int) Math.round(((WIDTH + w) / 2.0) * newConcepts); } else if (additionalIndividualSize != coveredIndividualSize) { - shiftNewConcept = (int) Math.round((WIDTH / 2.0) + shiftNewConcept = (int) Math.round(((WIDTH + w) / 2.0) * (1.0 + (1.0 - oldConcepts))); - shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcepts); - shiftCovered = (int) Math.round((WIDTH / 2.0) + shiftOldConcept = (int) Math.round(((WIDTH + w) / 2.0) * oldConcepts); + shiftCovered = (int) Math.round(((WIDTH + w) / 2.0) * (1 - oldConcepts)); } if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval) .getCoverage() == 1.0) { - shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); + shiftCovered = (int) Math.round(((WIDTH + w) / 2.0) * 0.625); shiftNewConceptX = shiftCovered; shiftNewConcept = 2 * shiftNewConceptX; } @@ -392,13 +409,13 @@ } } - private void computeIndividualPoints() { + private void computeIndividualPoints(int n) { if (eval != null) { Set<Individual> posInd = ((EvaluatedDescriptionClass) eval) .getCoveredInstances(); int i = 0; - double x = random.nextInt(300); - double y = random.nextInt(300); + double x = random.nextInt(n); + double y = random.nextInt(n); boolean flag = true; for (Individual ind : posInd) { flag = true; @@ -421,12 +438,12 @@ i++; flag = false; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); break; } else { - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); } } @@ -436,8 +453,8 @@ Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval) .getAdditionalInstances(); int j = 0; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); for (Individual ind : posNotCovInd) { flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { @@ -477,12 +494,12 @@ } j++; flag = false; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); break; } else { - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); } } @@ -493,8 +510,8 @@ model.getCurrentConcept()); notCovInd.removeAll(posInd); int k = 0; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); for (Individual ind : notCovInd) { flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { @@ -516,12 +533,12 @@ } k++; flag = false; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); break; } else { - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); } } @@ -645,4 +662,17 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } + + public void resizePanel(int w, int h) { + this.setPreferredSize(new Dimension(WIDTH + w, HEIGHT + 100 + h)); + this.computeGraphics(w, h); + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), + ELLIPSE_Y_AXIS, WIDTH + w, HEIGHT + h); + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld + w, HEIGHT + + distortionOld + h); + this.computeIndividualPoints(300 + w + h); + this.repaint(); + + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-04-07 09:45:11 UTC (rev 1684) @@ -3,7 +3,9 @@ <extension id="org.dllearner.tools.protege.ProtegePlugin" point="org.protege.editor.owl.ui.editor.description"> <label value="DL-Learner"/> + <axiomTypes value="Equivalent classes axiom,SubClass axiom"/> <class value="org.dllearner.tools.protege.ProtegePlugin"/> + <index value="E"/> </extension> </plugin> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -37,6 +37,8 @@ public class ProtegePlugin extends AbstractOWLDescriptionEditor { private static final long serialVersionUID = 728362819273927L; private DLLearnerView view; + private static final String EQUIVALENT_CLASS_STRING = "Equivalent classes axiom"; + private static final String SUPERCLASS_STRING = "SubClass axiom"; @Override @@ -51,7 +53,11 @@ @Override public boolean isValidInput() { - view.makeView(); + if(this.getAxiomType().toString().equals(EQUIVALENT_CLASS_STRING)) { + view.makeView("equivalent class"); + } else if(this.getAxiomType().toString().equals(SUPERCLASS_STRING)) { + view.makeView("super class"); + } view.getMoreDetailForSuggestedConceptsPanel().unsetPanel(); return true; } @@ -63,8 +69,12 @@ @Override public void initialise() throws Exception { - view = new DLLearnerView("equivalent class", super.getOWLEditorKit()); - view.makeView(); + view = new DLLearnerView(super.getOWLEditorKit()); + if(this.getAxiomType().toString().equals(EQUIVALENT_CLASS_STRING)) { + view.makeView("equivalent class"); + } else if(this.getAxiomType().toString().equals(SUPERCLASS_STRING)) { + view.makeView("super class"); + } } @Override Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -98,7 +98,6 @@ currentConcept = concept; if (reasoner.getIndividuals(concept) != null) { if (reasoner.getIndividuals(concept).size() > 0) { - model.setInstancesCount(reasoner.getIndividuals(concept).size()); hasIndividuals = true; } individual = reasoner.getIndividuals(concept); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -48,6 +48,8 @@ //Scroll panel if the suggestions are longer than the Panel itself private final JScrollPane suggestScroll; + private static final int WIDTH = 460; + private static final int HEIGHT = 108; /** * This is the constructor for the suggest panel. * It creates a new Scroll panel and puts the Suggest List in it. @@ -61,7 +63,7 @@ suggestPanel = new JPanel(); descriptions.setVisible(true); suggestPanel.add(descriptions); - suggestScroll.setPreferredSize(new Dimension(460, 108)); + suggestScroll.setPreferredSize(new Dimension(WIDTH, HEIGHT)); suggestScroll.setViewportView(descriptions); descriptions.setCellRenderer(new SuggestListCellRenderer()); add(suggestScroll); @@ -102,5 +104,11 @@ } + public void resizePanel(int w, int h) { + suggestScroll.setPreferredSize(new Dimension(WIDTH + w, HEIGHT + h)); + suggestScroll.setViewportView(descriptions); + add(suggestScroll); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |