From: <Jen...@us...> - 2008-05-13 13:45:15
|
Revision: 834 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=834&view=rev Author: JensLehmann Date: 2008-05-13 06:45:10 -0700 (Tue, 13 May 2008) Log Message: ----------- comparator finished Modified Paths: -------------- trunk/examples/sparql/Aristotle.conf trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/SubsumptionComparator.java Added Paths: ----------- trunk/examples/sparql/AristotlePos.conf Modified: trunk/examples/sparql/Aristotle.conf =================================================================== --- trunk/examples/sparql/Aristotle.conf 2008-05-13 13:23:45 UTC (rev 833) +++ trunk/examples/sparql/Aristotle.conf 2008-05-13 13:45:10 UTC (rev 834) @@ -15,6 +15,8 @@ sparql.predefinedEndpoint = "DBPEDIA"; import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL"); +algorithm = refexamples; +reasoner = fastInstanceChecker; sparql.instances = { "http://dbpedia.org/resource/Democritus", Added: trunk/examples/sparql/AristotlePos.conf =================================================================== --- trunk/examples/sparql/AristotlePos.conf (rev 0) +++ trunk/examples/sparql/AristotlePos.conf 2008-05-13 13:45:10 UTC (rev 834) @@ -0,0 +1,41 @@ +/** + * 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 = "DBPEDIA"; + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL"); + +algorithm = refexamples; +reasoner = fastInstanceChecker; +problem = posOnlyDefinitionLP; + +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/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-05-13 13:23:45 UTC (rev 833) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-05-13 13:45:10 UTC (rev 834) @@ -455,6 +455,17 @@ } logger.debug(manchester); logger.debug(KBSyntax); + + boolean showOrderedSolutions = true; + + if(showOrderedSolutions) { + System.out.println("ordered by generality (most special solutions first):"); + SubsumptionComparator sc = new SubsumptionComparator(rs); + TreeSet<Description> solutionsOrderedBySubsumption = new TreeSet<Description>(sc); + solutionsOrderedBySubsumption.addAll(solutions); + for(Description d : solutionsOrderedBySubsumption) + System.out.println(d); + } } logger.debug("size of candidate set: " + candidates.size()); Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/SubsumptionComparator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/SubsumptionComparator.java 2008-05-13 13:23:45 UTC (rev 833) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/SubsumptionComparator.java 2008-05-13 13:45:10 UTC (rev 834) @@ -4,10 +4,12 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.Description; +import org.dllearner.utilities.ConceptComparator; -public class SubsumptionComparator implements Comparator<ExampleBasedNode> { +public class SubsumptionComparator implements Comparator<Description> { - public ReasoningService rs; + private ReasoningService rs; + private ConceptComparator cc = new ConceptComparator(); public SubsumptionComparator(ReasoningService rs) { this.rs = rs; @@ -16,6 +18,10 @@ public int compare(ExampleBasedNode arg0, ExampleBasedNode arg1) { Description concept1 = arg0.getConcept(); Description concept2 = arg1.getConcept(); + return compare(concept1, concept2); + } + + public int compare(Description concept1, Description concept2) { // return true if concept1 is a super concept of concept2 boolean value1 = rs.subsumes(concept1, concept2); if(value1) @@ -25,8 +31,10 @@ if(value2) return -1; - // both concepts are equal - return 0; +// System.out.println("Incomparable: " + concept1 + " " + concept2); + + // both concepts are incomparable => order them syntactically + return cc.compare(concept1, concept2); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |