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...> - 2008-11-29 23:26:11
|
Revision: 1533 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1533&view=rev Author: jenslehmann Date: 2008-11-29 23:26:05 +0000 (Sat, 29 Nov 2008) Log Message: ----------- removed erronous title axioms (used as class, object and data property) in SWORE Modified Paths: -------------- trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2008-11-29 23:07:28 UTC (rev 1532) +++ trunk/examples/swore/swore.rdf 2008-11-29 23:26:05 UTC (rev 1533) @@ -2,23 +2,18 @@ <!DOCTYPE rdf:RDF [ - <!ENTITY dct "http://purl.org/dc/terms/" > <!ENTITY req "http://ns.softwiki.de/req/" > - <!ENTITY foaf "http://xmlns.com/foaf/0.1/" > + <!ENTITY foaf2 "http://xmlns.com/foaf/0.1/" > <!ENTITY dcmitype "http://purl.org/dc/dcmitype/" > <!ENTITY owl "http://www.w3.org/2002/07/owl#" > - <!ENTITY swrl "http://www.w3.org/2003/11/swrl#" > <!ENTITY dc "http://purl.org/dc/elements/1.1/" > - <!ENTITY swrlb "http://www.w3.org/2003/11/swrlb#" > <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > - <!ENTITY foaf2 "http://www.holygoat.co.uk/foaf.rdf#" > - <!ENTITY p1 "http://www.w3.org/2004/02/skos/core#" > + <!ENTITY foaf "http://www.holygoat.co.uk/foaf.rdf#" > + <!ENTITY skos "http://www.w3.org/2004/02/skos/core#" > <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > <!ENTITY tags "http://www.holygoat.co.uk/owl/redwood/0.1/tags/" > - <!ENTITY protege "http://protege.stanford.edu/plugins/owl/protege#" > - <!ENTITY xsp "http://www.owl-ontologies.com/2005/08/07/xsp.owl#" > ]> @@ -26,21 +21,16 @@ xml:base="http://ns.softwiki.de/req/" xmlns:tags="http://www.holygoat.co.uk/owl/redwood/0.1/tags/" xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:foaf2="http://www.holygoat.co.uk/foaf.rdf#" - xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#" - xmlns:foaf="http://xmlns.com/foaf/0.1/" - xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#" - xmlns:p1="http://www.w3.org/2004/02/skos/core#" + xmlns:foaf2="http://xmlns.com/foaf/0.1/" + xmlns:foaf="http://www.holygoat.co.uk/foaf.rdf#" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" - xmlns:swrl="http://www.w3.org/2003/11/swrl#" xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" - xmlns:dct="http://purl.org/dc/terms/" xmlns:owl="http://www.w3.org/2002/07/owl#" - xmlns:swrlb="http://www.w3.org/2003/11/swrlb#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:req="http://ns.softwiki.de/req/"> + xmlns:req="http://ns.softwiki.de/req/" + xmlns:skos="http://www.w3.org/2004/02/skos/core#"> <owl:Ontology rdf:about=""> <rdfs:label rdf:datatype="&xsd;string" >SoftWiki Ontology for Requirements Engineering</rdfs:label> @@ -72,13 +62,6 @@ /////////////////////////////////////////////////////////////////////////////////////// --> - <owl:AnnotationProperty rdf:about="&rdfs;comment"> - <rdfs:label rdf:datatype="&xsd;string">comment</rdfs:label> - </owl:AnnotationProperty> - <owl:AnnotationProperty rdf:about="&owl;versionInfo"> - <rdfs:label rdf:datatype="&xsd;string">version info</rdfs:label> - </owl:AnnotationProperty> - <owl:AnnotationProperty rdf:about="&rdfs;label"/> <owl:AnnotationProperty rdf:about="&dc;contributor"/> @@ -346,15 +329,6 @@ - <!-- http://purl.org/dc/elements/1.1/title --> - - <owl:ObjectProperty rdf:about="&dc;title"> - <owl:objectPropertyDomain rdf:resource="AbstractRequirement"/> - <owl:objectPropertyRange rdf:resource="&xsd;string"/> - </owl:ObjectProperty> - - - <!-- http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag --> <owl:ObjectProperty rdf:about="&tags;taggedWithTag"> @@ -669,17 +643,6 @@ <!-- http://ns.softwiki.de/req/CustomerRequirement --> <owl:Class rdf:about="CustomerRequirement"> - <owl:equivalentClass> - <owl:Class> - <owl:intersectionOf rdf:parseType="Collection"> - <rdf:Description rdf:about="Requirement"/> - <owl:Restriction> - <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="Customer"/> - </owl:Restriction> - </owl:intersectionOf> - </owl:Class> - </owl:equivalentClass> <rdfs:subClassOf rdf:resource="Requirement"/> </owl:Class> @@ -828,12 +791,6 @@ <rdfs:subClassOf rdf:resource="AbstractRequirement"/> <rdfs:subClassOf> <owl:Restriction> - <owl:onProperty rdf:resource="&dc;title"/> - <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> - </owl:Restriction> - </rdfs:subClassOf> - <rdfs:subClassOf> - <owl:Restriction> <owl:onProperty rdf:resource="&dc;description"/> <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> </owl:Restriction> @@ -924,15 +881,6 @@ - <!-- http://purl.org/dc/elements/1.1/title --> - - <owl:Class rdf:about="&dc;title"> - <rdfs:label rdf:datatype="&xsd;string">title</rdfs:label> - <rdfs:label xml:lang="de">Titel</rdfs:label> - </owl:Class> - - - <!-- http://www.w3.org/2000/01/rdf-schema#Resource --> <owl:Class rdf:about="&rdfs;Resource"/> @@ -955,7 +903,7 @@ <!-- http://www.w3.org/2004/02/skos/core#Concept --> - <owl:Class rdf:about="&p1;Concept"> + <owl:Class rdf:about="&skos;Concept"> <rdfs:label xml:lang="de">Thema</rdfs:label> </owl:Class> @@ -963,7 +911,7 @@ <!-- http://xmlns.com/foaf/0.1/Document --> - <owl:Class rdf:about="&foaf;Document"/> + <owl:Class rdf:about="&foaf2;Document"/> @@ -1257,7 +1205,7 @@ <!-- http://ns.softwiki.de/req/NotNecessaryRequirment --> <Comment rdf:about="NotNecessaryRequirment"> - <isDefinedBy rdf:resource="&foaf2;RichardNewman"/> + <isDefinedBy rdf:resource="&foaf;RichardNewman"/> </Comment> @@ -1515,7 +1463,7 @@ <!-- http://www.holygoat.co.uk/foaf.rdf#RichardNewman --> - <Author rdf:about="&foaf2;RichardNewman"> + <Author rdf:about="&foaf;RichardNewman"> <defines rdf:resource="NotNecessaryRequirment"/> </Author> @@ -1539,7 +1487,7 @@ <!-- http://www.w3.org/2004/02/skos/core#primarySubject --> - <Topic rdf:about="&p1;primarySubject"> + <Topic rdf:about="&skos;primarySubject"> <rdfs:label xml:lang="de">Thema</rdfs:label> </Topic> @@ -1559,7 +1507,7 @@ <rdf:Description rdf:about="Requirement"/> <owl:Restriction> <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="AbstractSource"/> + <owl:someValuesFrom rdf:resource="Customer"/> </owl:Restriction> </owl:intersectionOf> </owl:Class> @@ -1569,7 +1517,7 @@ <rdf:Description rdf:about="Requirement"/> <owl:Restriction> <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="Customer"/> + <owl:someValuesFrom rdf:resource="AbstractSource"/> </owl:Restriction> </owl:intersectionOf> </owl:Class> @@ -1577,5 +1525,5 @@ -<!-- Generated by the OWL API (version 2.2.1.962) http://owlapi.sourceforge.net --> +<!-- Generated by the OWL API (version 2.2.1.842) http://owlapi.sourceforge.net --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-29 23:07:34
|
Revision: 1532 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1532&view=rev Author: jenslehmann Date: 2008-11-29 23:07:28 +0000 (Sat, 29 Nov 2008) Log Message: ----------- added log4j logging for protege plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-29 22:33:54 UTC (rev 1531) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-29 23:07:28 UTC (rev 1532) @@ -58,6 +58,8 @@ // This is the DLLearnerModel. + private static Logger logger = Logger.getLogger(ActionHandler.class); + private DLLearnerModel model; private OWLEditorKit editorKit; @@ -388,6 +390,8 @@ private void updateList(final List<EvaluatedDescription> result) { + logger.debug("update list with " + result); + Runnable doUpdateList = new Runnable() { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2008-11-29 22:33:54 UTC (rev 1531) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2008-11-29 23:07:28 UTC (rev 1532) @@ -19,6 +19,11 @@ */ package org.dllearner.tools.protege; +import org.apache.log4j.FileAppender; +import org.apache.log4j.HTMLLayout; +import org.apache.log4j.Layout; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; import org.protege.editor.owl.ui.view.AbstractOWLClassViewComponent; import org.semanticweb.owl.model.OWLClass; import org.protege.editor.owl.ui.framelist.OWLFrameList2; @@ -48,7 +53,17 @@ JScrollPane dlLearner = new JScrollPane(list); add(dlLearner); - + // add file logger (comment out if not needed) + boolean useAdditionalLogger = true; + if(useAdditionalLogger) { + Layout layout = new HTMLLayout(); + String fileName = "logs/dllearner_log.html"; + FileAppender fileAppender = new FileAppender(layout, fileName); + // only add log statements in protege package to log file + Logger protegeLogger = Logger.getLogger("org.dllearner.tools.protege"); + protegeLogger.addAppender(fileAppender); + protegeLogger.setLevel(Level.DEBUG); + } } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-29 22:34:00
|
Revision: 1531 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1531&view=rev Author: jenslehmann Date: 2008-11-29 22:33:54 +0000 (Sat, 29 Nov 2008) Log Message: ----------- small fix Modified Paths: -------------- trunk/examples/swore/swore.conf trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java Modified: trunk/examples/swore/swore.conf =================================================================== --- trunk/examples/swore/swore.conf 2008-11-29 20:38:13 UTC (rev 1530) +++ trunk/examples/swore/swore.conf 2008-11-29 22:33:54 UTC (rev 1531) @@ -1,8 +1,9 @@ import("swore.rdf"); -refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/AbstractRequirement" }; +// refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/AbstractRequirement" }; refexamples.ignoredRoles = { "http://ns.softwiki.de/req/broader" }; +"http://ns.softwiki.de/req/important" +"http://ns.softwiki.de/req/very_important" -"http://ns.softwiki.de/req/Topic" +-"http://ns.softwiki.de/req/important" \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-29 20:38:13 UTC (rev 1530) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-29 22:33:54 UTC (rev 1531) @@ -60,7 +60,8 @@ public SortedSet<Description> getSuperClasses(Description concept) { SortedSet<Description> result = subsumptionHierarchyUp.get(concept); if(result == null) { - logger.error("Query for super class of " + concept + " in subsumption hierarchy, but the class is not contained in the (upward) hierarchy"); + logger.error("Query for super class of " + concept + " in subsumption hierarchy, but the class is not contained in the (upward) hierarchy, e.g. because the class does not exist or is ignored. Returning empty result instead."); + return new TreeSet<Description>(); } // we copy all concepts before returning them such that they cannot be @@ -71,7 +72,8 @@ public SortedSet<Description> getSubClasses(Description concept) { SortedSet<Description> result = subsumptionHierarchyDown.get(concept); if(result == null) { - logger.error("Query for sub class of " + concept + " in subsumption hierarchy, but the class is not contained in the (downward) hierarchy"); + logger.error("Query for sub class of " + concept + " in subsumption hierarchy, but the class is not contained in the (downward) hierarchy, e.g. because the class does not exist or is ignored. Returning empty result instead."); + return new TreeSet<Description>(); } return new TreeSet<Description>(result); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-29 20:38:15
|
Revision: 1530 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1530&view=rev Author: heeroyuy Date: 2008-11-29 20:38:13 +0000 (Sat, 29 Nov 2008) Log Message: ----------- -some bugfixes 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/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.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 2008-11-29 20:37:20 UTC (rev 1529) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-29 20:38:13 UTC (rev 1530) @@ -40,6 +40,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.apache.log4j.Logger; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; @@ -106,7 +107,7 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("Suggest " + id)) { + if (z.getActionCommand().equals(id)) { if (model.getAlreadyLearned()) { model.unsetListModel(); } @@ -116,7 +117,7 @@ model.setLearningProblem(); model.setLearningAlgorithm(); view.getRunButton().setEnabled(false); - view.renderErrorMessage("Learning started"); + view.renderErrorMessage("learning started"); view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); retriever = new SuggestionRetriever(); // @@ -136,7 +137,7 @@ .getSuggestClassPanel().getSuggestList() .getSelectedValue()); } - String message = "Concept added"; + String message = "class description added"; view.renderErrorMessage(message); view.updateWindow(); } @@ -307,43 +308,40 @@ SwingWorker<List<EvaluatedDescription>, List<EvaluatedDescription>> { private Thread dlLearner; - /** - * Constructor for the SuggestionRetriever. - */ - public SuggestionRetriever() { - - } + private DefaultListModel dm = new DefaultListModel(); + Logger logger = Logger.getLogger(SuggestionRetriever.class); + Logger rootLogger = Logger.getRootLogger(); + @SuppressWarnings("unchecked") @Override protected List<EvaluatedDescription> doInBackground() throws Exception { - // DefaultListModel descriptions = new DefaultListModel(); - // List<Description> descriptionList = - // model.getLearningAlgorithm().getCurrentlyBestDescriptions(); - // Iterator<Description> it = descriptionList.iterator(); la = model.getLearningAlgorithm(); timer = new Timer(); timer.schedule(new TimerTask(){ @Override public void run() { + System.out.println("DA BIN ICH:"); if (la != null) { - - publish(la - .getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel() - .getNrOfConcepts(), - view.getPosAndNegSelectPanel().getOptionPanel() - .getMinAccuracy(), true)); + + //System.out.println("EVAL: " + la.getCurrentlyBestEvaluatedDescriptions().isEmpty()); + //System.out.println("SIZE: " + la.getCurrentlyBestEvaluatedDescriptions().size()); + publish(la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts() + , view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true)); } } - }, 0, 100); + }, 0, 1000); dlLearner = new Thread(new Runnable() { @Override public void run() { - + try { model.run(); + } catch (Exception e) { + e.printStackTrace(); + } } }); @@ -355,11 +353,8 @@ // TODO Auto-generated catch block e.printStackTrace(); } - List<EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions( - view.getPosAndNegSelectPanel().getOptionPanel() - .getNrOfConcepts(), - view.getPosAndNegSelectPanel().getOptionPanel() - .getMinAccuracy(), true); + List<EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts() + , view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true); return result; } @@ -378,6 +373,7 @@ } view.getRunButton().setEnabled(true); + System.out.println("DONE"); updateList(result); } @@ -394,31 +390,35 @@ Runnable doUpdateList = new Runnable() { - DefaultListModel dm = new DefaultListModel(); + public void run() { + System.out.println("JETZT HIER:"); model.setSuggestList(result); // learnPanel.getListModel().clear(); Iterator<EvaluatedDescription> it = result.iterator(); - + int i = 0; while (it.hasNext()) { Iterator<OWLOntology> ont = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); EvaluatedDescription eval = it.next(); while(ont.hasNext()) { String onto = ont.next().getURI().toString(); + if(eval.getDescription().toString().contains(onto)) { if(model.isConsistent(eval)) { - dm.add(0, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto, null))); + dm.add(i, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto, null))); + i++; break; } else { - dm.add(0, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(onto, null))); + dm.add(i, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(onto, null))); + i++; break; } } } } - view.getSuggestClassPanel().getSuggestList().setModel(dm); - + System.out.println("NAJA NUN HIER"); + view.getSuggestClassPanel().setSuggestList(dm); } }; SwingUtilities.invokeLater(doUpdateList); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-29 20:37:20 UTC (rev 1529) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-29 20:38:13 UTC (rev 1530) @@ -35,6 +35,7 @@ import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; @@ -90,10 +91,6 @@ private ReasonerComponent rs; - // The Knowledge source for the reasoner - - private OWLAPIOntology source; - // The View of the DL-Learner Plugin private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; @@ -171,6 +168,7 @@ // The Individuals of the Ontology private Set<Individual> individual; + private Set<OWLAPIOntology> ontologies; // The error message which is rendered when an error occured @@ -185,6 +183,8 @@ private JXTaskPane detailPane; private DefaultListModel posListModel; private DefaultListModel negListModel; + private Set<KnowledgeSource> sources; + //private KnowledgeSource source; private boolean hasIndividuals; private NamedClass currentConcept; private Vector<IndividualObject> individualVector; @@ -222,6 +222,7 @@ suggestModel = new DefaultListModel(); detailPane = new JXTaskPane(); detailPane.setTitle("Details"); + sources = new HashSet<KnowledgeSource>(); } @@ -252,7 +253,6 @@ .getIndividualString()); } } - System.out.println("TEST: " + positiveExamples); } /** @@ -288,10 +288,11 @@ * OWLAPIOntology will be available. */ public void setKnowledgeSource() { - this.source = new OWLAPIOntology(editor.getModelManager() - .getActiveOntology()); - source.setOWLOntologies(editor.getModelManager().getActiveOntologies()); - + //Ssource = new OWLAPIOntology(editor.getModelManager().getActiveOntology()); + Iterator<OWLOntology> it = editor.getModelManager().getActiveOntologies().iterator(); + while (it.hasNext()) { + sources.add(new OWLAPIOntology(it.next())); + } } /** @@ -299,7 +300,8 @@ * OWLAPIReasoner is available. */ public void setReasoner() { - this.reasoner = cm.reasoner(OWLAPIReasoner.class, source); + this.reasoner = cm.reasoner(OWLAPIReasoner.class, sources); + try { reasoner.init(); } catch (ComponentInitException e) { @@ -316,12 +318,12 @@ * classes. */ public void setLearningProblem() { - if (id.equals("equivalent classes")) { + if (id.equals("Suggest equivalent class")) { // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class lp = cm.learningProblem(PosNegDefinitionLP.class, reasoner); } - if (id.equals("super classes")) { + if (id.equals("Suggest super class")) { // sets the learning problem to PosNegInclusionLP when the dllearner // should suggest a subclass lp = cm.learningProblem(PosNegInclusionLP.class, reasoner); @@ -349,6 +351,9 @@ // TODO Auto-generated catch block e.printStackTrace(); } + Set<String> ignore = new TreeSet<String>(); + ignore.add(currentConcept.toString()); + cm.applyConfigEntry(la, "ignoredConcepts", ignore); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); @@ -365,7 +370,7 @@ * This method starts the learning process. */ public void run() { - error = "Learning succesful"; + error = "learning succesful"; String message = "To view details about why a class description was suggested, please doubleclick on it."; // start the algorithm and print the best concept found la.start(); @@ -470,18 +475,34 @@ if (individuals == null) { NamedClass concept = i.next(); // checks if the concept is the selected concept in protege - if (concept.toString().endsWith( - current.getRootObject().toString())) { - // if individuals is not null it gets all individuals of - // the concept - currentConcept = concept; - if (reasoner.getIndividuals(concept) != null) { - if (reasoner.getIndividuals(concept).size() > 0) { - hasIndividuals = true; + if(concept.toString().contains("#")) { + if (concept.toString().endsWith("#"+ + current.getRootObject().toString())) { + // if individuals is not null it gets all individuals of + // the concept + currentConcept = concept; + if (reasoner.getIndividuals(concept) != null) { + if (reasoner.getIndividuals(concept).size() > 0) { + hasIndividuals = true; + } + individual = reasoner.getIndividuals(concept); + break; } - individual = reasoner.getIndividuals(concept); - break; } + } else { + if (concept.toString().endsWith( + current.getRootObject().toString())) { + // if individuals is not null it gets all individuals of + // the concept + currentConcept = concept; + if (reasoner.getIndividuals(concept) != null) { + if (reasoner.getIndividuals(concept).size() > 0) { + hasIndividuals = true; + } + individual = reasoner.getIndividuals(concept); + break; + } + } } } } @@ -784,4 +805,17 @@ public OWLEditorKit getOWLEditorKit() { return editor; } + + /** + * This method returns the currently used ontoloies including + * importet ontologies. + * @return Set<OWLAPIOntology> ontologies + */ + public Set<OWLAPIOntology> getOWLOntologies() { + return ontologies; + } + + public Set<KnowledgeSource> getKnowledgeSources() { + return sources; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-29 20:37:20 UTC (rev 1529) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-29 20:38:13 UTC (rev 1530) @@ -118,7 +118,7 @@ //checker = new OWLDescriptionChecker(editorKit); editor = new ExpressionEditor<OWLDescription>(editorKit, editorKit.getModelManager().getOWLExpressionCheckerFactory().getOWLDescriptionChecker()); editor.setExpressionObject(description); - dllearner = new DLLearnerView(frame, label, this); + action = new ActionHandler(this.action, null, dllearner, null, editorKit); tabbedPane = new JTabbedPane(); @@ -127,9 +127,11 @@ editingComponent.add(tabbedPane); editingComponent.setPreferredSize(new Dimension(600, 520)); if (label.equals("equivalent classes")) { + dllearner = new DLLearnerView(frame, SUGGEST_EQUIVALENT_CLASS_LABEL, this); tabbedPane.add(SUGGEST_EQUIVALENT_CLASS_LABEL, dllearner); } if (label.equals("super classes")) { + dllearner = new DLLearnerView(frame, SUGGEST_SUBCLASS_LABEL, this); tabbedPane.add(SUGGEST_SUBCLASS_LABEL, dllearner); } @@ -384,7 +386,7 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - run = new JButton("Suggest " + label); + run = new JButton(label); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-29 20:37:20 UTC (rev 1529) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-29 20:38:13 UTC (rev 1530) @@ -54,7 +54,7 @@ maxExecutionTimeLabel = new JLabel("maximum execution time"); nrOfConceptsLabel = new JLabel("maximum number of results"); - minAccuracy = new JSlider(50, 100, 80); + minAccuracy = new JSlider(50, 100, 50); minAccuracy.setPaintTicks(true); minAccuracy.setMajorTickSpacing(10); minAccuracy.setMinorTickSpacing(1); @@ -68,7 +68,7 @@ maxExecutionTime.setPaintLabels(true); - nrOfConcepts = new JSlider(2, 20, 5); + nrOfConcepts = new JSlider(2, 20, 10); nrOfConcepts.setPaintTicks(true); nrOfConcepts.setMajorTickSpacing(2); nrOfConcepts.setMinorTickSpacing(1); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-11-29 20:37:20 UTC (rev 1529) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-11-29 20:38:13 UTC (rev 1530) @@ -88,7 +88,9 @@ * @param desc List model of descriptions made by the DL-Learner */ public void setSuggestList(DefaultListModel desc) { + System.out.println("HUHU"); descriptions.setModel(desc); + repaint(); } /** * This method returns the current Description list. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-29 20:37:25
|
Revision: 1529 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1529&view=rev Author: heeroyuy Date: 2008-11-29 20:37:20 +0000 (Sat, 29 Nov 2008) Log Message: ----------- -update ontology Modified Paths: -------------- trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2008-11-29 10:16:38 UTC (rev 1528) +++ trunk/examples/swore/swore.rdf 2008-11-29 20:37:20 UTC (rev 1529) @@ -669,6 +669,17 @@ <!-- http://ns.softwiki.de/req/CustomerRequirement --> <owl:Class rdf:about="CustomerRequirement"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="Requirement"/> + <owl:Restriction> + <owl:onProperty rdf:resource="isCreatedBy"/> + <owl:someValuesFrom rdf:resource="Customer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> <rdfs:subClassOf rdf:resource="Requirement"/> </owl:Class> @@ -1121,7 +1132,9 @@ <!-- http://ns.softwiki.de/req/CustomerRequirement1 --> - <CustomerRequirement rdf:about="CustomerRequirement1"/> + <CustomerRequirement rdf:about="CustomerRequirement1"> + <isCreatedBy rdf:resource="Tom"/> + </CustomerRequirement> @@ -1546,7 +1559,7 @@ <rdf:Description rdf:about="Requirement"/> <owl:Restriction> <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="Customer"/> + <owl:someValuesFrom rdf:resource="AbstractSource"/> </owl:Restriction> </owl:intersectionOf> </owl:Class> @@ -1556,7 +1569,7 @@ <rdf:Description rdf:about="Requirement"/> <owl:Restriction> <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="AbstractSource"/> + <owl:someValuesFrom rdf:resource="Customer"/> </owl:Restriction> </owl:intersectionOf> </owl:Class> @@ -1564,5 +1577,5 @@ -<!-- Generated by the OWL API (version 2.2.1.914) http://owlapi.sourceforge.net --> +<!-- Generated by the OWL API (version 2.2.1.962) http://owlapi.sourceforge.net --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-29 10:16:43
|
Revision: 1528 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1528&view=rev Author: heeroyuy Date: 2008-11-29 10:16:38 +0000 (Sat, 29 Nov 2008) Log Message: ----------- -added examples to ontology Modified Paths: -------------- trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2008-11-28 16:26:57 UTC (rev 1527) +++ trunk/examples/swore/swore.rdf 2008-11-29 10:16:38 UTC (rev 1528) @@ -198,6 +198,14 @@ + <!-- http://ns.softwiki.de/req/isCreatedBy --> + + <owl:ObjectProperty rdf:about="isCreatedBy"> + <rdfs:domain rdf:resource="AbstractRequirement"/> + </owl:ObjectProperty> + + + <!-- http://ns.softwiki.de/req/isDefinedBy --> <owl:ObjectProperty rdf:about="isDefinedBy"> @@ -269,6 +277,15 @@ + <!-- http://ns.softwiki.de/req/isReleatedTo --> + + <owl:ObjectProperty rdf:about="isReleatedTo"> + <rdfs:range rdf:resource="Customer"/> + <rdfs:domain rdf:resource="CustomerRequirement"/> + </owl:ObjectProperty> + + + <!-- http://ns.softwiki.de/req/isSimilarTo --> <owl:ObjectProperty rdf:about="isSimilarTo"> @@ -332,8 +349,7 @@ <!-- http://purl.org/dc/elements/1.1/title --> <owl:ObjectProperty rdf:about="&dc;title"> - <rdf:type rdf:resource="&owl;Class"/> - <owl:objectPropertyDomain rdf:resource="&dc;title"/> + <owl:objectPropertyDomain rdf:resource="AbstractRequirement"/> <owl:objectPropertyRange rdf:resource="&xsd;string"/> </owl:ObjectProperty> @@ -645,6 +661,7 @@ <owl:Class rdf:about="Customer"> <rdfs:subClassOf rdf:resource="Stakeholder"/> + <owl:disjointWith rdf:resource="Programmer"/> </owl:Class> @@ -754,6 +771,14 @@ + <!-- http://ns.softwiki.de/req/Programmer --> + + <owl:Class rdf:about="Programmer"> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/QualityRating --> <owl:Class rdf:about="QualityRating"> @@ -947,6 +972,7 @@ <Rating rdf:about="1"> <rdf:type rdf:resource="PriorityRating"/> <rdf:type rdf:resource="QualityRating"/> + <isDefinedBy rdf:resource="Andrew_Stellman"/> </Rating> @@ -1031,16 +1057,42 @@ <!-- http://ns.softwiki.de/req/Andrew_Stellman --> - <Author rdf:about="Andrew_Stellman"/> + <Author rdf:about="Andrew_Stellman"> + <defines rdf:resource="1"/> + <defines rdf:resource="MultiUserSystem"/> + <defines rdf:resource="loadGUIInUnder2Sec"/> + </Author> + <!-- http://ns.softwiki.de/req/BuildAFastSoftware --> + + <CustomerRequirement rdf:about="BuildAFastSoftware"> + <isCreatedBy rdf:resource="Charlotte_Blay"/> + </CustomerRequirement> + + + + <!-- http://ns.softwiki.de/req/BuildASoftwareThatRuns24hADay --> + + <CustomerRequirement rdf:about="BuildASoftwareThatRuns24hADay"> + <isCreatedBy rdf:resource="Philippe_Soupault"/> + </CustomerRequirement> + + + <!-- http://ns.softwiki.de/req/CentralOrganisationOfFinnishTrade --> <TradeUnion rdf:about="CentralOrganisationOfFinnishTrade"/> + <!-- http://ns.softwiki.de/req/Charlotte_Blay --> + + <Customer rdf:about="Charlotte_Blay"/> + + + <!-- http://ns.softwiki.de/req/Complete --> <QualityRequirement rdf:about="Complete"/> @@ -1059,12 +1111,40 @@ + <!-- http://ns.softwiki.de/req/CreateModernGUIDesign --> + + <CustomerRequirement rdf:about="CreateModernGUIDesign"> + <isCreatedBy rdf:resource="Jane_Smiley"/> + </CustomerRequirement> + + + + <!-- http://ns.softwiki.de/req/CustomerRequirement1 --> + + <CustomerRequirement rdf:about="CustomerRequirement1"/> + + + + <!-- http://ns.softwiki.de/req/Derick_Garnier --> + + <Customer rdf:about="Derick_Garnier"/> + + + <!-- http://ns.softwiki.de/req/DialogSystemShoudRespondInUnder5Sec --> - <PerformanceRequirement rdf:about="DialogSystemShoudRespondInUnder5Sec"/> + <PerformanceRequirement rdf:about="DialogSystemShoudRespondInUnder5Sec"> + <isDefinedBy rdf:resource="NotNecessaryRequirment"/> + </PerformanceRequirement> + <!-- http://ns.softwiki.de/req/Dual_Core_2_GHz_2GB_RAM --> + + <PerformanceRequirement rdf:about="Dual_Core_2_GHz_2GB_RAM"/> + + + <!-- http://ns.softwiki.de/req/EuropeanTradeUnionConfederation --> <TradeUnion rdf:about="EuropeanTradeUnionConfederation"/> @@ -1083,9 +1163,17 @@ + <!-- http://ns.softwiki.de/req/Jane_Smiley --> + + <Customer rdf:about="Jane_Smiley"/> + + + <!-- http://ns.softwiki.de/req/Jennifer_Greene --> - <Author rdf:about="Jennifer_Greene"/> + <Author rdf:about="Jennifer_Greene"> + <defines rdf:resource="MultiWindowSystem"/> + </Author> @@ -1097,10 +1185,18 @@ <!-- http://ns.softwiki.de/req/LogEveryUserActivity --> - <FunctionalRequirement rdf:about="LogEveryUserActivity"/> + <FunctionalRequirement rdf:about="LogEveryUserActivity"> + <isDefinedBy rdf:resource="Steve_McConnell"/> + </FunctionalRequirement> + <!-- http://ns.softwiki.de/req/Michael_Steinmetz --> + + <Customer rdf:about="Michael_Steinmetz"/> + + + <!-- http://ns.softwiki.de/req/Modifiable --> <QualityRequirement rdf:about="Modifiable"/> @@ -1109,19 +1205,25 @@ <!-- http://ns.softwiki.de/req/MultiTabSystem --> - <DesignRequirement rdf:about="MultiTabSystem"/> + <DesignRequirement rdf:about="MultiTabSystem"> + <isDefinedBy rdf:resource="Steve_McConnell"/> + </DesignRequirement> <!-- http://ns.softwiki.de/req/MultiUserSystem --> - <FunctionalRequirement rdf:about="MultiUserSystem"/> + <FunctionalRequirement rdf:about="MultiUserSystem"> + <isDefinedBy rdf:resource="Andrew_Stellman"/> + </FunctionalRequirement> <!-- http://ns.softwiki.de/req/MultiWindowSystem --> - <DesignRequirement rdf:about="MultiWindowSystem"/> + <DesignRequirement rdf:about="MultiWindowSystem"> + <isDefinedBy rdf:resource="Jennifer_Greene"/> + </DesignRequirement> @@ -1141,7 +1243,9 @@ <!-- http://ns.softwiki.de/req/NotNecessaryRequirment --> - <Comment rdf:about="NotNecessaryRequirment"/> + <Comment rdf:about="NotNecessaryRequirment"> + <isDefinedBy rdf:resource="&foaf2;RichardNewman"/> + </Comment> @@ -1151,15 +1255,30 @@ + <!-- http://ns.softwiki.de/req/Philippe_Soupault --> + + <Customer rdf:about="Philippe_Soupault"/> + + + <!-- http://ns.softwiki.de/req/Prioritized --> <QualityRequirement rdf:about="Prioritized"/> + <!-- http://ns.softwiki.de/req/Quad_Core_3_GHz_16_GB_RAM --> + + <PerformanceRequirement rdf:about="Quad_Core_3_GHz_16_GB_RAM"/> + + + <!-- http://ns.softwiki.de/req/Steve_McConnell --> - <Author rdf:about="Steve_McConnell"/> + <Author rdf:about="Steve_McConnell"> + <defines rdf:resource="LogEveryUserActivity"/> + <defines rdf:resource="MultiTabSystem"/> + </Author> @@ -1169,12 +1288,30 @@ + <!-- http://ns.softwiki.de/req/SystemStabilityRequirement --> + + <PerformanceRequirement rdf:about="SystemStabilityRequirement"/> + + + <!-- http://ns.softwiki.de/req/TextualScenario --> <Scenario rdf:about="TextualScenario"/> + <!-- http://ns.softwiki.de/req/Tilman_Röhrig --> + + <Customer rdf:about="Tilman_Röhrig"/> + + + + <!-- http://ns.softwiki.de/req/Tom --> + + <Programmer rdf:about="Tom"/> + + + <!-- http://ns.softwiki.de/req/Traceable --> <QualityRequirement rdf:about="Traceable"/> @@ -1199,9 +1336,19 @@ + <!-- http://ns.softwiki.de/req/UseAsLittleSystemResourcesAsPosible --> + + <CustomerRequirement rdf:about="UseAsLittleSystemResourcesAsPosible"> + <isCreatedBy rdf:resource="Michael_Steinmetz"/> + </CustomerRequirement> + + + <!-- http://ns.softwiki.de/req/UseDatabaseToStoreUserData --> - <CustomerRequirement rdf:about="UseDatabaseToStoreUserData"/> + <CustomerRequirement rdf:about="UseDatabaseToStoreUserData"> + <isCreatedBy rdf:resource="Derick_Garnier"/> + </CustomerRequirement> @@ -1219,7 +1366,9 @@ <!-- http://ns.softwiki.de/req/UserCanAccessDataFromEveryComputer --> - <FunctionalRequirement rdf:about="UserCanAccessDataFromEveryComputer"/> + <FunctionalRequirement rdf:about="UserCanAccessDataFromEveryComputer"> + <isCommentedBy rdf:resource="MustBeDiscussed"/> + </FunctionalRequirement> @@ -1241,6 +1390,12 @@ + <!-- http://ns.softwiki.de/req/cluster --> + + <PerformanceRequirement rdf:about="cluster"/> + + + <!-- http://ns.softwiki.de/req/comment --> <Comment rdf:about="comment"/> @@ -1271,6 +1426,12 @@ + <!-- http://ns.softwiki.de/req/großsystemen --> + + <PerformanceRequirement rdf:about="großsystemen"/> + + + <!-- http://ns.softwiki.de/req/important --> <Vote rdf:about="important"/> @@ -1291,7 +1452,9 @@ <!-- http://ns.softwiki.de/req/loadGUIInUnder2Sec --> - <PerformanceRequirement rdf:about="loadGUIInUnder2Sec"/> + <PerformanceRequirement rdf:about="loadGUIInUnder2Sec"> + <isDefinedBy rdf:resource="Andrew_Stellman"/> + </PerformanceRequirement> @@ -1339,7 +1502,9 @@ <!-- http://www.holygoat.co.uk/foaf.rdf#RichardNewman --> - <Author rdf:about="&foaf2;RichardNewman"/> + <Author rdf:about="&foaf2;RichardNewman"> + <defines rdf:resource="NotNecessaryRequirment"/> + </Author> @@ -1364,6 +1529,37 @@ <Topic rdf:about="&p1;primarySubject"> <rdfs:label xml:lang="de">Thema</rdfs:label> </Topic> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // General axioms + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + <owl:Class> + <rdfs:subClassOf rdf:resource="CustomerRequirement"/> + <owl:intersectionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="Requirement"/> + <owl:Restriction> + <owl:onProperty rdf:resource="isCreatedBy"/> + <owl:someValuesFrom rdf:resource="Customer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + <owl:Class> + <rdfs:subClassOf rdf:resource="CustomerRequirement"/> + <owl:intersectionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="Requirement"/> + <owl:Restriction> + <owl:onProperty rdf:resource="isCreatedBy"/> + <owl:someValuesFrom rdf:resource="AbstractSource"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> </rdf:RDF> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-28 16:27:06
|
Revision: 1527 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1527&view=rev Author: heeroyuy Date: 2008-11-28 16:26:57 +0000 (Fri, 28 Nov 2008) Log Message: ----------- -added examples to ontology Modified Paths: -------------- trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2008-11-28 14:12:06 UTC (rev 1526) +++ trunk/examples/swore/swore.rdf 2008-11-28 16:26:57 UTC (rev 1527) @@ -590,6 +590,14 @@ + <!-- http://ns.softwiki.de/req/AllocatedRequirement --> + + <owl:Class rdf:about="AllocatedRequirement"> + <rdfs:subClassOf rdf:resource="Requirement"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/ApplicationPointer --> <owl:Class rdf:about="ApplicationPointer"> @@ -625,6 +633,30 @@ + <!-- http://ns.softwiki.de/req/Creditor --> + + <owl:Class rdf:about="Creditor"> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Customer --> + + <owl:Class rdf:about="Customer"> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/CustomerRequirement --> + + <owl:Class rdf:about="CustomerRequirement"> + <rdfs:subClassOf rdf:resource="Requirement"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/DefinedKeyword --> <owl:Class rdf:about="DefinedKeyword"> @@ -633,6 +665,22 @@ + <!-- http://ns.softwiki.de/req/DerivedRequirement --> + + <owl:Class rdf:about="DerivedRequirement"> + <rdfs:subClassOf rdf:resource="Requirement"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/DesignRequirement --> + + <owl:Class rdf:about="DesignRequirement"> + <rdfs:subClassOf rdf:resource="Requirement"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/Document --> <owl:Class rdf:about="Document"> @@ -672,6 +720,14 @@ + <!-- http://ns.softwiki.de/req/Government --> + + <owl:Class rdf:about="Government"> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/Keyword --> <owl:Class rdf:about="Keyword"> @@ -680,6 +736,14 @@ + <!-- http://ns.softwiki.de/req/PerformanceRequirement --> + + <owl:Class rdf:about="PerformanceRequirement"> + <rdfs:subClassOf rdf:resource="Requirement"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/PriorityRating --> <owl:Class rdf:about="PriorityRating"> @@ -728,13 +792,13 @@ <rdfs:subClassOf rdf:resource="AbstractRequirement"/> <rdfs:subClassOf> <owl:Restriction> - <owl:onProperty rdf:resource="&dc;description"/> + <owl:onProperty rdf:resource="&dc;title"/> <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> </owl:Restriction> </rdfs:subClassOf> <rdfs:subClassOf> <owl:Restriction> - <owl:onProperty rdf:resource="&dc;title"/> + <owl:onProperty rdf:resource="&dc;description"/> <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> </owl:Restriction> </rdfs:subClassOf> @@ -755,6 +819,14 @@ + <!-- http://ns.softwiki.de/req/SeniorManagementStaff --> + + <owl:Class rdf:about="SeniorManagementStaff"> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/Stakeholder --> <owl:Class rdf:about="Stakeholder"> @@ -791,6 +863,14 @@ + <!-- http://ns.softwiki.de/req/TradeUnion --> + + <owl:Class rdf:about="TradeUnion"> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + </owl:Class> + + + <!-- http://ns.softwiki.de/req/Vote --> <owl:Class rdf:about="Vote"> @@ -943,9 +1023,9 @@ - <!-- http://ns.softwiki.de/req/Allocated_Requirements --> + <!-- http://ns.softwiki.de/req/ActiveHelpDialog --> - <Requirement rdf:about="Allocated_Requirements"/> + <DesignRequirement rdf:about="ActiveHelpDialog"/> @@ -955,6 +1035,12 @@ + <!-- http://ns.softwiki.de/req/CentralOrganisationOfFinnishTrade --> + + <TradeUnion rdf:about="CentralOrganisationOfFinnishTrade"/> + + + <!-- http://ns.softwiki.de/req/Complete --> <QualityRequirement rdf:about="Complete"/> @@ -973,81 +1059,89 @@ - <!-- http://ns.softwiki.de/req/Creditors --> + <!-- http://ns.softwiki.de/req/DialogSystemShoudRespondInUnder5Sec --> - <Stakeholder rdf:about="Creditors"/> + <PerformanceRequirement rdf:about="DialogSystemShoudRespondInUnder5Sec"/> - <!-- http://ns.softwiki.de/req/Customer_Requirements_ --> + <!-- http://ns.softwiki.de/req/EuropeanTradeUnionConfederation --> - <Requirement rdf:about="Customer_Requirements_"/> + <TradeUnion rdf:about="EuropeanTradeUnionConfederation"/> - <!-- http://ns.softwiki.de/req/Customers --> + <!-- http://ns.softwiki.de/req/Feasible --> - <Stakeholder rdf:about="Customers"/> + <QualityRequirement rdf:about="Feasible"/> - <!-- http://ns.softwiki.de/req/Derived_Requirements --> + <!-- http://ns.softwiki.de/req/GermanGovernment --> - <Requirement rdf:about="Derived_Requirements"/> + <Government rdf:about="GermanGovernment"/> - <!-- http://ns.softwiki.de/req/Design_Requirements --> + <!-- http://ns.softwiki.de/req/Jennifer_Greene --> - <Requirement rdf:about="Design_Requirements"/> + <Author rdf:about="Jennifer_Greene"/> - <!-- http://ns.softwiki.de/req/Feasible --> + <!-- http://ns.softwiki.de/req/Lastenheft --> - <QualityRequirement rdf:about="Feasible"/> + <Document rdf:about="Lastenheft"/> - <!-- http://ns.softwiki.de/req/Functional_Requirements --> + <!-- http://ns.softwiki.de/req/LogEveryUserActivity --> - <Requirement rdf:about="Functional_Requirements"/> + <FunctionalRequirement rdf:about="LogEveryUserActivity"/> - <!-- http://ns.softwiki.de/req/Government --> + <!-- http://ns.softwiki.de/req/Modifiable --> - <Stakeholder rdf:about="Government"/> + <QualityRequirement rdf:about="Modifiable"/> - <!-- http://ns.softwiki.de/req/Jennifer_Greene --> + <!-- http://ns.softwiki.de/req/MultiTabSystem --> - <Author rdf:about="Jennifer_Greene"/> + <DesignRequirement rdf:about="MultiTabSystem"/> - <!-- http://ns.softwiki.de/req/Lastenheft --> + <!-- http://ns.softwiki.de/req/MultiUserSystem --> - <Document rdf:about="Lastenheft"/> + <FunctionalRequirement rdf:about="MultiUserSystem"/> - <!-- http://ns.softwiki.de/req/Modifiable --> + <!-- http://ns.softwiki.de/req/MultiWindowSystem --> - <QualityRequirement rdf:about="Modifiable"/> + <DesignRequirement rdf:about="MultiWindowSystem"/> + <!-- http://ns.softwiki.de/req/MustBeDiscussed --> + + <Comment rdf:about="MustBeDiscussed"> + <comments rdf:resource="UserCanAccessDataFromEveryComputer"/> + </Comment> + + + <!-- http://ns.softwiki.de/req/Necessary --> <QualityRequirement rdf:about="Necessary"/> - <!-- http://ns.softwiki.de/req/Performance_Requirements --> + <!-- http://ns.softwiki.de/req/NotNecessaryRequirment --> - <Requirement rdf:about="Performance_Requirements"/> + <Comment rdf:about="NotNecessaryRequirment"/> @@ -1063,15 +1157,15 @@ - <!-- http://ns.softwiki.de/req/Senior_Management_staff --> + <!-- http://ns.softwiki.de/req/Steve_McConnell --> - <Stakeholder rdf:about="Senior_Management_staff"/> + <Author rdf:about="Steve_McConnell"/> - <!-- http://ns.softwiki.de/req/Steve_McConnell --> + <!-- http://ns.softwiki.de/req/SwedishTradeUnionConfederation --> - <Author rdf:about="Steve_McConnell"/> + <TradeUnion rdf:about="SwedishTradeUnionConfederation"/> @@ -1087,15 +1181,15 @@ - <!-- http://ns.softwiki.de/req/Trade_Unions --> + <!-- http://ns.softwiki.de/req/UML --> - <Stakeholder rdf:about="Trade_Unions"/> + <Document rdf:about="UML"/> - <!-- http://ns.softwiki.de/req/UML --> + <!-- http://ns.softwiki.de/req/USGovernment --> - <Document rdf:about="UML"/> + <Government rdf:about="USGovernment"/> @@ -1105,12 +1199,42 @@ + <!-- http://ns.softwiki.de/req/UseDatabaseToStoreUserData --> + + <CustomerRequirement rdf:about="UseDatabaseToStoreUserData"/> + + + + <!-- http://ns.softwiki.de/req/UseOfIcons --> + + <DesignRequirement rdf:about="UseOfIcons"/> + + + + <!-- http://ns.softwiki.de/req/UsefulRequirement --> + + <Comment rdf:about="UsefulRequirement"/> + + + + <!-- http://ns.softwiki.de/req/UserCanAccessDataFromEveryComputer --> + + <FunctionalRequirement rdf:about="UserCanAccessDataFromEveryComputer"/> + + + <!-- http://ns.softwiki.de/req/Verifiable --> <QualityRequirement rdf:about="Verifiable"/> + <!-- http://ns.softwiki.de/req/WindowDesign --> + + <DesignRequirement rdf:about="WindowDesign"/> + + + <!-- http://ns.softwiki.de/req/calculations --> <FunctionalRequirement rdf:about="calculations"/> @@ -1135,6 +1259,18 @@ + <!-- http://ns.softwiki.de/req/determineCoreRequirements --> + + <Goal rdf:about="determineCoreRequirements"/> + + + + <!-- http://ns.softwiki.de/req/determineSystemRequirements --> + + <Goal rdf:about="determineSystemRequirements"/> + + + <!-- http://ns.softwiki.de/req/important --> <Vote rdf:about="important"/> @@ -1153,6 +1289,18 @@ + <!-- http://ns.softwiki.de/req/loadGUIInUnder2Sec --> + + <PerformanceRequirement rdf:about="loadGUIInUnder2Sec"/> + + + + <!-- http://ns.softwiki.de/req/task --> + + <owl:Thing rdf:about="task"/> + + + <!-- http://ns.softwiki.de/req/technical_details --> <FunctionalRequirement rdf:about="technical_details"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-28 14:12:11
|
Revision: 1526 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1526&view=rev Author: jenslehmann Date: 2008-11-28 14:12:06 +0000 (Fri, 28 Nov 2008) Log Message: ----------- fixed ignore concept bug Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java Added Paths: ----------- trunk/examples/swore/swore.conf Added: trunk/examples/swore/swore.conf =================================================================== --- trunk/examples/swore/swore.conf (rev 0) +++ trunk/examples/swore/swore.conf 2008-11-28 14:12:06 UTC (rev 1526) @@ -0,0 +1,8 @@ +import("swore.rdf"); + +refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/AbstractRequirement" }; +refexamples.ignoredRoles = { "http://ns.softwiki.de/req/broader" }; + ++"http://ns.softwiki.de/req/important" ++"http://ns.softwiki.de/req/very_important" +-"http://ns.softwiki.de/req/Topic" Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-28 12:18:12 UTC (rev 1525) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-28 14:12:06 UTC (rev 1526) @@ -229,7 +229,7 @@ // they are empty) TreeSet<Description> superClasses = new TreeSet<Description>(entry.getValue()); // storage for new super classes - TreeSet<Description> newSuperClasses = new TreeSet<Description>(); + TreeSet<Description> newSuperClasses = new TreeSet<Description>(conceptComparator); while(!superClasses.isEmpty()) { // pick and remove the first element Modified: trunk/src/dl-learner/org/dllearner/utilities/Helper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-11-28 12:18:12 UTC (rev 1525) +++ trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-11-28 14:12:06 UTC (rev 1526) @@ -492,7 +492,7 @@ // concepts case 2: ignore list public static Set<NamedClass> computeConceptsUsingIgnoreList(ReasonerComponent rs, Set<NamedClass> ignoredConcepts) { - Set<NamedClass> concepts = rs.getNamedClasses(); + Set<NamedClass> concepts = new TreeSet<NamedClass>(rs.getNamedClasses()); // Helper.removeUninterestingConcepts(concepts); for (NamedClass ac : ignoredConcepts) { boolean success = concepts.remove(ac); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-28 12:18:15
|
Revision: 1525 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1525&view=rev Author: heeroyuy Date: 2008-11-28 12:18:12 +0000 (Fri, 28 Nov 2008) Log Message: ----------- -added new methods for the dl-learner plugin for protege Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java Modified: trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-11-28 12:13:18 UTC (rev 1524) +++ trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-11-28 12:18:12 UTC (rev 1525) @@ -2,6 +2,8 @@ import java.io.File; import java.net.URI; +import java.util.Iterator; +import java.util.Set; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.OntologyFormat; @@ -9,6 +11,10 @@ import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.InvalidConfigOptionValueException; import org.dllearner.core.owl.KB; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataProperty; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObjectProperty; import org.semanticweb.owl.model.OWLOntology; public class OWLAPIOntology extends KnowledgeSource { @@ -20,6 +26,11 @@ } private OWLOntology ontology; + private Set<OWLOntology> ontologies; + private Set<OWLClass> classes; + private Set<OWLObjectProperty> prop; + private Set<OWLDataProperty> dataProp; + private Set<OWLIndividual> individuals; public OWLAPIOntology() { this(null); @@ -28,6 +39,10 @@ public OWLAPIOntology(OWLOntology onto) { this.ontology = onto; + classes = ontology.getReferencedClasses(); + prop = ontology.getReferencedObjectProperties(); + dataProp = ontology.getReferencedDataProperties(); + individuals = ontology.getReferencedIndividuals(); this.configurator = new OWLAPIOntologyConfigurator(this); } @@ -69,4 +84,45 @@ { return null; } + + public void setOWLOntologies(Set<OWLOntology> onto) { + ontologies = onto; + System.out.println("ONTO: " + ontologies); + Iterator<OWLOntology> it = ontologies.iterator(); + while(it.hasNext()) { + OWLOntology ont = it.next(); + if(ont.getReferencedClasses() != null) { + classes.addAll(ont.getReferencedClasses()); + } + if(ont.getReferencedObjectProperties() != null) { + prop.addAll(ont.getReferencedObjectProperties()); + } + if(ont.getReferencedDataProperties() != null) { + dataProp.addAll(ont.getReferencedDataProperties()); + } + if(ont.getReferencedIndividuals() != null) { + individuals.addAll(ont.getReferencedIndividuals()); + } + } + } + + public Set<OWLOntology> getOWLOnntologies() { + return ontologies; + } + + public Set<OWLClass> getOWLClasses() { + return classes; + } + + public Set<OWLObjectProperty> getOWLObjectProperies() { + return prop; + } + + public Set<OWLDataProperty> getOWLDataProperies() { + return dataProp; + } + + public Set<OWLIndividual> getOWLIndividuals() { + return individuals; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-28 12:13:31
|
Revision: 1524 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1524&view=rev Author: heeroyuy Date: 2008-11-28 12:13:18 +0000 (Fri, 28 Nov 2008) Log Message: ----------- -some bugfixes 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/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-27 11:54:33 UTC (rev 1523) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-28 12:13:18 UTC (rev 1524) @@ -226,8 +226,8 @@ if (desc.equals(eDescription.getDescription() .toManchesterSyntaxString( editorKit.getModelManager() - .getActiveOntology().getURI() - + "#", null))) { + .getActiveOntology().getURI().toString() + , null))) { evaluatedDescription = eDescription; break; @@ -406,12 +406,13 @@ EvaluatedDescription eval = it.next(); while(ont.hasNext()) { String onto = ont.next().getURI().toString(); - System.out.println(eval.getDescription()); if(eval.getDescription().toString().contains(onto)) { if(model.isConsistent(eval)) { - dm.add(0, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); + dm.add(0, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto, null))); + break; } else { - dm.add(0, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); + dm.add(0, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(onto, null))); + break; } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-27 11:54:33 UTC (rev 1523) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-28 12:13:18 UTC (rev 1524) @@ -24,7 +24,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -36,7 +35,6 @@ import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; @@ -58,7 +56,6 @@ import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; -import org.semanticweb.owl.model.OWLIndividual; import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyManager; @@ -85,7 +82,6 @@ "org.dllearner.algorithms.refexamples.ExampleBasedROLComponent", "org.dllearner.algorithms.gp.GP" }; - // Component Manager that manages the components of the DL-Learner private ComponentManager cm; @@ -96,7 +92,7 @@ // The Knowledge source for the reasoner - private KnowledgeSource source; + private OWLAPIOntology source; // The View of the DL-Learner Plugin @@ -187,9 +183,10 @@ // This is necessary to get the details of the suggested concept private JXTaskPane detailPane; - private Map<String, String> prefixes; private DefaultListModel posListModel; private DefaultListModel negListModel; + private boolean hasIndividuals; + private NamedClass currentConcept; private Vector<IndividualObject> individualVector; // This is a List of evaluated descriptions to get more information of the @@ -236,7 +233,6 @@ alreadyLearned = false; setKnowledgeSource(); setReasoner(); - prefixes = reasoner.getPrefixes(); } @@ -249,11 +245,14 @@ negativeExamples = new TreeSet<String>(); for (int i = 0; i < individualVector.size(); i++) { if (individualVector.get(i).isPositiveExample()) { - positiveExamples.add(individualVector.get(i).getIndividualString()); + positiveExamples.add(individualVector.get(i) + .getIndividualString()); } else { - negativeExamples.add(individualVector.get(i).getIndividualString()); + negativeExamples.add(individualVector.get(i) + .getIndividualString()); } } + System.out.println("TEST: " + positiveExamples); } /** @@ -291,6 +290,8 @@ public void setKnowledgeSource() { this.source = new OWLAPIOntology(editor.getModelManager() .getActiveOntology()); + source.setOWLOntologies(editor.getModelManager().getActiveOntologies()); + } /** @@ -306,7 +307,7 @@ System.out.println("fehler!!!!!!!!!"); e.printStackTrace(); } -// rs = cm.reasoningService(reasoner); + // rs = cm.reasoningService(reasoner); } /** @@ -348,7 +349,9 @@ // TODO Auto-generated catch block e.printStackTrace(); } - cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view.getPosAndNegSelectPanel().getOptionPanel().getMaxExecutionTime()); + cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view + .getPosAndNegSelectPanel().getOptionPanel() + .getMaxExecutionTime()); try { // initializes the learning algorithm la.init(); @@ -366,17 +369,8 @@ String message = "To view details about why a class description was suggested, please doubleclick on it."; // start the algorithm and print the best concept found la.start(); - //description = new Description[la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts()) - // .size()]; - //addToListModel(); - // renders the errormessage view.renderErrorMessage(error); view.setHintMessage(message); - // reenables the run button - //view.getRunButton().setEnabled(true); - // disables the cancel button - //view.getPosAndNegSelectPanel().setCheckBoxesEnable(true); - //view.getSuggestClassPanel().setSuggestList(suggestModel); } /** @@ -404,37 +398,40 @@ */ public void setPosVector() { setPositiveConcept(); - Set<OWLIndividual> individual = editor.getModelManager().getActiveOntology().getReferencedIndividuals(); - Iterator<OWLIndividual> it = individual.iterator(); - while (it.hasNext()) { - OWLIndividual individum = it.next(); - String individuals = individum.toString(); - if (setPositivExamplesChecked(individuals)) { - // when yes then it sets the positive example checked - posListModel.add(0, individuals); - - } else { - // When no it unchecks the positive example - negListModel.add(0, individuals); - } - } SortedSet<Individual> reasonerIndi = reasoner.getIndividuals(); Iterator<Individual> reasonerIt = reasonerIndi.iterator(); - while(reasonerIt.hasNext()) { + while (reasonerIt.hasNext()) { Individual ind = reasonerIt.next(); - - String indiv = ind.toString(); - // checks if individual belongs to the selected concept - if (setPositivExamplesChecked(indiv)) { - // when yes then it sets the positive example checked - individualVector.add(new IndividualObject(indiv, true)); + Iterator<OWLOntology> onto = editor.getModelManager() + .getActiveOntologies().iterator(); + while (onto.hasNext()) { + OWLOntology ont = onto.next(); + String indiv = ind.toString(); + // checks if individual belongs to the selected concept + if (setPositivExamplesChecked(indiv)) { + if (indiv.contains(ont.getURI().toString())) { + // when yes then it sets the positive example checked + + //OWLExpressionCheckerFactory + posListModel.add(0, ind.toManchesterSyntaxString(ont + .getURI().toString(), null)); + individualVector.add(new IndividualObject(indiv, true)); + break; + } - } else { - // When no it unchecks the positive example - individualVector.add(new IndividualObject(indiv, false)); + } else { + // When no it unchecks the positive example + if (indiv.contains(ont.getURI().toString())) { + individualVector + .add(new IndividualObject(indiv, false)); + negListModel.add(0, ind.toManchesterSyntaxString(ont + .getURI().toString(), null)); + break; + } + } } } - + } /** @@ -443,39 +440,45 @@ public void unsetNewConcepts() { while (owlDescription.iterator().hasNext()) { owlDescription.remove(owlDescription.iterator().next()); - + } } - + /** * This method returns the Vector of IndividualObjects. + * * @return individualVector Vector */ public Vector<IndividualObject> getIndividualVector() { return individualVector; } + /** * This method sets the individuals that belong to the concept which is * chosen in protege. */ public void setPositiveConcept() { SortedSet<Individual> individuals = null; - //System.out.println("TEST: " + rs.getNamedClasses()); + hasIndividuals = false; // checks if selected concept is thing when yes then it selects all // individuals if (!current.getRootObject().toString().equals("Thing")) { - - for (Iterator<NamedClass> i = reasoner.getAtomicConceptsList().iterator(); i - .hasNext();) { + + for (Iterator<NamedClass> i = reasoner.getAtomicConceptsList() + .iterator(); i.hasNext();) { // if individuals is null if (individuals == null) { NamedClass concept = i.next(); // checks if the concept is the selected concept in protege if (concept.toString().endsWith( - "#" + current.getRootObject().toString())) { + current.getRootObject().toString())) { // if individuals is not null it gets all individuals of // the concept + currentConcept = concept; if (reasoner.getIndividuals(concept) != null) { + if (reasoner.getIndividuals(concept).size() > 0) { + hasIndividuals = true; + } individual = reasoner.getIndividuals(concept); break; } @@ -483,44 +486,24 @@ } } } else { + if (reasoner.getIndividuals().size() > 0) { + hasIndividuals = true; + } individual = reasoner.getIndividuals(); } } - + /** * This Method checks if the selected class has any individuals. - * @param owlConcept OWLClass + * + * @param owlConcept + * OWLClass * @return boolean hasIndividuals */ - public boolean hasIndividuals(OWLClass owlConcept) { - boolean hasIndividuals = false; - NamedClass concept = null; - NamedClass selectedConcept = null; - Iterator<NamedClass> it = reasoner.getNamedClasses().iterator(); - while(it.hasNext()) { - concept = it.next(); - Iterator<OWLOntology> onto = editor.getModelManager().getActiveOntologies().iterator(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if (concept.toString().contains(uri)) { - if (concept.toManchesterSyntaxString(uri+"#", prefixes).equals(owlConcept.toString())) { - selectedConcept = concept; - break; - } - } - - } - - } - if(selectedConcept != null) { - if (reasoner.getIndividuals(selectedConcept).size() > 0) { - hasIndividuals = true; - } - } - concept = null; - selectedConcept = null; + public boolean hasIndividuals() { return hasIndividuals; } + /** * This method gets an Individual and checks if this individual belongs to * the concept chosen in protege. @@ -564,22 +547,25 @@ public void setDescriptionList(Description[] list) { description = list; } - + /** * This method returns the PosListModel. + * * @return DefaultListModel posListModel */ public DefaultListModel getPosListModel() { return posListModel; } - + /** * This method returns the NegListModel. + * * @return DefaultListModel negListModel */ public DefaultListModel getNegListModel() { return negListModel; } + /** * This method returns the current learning algorithm that is used to learn * new concepts. @@ -686,34 +672,25 @@ return suggestModel; } - /** + /* * This method gets the old concept from checking the positive examples. + * + * private void setOldConceptOWLAPI() { // gets all individuals + * SortedSet<Individual> indi = reasoner.getIndividuals(); // Iterator of + * Individuals for (Iterator<Individual> i = indi.iterator(); i.hasNext();) + * { Individual indi2 = i.next(); // checks if the current individual + * belongs to positive examples if (positiveExamples != null) { if + * (positiveExamples.toString().contains(indi2.toString())) { // if yes then + * get the concepts of this individuals Set<NamedClass> concept = + * reasoner.getTypes(indi2); // adds all concepts to old concept OWLAPI for + * (Iterator<NamedClass> k = concept.iterator(); k .hasNext();) { + * OWLDescription oldOWLAPI = OWLAPIDescriptionConvertVisitor + * .getOWLDescription(k.next()); oldConceptOWLAPI = oldOWLAPI; + * ds.add(oldOWLAPI); } + * + * } } } } */ - private void setOldConceptOWLAPI() { - // gets all individuals - SortedSet<Individual> indi = reasoner.getIndividuals(); - // Iterator of Individuals - for (Iterator<Individual> i = indi.iterator(); i.hasNext();) { - Individual indi2 = i.next(); - // checks if the current individual belongs to positive examples - if (positiveExamples != null) { - if (positiveExamples.toString().contains(indi2.toString())) { - // if yes then get the concepts of this individuals - Set<NamedClass> concept = reasoner.getTypes(indi2); - // adds all concepts to old concept OWLAPI - for (Iterator<NamedClass> k = concept.iterator(); k - .hasNext();) { - OWLDescription oldOWLAPI = OWLAPIDescriptionConvertVisitor - .getOWLDescription(k.next()); - oldConceptOWLAPI = oldOWLAPI; - ds.add(oldOWLAPI); - } - } - } - } - } - /** * This method stores the new concept learned by the DL-Learner in the * Ontology. @@ -724,7 +701,10 @@ public void changeDLLearnerDescriptionsToOWLDescriptions( Description descript) { setNewConceptOWLAPI(descript); - setOldConceptOWLAPI(); + // setOldConceptOWLAPI(); + oldConceptOWLAPI = OWLAPIDescriptionConvertVisitor + .getOWLDescription(currentConcept); + ds.add(oldConceptOWLAPI); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); @@ -763,11 +743,13 @@ public boolean getAlreadyLearned() { return alreadyLearned; } - + /** - * This Method checks if after inserting of this concept the ontology is still - * consistent. - * @param eDescription EvauatedDescription + * 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) { @@ -788,15 +770,17 @@ public URI getURI() { return editor.getModelManager().getActiveOntology().getURI(); } - + /** * This method sets the suggestion list. - * @param list List(EvaluatedDescription) + * + * @param list + * List(EvaluatedDescription) */ public void setSuggestList(List<EvaluatedDescription> list) { evalDescriptions = list; } - + public OWLEditorKit getOWLEditorKit() { return editor; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-27 11:54:33 UTC (rev 1523) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-28 12:13:18 UTC (rev 1524) @@ -139,6 +139,7 @@ * @param desc selected description */ public void renderDetailPanel(EvaluatedDescription desc) { + unsetEverything(); posCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); posCoveredScroll.setBounds(5, 150, 280, 140); posNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); @@ -228,15 +229,19 @@ add(negNotCoveredScroll); detailPopup.add(this); } + + private void unsetEverything() { + removeAll(); + } /** * This method sets the Informations of the selected description. */ private void setInformation() { if(eval!=null) { //sets the accuracy of the selected concept - conceptText.append(eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null)); + conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString(), null)); double acc = (eval.getAccuracy())*100; - accuracyText.append(String.valueOf(acc)+"%"); + accuracyText.setText(String.valueOf(acc)+"%"); Iterator<Individual> i = eval.getCoveredPositives().iterator(); while (i.hasNext()) { Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); @@ -244,7 +249,7 @@ while (onto.hasNext()) { String uri = onto.next().getURI().toString(); if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); posLabel.setForeground(colorGreen); posCoveredPanel.add(posLabel); } @@ -260,7 +265,7 @@ while (onto.hasNext()) { String uri = onto.next().getURI().toString(); if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); posLabel.setForeground(colorRed); posNotCoveredPanel.add(posLabel); } @@ -278,7 +283,7 @@ while (onto.hasNext()) { String uri = onto.next().getURI().toString(); if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); posLabel.setForeground(colorRed); negCoveredPanel.add(posLabel); } @@ -295,7 +300,7 @@ while (onto.hasNext()) { String uri = onto.next().getURI().toString(); if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); posLabel.setForeground(colorGreen); negNotCoveredPanel.add(posLabel); } @@ -304,5 +309,5 @@ } } - } + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-27 11:54:33 UTC (rev 1523) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-28 12:13:18 UTC (rev 1524) @@ -384,7 +384,6 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - run = new JButton("Suggest " + label); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); @@ -439,7 +438,7 @@ model.initReasoner(); model.setPosVector(); hint.setVisible(true); - if (model.hasIndividuals(frame.getRootObject())) { + if (model.hasIndividuals()) { run.setEnabled(true); } else { run.setEnabled(false); @@ -604,7 +603,7 @@ posPanel.removeListeners(action); posPanel.removeHelpButtonListener(action); } - + /** * Adds Actionlistener to the run button. * @param a ActionListener Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-11-27 11:54:33 UTC (rev 1523) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-11-28 12:13:18 UTC (rev 1524) @@ -63,6 +63,10 @@ if (action.getActionCommand().equals("pos")) { panel.setExampleToOtherList(true, panel.getNegExampleList().getSelectedValue().toString()); + System.out.println("COUNT: " + panel.getPosExampleList().getModel().getSize()); + if(panel.getPosExampleList().getModel().getSize()>0) { + view.getRunButton().setEnabled(true); + } } if (action.getActionCommand().equals("neg")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-27 11:54:40
|
Revision: 1523 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1523&view=rev Author: jenslehmann Date: 2008-11-27 11:54:33 +0000 (Thu, 27 Nov 2008) Log Message: ----------- fixed bug when learning on SWORE ontology Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java trunk/src/music-recommender/DLLearnerConnection.php Added Paths: ----------- trunk/examples/swore/ trunk/examples/swore/swore.rdf trunk/src/dl-learner/org/dllearner/test/SworeTest.java Added: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf (rev 0) +++ trunk/examples/swore/swore.rdf 2008-11-27 11:54:33 UTC (rev 1523) @@ -0,0 +1,1224 @@ +<?xml version="1.0"?> + + +<!DOCTYPE rdf:RDF [ + <!ENTITY dct "http://purl.org/dc/terms/" > + <!ENTITY req "http://ns.softwiki.de/req/" > + <!ENTITY foaf "http://xmlns.com/foaf/0.1/" > + <!ENTITY dcmitype "http://purl.org/dc/dcmitype/" > + <!ENTITY owl "http://www.w3.org/2002/07/owl#" > + <!ENTITY swrl "http://www.w3.org/2003/11/swrl#" > + <!ENTITY dc "http://purl.org/dc/elements/1.1/" > + <!ENTITY swrlb "http://www.w3.org/2003/11/swrlb#" > + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" > + <!ENTITY foaf2 "http://www.holygoat.co.uk/foaf.rdf#" > + <!ENTITY p1 "http://www.w3.org/2004/02/skos/core#" > + <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > + <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > + <!ENTITY tags "http://www.holygoat.co.uk/owl/redwood/0.1/tags/" > + <!ENTITY protege "http://protege.stanford.edu/plugins/owl/protege#" > + <!ENTITY xsp "http://www.owl-ontologies.com/2005/08/07/xsp.owl#" > +]> + + +<rdf:RDF xmlns="http://ns.softwiki.de/req/" + xml:base="http://ns.softwiki.de/req/" + xmlns:tags="http://www.holygoat.co.uk/owl/redwood/0.1/tags/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:foaf2="http://www.holygoat.co.uk/foaf.rdf#" + xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#" + xmlns:p1="http://www.w3.org/2004/02/skos/core#" + xmlns:dcmitype="http://purl.org/dc/dcmitype/" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:swrl="http://www.w3.org/2003/11/swrl#" + xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#" + xmlns:dct="http://purl.org/dc/terms/" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:swrlb="http://www.w3.org/2003/11/swrlb#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:req="http://ns.softwiki.de/req/"> + <owl:Ontology rdf:about=""> + <rdfs:label rdf:datatype="&xsd;string" + >SoftWiki Ontology for Requirements Engineering</rdfs:label> + <rdfs:comment rdf:datatype="&xsd;string" + >A requirements engineering ontology for the SoftWiki project.</rdfs:comment> + <dc:contributor rdf:datatype="&xsd;string">Jens Lehmann</dc:contributor> + <dc:contributor rdf:datatype="&xsd;string" + >Sebastian Dietzold</dc:contributor> + <owl:versionInfo rdf:datatype="&xsd;string" + >version 1.00 - Thomas Riechert, Steffen Lohmann, Kim Lauenroth, Philipp Heim - starting the next generation of SWORE on 8th of July 2008 in Duisburg +version 0.8 - Sebastian Dietzold - skos, tags and dc alignment (title now functional) +version 0.7 - Sebastian Dietzold - labels completed and namespace correction +version 0.6 - name space changed to ns.softwiki.de/req +version 0.5 - refined by Thomas according to ESWC Poster submission +version 0.4 - refined by Jens on the way home from Essen +version 0.3 - refined by Jens during discussion with Kim and Steffen on 13 March 2007 in Essen +version 0.2 - refined by Thomas and Jens in the evening of 12 March 2007 in Essen +version 0.1 - simple initial version by Thomas and Jens before meeting in Essen</owl:versionInfo> + <owl:imports rdf:resource="http://www.holygoat.co.uk/owl/redwood/0.1/tags/"/> + </owl:Ontology> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Annotation properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + <owl:AnnotationProperty rdf:about="&rdfs;comment"> + <rdfs:label rdf:datatype="&xsd;string">comment</rdfs:label> + </owl:AnnotationProperty> + <owl:AnnotationProperty rdf:about="&owl;versionInfo"> + <rdfs:label rdf:datatype="&xsd;string">version info</rdfs:label> + </owl:AnnotationProperty> + <owl:AnnotationProperty rdf:about="&rdfs;label"/> + <owl:AnnotationProperty rdf:about="&dc;contributor"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://ns.softwiki.de/req/broader --> + + <owl:ObjectProperty rdf:about="broader"/> + + + + <!-- http://ns.softwiki.de/req/comments --> + + <owl:ObjectProperty rdf:about="comments"> + <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/> + <rdfs:domain rdf:resource="AbstractComment"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/conflicts --> + + <owl:ObjectProperty rdf:about="conflicts"> + <rdf:type rdf:resource="&owl;SymmetricProperty"/> + <owl:inverseOf rdf:resource="conflicts"/> + <rdfs:subPropertyOf rdf:resource="undirectedrelation"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/cui --> + + <owl:ObjectProperty rdf:about="cui"/> + + + + <!-- http://ns.softwiki.de/req/defines --> + + <owl:ObjectProperty rdf:about="defines"> + <rdfs:label rdf:datatype="&xsd;string">defines</rdfs:label> + <rdfs:domain rdf:resource="Author"/> + <rdfs:range> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="AbstractComment"/> + <rdf:Description rdf:about="AbstractRequirement"/> + <rdf:Description rdf:about="Keyword"/> + </owl:unionOf> + </owl:Class> + </rdfs:range> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/depentsOn --> + + <owl:ObjectProperty rdf:about="depentsOn"> + <rdfs:range rdf:resource="AbstractRequirement"/> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <owl:inverseOf rdf:resource="entails"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/details --> + + <owl:ObjectProperty rdf:about="details"> + <rdfs:label rdf:datatype="&xsd;string">details</rdfs:label> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/documentation --> + + <owl:ObjectProperty rdf:about="documentation"/> + + + + <!-- http://ns.softwiki.de/req/entails --> + + <owl:ObjectProperty rdf:about="entails"> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/invalidates --> + + <owl:ObjectProperty rdf:about="invalidates"> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isCommentedBy --> + + <owl:ObjectProperty rdf:about="isCommentedBy"> + <rdfs:range rdf:resource="AbstractComment"/> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <owl:inverseOf rdf:resource="comments"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isDefinedBy --> + + <owl:ObjectProperty rdf:about="isDefinedBy"> + <rdfs:label rdf:datatype="&xsd;string">defined by</rdfs:label> + <rdfs:range rdf:resource="Author"/> + <owl:inverseOf rdf:resource="defines"/> + <rdfs:domain> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="AbstractComment"/> + <rdf:Description rdf:about="AbstractRequirement"/> + <rdf:Description rdf:about="Keyword"/> + </owl:unionOf> + </owl:Class> + </rdfs:domain> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isDetailedBy --> + + <owl:ObjectProperty rdf:about="isDetailedBy"> + <rdfs:label rdf:datatype="&xsd;string">detailed by</rdfs:label> + <rdfs:range rdf:resource="AbstractRequirement"/> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <owl:inverseOf rdf:resource="details"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isInvalidFor --> + + <owl:ObjectProperty rdf:about="isInvalidFor"> + <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <owl:inverseOf rdf:resource="invalidates"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isLeadingTo --> + + <owl:ObjectProperty rdf:about="isLeadingTo"> + <rdfs:label rdf:datatype="&xsd;string">lead to</rdfs:label> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="AbstractSource"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isRedundant --> + + <owl:ObjectProperty rdf:about="isRedundant"> + <rdf:type rdf:resource="&owl;SymmetricProperty"/> + <owl:inverseOf rdf:resource="isRedundant"/> + <rdfs:subPropertyOf rdf:resource="undirectedrelation"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isRelated --> + + <owl:ObjectProperty rdf:about="isRelated"> + <rdf:type rdf:resource="&owl;SymmetricProperty"/> + <owl:inverseOf rdf:resource="isRelated"/> + <rdfs:subPropertyOf rdf:resource="undirectedrelation"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/isSimilarTo --> + + <owl:ObjectProperty rdf:about="isSimilarTo"> + <rdf:type rdf:resource="&owl;SymmetricProperty"/> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + <owl:inverseOf rdf:resource="isSimilarTo"/> + <rdfs:subPropertyOf rdf:resource="undirectedrelation"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/leadsTo --> + + <owl:ObjectProperty rdf:about="leadsTo"> + <rdfs:label rdf:datatype="&xsd;string">leads to</rdfs:label> + <rdfs:range rdf:resource="AbstractRequirement"/> + <rdfs:domain rdf:resource="AbstractSource"/> + <owl:inverseOf rdf:resource="isLeadingTo"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/refersTo --> + + <owl:ObjectProperty rdf:about="refersTo"> + <rdfs:label rdf:datatype="&xsd;string">refers to</rdfs:label> + <rdfs:comment xml:lang="de" + >Relevanter Aspekt eines geplantes Systems (ähnlich zu Tagging).</rdfs:comment> + <rdfs:range rdf:resource="AbstractReferencePoint"/> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <owl:inverseOf rdf:resource="relevantRequirements"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/relevantRequirements --> + + <owl:ObjectProperty rdf:about="relevantRequirements"> + <rdfs:label rdf:datatype="&xsd;string" + >relevant requirements</rdfs:label> + <rdfs:domain rdf:resource="AbstractReferencePoint"/> + <rdfs:range rdf:resource="AbstractRequirement"/> + </owl:ObjectProperty> + + + + <!-- http://ns.softwiki.de/req/undirectedrelation --> + + <owl:ObjectProperty rdf:about="undirectedrelation"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> + <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/> + <rdf:type rdf:resource="&owl;SymmetricProperty"/> + <rdfs:comment rdf:datatype="&xsd;string" + >Rule: only one ration between the same pair of two requirements allowed.</rdfs:comment> + <owl:inverseOf rdf:resource="undirectedrelation"/> + </owl:ObjectProperty> + + + + <!-- http://purl.org/dc/elements/1.1/title --> + + <owl:ObjectProperty rdf:about="&dc;title"> + <rdf:type rdf:resource="&owl;Class"/> + <owl:objectPropertyDomain rdf:resource="&dc;title"/> + <owl:objectPropertyRange rdf:resource="&xsd;string"/> + </owl:ObjectProperty> + + + + <!-- http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag --> + + <owl:ObjectProperty rdf:about="&tags;taggedWithTag"> + <rdfs:label xml:lang="de">Tags</rdfs:label> + </owl:ObjectProperty> + + + + <!-- http://www.w3.org/2000/01/rdf-schema#label --> + + <owl:ObjectProperty rdf:about="&rdfs;label"> + <rdf:type rdf:resource="&owl;AnnotationProperty"/> + <rdfs:label rdf:datatype="&xsd;string">label</rdfs:label> + </owl:ObjectProperty> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Data properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://ns.softwiki.de/req/averagePriorityRate --> + + <owl:DatatypeProperty rdf:about="averagePriorityRate"> + <rdfs:subPropertyOf rdf:resource="averageRate"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/averageQualityRate --> + + <owl:DatatypeProperty rdf:about="averageQualityRate"> + <rdfs:subPropertyOf rdf:resource="averageRate"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/averageRate --> + + <owl:DatatypeProperty rdf:about="averageRate"> + <rdfs:comment rdf:datatype="&xsd;string" + >Is calculated by given rates.</rdfs:comment> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="&xsd;float"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/changeDate --> + + <owl:DatatypeProperty rdf:about="changeDate"> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="&xsd;dateTime"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/creationDate --> + + <owl:DatatypeProperty rdf:about="creationDate"> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range rdf:resource="&xsd;dateTime"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/definition --> + + <owl:DatatypeProperty rdf:about="definition"> + <rdfs:domain rdf:resource="DefinedKeyword"/> + <rdfs:range rdf:resource="&xsd;string"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/rate --> + + <owl:DatatypeProperty rdf:about="rate"> + <rdfs:domain rdf:resource="Rating"/> + <rdfs:range rdf:resource="&xsd;float"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/rational --> + + <owl:DatatypeProperty rdf:about="rational"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> + <rdfs:label rdf:datatype="&xsd;string">rational</rdfs:label> + <rdfs:range rdf:resource="&xsd;string"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/result --> + + <owl:DatatypeProperty rdf:about="result"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> + <rdfs:label rdf:datatype="&xsd;string">result</rdfs:label> + <rdfs:comment xml:lang="de" + >z.B. Veränderung von priority und agreement</rdfs:comment> + <rdfs:range rdf:resource="&xsd;string"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/role --> + + <owl:DatatypeProperty rdf:about="role"> + <rdfs:domain rdf:resource="Author"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/scenarioStep --> + + <owl:DatatypeProperty rdf:about="scenarioStep"> + <rdfs:label rdf:datatype="&xsd;string">scenario step</rdfs:label> + <rdfs:comment rdf:datatype="&xsd;string"></rdfs:comment> + <owl:versionInfo rdf:datatype="&xsd;string" + >TODO: es muss eine konkrete Reihenfolge der Steps gegeben sein (Listenstruktur)</owl:versionInfo> + <rdfs:domain rdf:resource="TextualScenario"/> + <rdfs:range rdf:resource="&xsd;string"/> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/state --> + + <owl:DatatypeProperty rdf:about="state"> + <rdfs:domain rdf:resource="AbstractRequirement"/> + <rdfs:range> + <rdf:Description> + <rdf:type rdf:resource="&owl;DataRange"/> + <owl:oneOf> + <rdf:Description> + <rdf:type rdf:resource="&rdf;List"/> + <rdf:first rdf:datatype="&xsd;string" + >isNegativDecided</rdf:first> + <rdf:rest> + <rdf:Description> + <rdf:type rdf:resource="&rdf;List"/> + <rdf:first rdf:datatype="&xsd;string">isPositvDecided</rdf:first> + <rdf:rest rdf:resource="&rdf;nil"/> + </rdf:Description> + </rdf:rest> + </rdf:Description> + </owl:oneOf> + </rdf:Description> + </rdfs:range> + </owl:DatatypeProperty> + + + + <!-- http://ns.softwiki.de/req/voteTime --> + + <owl:DatatypeProperty rdf:about="voteTime"> + <rdfs:label rdf:datatype="&xsd;string">vote time</rdfs:label> + <rdfs:domain rdf:resource="Vote"/> + <rdfs:range rdf:resource="&xsd;dateTime"/> + </owl:DatatypeProperty> + + + + <!-- http://purl.org/dc/elements/1.1/description --> + + <owl:DatatypeProperty rdf:about="&dc;description"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> + <rdfs:label rdf:datatype="&xsd;string">description</rdfs:label> + <rdfs:label xml:lang="de">Beschreibung</rdfs:label> + <rdfs:range rdf:resource="&xsd;string"/> + <rdfs:domain> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <rdf:Description rdf:about="Goal"/> + <rdf:Description rdf:about="Requirement"/> + </owl:unionOf> + </owl:Class> + </rdfs:domain> + </owl:DatatypeProperty> + + + + <!-- http://purl.org/dc/elements/1.1/title --> + + <owl:DatatypeProperty rdf:about="&dc;title"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Classes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://ns.softwiki.de/req/AbstractComment --> + + <owl:Class rdf:about="AbstractComment"/> + + + + <!-- http://ns.softwiki.de/req/AbstractReferencePoint --> + + <owl:Class rdf:about="AbstractReferencePoint"> + <rdfs:label rdf:datatype="&xsd;string">reference point</rdfs:label> + <owl:disjointWith rdf:resource="AbstractRequirement"/> + <owl:disjointWith rdf:resource="AbstractSource"/> + <owl:disjointWith rdf:resource="Author"/> + <owl:disjointWith rdf:resource="Vote"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/AbstractRequirement --> + + <owl:Class rdf:about="AbstractRequirement"> + <rdfs:label rdf:datatype="&xsd;string" + >abstract requirement</rdfs:label> + <rdfs:label xml:lang="de" + >abstraktes Requirement</rdfs:label> + <owl:disjointWith rdf:resource="AbstractSource"/> + <owl:disjointWith rdf:resource="Author"/> + <owl:disjointWith rdf:resource="Vote"/> + <rdfs:comment rdf:datatype="&xsd;string" + >Es ist ungünstig, dass Requirement Subklasse von AbstractRequirement ist.</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/AbstractSource --> + + <owl:Class rdf:about="AbstractSource"> + <rdfs:label rdf:datatype="&xsd;string">abstract source</rdfs:label> + <owl:disjointWith rdf:resource="Vote"/> + <rdfs:comment rdf:datatype="&xsd;string"></rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/ApplicationPointer --> + + <owl:Class rdf:about="ApplicationPointer"> + <rdfs:subClassOf rdf:resource="AbstractReferencePoint"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/ApplicationState --> + + <owl:Class rdf:about="ApplicationState"> + <rdfs:subClassOf rdf:resource="AbstractReferencePoint"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Author --> + + <owl:Class rdf:about="Author"> + <rdfs:label xml:lang="de">Autor</rdfs:label> + <rdfs:label xml:lang="en">author</rdfs:label> + <rdfs:subClassOf rdf:resource="Stakeholder"/> + <owl:disjointWith rdf:resource="Vote"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Comment --> + + <owl:Class rdf:about="Comment"> + <rdfs:subClassOf rdf:resource="AbstractComment"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/DefinedKeyword --> + + <owl:Class rdf:about="DefinedKeyword"> + <rdfs:subClassOf rdf:resource="Keyword"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Document --> + + <owl:Class rdf:about="Document"> + <rdfs:subClassOf rdf:resource="AbstractSource"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/FunctionalRequirement --> + + <owl:Class rdf:about="FunctionalRequirement"> + <rdfs:label rdf:datatype="&xsd;string" + >functional requirement</rdfs:label> + <rdfs:subClassOf rdf:resource="Requirement"/> + <owl:disjointWith rdf:resource="QualityRequirement"/> + <rdfs:comment rdf:datatype="&xsd;string" + >refers to functional reference point, for instance components of the system</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Goal --> + + <owl:Class rdf:about="Goal"> + <rdfs:label rdf:datatype="&xsd;string">goal</rdfs:label> + <rdfs:label xml:lang="de">Ziel</rdfs:label> + <rdfs:subClassOf rdf:resource="AbstractRequirement"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="&dc;description"/> + <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + </rdfs:subClassOf> + <owl:disjointWith rdf:resource="Requirement"/> + <owl:disjointWith rdf:resource="Scenario"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Keyword --> + + <owl:Class rdf:about="Keyword"> + <rdfs:subClassOf rdf:resource="AbstractReferencePoint"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/PriorityRating --> + + <owl:Class rdf:about="PriorityRating"> + <rdfs:subClassOf rdf:resource="Rating"/> + <rdfs:comment rdf:datatype="&xsd;string" + >Rule: Every Author only defines at most one rating about the priority for each requirement.</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/QualityRating --> + + <owl:Class rdf:about="QualityRating"> + <rdfs:subClassOf rdf:resource="Rating"/> + <rdfs:comment rdf:datatype="&xsd;string" + >Rule: Every Author only defines at most one rating about the quality for each requirement.</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/QualityRequirement --> + + <owl:Class rdf:about="QualityRequirement"> + <rdfs:label rdf:datatype="&xsd;string" + >QualityRequirement</rdfs:label> + <rdfs:subClassOf rdf:resource="Requirement"/> + <rdfs:comment rdf:datatype="&xsd;string" + >refers to quality reference point, e.g. reliability, performance, usability</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Rating --> + + <owl:Class rdf:about="Rating"> + <rdfs:subClassOf rdf:resource="AbstractComment"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Requirement --> + + <owl:Class rdf:about="Requirement"> + <rdfs:label rdf:datatype="&xsd;string">requirement</rdfs:label> + <rdfs:label xml:lang="de">Anforderung(en)</rdfs:label> + <rdfs:subClassOf rdf:resource="AbstractRequirement"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="&dc;description"/> + <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="&dc;title"/> + <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + </rdfs:subClassOf> + <owl:disjointWith rdf:resource="Scenario"/> + <rdfs:comment rdf:datatype="&xsd;string"></rdfs:comment> + <owl:versionInfo rdf:datatype="&xsd;string" + >TODO: semantische Verfeinerung geplant, d.h. Anforderungen nicht nur als Textstring, sondern z.B. als RDF-Triple formulieren</owl:versionInfo> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Scenario --> + + <owl:Class rdf:about="Scenario"> + <rdfs:label rdf:datatype="&xsd;string">scenario</rdfs:label> + <rdfs:subClassOf rdf:resource="AbstractRequirement"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Stakeholder --> + + <owl:Class rdf:about="Stakeholder"> + <rdfs:subClassOf rdf:resource="AbstractSource"/> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/TextualScenario --> + + <owl:Class rdf:about="TextualScenario"> + <rdfs:label rdf:datatype="&xsd;string" + >textual scenario</rdfs:label> + <rdfs:subClassOf rdf:resource="Scenario"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="scenarioStep"/> + <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:comment xml:lang="de" + >Szenario, welches aus mehreren textuell beschriebenen Szenarioschritten besteht.</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Topic --> + + <owl:Class rdf:about="Topic"> + <rdfs:subClassOf rdf:resource="DefinedKeyword"/> + <rdfs:comment rdf:datatype="&xsd;string" + >Rule: Every Requirement refers to exact one topic.</rdfs:comment> + </owl:Class> + + + + <!-- http://ns.softwiki.de/req/Vote --> + + <owl:Class rdf:about="Vote"> + <rdfs:label rdf:datatype="&xsd;string">vote</rdfs:label> + <rdfs:subClassOf rdf:resource="AbstractComment"/> + <rdfs:comment rdf:datatype="&xsd;string" + >Rule: Every Author only votes at most one requirement.</rdfs:comment> + </owl:Class> + + + + <!-- http://purl.org/dc/dcmitype/Image --> + + <owl:Class rdf:about="&dcmitype;Image"/> + + + + <!-- http://purl.org/dc/elements/1.1/title --> + + <owl:Class rdf:about="&dc;title"> + <rdfs:label rdf:datatype="&xsd;string">title</rdfs:label> + <rdfs:label xml:lang="de">Titel</rdfs:label> + </owl:Class> + + + + <!-- http://www.w3.org/2000/01/rdf-schema#Resource --> + + <owl:Class rdf:about="&rdfs;Resource"/> + + + + <!-- http://www.w3.org/2001/XMLSchema#string --> + + <owl:Class rdf:about="&xsd;string"> + <rdfs:label rdf:datatype="&xsd;string">string</rdfs:label> + </owl:Class> + + + + <!-- http://www.w3.org/2002/07/owl#Thing --> + + <owl:Class rdf:about="&owl;Thing"/> + + + + <!-- http://www.w3.org/2004/02/skos/core#Concept --> + + <owl:Class rdf:about="&p1;Concept"> + <rdfs:label xml:lang="de">Thema</rdfs:label> + </owl:Class> + + + + <!-- http://xmlns.com/foaf/0.1/Document --> + + <owl:Class rdf:about="&foaf;Document"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Individuals + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://ns.softwiki.de/req/1 --> + + <Rating rdf:about="1"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="QualityRating"/> + </Rating> + + + + <!-- http://ns.softwiki.de/req/2 --> + + <Rating rdf:about="2"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="QualityRating"/> + </Rating> + + + + <!-- http://ns.softwiki.de/req/3 --> + + <PriorityRating rdf:about="3"> + <rdf:type rdf:resource="QualityRating"/> + <rdf:type rdf:resource="Rating"/> + </PriorityRating> + + + + <!-- http://ns.softwiki.de/req/4 --> + + <Rating rdf:about="4"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="QualityRating"/> + </Rating> + + + + <!-- http://ns.softwiki.de/req/5 --> + + <Rating rdf:about="5"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="QualityRating"/> + </Rating> + + + + <!-- http://ns.softwiki.de/req/6 --> + + <Rating rdf:about="6"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="QualityRating"/> + </Rating> + + + + <!-- http://ns.softwiki.de/req/7 --> + + <PriorityRating rdf:about="7"> + <rdf:type rdf:resource="QualityRating"/> + <rdf:type rdf:resource="Rating"/> + </PriorityRating> + + + + <!-- http://ns.softwiki.de/req/8 --> + + <QualityRating rdf:about="8"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="Rating"/> + </QualityRating> + + + + <!-- http://ns.softwiki.de/req/9 --> + + <Rating rdf:about="9"> + <rdf:type rdf:resource="PriorityRating"/> + <rdf:type rdf:resource="QualityRating"/> + </Rating> + + + + <!-- http://ns.softwiki.de/req/Allocated_Requirements --> + + <Requirement rdf:about="Allocated_Requirements"/> + + + + <!-- http://ns.softwiki.de/req/Andrew_Stellman --> + + <Author rdf:about="Andrew_Stellman"/> + + + + <!-- http://ns.softwiki.de/req/Complete --> + + <QualityRequirement rdf:about="Complete"/> + + + + <!-- http://ns.softwiki.de/req/Consistent --> + + <QualityRequirement rdf:about="Consistent"/> + + + + <!-- http://ns.softwiki.de/req/Correct --> + + <QualityRequirement rdf:about="Correct"/> + + + + <!-- http://ns.softwiki.de/req/Creditors --> + + <Stakeholder rdf:about="Creditors"/> + + + + <!-- http://ns.softwiki.de/req/Customer_Requirements_ --> + + <Requirement rdf:about="Customer_Requirements_"/> + + + + <!-- http://ns.softwiki.de/req/Customers --> + + <Stakeholder rdf:about="Customers"/> + + + + <!-- http://ns.softwiki.de/req/Derived_Requirements --> + + <Requirement rdf:about="Derived_Requirements"/> + + + + <!-- http://ns.softwiki.de/req/Design_Requirements --> + + <Requirement rdf:about="Design_Requirements"/> + + + + <!-- http://ns.softwiki.de/req/Feasible --> + + <QualityRequirement rdf:about="Feasible"/> + + + + <!-- http://ns.softwiki.de/req/Functional_Requirements --> + + <Requirement rdf:about="Functional_Requirements"/> + + + + <!-- http://ns.softwiki.de/req/Government --> + + <Stakeholder rdf:about="Government"/> + + + + <!-- http://ns.softwiki.de/req/Jennifer_Greene --> + + <Author rdf:about="Jennifer_Greene"/> + + + + <!-- http://ns.softwiki.de/req/Lastenheft --> + + <Document rdf:about="Lastenheft"/> + + + + <!-- http://ns.softwiki.de/req/Modifiable --> + + <QualityRequirement rdf:about="Modifiable"/> + + + + <!-- http://ns.softwiki.de/req/Necessary --> + + <QualityRequirement rdf:about="Necessary"/> + + + + <!-- http://ns.softwiki.de/req/Performance_Requirements --> + + <Requirement rdf:about="Performance_Requirements"/> + + + + <!-- http://ns.softwiki.de/req/Pflichtenheft --> + + <Document rdf:about="Pflichtenheft"/> + + + + <!-- http://ns.softwiki.de/req/Prioritized --> + + <QualityRequirement rdf:about="Prioritized"/> + + + + <!-- http://ns.softwiki.de/req/Senior_Management_staff --> + + <Stakeholder rdf:about="Senior_Management_staff"/> + + + + <!-- http://ns.softwiki.de/req/Steve_McConnell --> + + <Author rdf:about="Steve_McConnell"/> + + + + <!-- http://ns.softwiki.de/req/TextualScenario --> + + <Scenario rdf:about="TextualScenario"/> + + + + <!-- http://ns.softwiki.de/req/Traceable --> + + <QualityRequirement rdf:about="Traceable"/> + + + + <!-- http://ns.softwiki.de/req/Trade_Unions --> + + <Stakeholder rdf:about="Trade_Unions"/> + + + + <!-- http://ns.softwiki.de/req/UML --> + + <Document rdf:about="UML"/> + + + + <!-- http://ns.softwiki.de/req/Unambiguous --> + + <QualityRequirement rdf:about="Unambiguous"/> + + + + <!-- http://ns.softwiki.de/req/Verifiable --> + + <QualityRequirement rdf:about="Verifiable"/> + + + + <!-- http://ns.softwiki.de/req/calculations --> + + <FunctionalRequirement rdf:about="calculations"/> + + + + <!-- http://ns.softwiki.de/req/comment --> + + <Comment rdf:about="comment"/> + + + + <!-- http://ns.softwiki.de/req/complete --> + + <ApplicationState rdf:about="complete"/> + + + + <!-- http://ns.softwiki.de/req/data_manipulation --> + + <FunctionalRequirement rdf:about="data_manipulation"/> + + + + <!-- http://ns.softwiki.de/req/important --> + + <Vote rdf:about="important"/> + + + + <!-- http://ns.softwiki.de/req/incomplete --> + + <ApplicationState rdf:about="incomplete"/> + + + + <!-- http://ns.softwiki.de/req/less_importent --> + + <Vote rdf:about="less_importent"/> + + + + <!-- http://ns.softwiki.de/req/technical_details --> + + <FunctionalRequirement rdf:about="technical_details"/> + + + + <!-- http://ns.softwiki.de/req/text --> + + <TextualScenario rdf:about="text"/> + + + + <!-- http://ns.softwiki.de/req/topic --> + + <Topic rdf:about="topic"/> + + + + <!-- http://ns.softwiki.de/req/unimportant --> + + <Vote rdf:about="unimportant"/> + + + + <!-- http://ns.softwiki.de/req/use_cases --> + + <Document rdf:about="use_cases"/> + + + + <!-- http://ns.softwiki.de/req/very_important --> + + <Vote rdf:about="very_important"/> + + + + <!-- http://www.holygoat.co.uk/foaf.rdf#RichardNewman --> + + <Author rdf:about="&foaf2;RichardNewman"/> + + + + <!-- http://www.w3.org/2001/XMLSchema#boolean --> + + <rdf:Description rdf:about="&xsd;boolean"> + <rdfs:label rdf:datatype="&xsd;string">boolean</rdfs:label> + </rdf:Description> + + + + <!-- http://www.w3.org/2001/XMLSchema#dateTime --> + + <rdf:Description rdf:about="&xsd;dateTime"> + <rdfs:label rdf:datatype="&xsd;string">dateTime</rdfs:label> + </rdf:Description> + + + + <!-- http://www.w3.org/2004/02/skos/core#primarySubject --> + + <Topic rdf:about="&p1;primarySubject"> + <rdfs:label xml:lang="de">Thema</rdfs:label> + </Topic> +</rdf:RDF> + + + +<!-- Generated by the OWL API (version 2.2.1.914) http://owlapi.sourceforge.net --> + Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -174,6 +174,8 @@ // } // } + System.out.println(update); + // apply updates recursively top-down tree.updateSimulation(update); @@ -352,7 +354,9 @@ for(ELDescriptionNode w : tmp) { if(w != this) { if(!tree.checkSC1(w, this)) { - tree.shrinkSimulation(w, this); +// tree.shrinkSimulation(w, this); + tree.shrinkSimulationSC1(w, this); + tree.shrinkSimulationSC12(w, this); update.add(w.parent); } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -237,15 +237,25 @@ Set<ELDescriptionNode> sameLevel = levelNodeMapping.get(v.getLevel()); for(ELDescriptionNode w : sameLevel) { if(v != w) { - if(!v.out.contains(w) && v.outSC1.contains(w) && checkSC2(v,w)) { - extendSimulation(v,w); - list.add(v.getParent()); - list.add(w.getParent()); + if(!v.out.contains(w) ) { + System.out.println("test"); + if(checkSC2(v,w) && v.outSC1.contains(w)) { + extendSimulation(v,w); + list.add(v.getParent()); + list.add(w.getParent()); + } else { + System.out.println("test in"); + shrinkSimulationSC2(v,w); + } } - if(!w.out.contains(v) && w.outSC1.contains(v) && checkSC2(w,v)) { - extendSimulation(w,v); - list.add(v.getParent()); - list.add(w.getParent()); + if(!w.out.contains(v) ) { + if(checkSC2(w,v) && w.outSC1.contains(v)) { + extendSimulation(w,v); + list.add(v.getParent()); + list.add(w.getParent()); + } else { + shrinkSimulationSC2(w,v); + } } } } @@ -361,8 +371,10 @@ } public void shrinkSimulationSC2(ELDescriptionNode node1, ELDescriptionNode node2) { + System.out.println(node2.outSC2); node1.inSC2.remove(node2); node2.outSC2.remove(node1); + System.out.println(node2.outSC2); } public void shrinkSimulationSC12(ELDescriptionNode node1, ELDescriptionNode node2) { Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -869,7 +869,7 @@ tmp = getSuperClassesImpl(Nothing.instance); subsumptionHierarchyUp.put(Nothing.instance, tmp); subsumptionHierarchyDown.put(Nothing.instance, new TreeSet<Description>()); - + // ... and named classes Set<NamedClass> atomicConcepts = getNamedClasses(); for (NamedClass atom : atomicConcepts) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -229,7 +229,7 @@ // they are empty) TreeSet<Description> superClasses = new TreeSet<Description>(entry.getValue()); // storage for new super classes - TreeSet<Description> newSuperClasses = new TreeSet<Description>(entry.getValue()); + TreeSet<Description> newSuperClasses = new TreeSet<Description>(); while(!superClasses.isEmpty()) { // pick and remove the first element @@ -239,7 +239,8 @@ newSuperClasses.add(d); // case 2: it is not allowed, so we try its super classes } else { - superClasses.addAll(subsumptionHierarchyUp.get(d)); + Set<Description> tmp = subsumptionHierarchyUp.get(d); + superClasses.addAll(tmp); } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -24,6 +24,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; @@ -223,11 +224,16 @@ } owlAPIOntologies.add(ontology); - allImports.addAll(manager.getImportsClosure(ontology)); - classes.addAll(ontology.getReferencedClasses()); - owlObjectProperties.addAll(ontology.getReferencedObjectProperties()); - owlDatatypeProperties.addAll(ontology.getReferencedDataProperties()); - owlIndividuals.addAll(ontology.getReferencedIndividuals()); + // imports includes the ontology itself + Set<OWLOntology> imports = manager.getImportsClosure(ontology); + allImports.addAll(imports); +// System.out.println(imports); + for(OWLOntology ont : imports) { + classes.addAll(ont.getReferencedClasses()); + owlObjectProperties.addAll(ont.getReferencedObjectProperties()); + owlDatatypeProperties.addAll(ont.getReferencedDataProperties()); + owlIndividuals.addAll(ont.getReferencedIndividuals()); + } // if several knowledge sources are included, then we can only // guarantee that the base URI is from one of those sources (there @@ -366,20 +372,22 @@ individuals.add(new Individual(owlIndividual.getURI().toString())); } + + } /* (non-Javadoc) * @see org.dllearner.core.Reasoner#getAtomicConcepts() */ - public Set<NamedClass> getNamedClasses() { - return atomicConcepts; + public Set<NamedClass> getNamedClasses() { + return Collections.unmodifiableSet(atomicConcepts); } /* (non-Javadoc) * @see org.dllearner.core.Reasoner#getAtomicRoles() */ public Set<ObjectProperty> getObjectProperties() { - return atomicRoles; + return Collections.unmodifiableSet(atomicRoles); } @Override Added: trunk/src/dl-learner/org/dllearner/test/SworeTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/SworeTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/SworeTest.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.test; + +import java.io.File; +import java.net.MalformedURLException; +import java.util.Set; +import java.util.TreeSet; + +import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.kb.OWLFile; +import org.dllearner.learningproblems.PosNegDefinitionLP; +import org.dllearner.reasoning.OWLAPIReasoner; + +/** + * Test for learning on SWORE ontology. + * + * @author Jens Lehmann + * + */ +public class SworeTest { + + /** + * @param args + * @throws ComponentInitException + * @throws MalformedURLException + */ + public static void main(String[] args) throws ComponentInitException, MalformedURLException { + + // get singleton instance of component manager + ComponentManager cm = ComponentManager.getInstance(); + + // create knowledge source + KnowledgeSource source = cm.knowledgeSource(OWLFile.class); + String example = "examples/swore/swore.rdf"; + cm.applyConfigEntry(source, "url", new File(example).toURI().toURL()); + source.init(); + + // create OWL API reasoning service with standard settings + ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, source); + reasoner.init(); + + // create a learning problem and set positive and negative examples + LearningProblem lp = cm.learningProblem(PosNegDefinitionLP.class, reasoner); + Set<String> positiveExamples = new TreeSet<String>(); + positiveExamples.add("http://ns.softwiki.de/req/important"); + positiveExamples.add("http://ns.softwiki.de/req/very_important"); + Set<String> negativeExamples = new TreeSet<String>(); + negativeExamples.add("http://ns.softwiki.de/req/Topic"); + cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); + cm.applyConfigEntry(lp, "negativeExamples", negativeExamples); + lp.init(); + + // create the learning algorithm + LearningAlgorithm la = null; + try { + la = cm.learningAlgorithm(ExampleBasedROLComponent.class, lp, reasoner); + la.init(); + } catch (LearningProblemUnsupportedException e) { + e.printStackTrace(); + } + + // start the algorithm and print the best concept found + la.start(); + System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true)); + } + +} Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -42,7 +42,7 @@ * */ public class SimulationTests { - + /** * Empty tree - empty simulation. * @@ -115,24 +115,25 @@ Map<ELDescriptionNode,String> nodeNames = new LinkedHashMap<ELDescriptionNode,String>(); ELDescriptionNode v1 = new ELDescriptionNode(tree); nodeNames.put(v1, "v1"); - log("root node v1", tree, nodeNames); +// log("root node v1", tree, nodeNames); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1); nodeNames.put(v2, "v2"); - log("edge to v2 added", tree, nodeNames); +// log("edge to v2 added", tree, nodeNames); v2.extendLabel(a1); - log("a1 added to v2", tree, nodeNames); +// log("a1 added to v2", tree, nodeNames); v2.extendLabel(a2); - log("a2 added to v2", tree, nodeNames); +// log("a2 added to v2", tree, nodeNames); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); nodeNames.put(v3, "v3"); - log("edge to v3 added", tree, nodeNames); +// log("edge to v3 added", tree, nodeNames); v3.extendLabel(a2); - log("a2 added to v3", tree, nodeNames); +// log("a2 added to v3", tree, nodeNames); ELDescriptionNode v4 = new ELDescriptionNode(v1, r2); nodeNames.put(v4, "v4"); - log("edge to v4 added", tree, nodeNames); +// log("edge to v4 added", tree, nodeNames); v4.extendLabel(a1); - log("a1 added to v4", tree, nodeNames); +// log("a1 added to v4", tree, nodeNames); +// log("tree 3", tree, nodeNames); assertEmpty(v1); @@ -179,19 +180,35 @@ public void test4() { ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.SIMPLE2); ELDescriptionTree tree = new ELDescriptionTree(rs); + Map<ELDescriptionNode,String> nodeNames = new LinkedHashMap<ELDescriptionNode,String>(); + ObjectProperty r1 = new ObjectProperty(uri("r1")); ObjectProperty r2 = new ObjectProperty(uri("r2")); ObjectProperty r3 = new ObjectProperty(uri("r3")); NamedClass a1 = new NamedClass(uri("a1")); NamedClass a2 = new NamedClass(uri("a2")); NamedClass a3 = new NamedClass(uri("a3")); + ELDescriptionNode v1 = new ELDescriptionNode(tree); + nodeNames.put(v1, "v1"); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, a2, a3); + nodeNames.put(v2, "v2"); + log("v2 added", tree, nodeNames); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); + nodeNames.put(v3, "v3"); + log("v3 added", tree, nodeNames); ELDescriptionNode v4 = new ELDescriptionNode(v2, r1, a1); + nodeNames.put(v4, "v4"); + log("v4 added", tree, nodeNames); ELDescriptionNode v5 = new ELDescriptionNode(v2, r3, a1, a2); + nodeNames.put(v5, "v5"); + log("v5 added", tree, nodeNames); v2.refineEdge(1, r2); + log("edge refined", tree, nodeNames); ELDescriptionNode v6 = new ELDescriptionNode(v3, r3, a3); + nodeNames.put(v6, "v6"); + log("v6 added", tree, nodeNames); + log("tree 4", tree, nodeNames); assertEmpty(v1); Modified: trunk/src/dl-learner/org/dllearner/utilities/Helper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2008-11-27 11:54:33 UTC (rev 1523) @@ -450,7 +450,9 @@ * the RDF, RDFS, OWL standards. * * @param concepts The set from which concepts will be removed. + * @deprecated Deprecated method, because it is not needed anymore. */ + @Deprecated public static void removeUninterestingConcepts(Set<NamedClass> concepts) { Iterator<NamedClass> it = concepts.iterator(); while (it.hasNext()) { @@ -484,14 +486,14 @@ // if there is no ignore or allowed list, we just ignore the concepts // of uninteresting namespaces Set<NamedClass> concepts = rs.getNamedClasses(); - Helper.removeUninterestingConcepts(concepts); +// Helper.removeUninterestingConcepts(concepts); return concepts; } // concepts case 2: ignore list public static Set<NamedClass> computeConceptsUsingIgnoreList(ReasonerComponent rs, Set<NamedClass> ignoredConcepts) { Set<NamedClass> concepts = rs.getNamedClasses(); - Helper.removeUninterestingConcepts(concepts); +// Helper.removeUninterestingConcepts(concepts); for (NamedClass ac : ignoredConcepts) { boolean success = concepts.remove(ac); if (!success) Modified: trunk/src/music-recommender/DLLearnerConnection.php =================================================================== --- trunk/src/music-recommender/DLLearnerConnection.php 2008-11-22 08:45:50 UTC (rev 1522) +++ trunk/src/music-recommender/DLLearnerConnection.php 2008-11-27 11:54:33 UTC (rev 1523) @@ -17,7 +17,7 @@ // read in ini values $ini = parse_ini_file("settings.ini"); - $this->endpointURL = $ini['endpointURL']; + $this->endpointURL = $ini['endpointURL1']; // connect to DL-Learner-Web-Service $this->client=new SoapClient($ini["wsdlURLLocal"],array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-22 08:45:56
|
Revision: 1522 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1522&view=rev Author: jenslehmann Date: 2008-11-22 08:45:50 +0000 (Sat, 22 Nov 2008) Log Message: ----------- utility methods for debugging EL simulations Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-21 15:11:14 UTC (rev 1521) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-22 08:45:50 UTC (rev 1522) @@ -24,6 +24,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.NavigableSet; import java.util.Set; import java.util.TreeSet; @@ -485,8 +486,30 @@ return str; } - + private String toString(Set<ELDescriptionNode> nodes, Map<ELDescriptionNode,String> nodeNames) { + String str = ""; + // comma separated list of descriptions + for(ELDescriptionNode node : nodes) { + str += nodeNames.get(node) + ","; + } + // remove last comma + if(str.length() > 0) { + str = str.substring(0, str.length()-1); + } + return str; + } + public String toSimulationString(Map<ELDescriptionNode,String> nodeNames) { + String str = ""; + str += " in: " + toString(in, nodeNames) + "\n"; + str += " inSC1: " + toString(inSC1, nodeNames) + "\n"; + str += " inSC2: " + toString(inSC2, nodeNames) + "\n"; + str += " out: " + toString(out, nodeNames) + "\n"; + str += " outSC1: " + toString(outSC1, nodeNames) + "\n"; + str += " outSC2: " + toString(outSC2, nodeNames) + "\n"; + return str; + } + public ELDescriptionNode getParent() { return parent; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-21 15:11:14 UTC (rev 1521) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-22 08:45:50 UTC (rev 1522) @@ -370,6 +370,17 @@ node2.out.remove(node1); } + public String toSimulationString(Map<ELDescriptionNode,String> nodeNames) { + String str = ""; + for(Entry<ELDescriptionNode,String> entry : nodeNames.entrySet()) { + String nodeName = entry.getValue(); + ELDescriptionNode node = entry.getKey(); + str += nodeName + ":\n"; + str += node.toSimulationString(nodeNames) + "\n"; + } + return str; + } + @Override @SuppressWarnings("unchecked") public ELDescriptionTree clone() { Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-21 15:11:14 UTC (rev 1521) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-22 08:45:50 UTC (rev 1522) @@ -19,8 +19,10 @@ */ package org.dllearner.test.junit; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.TreeSet; import org.dllearner.algorithms.el.ELDescriptionNode; @@ -100,22 +102,37 @@ * v4: out=outSC1={v2}, inSC2=outSC2={v2,v3} */ @Test - public void test3() { + public void test3() { + // background knowledge, concepts, roles ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.R1SUBR2); - ELDescriptionTree tree = new ELDescriptionTree(rs); - ELDescriptionNode v1 = new ELDescriptionNode(tree); ObjectProperty r1 = new ObjectProperty(uri("r1")); NamedClass a1 = new NamedClass(uri("a1")); NamedClass a2 = new NamedClass(uri("a2")); - ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, a1, a2); - ELDescriptionNode v3 = new ELDescriptionNode(v1, r1, a2); ObjectProperty r2 = new ObjectProperty(uri("r2")); - ELDescriptionNode v4 = new ELDescriptionNode(v1, r2, a1); - System.out.println("v1:\n" + v1.toSimulationString()); - System.out.println("v2:\n" + v2.toSimulationString()); - System.out.println("v3:\n" + v3.toSimulationString()); - System.out.println("v4:\n" + v4.toSimulationString()); + // iteratively building up the tree (nodeNames is used for logging/debugging) + ELDescriptionTree tree = new ELDescriptionTree(rs); + Map<ELDescriptionNode,String> nodeNames = new LinkedHashMap<ELDescriptionNode,String>(); + ELDescriptionNode v1 = new ELDescriptionNode(tree); + nodeNames.put(v1, "v1"); + log("root node v1", tree, nodeNames); + ELDescriptionNode v2 = new ELDescriptionNode(v1, r1); + nodeNames.put(v2, "v2"); + log("edge to v2 added", tree, nodeNames); + v2.extendLabel(a1); + log("a1 added to v2", tree, nodeNames); + v2.extendLabel(a2); + log("a2 added to v2", tree, nodeNames); + ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); + nodeNames.put(v3, "v3"); + log("edge to v3 added", tree, nodeNames); + v3.extendLabel(a2); + log("a2 added to v3", tree, nodeNames); + ELDescriptionNode v4 = new ELDescriptionNode(v1, r2); + nodeNames.put(v4, "v4"); + log("edge to v4 added", tree, nodeNames); + v4.extendLabel(a1); + log("a1 added to v4", tree, nodeNames); assertEmpty(v1); @@ -202,6 +219,16 @@ assertOutSC1(v6,v5); } + private void log(String message, ELDescriptionTree tree, Map<ELDescriptionNode,String> nodeNames) { + // print underlined message + System.out.println(message); + for(int i=0; i<=message.length(); i++) { + System.out.print("="); + } + System.out.println("\n"); + System.out.println(tree.toSimulationString(nodeNames)); + } + // all relations (in, inSC1, inSC2) should have the // the specified node set as value private void assertAll(ELDescriptionNode node, ELDescriptionNode... nodes) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-21 15:11:20
|
Revision: 1521 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1521&view=rev Author: jenslehmann Date: 2008-11-21 15:11:14 +0000 (Fri, 21 Nov 2008) Log Message: ----------- simulation fixes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-21 12:06:58 UTC (rev 1520) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-21 15:11:14 UTC (rev 1521) @@ -330,7 +330,7 @@ // (same in both cases) private void labelSimulationUpdate() { // compute the nodes, which need to be updated - Set<ELDescriptionNode> update = new TreeSet<ELDescriptionNode>(); + Set<ELDescriptionNode> update = new HashSet<ELDescriptionNode>(); // loop over all nodes on the same level, which are not in the in set Set<ELDescriptionNode> tmp = new HashSet<ELDescriptionNode>(tree.getNodesOnLevel(level)); @@ -345,8 +345,10 @@ } } - // loop over all nodes in out set - for(ELDescriptionNode w : out) { + // loop over all nodes in out set (we make a copy, because out + // is potentially modified, so we cannot safely iterate over it) + tmp = new HashSet<ELDescriptionNode>(out); + for(ELDescriptionNode w : tmp) { if(w != this) { if(!tree.checkSC1(w, this)) { tree.shrinkSimulation(w, this); Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-21 12:06:58 UTC (rev 1520) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-21 15:11:14 UTC (rev 1521) @@ -322,52 +322,52 @@ // adds (node1,node2) to simulation, takes care of all helper sets public void extendSimulation(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.out.add(node2); - node1.outSC1.add(node2); - node1.outSC2.add(node2); - node2.in.add(node1); - node2.inSC1.add(node1); - node2.inSC2.add(node1); + node1.in.add(node2); + node1.inSC1.add(node2); + node1.inSC2.add(node2); + node2.out.add(node1); + node2.outSC1.add(node1); + node2.outSC2.add(node1); } public void extendSimulationSC1(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.outSC1.add(node2); - node2.inSC1.add(node1); + node1.inSC1.add(node2); + node2.outSC1.add(node1); } public void extendSimulationSC2(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.outSC2.add(node2); - node2.inSC2.add(node1); + node1.inSC2.add(node2); + node2.outSC2.add(node1); } public void extendSimulationSC12(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.out.add(node2); - node2.in.add(node1); + node1.in.add(node2); + node2.out.add(node1); } // removes (node1,node2) from simulation, takes care of all helper sets public void shrinkSimulation(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.out.remove(node2); - node1.outSC1.remove(node2); - node1.outSC2.remove(node2); - node2.in.remove(node1); - node2.inSC1.remove(node1); - node2.inSC2.remove(node1); + node1.in.remove(node2); + node1.inSC1.remove(node2); + node1.inSC2.remove(node2); + node2.out.remove(node1); + node2.outSC1.remove(node1); + node2.outSC2.remove(node1); } public void shrinkSimulationSC1(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.outSC1.remove(node2); - node2.inSC1.remove(node1); + node1.inSC1.remove(node2); + node2.outSC1.remove(node1); } public void shrinkSimulationSC2(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.outSC2.remove(node2); - node2.inSC2.remove(node1); + node1.inSC2.remove(node2); + node2.outSC2.remove(node1); } public void shrinkSimulationSC12(ELDescriptionNode node1, ELDescriptionNode node2) { - node1.out.remove(node2); - node2.in.remove(node1); + node1.in.remove(node2); + node2.out.remove(node1); } @Override Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-21 12:06:58 UTC (rev 1520) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-21 15:11:14 UTC (rev 1521) @@ -28,6 +28,7 @@ import org.dllearner.core.ReasonerComponent; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.parser.KBParser; import org.dllearner.test.junit.TestOntologies.TestOntology; import org.junit.Test; @@ -71,12 +72,12 @@ // perform test with empty background knowledge and A1 AND EXISTS r1.TOP AND EXISTS r2.TOP ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.EMPTY); ELDescriptionTree tree = new ELDescriptionTree(rs); - NamedClass a1 = new NamedClass("a1"); + NamedClass a1 = new NamedClass(uri("a1")); ELDescriptionNode v1 = new ELDescriptionNode(tree); v1.extendLabel(a1); - ObjectProperty r1 = new ObjectProperty("r1"); + ObjectProperty r1 = new ObjectProperty(uri("r1")); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, new TreeSet<NamedClass>()); - ObjectProperty r2 = new ObjectProperty("r2"); + ObjectProperty r2 = new ObjectProperty(uri("r2")); ELDescriptionNode v3 = new ELDescriptionNode(v1, r2, new TreeSet<NamedClass>()); assertEmpty(v1); @@ -95,20 +96,20 @@ * * v1: - * v2: in=inSC1=inSC2=outSC2={v3,v4} - * v3: inSC2=outSC2={v2,v4} - * v4: inSC2=outSC2={v2,v3} + * v3: out=outSC1={v2}, inSC2=outSC2={v2,v4} + * v4: out=outSC1={v2}, inSC2=outSC2={v2,v3} */ @Test public void test3() { ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.R1SUBR2); ELDescriptionTree tree = new ELDescriptionTree(rs); ELDescriptionNode v1 = new ELDescriptionNode(tree); - ObjectProperty r1 = new ObjectProperty("r1"); - NamedClass a1 = new NamedClass("a1"); - NamedClass a2 = new NamedClass("a2"); + ObjectProperty r1 = new ObjectProperty(uri("r1")); + NamedClass a1 = new NamedClass(uri("a1")); + NamedClass a2 = new NamedClass(uri("a2")); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, a1, a2); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1, a2); - ObjectProperty r2 = new ObjectProperty("r2"); + ObjectProperty r2 = new ObjectProperty(uri("r2")); ELDescriptionNode v4 = new ELDescriptionNode(v1, r2, a1); System.out.println("v1:\n" + v1.toSimulationString()); @@ -123,13 +124,17 @@ assertOutSC1(v2); assertOut(v2); + assertOut(v3,v2); + assertOutSC1(v3,v2); assertSC2(v3, v2, v4); - assertSC1(v3); - assertSC(v3); + assertInSC1(v3); + assertIn(v3); + assertOut(v4,v2); + assertOutSC1(v4,v2); assertSC2(v4, v2, v3); - assertSC1(v4); - assertSC(v4); + assertInSC1(v4); + assertIn(v4); } /** @@ -157,12 +162,12 @@ public void test4() { ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.SIMPLE2); ELDescriptionTree tree = new ELDescriptionTree(rs); - ObjectProperty r1 = new ObjectProperty("r1"); - ObjectProperty r2 = new ObjectProperty("r2"); - ObjectProperty r3 = new ObjectProperty("r3"); - NamedClass a1 = new NamedClass("a1"); - NamedClass a2 = new NamedClass("a2"); - NamedClass a3 = new NamedClass("a3"); + ObjectProperty r1 = new ObjectProperty(uri("r1")); + ObjectProperty r2 = new ObjectProperty(uri("r2")); + ObjectProperty r3 = new ObjectProperty(uri("r3")); + NamedClass a1 = new NamedClass(uri("a1")); + NamedClass a2 = new NamedClass(uri("a2")); + NamedClass a3 = new NamedClass(uri("a3")); ELDescriptionNode v1 = new ELDescriptionNode(tree); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, a2, a3); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); @@ -220,11 +225,13 @@ assertOutSC2(node, nodesOut); } + @SuppressWarnings("unused") private void assertSC(ELDescriptionNode node, ELDescriptionNode... nodesOut) { assertIn(node, nodesOut); assertOut(node, nodesOut); } + @SuppressWarnings("unused") private void assertSC1(ELDescriptionNode node, ELDescriptionNode... nodesOut) { assertInSC1(node, nodesOut); assertOutSC1(node, nodesOut); @@ -286,4 +293,9 @@ assertTrue(node.getOutSC1().isEmpty()); assertTrue(node.getOutSC2().isEmpty()); } + + // we use the standard KB file prefix + private String uri(String localname) { + return KBParser.getInternalURI(localname); + } } Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-11-21 12:06:58 UTC (rev 1520) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-11-21 15:11:14 UTC (rev 1521) @@ -55,10 +55,13 @@ kbString += "cat SUB animal.\n"; kbString += "(human AND animal) = BOTTOM.\n"; } else if(ont.equals(TestOntology.SIMPLE2)) { - kbString += "Subrole(r2,r3)."; - kbString += "a2 SUB a4."; + kbString += "Subrole(r1,r2).\n"; + kbString += "a1 SUB TOP.\n"; + kbString += "a2 SUB a3.\n"; } else if(ont.equals(TestOntology.R1SUBR2)) { kbString += "Subrole(r1,r2).\n"; + kbString += "a1 SUB TOP.\n"; + kbString += "a2 SUB TOP.\n"; } else if(ont.equals(TestOntology.DATA1)) { kbString += "man SUB person.\n"; kbString += "woman SUB person.\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-21 12:07:02
|
Revision: 1520 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1520&view=rev Author: jenslehmann Date: 2008-11-21 12:06:58 +0000 (Fri, 21 Nov 2008) Log Message: ----------- continued work on EL simulations Modified Paths: -------------- trunk/examples/carcinogenesis/train.conf trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java Modified: trunk/examples/carcinogenesis/train.conf =================================================================== --- trunk/examples/carcinogenesis/train.conf 2008-11-18 18:05:10 UTC (rev 1519) +++ trunk/examples/carcinogenesis/train.conf 2008-11-21 12:06:58 UTC (rev 1520) @@ -10,7 +10,7 @@ refexamples.writeSearchTree = false; refexamples.searchTreeFile = "log/carcinogenesis/searchTree.log"; -// store some default settings to make the experiment reproducable in the future +// store some settings to make the experiment reproducable in the future refexamples.negativeWeight = 0.8; refexamples.startNodeBonus = 1.0; refexamples.forceRefinementLengthIncrease = false; Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-18 18:05:10 UTC (rev 1519) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-21 12:06:58 UTC (rev 1520) @@ -58,7 +58,7 @@ // the reference tree for storing values, must not be null protected ELDescriptionTree tree; - protected TreeSet<NamedClass> label; + protected TreeSet<NamedClass> label = new TreeSet<NamedClass>(); protected List<ELDescriptionEdge> edges = new LinkedList<ELDescriptionEdge>(); @@ -111,7 +111,9 @@ } public ELDescriptionNode(ELDescriptionNode parentNode, ObjectProperty parentProperty, TreeSet<NamedClass> label) { - this.label = label; +// this.label = label; + // we first need to add the edge and update the simulation and then add + // all classes iteratively to the label (each time updating the simulation again) this.edges = new LinkedList<ELDescriptionEdge>(); parent = parentNode; // the reference tree is the same as for the parent tree @@ -122,36 +124,63 @@ ELDescriptionEdge edge = new ELDescriptionEdge(parentProperty, this); parent.edges.add(edge); // we need to update the set of nodes on a particular level - tree.addNodeToLevel(this, level); + tree.addNodeToLevel(this, level); // simulation update // the nodes, which need to be updated - Set<ELDescriptionNode> update = new TreeSet<ELDescriptionNode>(); + Set<ELDescriptionNode> update = new HashSet<ELDescriptionNode>(); // loop over all nodes on the same level, which are not in the in set Set<ELDescriptionNode> nodes = tree.getNodesOnLevel(level); for(ELDescriptionNode w : nodes) { - if(w.label.size() == 0) { + // to save space, we do not add reflexive relations + if(w != this) { + // (w,v') is automatically added + tree.extendSimulation(w, this); - } - - if(inSC1.contains(w) && tree.checkSC2(this, w)) { - tree.extendSimulation(this, w); + // check conditions for (v',w) + boolean sc1 = false, sc2 = false; + + if(w.label.size() == 0) { + tree.extendSimulationSC1(this, w); + sc1 = true; + } + + if(w.edges.size() == 0) { + tree.extendSimulationSC2(this, w); + sc2 = true; + } + + if(sc1 && sc2) { + tree.extendSimulationSC12(this, w); + } + update.add(w.parent); } } + update.add(this.parent); +// if(inSC1.contains(w) && tree.checkSC2(this, w)) { +// tree.extendSimulation(this, w); +// update.add(w.parent); +// } + // loop over all nodes in out set - for(ELDescriptionNode w : out) { - if(!tree.checkSC1(this, w)) { - tree.shrinkSimulation(this, w); - update.add(w.parent); - } - } +// for(ELDescriptionNode w : out) { +// if(!tree.checkSC1(this, w)) { +// tree.shrinkSimulation(this, w); +// update.add(w.parent); +// } +// } // apply updates recursively top-down tree.updateSimulation(update); + // add all classes in label + for(NamedClass nc : label) { + extendLabel(nc); + } + } /** @@ -304,21 +333,25 @@ Set<ELDescriptionNode> update = new TreeSet<ELDescriptionNode>(); // loop over all nodes on the same level, which are not in the in set - Set<ELDescriptionNode> nodes = tree.getNodesOnLevel(level); - Set<ELDescriptionNode> tmp = Helper.difference(nodes, in); + Set<ELDescriptionNode> tmp = new HashSet<ELDescriptionNode>(tree.getNodesOnLevel(level)); + tmp.removeAll(in); for(ELDescriptionNode w : tmp) { - // we only need to recompute SC2 - if(inSC1.contains(w) && tree.checkSC2(this, w)) { - tree.extendSimulation(this, w); - update.add(w.parent); + if(w != this) { + // we only need to recompute SC2 + if(inSC1.contains(w) && tree.checkSC2(this, w)) { + tree.extendSimulation(this, w); + update.add(w.parent); + } } } // loop over all nodes in out set for(ELDescriptionNode w : out) { - if(!tree.checkSC1(this, w)) { - tree.shrinkSimulation(this, w); - update.add(w.parent); + if(w != this) { + if(!tree.checkSC1(w, this)) { + tree.shrinkSimulation(w, this); + update.add(w.parent); + } } } @@ -330,24 +363,28 @@ edges.get(edgeNumber).setLabel(op); // compute the nodes, which need to be updated - Set<ELDescriptionNode> update = new TreeSet<ELDescriptionNode>(); + Set<ELDescriptionNode> update = new HashSet<ELDescriptionNode>(); // loop over all nodes on the same level, which are not in the in set - Set<ELDescriptionNode> nodes = tree.getNodesOnLevel(level); - Set<ELDescriptionNode> tmp = Helper.difference(nodes, in); + Set<ELDescriptionNode> tmp = new HashSet<ELDescriptionNode>(tree.getNodesOnLevel(level)); + tmp.removeAll(in); for(ELDescriptionNode w : tmp) { - // we only need to recompute SC1 - if(inSC2.contains(w) && tree.checkSC1(this, w)) { - tree.extendSimulation(this, w); - update.add(w.parent); + if(w != this) { + // we only need to recompute SC1 + if(inSC2.contains(w) && tree.checkSC1(this, w)) { + tree.extendSimulation(this, w); + update.add(w.parent); + } } } // loop over all nodes in out set for(ELDescriptionNode w : out) { - if(!tree.checkSC2(this, w)) { - tree.shrinkSimulation(this, w); - update.add(w.parent); + if(w != this) { + if(!tree.checkSC2(this, w)) { + tree.shrinkSimulation(this, w); + update.add(w.parent); + } } } @@ -422,6 +459,32 @@ return str; } + private String toDescriptionString(Set<ELDescriptionNode> nodes) { + String str = ""; + // comma separated list of descriptions + for(ELDescriptionNode node : nodes) { + str += node.toDescriptionString() + ","; + } + // remove last comma + if(str.length() > 0) { + str = str.substring(0, str.length()-1); + } + return str; + } + + public String toSimulationString() { + String str = ""; + str += "in: " + toDescriptionString(in) + "\n"; + str += "inSC1: " + toDescriptionString(inSC1) + "\n"; + str += "inSC2: " + toDescriptionString(inSC2) + "\n"; + str += "out: " + toDescriptionString(out) + "\n"; + str += "outSC1: " + toDescriptionString(outSC1) + "\n"; + str += "outSC2: " + toDescriptionString(outSC2) + "\n"; + return str; + } + + + public ELDescriptionNode getParent() { return parent; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-18 18:05:10 UTC (rev 1519) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-21 12:06:58 UTC (rev 1520) @@ -234,17 +234,20 @@ // same level are tested before any node of a lower level is tested) ELDescriptionNode v = list.pollFirst(); // loop through all nodes on same level - for(ELDescriptionNode w : levelNodeMapping.get(v.getLevel())) { - if(!v.out.contains(w) && v.outSC1.contains(w) && checkSC2(v,w)) { - extendSimulation(v,w); - list.add(v.getParent()); - list.add(w.getParent()); + Set<ELDescriptionNode> sameLevel = levelNodeMapping.get(v.getLevel()); + for(ELDescriptionNode w : sameLevel) { + if(v != w) { + if(!v.out.contains(w) && v.outSC1.contains(w) && checkSC2(v,w)) { + extendSimulation(v,w); + list.add(v.getParent()); + list.add(w.getParent()); + } + if(!w.out.contains(v) && w.outSC1.contains(v) && checkSC2(w,v)) { + extendSimulation(w,v); + list.add(v.getParent()); + list.add(w.getParent()); + } } - if(!w.out.contains(v) && w.outSC1.contains(v) && checkSC2(w,v)) { - extendSimulation(w,v); - list.add(v.getParent()); - list.add(w.getParent()); - } } } } @@ -327,6 +330,21 @@ node2.inSC2.add(node1); } + public void extendSimulationSC1(ELDescriptionNode node1, ELDescriptionNode node2) { + node1.outSC1.add(node2); + node2.inSC1.add(node1); + } + + public void extendSimulationSC2(ELDescriptionNode node1, ELDescriptionNode node2) { + node1.outSC2.add(node2); + node2.inSC2.add(node1); + } + + public void extendSimulationSC12(ELDescriptionNode node1, ELDescriptionNode node2) { + node1.out.add(node2); + node2.in.add(node1); + } + // removes (node1,node2) from simulation, takes care of all helper sets public void shrinkSimulation(ELDescriptionNode node1, ELDescriptionNode node2) { node1.out.remove(node2); @@ -337,6 +355,21 @@ node2.inSC2.remove(node1); } + public void shrinkSimulationSC1(ELDescriptionNode node1, ELDescriptionNode node2) { + node1.outSC1.remove(node2); + node2.inSC1.remove(node1); + } + + public void shrinkSimulationSC2(ELDescriptionNode node1, ELDescriptionNode node2) { + node1.outSC2.remove(node2); + node2.inSC2.remove(node1); + } + + public void shrinkSimulationSC12(ELDescriptionNode node1, ELDescriptionNode node2) { + node1.out.remove(node2); + node2.in.remove(node1); + } + @Override @SuppressWarnings("unchecked") public ELDescriptionTree clone() { Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-18 18:05:10 UTC (rev 1519) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-21 12:06:58 UTC (rev 1520) @@ -49,7 +49,6 @@ import org.dllearner.core.owl.Constant; import org.dllearner.core.owl.Datatype; import org.dllearner.core.owl.DatatypeProperty; -import org.dllearner.core.owl.DatatypePropertyHierarchy; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Entity; import org.dllearner.core.owl.Individual; @@ -126,7 +125,7 @@ private RoleComparator roleComparator = new RoleComparator(); // private ClassHierarchy subsumptionHierarchy; // private ObjectPropertyHierarchy roleHierarchy; - private DatatypePropertyHierarchy datatypePropertyHierarchy; +// private DatatypePropertyHierarchy datatypePropertyHierarchy; // private Set<Description> allowedConceptsInSubsumptionHierarchy; // primitives Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-18 18:05:10 UTC (rev 1519) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-11-21 12:06:58 UTC (rev 1520) @@ -71,12 +71,14 @@ // perform test with empty background knowledge and A1 AND EXISTS r1.TOP AND EXISTS r2.TOP ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.EMPTY); ELDescriptionTree tree = new ELDescriptionTree(rs); + NamedClass a1 = new NamedClass("a1"); ELDescriptionNode v1 = new ELDescriptionNode(tree); + v1.extendLabel(a1); ObjectProperty r1 = new ObjectProperty("r1"); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, new TreeSet<NamedClass>()); ObjectProperty r2 = new ObjectProperty("r2"); ELDescriptionNode v3 = new ELDescriptionNode(v1, r2, new TreeSet<NamedClass>()); - + assertEmpty(v1); assertAll(v2, v3); assertAll(v3, v2); @@ -109,6 +111,11 @@ ObjectProperty r2 = new ObjectProperty("r2"); ELDescriptionNode v4 = new ELDescriptionNode(v1, r2, a1); + System.out.println("v1:\n" + v1.toSimulationString()); + System.out.println("v2:\n" + v2.toSimulationString()); + System.out.println("v3:\n" + v3.toSimulationString()); + System.out.println("v4:\n" + v4.toSimulationString()); + assertEmpty(v1); assertAllIn(v2, v3, v4); @@ -160,7 +167,8 @@ ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, a2, a3); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); ELDescriptionNode v4 = new ELDescriptionNode(v2, r1, a1); - ELDescriptionNode v5 = new ELDescriptionNode(v2, r2, a1, a2); + ELDescriptionNode v5 = new ELDescriptionNode(v2, r3, a1, a2); + v2.refineEdge(1, r2); ELDescriptionNode v6 = new ELDescriptionNode(v3, r3, a3); assertEmpty(v1); Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-11-18 18:05:10 UTC (rev 1519) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-11-21 12:06:58 UTC (rev 1520) @@ -56,7 +56,7 @@ kbString += "(human AND animal) = BOTTOM.\n"; } else if(ont.equals(TestOntology.SIMPLE2)) { kbString += "Subrole(r2,r3)."; - kbString += "a2 SUB a4"; + kbString += "a2 SUB a4."; } else if(ont.equals(TestOntology.R1SUBR2)) { kbString += "Subrole(r1,r2).\n"; } else if(ont.equals(TestOntology.DATA1)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-18 18:05:13
|
Revision: 1519 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1519&view=rev Author: heeroyuy Date: 2008-11-18 18:05:10 +0000 (Tue, 18 Nov 2008) Log Message: ----------- -some buxfixes 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/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.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 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -44,6 +44,7 @@ import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; import org.protege.editor.owl.OWLEditorKit; +import org.semanticweb.owl.model.OWLOntology; /** * This class processes input from the user. @@ -399,13 +400,20 @@ model.setSuggestList(result); // learnPanel.getListModel().clear(); Iterator<EvaluatedDescription> it = result.iterator(); - //it.next().getDescription().toManchesterSyntaxString(baseURI, prefixes); + while (it.hasNext()) { + Iterator<OWLOntology> ont = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); EvaluatedDescription eval = it.next(); - if(model.isConsistent(eval)) { - dm.add(0, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null))); - } else { - dm.add(0, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null))); + while(ont.hasNext()) { + String onto = ont.next().getURI().toString(); + System.out.println(eval.getDescription()); + if(eval.getDescription().toString().contains(onto)) { + if(model.isConsistent(eval)) { + dm.add(0, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); + } else { + dm.add(0, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); + } + } } } view.getSuggestClassPanel().getSuggestList().setModel(dm); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -58,6 +58,7 @@ import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLIndividual; import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyChangeException; import org.semanticweb.owl.model.OWLOntologyManager; @@ -186,7 +187,6 @@ // This is necessary to get the details of the suggested concept private JXTaskPane detailPane; - private String ontologyURI; private Map<String, String> prefixes; private DefaultListModel posListModel; private DefaultListModel negListModel; @@ -215,7 +215,6 @@ current = h; this.id = id; this.view = view; - ontologyURI = editor.getModelManager().getActiveOntology().getURI().toString()+"#"; owlDescription = new HashSet<OWLDescription>(); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); @@ -349,7 +348,6 @@ // TODO Auto-generated catch block e.printStackTrace(); } - System.out.println("TIME: "+view.getPosAndNegSelectPanel().getOptionPanel().getMaxExecutionTime()); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view.getPosAndNegSelectPanel().getOptionPanel().getMaxExecutionTime()); try { // initializes the learning algorithm @@ -406,23 +404,37 @@ */ public void setPosVector() { setPositiveConcept(); + Set<OWLIndividual> individual = editor.getModelManager().getActiveOntology().getReferencedIndividuals(); + Iterator<OWLIndividual> it = individual.iterator(); + while (it.hasNext()) { + OWLIndividual individum = it.next(); + String individuals = individum.toString(); + if (setPositivExamplesChecked(individuals)) { + // when yes then it sets the positive example checked + posListModel.add(0, individuals); - for (Iterator<Individual> j = reasoner.getIndividuals().iterator(); j - .hasNext();) { - Individual ind = j.next(); + } else { + // When no it unchecks the positive example + negListModel.add(0, individuals); + } + } + SortedSet<Individual> reasonerIndi = reasoner.getIndividuals(); + Iterator<Individual> reasonerIt = reasonerIndi.iterator(); + while(reasonerIt.hasNext()) { + Individual ind = reasonerIt.next(); + String indiv = ind.toString(); // checks if individual belongs to the selected concept if (setPositivExamplesChecked(indiv)) { // when yes then it sets the positive example checked - posListModel.add(0, ind.toManchesterSyntaxString(ontologyURI, prefixes)); - individualVector.add(new IndividualObject(indiv, ind.toManchesterSyntaxString(ontologyURI, prefixes), true)); + individualVector.add(new IndividualObject(indiv, true)); } else { // When no it unchecks the positive example - negListModel.add(0, ind.toManchesterSyntaxString(ontologyURI, prefixes)); - individualVector.add(new IndividualObject(indiv, ind.toManchesterSyntaxString(ontologyURI, prefixes), false)); + individualVector.add(new IndividualObject(indiv, false)); } } + } /** @@ -487,13 +499,23 @@ Iterator<NamedClass> it = reasoner.getNamedClasses().iterator(); while(it.hasNext()) { concept = it.next(); - if (concept.toManchesterSyntaxString(ontologyURI, prefixes).equals(owlConcept.toString())) { - selectedConcept = concept; - break; + Iterator<OWLOntology> onto = editor.getModelManager().getActiveOntologies().iterator(); + while (onto.hasNext()) { + String uri = onto.next().getURI().toString(); + if (concept.toString().contains(uri)) { + if (concept.toManchesterSyntaxString(uri+"#", prefixes).equals(owlConcept.toString())) { + selectedConcept = concept; + break; + } + } + } + } - if (reasoner.getIndividuals(selectedConcept).size() > 0) { - hasIndividuals = true; + if(selectedConcept != null) { + if (reasoner.getIndividuals(selectedConcept).size() > 0) { + hasIndividuals = true; + } } concept = null; selectedConcept = null; @@ -774,4 +796,8 @@ public void setSuggestList(List<EvaluatedDescription> list) { evalDescriptions = list; } + + public OWLEditorKit getOWLEditorKit() { + return editor; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -26,7 +26,6 @@ public class IndividualObject { private String normalIndividual; - private String manchesterIndividual; private boolean isPos; /** @@ -35,9 +34,8 @@ * @param manchester String * @param pos boolean */ - public IndividualObject(String normal, String manchester, boolean pos) { + public IndividualObject(String normal, boolean pos) { normalIndividual = normal; - manchesterIndividual = manchester; isPos = pos; } @@ -50,14 +48,6 @@ } /** - * This method returns the manchester String of the Individual. - * @return String manchesterIndividual - */ - public String getManchesterIndividual() { - return manchesterIndividual; - } - - /** * This method returns if the Example is a positive Example. * @return boolean isPos */ Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -32,6 +32,10 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; +import org.semanticweb.owl.model.OWLOntology; + + + /** * This class shows more details of the suggested concepts. It shows the positive and negative examples * that are covered and that are not covered by the suggested concepts. It also shows the accuracya of the @@ -146,7 +150,6 @@ eval = desc; concept = new JTextArea("Class Description:"); concept.setEditable(false); - coveredPositiveExamples = new JLabel("Covered Positive Examples:"); coveredPositiveExamples.setForeground(colorGreen); coveredPositiveExamples.setBounds(5, 110, 280, 30); @@ -195,7 +198,6 @@ //panel for the informations of the selected concept //this method adds the informations for the selected concept to the panel setInformation(); - detailPopup = new JDialog(); detailPopup.setSize(600, 500); //window will be disposed if the x button is pressed @@ -235,28 +237,71 @@ conceptText.append(eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null)); double acc = (eval.getAccuracy())*100; accuracyText.append(String.valueOf(acc)+"%"); - for(Iterator<Individual> i = eval.getCoveredPositives().iterator(); i.hasNext();) { - JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); + Iterator<Individual> i = eval.getCoveredPositives().iterator(); + while (i.hasNext()) { + Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); + Individual ind = i.next(); + while (onto.hasNext()) { + String uri = onto.next().getURI().toString(); + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + posLabel.setForeground(colorGreen); + posCoveredPanel.add(posLabel); + } + } + + } //sets the positive examples that are not covered - for(Iterator<Individual> i = eval.getNotCoveredPositives().iterator(); i.hasNext();) { - JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); + Iterator<Individual> a = eval.getNotCoveredPositives().iterator(); + while (a.hasNext()) { + Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); + Individual ind = a.next(); + while (onto.hasNext()) { + String uri = onto.next().getURI().toString(); + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + posLabel.setForeground(colorRed); + posNotCoveredPanel.add(posLabel); + } + } + + } + + //sets the negative examples that are covered - for(Iterator<Individual> i = eval.getCoveredNegatives().iterator(); i.hasNext();) { - JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); + Iterator<Individual> b = eval.getCoveredNegatives().iterator(); + while (b.hasNext()) { + Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); + Individual ind = b.next(); + while (onto.hasNext()) { + String uri = onto.next().getURI().toString(); + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + posLabel.setForeground(colorRed); + negCoveredPanel.add(posLabel); + } + } + + } + //sets the negative examples that are not covered - for(Iterator<Individual> i = eval.getNotCoveredNegatives().iterator(); i.hasNext();) { - JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); + Iterator<Individual> c = eval.getNotCoveredNegatives().iterator(); + while (c.hasNext()) { + Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); + Individual ind = c.next(); + while (onto.hasNext()) { + String uri = onto.next().getURI().toString(); + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri+"#", null)); + posLabel.setForeground(colorGreen); + negNotCoveredPanel.add(posLabel); + } + } + + } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -24,7 +24,6 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -358,8 +357,7 @@ private JTextArea hint; // This is the Panel for more details of the suggested concept private MoreDetailForSuggestedConceptsPanel detail; - //private OWLFrame<OWLClass> frame; - private URL pluginURL; + private OWLFrame<OWLClass> frame; /** * The constructor for the DL-Learner tab in the class description @@ -372,16 +370,8 @@ public DLLearnerView(OWLFrame<OWLClass> current, String label, OWLClassDescriptionEditorWithDLLearnerTab dlLearner) { classSelectorPanel = new OWLClassSelectorPanel(editorKit); mainWindow = dlLearner; - //frame = current; - try { - pluginURL = new URL("http://dl-learner.org/wiki/ProtegePlugin"); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - wikiPane = new JLabel("See " + pluginURL + " for an introduction."); - //wikiPane.setEditable(false); - + frame = current; + wikiPane = new JLabel("<html>See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for an introduction.</html>"); classSelectorPanel.firePropertyChange("test", false, true); URL iconUrl = this.getClass().getResource("arrow.gif"); icon = new ImageIcon(iconUrl); @@ -443,19 +433,22 @@ * This Method renders the view of the plugin. */ public void makeView() { - /* + + model.clearVector(); + model.unsetListModel(); + model.initReasoner(); + model.setPosVector(); + hint.setVisible(true); if (model.hasIndividuals(frame.getRootObject())) { run.setEnabled(true); } else { run.setEnabled(false); + hint.setVisible(false); String message ="There are no Instances for "+ frame.getRootObject()+" available. Please insert some Instances."; renderErrorMessage(message); - }*/ + } advanced.setIcon(icon); - model.clearVector(); - model.unsetListModel(); - model.initReasoner(); - model.setPosVector(); + posPanel.setExampleList(model.getPosListModel(), model.getNegListModel()); accept.setEnabled(false); action.resetToggled(); @@ -465,7 +458,7 @@ advanced.setSelected(false); sugPanel.setBounds(10, 35, 490, 110); adv.setBounds(40, 200, 200, 20); - wikiPane.setBounds(220, 10, 350, 30); + wikiPane.setBounds(220, 0, 350, 30); addButtonPanel.setBounds(510, 40, 80, 110); run.setBounds(10, 0, 200, 30); advanced.setBounds(10, 200, 20, 20); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -41,6 +41,7 @@ private JSlider maxExecutionTime; private JSlider nrOfConcepts; private JPanel optionPanel; + private double accuracy; /** * Construktor for the Option Panel. */ @@ -89,7 +90,7 @@ */ public double getMinAccuracy() { int acc = minAccuracy.getValue(); - double accuracy = acc/100; + accuracy = (acc/100.0); return accuracy; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -29,6 +29,7 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; /** * This class is the Panel for the Check boxes where the positive and negative @@ -123,7 +124,11 @@ neg = new JLabel("Negative Examples"); neg.setBounds(0, 0, 100, 30); posList = new JList(posListModel); - negList = new JList(negListModel); + posList.setName("pos"); + posList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + negList = new JList(negListModel); + negList.setName("neg"); + negList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); addToPosExamples = new JButton("pos"); addToNegExamples = new JButton("neg"); helpForPosExamples = new JButton("?"); @@ -276,7 +281,7 @@ if(negListModel.get(i).equals(example)) { negListModel.remove(i); for (int j = 0; j < model.getIndividualVector().size(); j++) { - if (model.getIndividualVector().get(j).getManchesterIndividual().equals(example)) { + if (model.getIndividualVector().get(j).getIndividualString().contains(example)) { model.getIndividualVector().get(j).setExamplePositive(true); break; } @@ -290,7 +295,7 @@ if(posListModel.get(i).equals(example)) { posListModel.remove(i); for (int j = 0; j < model.getIndividualVector().size(); j++) { - if (model.getIndividualVector().get(j).getManchesterIndividual().equals(example)) { + if (model.getIndividualVector().get(j).getIndividualString().contains(example)) { model.getIndividualVector().get(j).setExamplePositive(false); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -108,16 +108,16 @@ * @param m MouseEvent */ public void mouseClicked(MouseEvent m) { - if (panel.getPosExampleList().getSelectedValue() != null) { + if (!panel.getPosExampleList().isSelectionEmpty() && m.toString().contains("pos")) { panel.getAddToNegPanelButton().setEnabled(true); - } else { - panel.getAddToNegPanelButton().setEnabled(false); + panel.getAddToPosPanelButton().setEnabled(false); + panel.getNegExampleList().clearSelection(); } - if (panel.getNegExampleList().getSelectedValue()!= null) { + if (!panel.getNegExampleList().isSelectionEmpty() && m.toString().contains("neg")) { panel.getAddToPosPanelButton().setEnabled(true); - } else { - panel.getAddToPosPanelButton().setEnabled(false); - } + panel.getAddToNegPanelButton().setEnabled(false); + panel.getPosExampleList().clearSelection(); + } } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-11-16 19:20:34 UTC (rev 1518) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-11-18 18:05:10 UTC (rev 1519) @@ -25,6 +25,7 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; /** * This class is the panel for the suggest list. @@ -62,6 +63,7 @@ suggestScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); model = new DefaultListModel(); descriptions = new JList(model); + descriptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); suggestPanel = new JPanel(); descriptions.setVisible(true); suggestPanel.add(descriptions); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-16 19:20:38
|
Revision: 1518 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1518&view=rev Author: jenslehmann Date: 2008-11-16 19:20:34 +0000 (Sun, 16 Nov 2008) Log Message: ----------- - cardinality limit option - reasoner unit test extended - small fixes Modified Paths: -------------- trunk/examples/carcinogenesis/train.conf trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java Modified: trunk/examples/carcinogenesis/train.conf =================================================================== --- trunk/examples/carcinogenesis/train.conf 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/examples/carcinogenesis/train.conf 2008-11-16 19:20:34 UTC (rev 1518) @@ -1,15 +1,21 @@ import("carcinogenesis.owl"); -// store some settings to make the experiment reproducable in the future +// general setup reasoner = fastInstanceChecker; algorithm = refexamples; refexamples.noisePercentage = 32; refexamples.startClass = "http://dl-learner.org/carcinogenesis#Compound"; + +// search tree refexamples.writeSearchTree = false; refexamples.searchTreeFile = "log/carcinogenesis/searchTree.log"; + +// store some default settings to make the experiment reproducable in the future refexamples.negativeWeight = 0.8; -refexamples.startNodeBonus = 2.0; +refexamples.startNodeBonus = 1.0; refexamples.forceRefinementLengthIncrease = false; +refexamples.cardinalityLimit = 5; +refexamples.usePropernessChecks = false; +"http://dl-learner.org/carcinogenesis#d1" +"http://dl-learner.org/carcinogenesis#d10" Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -25,6 +25,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.utilities.owl.ConceptComparator; @@ -41,6 +42,8 @@ */ public class ExampleBasedNode { + private ExampleBasedROLComponentConfigurator configurator; + private static DecimalFormat df = new DecimalFormat(); // example based variables @@ -72,7 +75,8 @@ // a flag whether this could be a solution for a posonly learning problem private boolean isPosOnlyCandidate = true; - public ExampleBasedNode(Description concept) { + public ExampleBasedNode(ExampleBasedROLComponentConfigurator configurator, Description concept) { + this.configurator = configurator; this.concept = concept; horizontalExpansion = 0; isQualityEvaluated = false; @@ -165,7 +169,7 @@ ret += "acc:" + df.format(accuracy) + "% "; // comment this out to display the heuristic score with default parameters - double heuristicScore = MultiHeuristic.getNodeScore(this, nrOfPositiveExamples, nrOfNegativeExamples); + double heuristicScore = MultiHeuristic.getNodeScore(this, nrOfPositiveExamples, nrOfNegativeExamples, configurator); ret += "h:" +df.format(heuristicScore) + " "; int wrongPositives = nrOfPositiveExamples - coveredPositives.size(); @@ -188,7 +192,7 @@ ret += "<b>acc: " + df.format(accuracy) + "% </b>"; // comment this out to display the heuristic score with default parameters - double heuristicScore = MultiHeuristic.getNodeScore(this, nrOfPositiveExamples, nrOfNegativeExamples); + double heuristicScore = MultiHeuristic.getNodeScore(this, nrOfPositiveExamples, nrOfNegativeExamples, configurator); ret += "h:" +df.format(heuristicScore) + " "; int wrongPositives = nrOfPositiveExamples - coveredPositives.size(); @@ -212,7 +216,7 @@ ret += "acc:" + df.format(accuracy) + "% "; // comment this out to display the heuristic score with default parameters - double heuristicScore = MultiHeuristic.getNodeScore(this, nrOfPositiveExamples, nrOfNegativeExamples); + double heuristicScore = MultiHeuristic.getNodeScore(this, nrOfPositiveExamples, nrOfNegativeExamples, configurator); ret += "h:" +df.format(heuristicScore) + " "; int wrongPositives = nrOfPositiveExamples - coveredPositives.size(); Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -196,6 +196,7 @@ options.add(CommonConfigOptions.useHasValueConstructor()); options.add(CommonConfigOptions.valueFreqencyThreshold()); options.add(CommonConfigOptions.useCardinalityRestrictions()); + options.add(CommonConfigOptions.cardinalityLimit()); options.add(CommonConfigOptions.useNegation()); options.add(CommonConfigOptions.useBooleanDatatypes()); options.add(CommonConfigOptions.useDoubleDatatypes()); @@ -376,6 +377,7 @@ RhoDRDown operator = new RhoDRDown( reasoner, classHierarchy, + configurator, applyAllFilter, applyExistsFilter, useAllConstructor, @@ -392,6 +394,7 @@ // create an algorithm object and pass all configuration // options to it algorithm = new ExampleBasedROLearner( + configurator, learningProblem, reasoner, operator, Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -37,6 +37,7 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.Score; +import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.Intersection; @@ -73,6 +74,7 @@ public class ExampleBasedROLearner { private static Logger logger = Logger.getLogger(ExampleBasedROLearner.class); + private ExampleBasedROLComponentConfigurator configurator; // basic setup: learning problem and reasoning service private ReasonerComponent rs; @@ -232,6 +234,7 @@ private Map<String, String> prefixes; public ExampleBasedROLearner( + ExampleBasedROLComponentConfigurator configurator, LearningProblem learningProblem, ReasonerComponent rs, RefinementOperator operator, @@ -268,6 +271,7 @@ // nrOfNegativeExamples = lp.getPseudoNegatives().size(); nrOfNegativeExamples = 0; } + this.configurator = configurator; nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; this.rs = rs; this.operator = (RhoDRDown) operator; @@ -384,10 +388,10 @@ // start search with start class if (startDescription == null) { - startNode = new ExampleBasedNode(Thing.instance); + startNode = new ExampleBasedNode(configurator, Thing.instance); startNode.setCoveredExamples(positiveExamples, negativeExamples); } else { - startNode = new ExampleBasedNode(startDescription); + startNode = new ExampleBasedNode(configurator, startDescription); Set<Individual> coveredNegatives = rs.hasType(startDescription, negativeExamples); Set<Individual> coveredPositives = rs.hasType(startDescription, positiveExamples); startNode.setCoveredExamples(coveredPositives, coveredNegatives); @@ -673,7 +677,7 @@ properRefinements.add(refinement); tooWeakList.add(refinement); - ExampleBasedNode newNode = new ExampleBasedNode(refinement); + ExampleBasedNode newNode = new ExampleBasedNode(configurator, refinement); newNode.setHorizontalExpansion(refinement.getLength() - 1); newNode.setTooWeak(true); newNode @@ -763,7 +767,7 @@ if (nonRedundant) { // newly created node - ExampleBasedNode newNode = new ExampleBasedNode(refinement); + ExampleBasedNode newNode = new ExampleBasedNode(configurator, refinement); // die -1 ist wichtig, da sonst keine gleich langen Refinements // für den neuen Knoten erlaubt wären z.B. person => male newNode.setHorizontalExpansion(refinement.getLength() - 1); Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -69,6 +69,7 @@ public class MultiHeuristic implements ExampleBasedHeuristic { private ConceptComparator conceptComparator = new ConceptComparator(); +// private ExampleBasedROLComponentConfigurator configurator; // heuristic parameters private double expansionPenaltyFactor = 0.02; @@ -83,6 +84,7 @@ private int nrOfNegativeExamples; private int nrOfExamples; + @Deprecated public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples) { this.nrOfNegativeExamples = nrOfNegativeExamples; nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; @@ -92,10 +94,9 @@ public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples, ExampleBasedROLComponentConfigurator configurator) { this.nrOfNegativeExamples = nrOfNegativeExamples; nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; +// this.configurator = configurator; negativeWeight = configurator.getNegativeWeight(); startNodeBonus = configurator.getStartNodeBonus(); - System.out.println(negativeWeight); - System.out.println(startNodeBonus); } // public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples, double expansionPenaltyFactor, double gainBonusFactor) { @@ -141,8 +142,8 @@ return (coveredPositives + negativeWeight * (nrOfNegativeExamples - coveredNegatives))/(double)nrOfExamples; } - public static double getNodeScore(ExampleBasedNode node, int nrOfPositiveExamples, int nrOfNegativeExamples) { - MultiHeuristic multi = new MultiHeuristic(nrOfPositiveExamples, nrOfNegativeExamples); + public static double getNodeScore(ExampleBasedNode node, int nrOfPositiveExamples, int nrOfNegativeExamples, ExampleBasedROLComponentConfigurator configurator) { + MultiHeuristic multi = new MultiHeuristic(nrOfPositiveExamples, nrOfNegativeExamples, configurator); return multi.getNodeScore(node); } Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -601,8 +601,7 @@ SortedSet<Constant> values = e.getValue(); if (values.size() > 1) { logger.warn("Property " + datatypeProperty + " has more than one value " + e.getValue() - + " for individual " + e.getKey() + ". We ignore the value."); - // d135 + + " for individual " + e.getKey() + ". We ignore the value."); } else { if (values.first().getLiteral().equalsIgnoreCase("true")) { ret.add(e.getKey()); Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -241,6 +241,15 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "useCardinalityRestrictions") ; } /** +* cardinalityLimit Gives the maximum number used in cardinality restrictions.. +* mandatory: false| reinit necessary: true +* default value: 5 +* @return int +**/ +public int getCardinalityLimit() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "cardinalityLimit") ; +} +/** * useNegation specifies whether negation is used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true @@ -557,6 +566,15 @@ reinitNecessary = true; } /** +* @param cardinalityLimit Gives the maximum number used in cardinality restrictions.. +* mandatory: false| reinit necessary: true +* default value: 5 +**/ +public void setCardinalityLimit(int cardinalityLimit) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "cardinalityLimit", cardinalityLimit); +reinitNecessary = true; +} +/** * @param useNegation specifies whether negation is used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true Modified: trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -43,6 +43,7 @@ public static boolean useHasValueConstructorDefault = false; public static int valueFrequencyThresholdDefault = 3; public static boolean useCardinalityRestrictionsDefault = true; + public static int cardinalityLimitDefault = 5; public static boolean useNegationDefault = true; public static boolean useBooleanDatatypesDefault = true; public static boolean useDoubleDatatypesDefault = true; @@ -115,6 +116,10 @@ return new BooleanConfigOption("useCardinalityRestrictions", "specifies whether CardinalityRestrictions is used in the learning algorithm",useCardinalityRestrictionsDefault); } + public static IntegerConfigOption cardinalityLimit() { + return new IntegerConfigOption("cardinalityLimit", "Gives the maximum number used in cardinality restrictions.",cardinalityLimitDefault); + } + public static BooleanConfigOption useNegation() { return new BooleanConfigOption("useNegation", "specifies whether negation is used in the learning algorothm",useNegationDefault); } Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -35,6 +35,7 @@ import org.apache.log4j.Logger; import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.owl.BooleanValueRestriction; import org.dllearner.core.owl.DataRange; @@ -102,8 +103,7 @@ // limit for cardinality restrictions (this makes sense if we e.g. have compounds with up to // more than 200 atoms but we are only interested in atoms with certain characteristics and do // not want something like e.g. >= 204 hasAtom.NOT Carbon-87; which blows up the search space - //RBC - private int cardinalityLimit = 2; + private int cardinalityLimit = 5; // start concept (can be used to start from an arbitrary concept, needs // to be Thing or NamedClass), note that when you use e.g. Compound as @@ -182,14 +182,15 @@ // private Map<NamedClass,Map<NamedClass,Boolean>> notABMeaningful = new TreeMap<NamedClass,Map<NamedClass,Boolean>>(); public RhoDRDown(ReasonerComponent reasoningService) { - this(reasoningService, reasoningService.getClassHierarchy(), true, true, true, true, true, 3, true, true, true, true, null); +// this(reasoningService, reasoningService.getClassHierarchy(), null, true, true, true, true, true, 3, true, true, true, true, null); + this.rs = reasoningService; } // TODO constructor which takes a RhoDRDownConfigurator object; // this should be an interface implemented e.g. by ExampleBasedROLComponentConfigurator; // the goal is to use the configurator system while still being flexible enough to // use one refinement operator in several learning algorithms - public RhoDRDown(ReasonerComponent reasoningService, ClassHierarchy subHierarchy, boolean applyAllFilter, boolean applyExistsFilter, boolean useAllConstructor, + public RhoDRDown(ReasonerComponent reasoningService, ClassHierarchy subHierarchy, ExampleBasedROLComponentConfigurator configurator, boolean applyAllFilter, boolean applyExistsFilter, boolean useAllConstructor, boolean useExistsConstructor, boolean useHasValueConstructor, int valueFrequencyThreshold, boolean useCardinalityRestrictions,boolean useNegation, boolean useBooleanDatatypes, boolean useDoubleDatatypes, NamedClass startClass) { this.rs = reasoningService; this.subHierarchy = subHierarchy; @@ -200,6 +201,7 @@ this.useHasValueConstructor = useHasValueConstructor; this.frequencyThreshold = valueFrequencyThreshold; this.useCardinalityRestrictions = useCardinalityRestrictions; + cardinalityLimit = configurator.getCardinalityLimit(); this.useNegation = useNegation; this.useBooleanDatatypes = useBooleanDatatypes; this.useDoubleDatatypes = useDoubleDatatypes; Modified: trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-11-16 14:38:32 UTC (rev 1517) +++ trunk/src/dl-learner/org/dllearner/test/junit/ReasonerTests.java 2008-11-16 19:20:34 UTC (rev 1518) @@ -21,6 +21,9 @@ import static org.junit.Assert.assertTrue; +import java.io.File; +import java.net.MalformedURLException; +import java.util.LinkedList; import java.util.List; import org.apache.log4j.Logger; @@ -32,8 +35,10 @@ import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.KB; import org.dllearner.kb.KBFile; +import org.dllearner.kb.OWLFile; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; +import org.dllearner.reasoning.OWLAPIReasoner; import org.junit.Test; /** @@ -45,6 +50,8 @@ public class ReasonerTests { private static Logger logger = Logger.getLogger(ReasonerTests.class); + + private String baseURI; public KB getSimpleKnowledgeBase() { String kb = "person SUB TOP."; @@ -101,5 +108,65 @@ e.printStackTrace(); } } + + /** + * Test of fast instance check algorithm on carcinogenesis data set. + * @throws ComponentInitException + * @throws ParseException + */ + @Test + public void fastInstanceCheckTest() throws ComponentInitException, ParseException { + String file = "examples/carcinogenesis/carcinogenesis.owl"; + ComponentManager cm = ComponentManager.getInstance(); + KnowledgeSource ks = cm.knowledgeSource(OWLFile.class); + try { + cm.applyConfigEntry(ks, "url", new File(file).toURI().toURL()); + } catch (MalformedURLException e) { + // should never happen + e.printStackTrace(); + } + ks.init(); + ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); + reasoner.init(); + baseURI = reasoner.getBaseURI(); + + List<Description> testDescriptions = new LinkedList<Description>(); + List<List<Individual>> posIndividuals = new LinkedList<List<Individual>>(); + List<List<Individual>> negIndividuals = new LinkedList<List<Individual>>(); + + // TODO manually verify that the results are indeed correct + testDescriptions.add(KBParser.parseConcept("\"http://dl-learner.org/carcinogenesis#Compound\" AND (\"http://dl-learner.org/carcinogenesis#amesTestPositive\" = true OR >= 2 \"http://dl-learner.org/carcinogenesis#hasStructure\" \"http://dl-learner.org/carcinogenesis#Ar_halide\"))")); + posIndividuals.add(getIndSet("d113","d133","d171","d262","d265","d294","d68","d77","d79")); + negIndividuals.add(getIndSet("d139","d199","d202","d203","d283","d42")); + // TODO add more descriptions and instances + + // make the specified assertions + for(int i=0; i<testDescriptions.size(); i++) { + Description description = testDescriptions.get(i); + List<Individual> pos = posIndividuals.get(i); + List<Individual> neg = negIndividuals.get(i); + + for(Individual ind : pos) { + assertTrue(reasoner.hasType(description, ind)); + } + + for(Individual ind : neg) { + assertTrue(!reasoner.hasType(description, ind)); + } + } + } + + private List<Individual> getIndSet(String... inds) { + List<Individual> individuals = new LinkedList<Individual>(); + for(String ind : inds) { + individuals.add(new Individual(uri(ind))); + } + return individuals; + } + + private String uri(String name) { + return "\""+baseURI+name+"\""; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-16 14:38:37
|
Revision: 1517 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1517&view=rev Author: heeroyuy Date: 2008-11-16 14:38:32 +0000 (Sun, 16 Nov 2008) Log Message: ----------- -some small changes -some changes in GUI 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/MoreDetailForSuggestedConceptsPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-15 08:43:53 UTC (rev 1516) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-16 14:38:32 UTC (rev 1517) @@ -41,6 +41,7 @@ import javax.swing.event.ListSelectionListener; import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; import org.protege.editor.owl.OWLEditorKit; @@ -64,11 +65,12 @@ // 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 - private Thread dlLearner; private EvaluatedDescription evaluatedDescription; // This is the view of the DL-Learner tab. private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; private Timer timer; + private LearningAlgorithm la; + private SuggestionRetriever retriever; /** * This is the constructor for the action handler. @@ -107,10 +109,15 @@ if (model.getAlreadyLearned()) { model.unsetListModel(); } + model.setKnowledgeSource(); + model.setReasoner(); + model.setPositiveAndNegativeExamples(); + model.setLearningProblem(); + model.setLearningAlgorithm(); view.getRunButton().setEnabled(false); view.renderErrorMessage("Learning started"); view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); - final SuggestionRetriever retriever = new SuggestionRetriever(); + retriever = new SuggestionRetriever(); // // dlLearner.start(); retriever.execute(); @@ -263,7 +270,7 @@ * Destroys the Thread after the Pluigin is closed. */ public void destroyDLLearnerThread() { - dlLearner = null; + //dlLearner = null; } /** @@ -290,40 +297,51 @@ // TODO Auto-generated method stub } - +/** + * Inner Class that retrieves the concepts given by the DL-Learner. + * @author Christian Koetteritzsch + * + */ class SuggestionRetriever extends SwingWorker<List<EvaluatedDescription>, List<EvaluatedDescription>> { - + + private Thread dlLearner; + /** + * Constructor for the SuggestionRetriever. + */ public SuggestionRetriever() { } - + @SuppressWarnings("unchecked") @Override protected List<EvaluatedDescription> doInBackground() throws Exception { // DefaultListModel descriptions = new DefaultListModel(); // List<Description> descriptionList = // model.getLearningAlgorithm().getCurrentlyBestDescriptions(); // Iterator<Description> it = descriptionList.iterator(); + la = model.getLearningAlgorithm(); timer = new Timer(); - timer.schedule(new TimerTask() { - - @SuppressWarnings("unchecked") + timer.schedule(new TimerTask(){ + @Override public void run() { - if (model.getLearningAlgorithm() != null) { - publish(model.getLearningAlgorithm() - .getCurrentlyBestEvaluatedDescriptions(30, 0.0, - true)); + if (la != null) { + + publish(la + .getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel() + .getNrOfConcepts(), + view.getPosAndNegSelectPanel().getOptionPanel() + .getMinAccuracy(), true)); } } - }, 1000, 2000); + }, 0, 100); dlLearner = new Thread(new Runnable() { @Override public void run() { - + model.run(); } @@ -336,14 +354,12 @@ // TODO Auto-generated catch block e.printStackTrace(); } - List<EvaluatedDescription> result = model.getLearningAlgorithm() - .getCurrentlyBestEvaluatedDescriptions( + List<EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions( view.getPosAndNegSelectPanel().getOptionPanel() .getNrOfConcepts(), view.getPosAndNegSelectPanel().getOptionPanel() .getMinAccuracy(), true); - return result; } @@ -367,7 +383,6 @@ @Override protected void process(List<List<EvaluatedDescription>> resultLists) { - // panel4.getModel().clear(); for (List<EvaluatedDescription> list : resultLists) { updateList(list); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-15 08:43:53 UTC (rev 1516) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-16 14:38:32 UTC (rev 1517) @@ -20,7 +20,6 @@ package org.dllearner.tools.protege; -import java.awt.Color; import java.net.URI; import java.util.HashSet; import java.util.Iterator; @@ -243,25 +242,6 @@ } /** - * This method adds the solutions from the DL-Learner to the List Model. - */ - private void addToListModel() { - - evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true); - for (int j = 0; j < evalDescriptions.size(); j++) { - if (isConsistent(evalDescriptions.get(j))) { - suggestModel.add(j, new SuggestListItem(Color.GREEN, - evalDescriptions.get(j).getDescription() - .toManchesterSyntaxString(ontologyURI, prefixes))); - } else { - suggestModel.add(j, new SuggestListItem(Color.RED, - evalDescriptions.get(j).getDescription() - .toManchesterSyntaxString(ontologyURI, prefixes))); - } - } - } - - /** * This method checks which positive and negative examples are checked and * puts the checked examples into a tree set. */ @@ -385,11 +365,6 @@ */ public void run() { error = "Learning succesful"; - setKnowledgeSource(); - setReasoner(); - setPositiveAndNegativeExamples(); - setLearningProblem(); - setLearningAlgorithm(); String message = "To view details about why a class description was suggested, please doubleclick on it."; // start the algorithm and print the best concept found la.start(); @@ -766,7 +741,13 @@ public boolean getAlreadyLearned() { return alreadyLearned; } - + + /** + * 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 (eDescription.getNotCoveredPositives().isEmpty()) { @@ -786,6 +767,10 @@ return editor.getModelManager().getActiveOntology().getURI(); } + /** + * This method sets the suggestion list. + * @param list List(EvaluatedDescription) + */ public void setSuggestList(List<EvaluatedDescription> list) { evalDescriptions = list; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-15 08:43:53 UTC (rev 1516) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-16 14:38:32 UTC (rev 1517) @@ -19,10 +19,10 @@ */ package org.dllearner.tools.protege; import java.awt.Color; +import java.awt.Dimension; import java.awt.GridLayout; import java.util.Iterator; -import javax.swing.Box; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; @@ -93,8 +93,10 @@ // Scroll pane if scroll bar is necessary to show all covered examples - private JScrollPane detailScroll; - + private JScrollPane posCoveredScroll; + private JScrollPane posNotCoveredScroll; + private JScrollPane negCoveredScroll; + private JScrollPane negNotCoveredScroll; // Evaluated description of the selected concept private JPanel conceptPanel; private JPanel accuracyPanel; @@ -112,6 +114,9 @@ * @param model DLLearnerModel */ public MoreDetailForSuggestedConceptsPanel(DLLearnerModel model) { + super(); + setLayout(null); + setPreferredSize(new Dimension(600, 500)); this.model = model; @@ -130,22 +135,36 @@ * @param desc selected description */ public void renderDetailPanel(EvaluatedDescription desc) { + posCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + posCoveredScroll.setBounds(5, 150, 280, 140); + posNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + posNotCoveredScroll.setBounds(300, 150, 280, 140); + negCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + negCoveredScroll.setBounds(5, 325, 280, 140); + negNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + negNotCoveredScroll.setBounds(300, 325, 280, 140); eval = desc; - JPanel posBox = new JPanel(new GridLayout(0, 2)); - JPanel negBox = new JPanel(new GridLayout(0, 2)); - Box exampleBox = Box.createVerticalBox(); concept = new JTextArea("Class Description:"); concept.setEditable(false); + coveredPositiveExamples = new JLabel("Covered Positive Examples:"); coveredPositiveExamples.setForeground(colorGreen); + coveredPositiveExamples.setBounds(5, 110, 280, 30); notCoveredPositiveExamples = new JLabel("Not Covered Positive Examples"); notCoveredPositiveExamples.setForeground(colorRed); + notCoveredPositiveExamples.setBounds(300, 110, 280, 30); coveredNegativeExamples = new JLabel("Covered Negative Examples:"); coveredNegativeExamples.setForeground(colorRed); + coveredNegativeExamples.setBounds(5, 295, 280, 30); notCoveredNegativeExamples = new JLabel("Not Covered Negative Examples"); notCoveredNegativeExamples.setForeground(colorGreen); + notCoveredNegativeExamples.setBounds(300, 295, 280, 30); + conceptPanel = new JPanel(new GridLayout(0, 1)); + conceptPanel.setBounds(5, 0, 600, 50); accuracyPanel = new JPanel(new GridLayout(0, 1)); + accuracyPanel.setBounds(5, 60, 600, 50); + posCoveredPanel = new JPanel(new GridLayout(0, 1)); posNotCoveredPanel = new JPanel(new GridLayout(0, 1)); negCoveredPanel = new JPanel(new GridLayout(0, 1)); @@ -178,12 +197,11 @@ setInformation(); detailPopup = new JDialog(); - detailPopup.setSize(400, 400); + detailPopup.setSize(600, 500); //window will be disposed if the x button is pressed detailPopup.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); detailPopup.setVisible(true); - detailPopup.setResizable(true); - detailScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + detailPopup.setResizable(false); //adds all information to the example panel conceptPanel.add(concept); conceptPanel.add(conceptText); @@ -191,16 +209,22 @@ accuracyPanel.add(accuracy); accuracyPanel.add(accuracyText); - exampleBox.add(conceptPanel); - exampleBox.add(accuracyPanel); - posBox.add(posCoveredPanel); - posBox.add(posNotCoveredPanel); - negBox.add(negCoveredPanel); - negBox.add(negNotCoveredPanel); - exampleBox.add(posBox); - exampleBox.add(negBox); - detailScroll.setViewportView(exampleBox); - detailPopup.add(detailScroll); + posCoveredScroll.setViewportView(posCoveredPanel); + posNotCoveredScroll.setViewportView(posNotCoveredPanel); + negCoveredScroll.setViewportView(negCoveredPanel); + negNotCoveredScroll.setViewportView(negNotCoveredPanel); + + add(conceptPanel); + add(accuracyPanel); + add(coveredPositiveExamples); + add(notCoveredPositiveExamples); + add(coveredNegativeExamples); + add(notCoveredNegativeExamples); + add(posCoveredScroll); + add(posNotCoveredScroll); + add(negCoveredScroll); + add(negNotCoveredScroll); + detailPopup.add(this); } /** * This method sets the Informations of the selected description. @@ -211,11 +235,6 @@ conceptText.append(eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null)); double acc = (eval.getAccuracy())*100; accuracyText.append(String.valueOf(acc)+"%"); - //sets the positive examples that are covered - posCoveredPanel.add(coveredPositiveExamples); - posNotCoveredPanel.add(notCoveredPositiveExamples); - negCoveredPanel.add(coveredNegativeExamples); - negNotCoveredPanel.add(notCoveredNegativeExamples); for(Iterator<Individual> i = eval.getCoveredPositives().iterator(); i.hasNext();) { JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); posLabel.setForeground(colorGreen); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-15 08:43:57
|
Revision: 1516 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1516&view=rev Author: jenslehmann Date: 2008-11-15 08:43:53 +0000 (Sat, 15 Nov 2008) Log Message: ----------- added two more parameters to learning algorithm Modified Paths: -------------- trunk/examples/carcinogenesis/train.conf trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java Modified: trunk/examples/carcinogenesis/train.conf =================================================================== --- trunk/examples/carcinogenesis/train.conf 2008-11-14 16:55:52 UTC (rev 1515) +++ trunk/examples/carcinogenesis/train.conf 2008-11-15 08:43:53 UTC (rev 1516) @@ -1,12 +1,15 @@ import("carcinogenesis.owl"); +// store some settings to make the experiment reproducable in the future reasoner = fastInstanceChecker; algorithm = refexamples; -// refexamples.noisePercentage = 28; refexamples.noisePercentage = 32; refexamples.startClass = "http://dl-learner.org/carcinogenesis#Compound"; refexamples.writeSearchTree = false; refexamples.searchTreeFile = "log/carcinogenesis/searchTree.log"; +refexamples.negativeWeight = 0.8; +refexamples.startNodeBonus = 2.0; +refexamples.forceRefinementLengthIncrease = false; +"http://dl-learner.org/carcinogenesis#d1" +"http://dl-learner.org/carcinogenesis#d10" Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-14 16:55:52 UTC (rev 1515) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-15 08:43:53 UTC (rev 1516) @@ -213,6 +213,8 @@ options.add(noisePercentage); options.add(new StringConfigOption("startClass", "the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)")); options.add(new BooleanConfigOption("forceRefinementLengthIncrease", "specifies whether nodes should be expanded until only longer refinements are reached")); + options.add(new DoubleConfigOption("negativeWeight", "Used to penalise errors on negative examples different from those of positive examples (lower = less importance for negatives).",1.0)); + options.add(new DoubleConfigOption("startNodeBonus", "You can use this to give a heuristic bonus on the start node (= initially broader exploration of search space).",0.0)); return options; } @@ -328,9 +330,9 @@ } else { if(learningProblem instanceof PosOnlyLP) { // throw new RuntimeException("does not work with positive examples only yet"); - algHeuristic = new MultiHeuristic(((PosOnlyLP)learningProblem).getPositiveExamples().size(),0); + algHeuristic = new MultiHeuristic(((PosOnlyLP)learningProblem).getPositiveExamples().size(),0, configurator); } else { - algHeuristic = new MultiHeuristic(((PosNegLP)learningProblem).getPositiveExamples().size(),((PosNegLP)learningProblem).getNegativeExamples().size()); + algHeuristic = new MultiHeuristic(((PosNegLP)learningProblem).getPositiveExamples().size(),((PosNegLP)learningProblem).getNegativeExamples().size(), configurator); } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-11-14 16:55:52 UTC (rev 1515) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-11-15 08:43:53 UTC (rev 1516) @@ -405,9 +405,9 @@ long lastPrintTime = 0; long lastTreeTraversalTime = System.nanoTime(); long lastReductionTime = System.nanoTime(); - // try a traversal after 100 seconds + // try a traversal after x seconds long traversalInterval = 300l * 1000000000l; - long reductionInterval = 500l * 1000000000l; + long reductionInterval = 300l * 1000000000l; long currentTime; while (!solutionFound && !stop) { Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java 2008-11-14 16:55:52 UTC (rev 1515) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java 2008-11-15 08:43:53 UTC (rev 1516) @@ -21,6 +21,7 @@ import java.util.List; +import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator; import org.dllearner.core.owl.DatatypeSomeRestriction; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Thing; @@ -70,8 +71,8 @@ private ConceptComparator conceptComparator = new ConceptComparator(); // heuristic parameters - private double expansionPenaltyFactor; - private double gainBonusFactor; + private double expansionPenaltyFactor = 0.02; + private double gainBonusFactor = 0.5; private double nodeChildPenalty = 0.0001; // (use higher values than 0.0001 for simple learning problems); private double startNodeBonus = 0.1; //was 2.0 // penalise errors on positive examples harder than on negative examples @@ -83,16 +84,28 @@ private int nrOfExamples; public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples) { - this(nrOfPositiveExamples, nrOfNegativeExamples, 0.02, 0.5); + this.nrOfNegativeExamples = nrOfNegativeExamples; + nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; +// this(nrOfPositiveExamples, nrOfNegativeExamples, 0.02, 0.5); } - public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples, double expansionPenaltyFactor, double gainBonusFactor) { + public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples, ExampleBasedROLComponentConfigurator configurator) { this.nrOfNegativeExamples = nrOfNegativeExamples; nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; - this.expansionPenaltyFactor = expansionPenaltyFactor; - this.gainBonusFactor = gainBonusFactor; + negativeWeight = configurator.getNegativeWeight(); + startNodeBonus = configurator.getStartNodeBonus(); + System.out.println(negativeWeight); + System.out.println(startNodeBonus); } +// public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples, double expansionPenaltyFactor, double gainBonusFactor) { +// this.nrOfNegativeExamples = nrOfNegativeExamples; +// nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; +// this.expansionPenaltyFactor = expansionPenaltyFactor; +// this.gainBonusFactor = gainBonusFactor; +// } + + /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ @@ -141,7 +154,7 @@ // do not count TOP symbols (in particular in ALL r.TOP and EXISTS r.TOP) // as they provide no extra information if(description instanceof Thing) - bonus = 2; + bonus = 1; //2; // if(description instanceof BooleanValueRestriction) // bonus = -1; @@ -149,7 +162,7 @@ // some bonus for doubles because they are already penalised by length 3 if(description instanceof DatatypeSomeRestriction) { // System.out.println(description); - bonus = 2; + bonus = 3; //2; } List<Description> children = description.getChildren(); Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-11-14 16:55:52 UTC (rev 1515) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-11-15 08:43:53 UTC (rev 1516) @@ -357,6 +357,24 @@ public boolean getForceRefinementLengthIncrease() { return (Boolean) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "forceRefinementLengthIncrease") ; } +/** +* negativeWeight Used to penalise errors on negative examples different from those of positive examples (lower = less importance for negatives).. +* mandatory: false| reinit necessary: true +* default value: 1.0 +* @return double +**/ +public double getNegativeWeight() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "negativeWeight") ; +} +/** +* startNodeBonus You can use this to give a heuristic bonus on the start node (= initially broader exploration of search space).. +* mandatory: false| reinit necessary: true +* default value: 0.0 +* @return double +**/ +public double getStartNodeBonus() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "startNodeBonus") ; +} /** * @param writeSearchTree specifies whether to write a search tree. @@ -655,6 +673,24 @@ ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "forceRefinementLengthIncrease", forceRefinementLengthIncrease); reinitNecessary = true; } +/** +* @param negativeWeight Used to penalise errors on negative examples different from those of positive examples (lower = less importance for negatives).. +* mandatory: false| reinit necessary: true +* default value: 1.0 +**/ +public void setNegativeWeight(double negativeWeight) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "negativeWeight", negativeWeight); +reinitNecessary = true; +} +/** +* @param startNodeBonus You can use this to give a heuristic bonus on the start node (= initially broader exploration of search space).. +* mandatory: false| reinit necessary: true +* default value: 0.0 +**/ +public void setStartNodeBonus(double startNodeBonus) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "startNodeBonus", startNodeBonus); +reinitNecessary = true; +} /** * true, if this component needs reinitializsation. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-14 16:56:03
|
Revision: 1515 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1515&view=rev Author: jenslehmann Date: 2008-11-14 16:55:52 +0000 (Fri, 14 Nov 2008) Log Message: ----------- - data type property hierarchy support now also moved to reasoner component - some small improvements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-14 15:09:11 UTC (rev 1514) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-14 16:55:52 UTC (rev 1515) @@ -600,8 +600,9 @@ for (Entry<Individual, SortedSet<Constant>> e : mapping.entrySet()) { SortedSet<Constant> values = e.getValue(); if (values.size() > 1) { - logger.warn("Property " + datatypeProperty + " has value " + e.getValue() - + ". Cannot determine whether it is true."); + logger.warn("Property " + datatypeProperty + " has more than one value " + e.getValue() + + " for individual " + e.getKey() + ". We ignore the value."); + // d135 } else { if (values.first().getLiteral().equalsIgnoreCase("true")) { ret.add(e.getKey()); @@ -822,11 +823,19 @@ return getDatatypePropertyHierarchy().getMoreGeneralRoles(role); } + protected SortedSet<DatatypeProperty> getSuperPropertiesImpl(DatatypeProperty role) throws ReasoningMethodUnsupportedException { + throw new ReasoningMethodUnsupportedException(); + } + @Override public final SortedSet<DatatypeProperty> getSubProperties(DatatypeProperty role) { return getDatatypePropertyHierarchy().getMoreSpecialRoles(role); } + protected SortedSet<DatatypeProperty> getSubPropertiesImpl(DatatypeProperty role) throws ReasoningMethodUnsupportedException { + throw new ReasoningMethodUnsupportedException(); + } + @Override public final TreeSet<DatatypeProperty> getMostGeneralDatatypeProperties() { return getDatatypePropertyHierarchy().getMostGeneralRoles(); @@ -914,7 +923,6 @@ TreeMap<ObjectProperty, SortedSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, SortedSet<ObjectProperty>>( roleComparator); - // refinement of atomic concepts Set<ObjectProperty> atomicRoles = getObjectProperties(); for (ObjectProperty role : atomicRoles) { roleHierarchyDown.put(role, getSubPropertiesImpl(role)); @@ -951,16 +959,29 @@ */ public DatatypePropertyHierarchy prepareDatatypePropertyHierarchy() throws ReasoningMethodUnsupportedException { - throw new ReasoningMethodUnsupportedException( - "Datatype property hierarchy creation not supported by this reasoner."); + + RoleComparator roleComparator = new RoleComparator(); + TreeMap<DatatypeProperty, SortedSet<DatatypeProperty>> datatypePropertyHierarchyUp = new TreeMap<DatatypeProperty, SortedSet<DatatypeProperty>>( + roleComparator); + TreeMap<DatatypeProperty, SortedSet<DatatypeProperty>> datatypePropertyHierarchyDown = new TreeMap<DatatypeProperty, SortedSet<DatatypeProperty>>( + roleComparator); + + Set<DatatypeProperty> datatypeProperties = getDatatypeProperties(); + for (DatatypeProperty role : datatypeProperties) { + datatypePropertyHierarchyDown.put(role, getSubPropertiesImpl(role)); + datatypePropertyHierarchyUp.put(role, getSuperPropertiesImpl(role)); + } + + return new DatatypePropertyHierarchy(datatypeProperties, datatypePropertyHierarchyUp, + datatypePropertyHierarchyDown); } @Override public final DatatypePropertyHierarchy getDatatypePropertyHierarchy() { - + try { if (datatypePropertyHierarchy == null) { - prepareDatatypePropertyHierarchy(); + datatypePropertyHierarchy = prepareDatatypePropertyHierarchy(); } } catch (ReasoningMethodUnsupportedException e) { handleExceptions(e); Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyHierarchy.java 2008-11-14 15:09:11 UTC (rev 1514) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypePropertyHierarchy.java 2008-11-14 16:55:52 UTC (rev 1515) @@ -38,12 +38,12 @@ public class DatatypePropertyHierarchy { RoleComparator rc = new RoleComparator(); - TreeMap<DatatypeProperty,TreeSet<DatatypeProperty>> roleHierarchyUp; - TreeMap<DatatypeProperty,TreeSet<DatatypeProperty>> roleHierarchyDown; + TreeMap<DatatypeProperty,SortedSet<DatatypeProperty>> roleHierarchyUp; + TreeMap<DatatypeProperty,SortedSet<DatatypeProperty>> roleHierarchyDown; TreeSet<DatatypeProperty> mostGeneralRoles = new TreeSet<DatatypeProperty>(rc); TreeSet<DatatypeProperty> mostSpecialRoles = new TreeSet<DatatypeProperty>(rc); - public DatatypePropertyHierarchy(Set<DatatypeProperty> atomicRoles, TreeMap<DatatypeProperty,TreeSet<DatatypeProperty>> roleHierarchyUp , TreeMap<DatatypeProperty,TreeSet<DatatypeProperty>> roleHierarchyDown) { + public DatatypePropertyHierarchy(Set<DatatypeProperty> atomicRoles, TreeMap<DatatypeProperty,SortedSet<DatatypeProperty>> roleHierarchyUp , TreeMap<DatatypeProperty,SortedSet<DatatypeProperty>> roleHierarchyDown) { this.roleHierarchyUp = roleHierarchyUp; this.roleHierarchyDown = roleHierarchyDown; @@ -56,20 +56,16 @@ } } - @SuppressWarnings("unchecked") public SortedSet<DatatypeProperty> getMoreGeneralRoles(DatatypeProperty role) { // we clone all concepts before returning them such that they cannot be // modified externally - return (TreeSet<DatatypeProperty>) roleHierarchyUp.get(role).clone(); + return new TreeSet<DatatypeProperty>(roleHierarchyUp.get(role)); } - @SuppressWarnings("unchecked") public SortedSet<DatatypeProperty> getMoreSpecialRoles(DatatypeProperty role) { - return (TreeSet<DatatypeProperty>) roleHierarchyDown.get(role).clone(); - } + return new TreeSet<DatatypeProperty>(roleHierarchyDown.get(role)); + } - - @Override public String toString() { String str = ""; @@ -79,7 +75,7 @@ return str; } - private String toString(TreeMap<DatatypeProperty,TreeSet<DatatypeProperty>> hierarchy, DatatypeProperty role, int depth) { + private String toString(TreeMap<DatatypeProperty,SortedSet<DatatypeProperty>> hierarchy, DatatypeProperty role, int depth) { String str = ""; for(int i=0; i<depth; i++) str += " "; Modified: trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java 2008-11-14 15:09:11 UTC (rev 1514) +++ trunk/src/dl-learner/org/dllearner/core/owl/TypedConstant.java 2008-11-14 16:55:52 UTC (rev 1515) @@ -82,5 +82,10 @@ } else return datatypeComparision; } + + @Override + public String toString() { + return literal + "^^" + datatype; + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java 2008-11-14 15:09:11 UTC (rev 1514) +++ trunk/src/dl-learner/org/dllearner/core/owl/UntypedConstant.java 2008-11-14 16:55:52 UTC (rev 1515) @@ -89,4 +89,13 @@ public void accept(KBElementVisitor visitor) { visitor.visit(this); } + + @Override + public String toString() { + if(hasLang) { + return literal + "@" + lang; + } else { + return literal; + } + } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-11-14 15:09:11 UTC (rev 1514) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-11-14 16:55:52 UTC (rev 1515) @@ -498,12 +498,6 @@ return atomicConcepts; } -// @Override -// public Map<Individual, SortedSet<Double>> getDoubleDatatypeMembersImpl( -// DatatypeProperty datatypeProperty) { -// return rc.getDoubleDatatypeMembers(datatypeProperty); -// } - /* * (non-Javadoc) * @@ -554,6 +548,16 @@ return rc.getSubPropertiesImpl(role); } + @Override + protected SortedSet<DatatypeProperty> getSuperPropertiesImpl(DatatypeProperty role) throws ReasoningMethodUnsupportedException { + return rc.getSuperPropertiesImpl(role); + } + + @Override + protected SortedSet<DatatypeProperty> getSubPropertiesImpl(DatatypeProperty role) throws ReasoningMethodUnsupportedException { + return rc.getSubPropertiesImpl(role); + } + /* * (non-Javadoc) * @@ -676,6 +680,28 @@ } @Override + public final SortedSet<Individual> getTrueDatatypeMembersImpl(DatatypeProperty datatypeProperty) { + return bdPos.get(datatypeProperty); + } + + @Override + public final SortedSet<Individual> getFalseDatatypeMembersImpl(DatatypeProperty datatypeProperty) { + return bdNeg.get(datatypeProperty); + } + + @Override + public Map<Individual, SortedSet<Integer>> getIntDatatypeMembersImpl( + DatatypeProperty datatypeProperty) { + return id.get(datatypeProperty); + } + + @Override + public Map<Individual, SortedSet<Double>> getDoubleDatatypeMembersImpl( + DatatypeProperty datatypeProperty) { + return dd.get(datatypeProperty); + } + + @Override public Set<Individual> getRelatedIndividualsImpl(Individual individual, ObjectProperty objectProperty) throws ReasoningMethodUnsupportedException { return rc.getRelatedIndividuals(individual, objectProperty); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-14 15:09:11 UTC (rev 1514) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-14 16:55:52 UTC (rev 1515) @@ -452,23 +452,23 @@ // return roleHierarchy; // } - public void prepareDatatypePropertyHierarchyImpl(Set<DatatypeProperty> allowedRoles) { - // code copied from DIG reasoner - - TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>> datatypePropertyHierarchyUp = new TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>>( - roleComparator); - TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>> datatypePropertyHierarchyDown = new TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>>( - roleComparator); - - // refinement of atomic concepts - for (DatatypeProperty role : datatypeProperties) { - datatypePropertyHierarchyDown.put(role, getMoreSpecialDatatypePropertiesImpl(role)); - datatypePropertyHierarchyUp.put(role, getMoreGeneralDatatypePropertiesImpl(role)); - } - - datatypePropertyHierarchy = new DatatypePropertyHierarchy(allowedRoles, datatypePropertyHierarchyUp, - datatypePropertyHierarchyDown); - } +// public void prepareDatatypePropertyHierarchyImpl(Set<DatatypeProperty> allowedRoles) { +// // code copied from DIG reasoner +// +// TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>> datatypePropertyHierarchyUp = new TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>>( +// roleComparator); +// TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>> datatypePropertyHierarchyDown = new TreeMap<DatatypeProperty, TreeSet<DatatypeProperty>>( +// roleComparator); +// +// // refinement of atomic concepts +// for (DatatypeProperty role : datatypeProperties) { +// datatypePropertyHierarchyDown.put(role, getMoreSpecialDatatypePropertiesImpl(role)); +// datatypePropertyHierarchyUp.put(role, getMoreGeneralDatatypePropertiesImpl(role)); +// } +// +// datatypePropertyHierarchy = new DatatypePropertyHierarchy(allowedRoles, datatypePropertyHierarchyUp, +// datatypePropertyHierarchyDown); +// } // @Override // public DatatypePropertyHierarchy getDatatypePropertyHierarchy() { @@ -533,7 +533,8 @@ return getFirstObjectProperties(properties); } - private TreeSet<DatatypeProperty> getMoreGeneralDatatypePropertiesImpl(DatatypeProperty role) { + @Override + protected TreeSet<DatatypeProperty> getSuperPropertiesImpl(DatatypeProperty role) { Set<Set<OWLDataProperty>> properties; try { properties = reasoner.getSuperProperties(OWLAPIConverter.getOWLAPIDataProperty(role)); @@ -544,7 +545,8 @@ return getFirstDatatypeProperties(properties); } - private TreeSet<DatatypeProperty> getMoreSpecialDatatypePropertiesImpl(DatatypeProperty role) { + @Override + protected TreeSet<DatatypeProperty> getSubPropertiesImpl(DatatypeProperty role) { Set<Set<OWLDataProperty>> properties; try { properties = reasoner.getSubProperties(OWLAPIConverter.getOWLAPIDataProperty(role)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-14 15:09:18
|
Revision: 1514 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1514&view=rev Author: jenslehmann Date: 2008-11-14 15:09:11 +0000 (Fri, 14 Nov 2008) Log Message: ----------- started class for detecting relevant entities at a certain position in a class description for a given individual Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/junit/UtilitiesTests.java trunk/src/dl-learner/org/dllearner/utilities/learn/UsedEntitiesDetection.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java 2008-11-14 15:04:06 UTC (rev 1513) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java 2008-11-14 15:09:11 UTC (rev 1514) @@ -22,8 +22,6 @@ import java.util.LinkedList; import java.util.List; -import org.dllearner.algorithms.refinement.Node; - /** * A node in the search tree of an EL algorithm. * Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-11-14 15:04:06 UTC (rev 1513) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-11-14 15:09:11 UTC (rev 1514) @@ -681,6 +681,11 @@ } @Override + protected Map<ObjectProperty,Set<Individual>> getObjectPropertyRelationshipsImpl(Individual individual) { + return rc.getObjectPropertyRelationships(individual); + } + + @Override public Set<Constant> getRelatedValuesImpl(Individual individual, DatatypeProperty datatypeProperty) throws ReasoningMethodUnsupportedException { return rc.getRelatedValues(individual, datatypeProperty); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-14 15:04:06 UTC (rev 1513) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-14 15:09:11 UTC (rev 1514) @@ -41,7 +41,6 @@ import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; -import org.dllearner.core.ReasoningMethodUnsupportedException; import org.dllearner.core.configurators.OWLAPIReasonerConfigurator; import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.ConfigOption; Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-11-14 15:04:06 UTC (rev 1513) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-11-14 15:09:11 UTC (rev 1514) @@ -36,7 +36,7 @@ */ public final class TestOntologies { - public enum TestOntology { EMPTY, SIMPLE, SIMPLE2, R1SUBR2 }; + public enum TestOntology { EMPTY, SIMPLE, SIMPLE2, R1SUBR2, DATA1 }; public static ReasonerComponent getTestOntology(TestOntology ont) { String kbString = ""; @@ -59,6 +59,14 @@ kbString += "a2 SUB a4"; } else if(ont.equals(TestOntology.R1SUBR2)) { kbString += "Subrole(r1,r2).\n"; + } else if(ont.equals(TestOntology.DATA1)) { + kbString += "man SUB person.\n"; + kbString += "woman SUB person.\n"; + kbString += "man(eric).\n"; + kbString += "woman(diana).\n"; + kbString += "married(eric,diana).\n"; + kbString += "hasChild(eric,frank).\n"; + kbString += "hasChild(eric,tim).\n"; } try { Added: trunk/src/dl-learner/org/dllearner/test/junit/UtilitiesTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/UtilitiesTests.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/junit/UtilitiesTests.java 2008-11-14 15:09:11 UTC (rev 1514) @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.test.junit; + +import java.util.Set; +import java.util.TreeSet; + +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.owl.Individual; +import org.dllearner.test.junit.TestOntologies.TestOntology; +import org.dllearner.utilities.learn.UsedEntitiesDetection; +import org.junit.Test; + +/** + * Various tests for methods/classes in the utilities package. + * + * @author Jens Lehmann + * + */ +public class UtilitiesTests { + + @Test + public void entityDetection() { + ReasonerComponent reasoner = TestOntologies.getTestOntology(TestOntology.DATA1); + int maxDepth = 2; + Set<Individual> individuals = new TreeSet<Individual>(); + individuals.add(new Individual("http://localhost/foo#tim")); + UsedEntitiesDetection detection = new UsedEntitiesDetection(reasoner, individuals, maxDepth); + System.out.println(detection); + } + +} Added: trunk/src/dl-learner/org/dllearner/utilities/learn/UsedEntitiesDetection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/learn/UsedEntitiesDetection.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/learn/UsedEntitiesDetection.java 2008-11-14 15:09:11 UTC (rev 1514) @@ -0,0 +1,175 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.utilities.learn; + +import java.util.Comparator; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; +import java.util.Map.Entry; + +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; + +/** + * This class takes a reasoner and individuals as input and detects + * the relevant (wrt. a learning process) classes and properties + * at a certain distance of the examples. + * + * @author Jens Lehmann + * + */ +public class UsedEntitiesDetection { + + Comparator<Set<ObjectProperty>> keyComp = new Comparator<Set<ObjectProperty>>() { + + @Override + public int compare(Set<ObjectProperty> key1, Set<ObjectProperty> key2) { + // first criterion: size of key + int sizeDiff = key1.size() - key2.size(); + if(sizeDiff == 0) { + Iterator<ObjectProperty> it1 = key1.iterator(); + Iterator<ObjectProperty> it2 = key2.iterator(); + // compare elements one by one (assumes that both use the same + // ordering, which is the case) + while(it1.hasNext()) { + ObjectProperty prop1 = it1.next(); + ObjectProperty prop2 = it2.next(); + int comp = prop1.compareTo(prop2); + if(comp != 0) { + return comp; + } + } + // all elements of the set are equal + return 0; + } else { + return sizeDiff; + } + } + + }; + + private Map<Set<ObjectProperty>,Set<NamedClass>> usedClasses; + + private Map<Set<ObjectProperty>,Set<ObjectProperty>> usedObjectProperties; + + private ReasonerComponent reasoner; + private int maxDepth; + + /** + * Computes used properties in classes. + * TODO more explanation + * + * @param reasoner A reasoner. + * @param individuals A set of individuals to start from. + * @param depth The maximum depth for the search. + */ + public UsedEntitiesDetection(ReasonerComponent reasoner, Set<Individual> individuals, int maxDepth) { + this.reasoner = reasoner; + this.maxDepth = maxDepth; + usedClasses = new TreeMap<Set<ObjectProperty>,Set<NamedClass>>(keyComp); + usedObjectProperties = new TreeMap<Set<ObjectProperty>,Set<ObjectProperty>>(keyComp); + + Set<ObjectProperty> startKey = new TreeSet<ObjectProperty>(); + computeUsedEntitiesRec(startKey, individuals); + + } + + private void computeUsedEntitiesRec(Set<ObjectProperty> key, Set<Individual> individuals) { + Set<NamedClass> types = new TreeSet<NamedClass>(); +// Set<ObjectProperty> properties = new TreeSet<ObjectProperty>(); + // we must use the object property comparator to avoid double occurences of properties + Map<ObjectProperty,Set<Individual>> relations = new TreeMap<ObjectProperty,Set<Individual>>(); + + for(Individual individual : individuals) { + // add all types + types.addAll(reasoner.getTypes(individual)); + + // compute outgoing properties + Map<ObjectProperty,Set<Individual>> map = reasoner.getObjectPropertyRelationships(individual); + for(Entry<ObjectProperty,Set<Individual>> entry : map.entrySet()) { + ObjectProperty prop = entry.getKey(); + // we must use the individual comparator to avoid + // multiple occurrences of the same individual + Set<Individual> inds = new TreeSet<Individual>(entry.getValue()); + + // if property exists, add the found individuals + if(relations.containsKey(prop)) { + relations.get(prop).addAll(inds); + // if property not encountered before, add it + } else { + relations.put(prop, inds); + } + } + } + + // store all found relations + usedClasses.put(key, types); + usedObjectProperties.put(key, relations.keySet()); + + // recurse if limit not reached yet + if(key.size() < maxDepth) { + for(Entry<ObjectProperty,Set<Individual>> entry : relations.entrySet()) { + // construct new key (copy and add) + Set<ObjectProperty> newKey = new TreeSet<ObjectProperty>(key); + newKey.add(entry.getKey()); + + // recursion + computeUsedEntitiesRec(newKey, entry.getValue()); + } + } + + } + + public Set<Set<ObjectProperty>> getKeys() { + return usedClasses.keySet(); + } + + /** + * @return the usedClasses + */ + public Map<Set<ObjectProperty>, Set<NamedClass>> getUsedClasses() { + return usedClasses; + } + + /** + * @return the usedObjectProperties + */ + public Map<Set<ObjectProperty>, Set<ObjectProperty>> getUsedObjectProperties() { + return usedObjectProperties; + } + + @Override + public String toString() { + String str = ""; + Set<Set<ObjectProperty>> keys = getKeys(); + for(Set<ObjectProperty> key : keys) { + str += key.toString() + ": \n"; + str += " classes: " + usedClasses.get(key) + "\n"; + str += " object properties: " + usedObjectProperties.get(key) + "\n"; + } + return str; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-14 15:04:17
|
Revision: 1513 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1513&view=rev Author: heeroyuy Date: 2008-11-14 15:04:06 +0000 (Fri, 14 Nov 2008) Log Message: ----------- -fixed updateproblem of the suggest panel after learning 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/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -19,6 +19,7 @@ */ package org.dllearner.tools.protege; +import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -26,7 +27,14 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Iterator; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ExecutionException; +import javax.swing.DefaultListModel; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; @@ -37,7 +45,8 @@ import org.protege.editor.owl.OWLEditorKit; /** - * This class processes input from the user. + * This class processes input from the user. + * * @author Christian Koetteritzsch * */ @@ -59,6 +68,7 @@ private EvaluatedDescription evaluatedDescription; // This is the view of the DL-Learner tab. private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; + private Timer timer; /** * This is the constructor for the action handler. @@ -71,7 +81,8 @@ * DLlearner tab * @param i * id if it is a subclass or an equivalent class - * @param editor OWLEditorKit + * @param editor + * OWLEditorKit */ public ActionHandler(ActionHandler a, DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, @@ -86,34 +97,36 @@ /** * When a Button is pressed this method select the right. - * @param z ActionEvent + * + * @param z + * ActionEvent */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("Suggest " + id)) { if (model.getAlreadyLearned()) { model.unsetListModel(); } - view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); - model.setKnowledgeSource(); - model.setReasoner(); - model.setPositiveAndNegativeExamples(); - model.setLearningProblem(); - model.setLearningAlgorithm(); - this.dlLearner = new Thread(model); - dlLearner.start(); - view.getRunButton().setEnabled(false); - view.renderErrorMessage("Learning started"); - //view.getPosAndNegSelectPanel().unsetCheckBoxes(); - + view.getRunButton().setEnabled(false); + view.renderErrorMessage("Learning started"); + view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); + final SuggestionRetriever retriever = new SuggestionRetriever(); + // + // dlLearner.start(); + retriever.execute(); + } if (z.getActionCommand().equals("ADD")) { if (evaluatedDescription != null) { - model.changeDLLearnerDescriptionsToOWLDescriptions(evaluatedDescription.getDescription()); + model + .changeDLLearnerDescriptionsToOWLDescriptions(evaluatedDescription + .getDescription()); } else { - model.changeDLLearnerDescriptionsToOWLDescriptions((Description) view.getSuggestClassPanel().getSuggestList().getSelectedValue()); + model + .changeDLLearnerDescriptionsToOWLDescriptions((Description) view + .getSuggestClassPanel().getSuggestList() + .getSelectedValue()); } String message = "Concept added"; view.renderErrorMessage(message); @@ -144,47 +157,21 @@ return id; } - /** * select/deselect the Check boxes. - * @param i ItemEvent + * + * @param i + * ItemEvent */ public void itemStateChanged(ItemEvent i) { - if (i.getItem().toString().contains("Positive")) { - for (int j = 0; j < model.getPosVector().size(); j++) { - if (i.getItem().toString().contains( - model.getPosVector().get(j).getText().toString())) { - if (!model.getPosVector().get(j).isSelected()) { - model.getPosVector().get(j).setSelected(true); - break; - } - if (model.getPosVector().get(j).isSelected()) { - model.getPosVector().get(j).setSelected(false); - break; - } - } - } - } - if (i.getItem().toString().contains("Negative")) { - for (int j = 0; j < model.getNegVector().size(); j++) { - if (i.getItem().toString().contains( - model.getNegVector().get(j).getText().toString())) { - if (!model.getNegVector().get(j).isSelected()) { - model.getNegVector().get(j).setSelected(true); - break; - } - if (model.getNegVector().get(j).isSelected()) { - model.getNegVector().get(j).setSelected(false); - break; - } - } - } - } + } - + /** * Nothing happens here. - * @param e ListSelectionEvent + * + * @param e + * ListSelectionEvent */ public void valueChanged(ListSelectionEvent e) { @@ -192,30 +179,37 @@ /** * Nothing happens here. - * @param m MouseEvent + * + * @param m + * MouseEvent */ public void mouseReleased(MouseEvent m) { } - /** + /** * Nothing happens here. - * @param m MouseEvent + * + * @param m + * MouseEvent */ public void mouseEntered(MouseEvent m) { } /** - * Choses the right EvaluatedDescription object after a concept is chosen in the list. - * @param m MouseEvent + * Choses the right EvaluatedDescription object after a concept is chosen in + * the list. + * + * @param m + * MouseEvent */ public void mouseClicked(MouseEvent m) { EvaluatedDescription eDescription = null; - if (view.getSuggestClassPanel().getSuggestList() - .getSelectedValue() != null) { - SuggestListItem item = (SuggestListItem) view.getSuggestClassPanel().getSuggestList() - .getSelectedValue(); + + if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { + SuggestListItem item = (SuggestListItem) view + .getSuggestClassPanel().getSuggestList().getSelectedValue(); String desc = item.getValue(); if (model.getEvaluatedDescriptionList() != null) { for (Iterator<EvaluatedDescription> i = model @@ -223,28 +217,29 @@ eDescription = i.next(); if (desc.equals(eDescription.getDescription() .toManchesterSyntaxString( - editorKit.getModelManager().getActiveOntology().getURI() + editorKit.getModelManager() + .getActiveOntology().getURI() + "#", null))) { evaluatedDescription = eDescription; + break; } } } - - - if(m.getClickCount()==2) { - view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( - evaluatedDescription); + + if (m.getClickCount() == 2) { + view.getMoreDetailForSuggestedConceptsPanel() + .renderDetailPanel(evaluatedDescription); + } } - } else { - } - } /** * Nothing happens here. - * @param m MouseEvent + * + * @param m + * MouseEvent */ public void mouseExited(MouseEvent m) { @@ -252,15 +247,16 @@ /** * Sets the ADD button enable after a concept is chosen. - * @param m MouseEvent + * + * @param m + * MouseEvent */ public void mousePressed(MouseEvent m) { - if (view.getSuggestClassPanel().getSuggestList() - .getSelectedValue()!= null) { + if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { if (!view.getAddButton().isEnabled()) { view.getAddButton().setEnabled(true); - } - } + } + } } /** @@ -271,7 +267,7 @@ } /** - * Resets the toggled Button after the plugin is closed. + * Resets the toggled Button after the plugin is closed. */ public void resetToggled() { toggled = false; @@ -280,19 +276,131 @@ @Override public void contentsChanged(ListDataEvent listEvent) { System.out.println(listEvent); - + } @Override public void intervalAdded(ListDataEvent listEvent) { // TODO Auto-generated method stub - + } @Override public void intervalRemoved(ListDataEvent listEvent) { // TODO Auto-generated method stub - + } + class SuggestionRetriever extends + SwingWorker<List<EvaluatedDescription>, List<EvaluatedDescription>> { + + public SuggestionRetriever() { + + } + + @Override + protected List<EvaluatedDescription> doInBackground() throws Exception { + // DefaultListModel descriptions = new DefaultListModel(); + // List<Description> descriptionList = + // model.getLearningAlgorithm().getCurrentlyBestDescriptions(); + // Iterator<Description> it = descriptionList.iterator(); + timer = new Timer(); + timer.schedule(new TimerTask() { + + @SuppressWarnings("unchecked") + @Override + public void run() { + if (model.getLearningAlgorithm() != null) { + publish(model.getLearningAlgorithm() + .getCurrentlyBestEvaluatedDescriptions(30, 0.0, + true)); + } + } + + }, 1000, 2000); + + dlLearner = new Thread(new Runnable() { + + @Override + public void run() { + + model.run(); + } + + }); + dlLearner.start(); + + try { + dlLearner.join(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + List<EvaluatedDescription> result = model.getLearningAlgorithm() + .getCurrentlyBestEvaluatedDescriptions( + view.getPosAndNegSelectPanel().getOptionPanel() + .getNrOfConcepts(), + view.getPosAndNegSelectPanel().getOptionPanel() + .getMinAccuracy(), true); + + + return result; + } + + @Override + public void done() { + + timer.cancel(); + List<EvaluatedDescription> result = null; + try { + result = get(); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + + view.getRunButton().setEnabled(true); + updateList(result); + } + + @Override + protected void process(List<List<EvaluatedDescription>> resultLists) { + + // panel4.getModel().clear(); + + for (List<EvaluatedDescription> list : resultLists) { + updateList(list); + } + } + + private void updateList(final List<EvaluatedDescription> result) { + + Runnable doUpdateList = new Runnable() { + + DefaultListModel dm = new DefaultListModel(); + + public void run() { + model.setSuggestList(result); + // learnPanel.getListModel().clear(); + Iterator<EvaluatedDescription> it = result.iterator(); + //it.next().getDescription().toManchesterSyntaxString(baseURI, prefixes); + while (it.hasNext()) { + EvaluatedDescription eval = it.next(); + if(model.isConsistent(eval)) { + dm.add(0, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null))); + } else { + dm.add(0, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(model.getURI().toString()+"#", null))); + } + } + view.getSuggestClassPanel().getSuggestList().setModel(dm); + + } + }; + SwingUtilities.invokeLater(doUpdateList); + + } + + } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -32,7 +32,6 @@ import java.util.Vector; import javax.swing.DefaultListModel; -import javax.swing.JCheckBox; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.core.ComponentInitException; @@ -86,14 +85,7 @@ "org.dllearner.algorithms.refexamples.ExampleBasedROLComponent", "org.dllearner.algorithms.gp.GP" }; - // This Vector stores the check boxes for the view. - private Vector<JCheckBox> positiv; - - // This Vector stores the negative Examples. - - private Vector<JCheckBox> negativ; - // Component Manager that manages the components of the DL-Learner private ComponentManager cm; @@ -204,7 +196,6 @@ // This is a List of evaluated descriptions to get more information of the // suggested concept private List<EvaluatedDescription> evalDescriptions; - private Vector<String> normalIndividuals; /** * This is the constructor for DL-Learner model. @@ -227,11 +218,8 @@ this.view = view; ontologyURI = editor.getModelManager().getActiveOntology().getURI().toString()+"#"; owlDescription = new HashSet<OWLDescription>(); - positiv = new Vector<JCheckBox>(); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); - negativ = new Vector<JCheckBox>(); - normalIndividuals = new Vector<String>(); ComponentManager.setComponentClasses(componenten); individualVector = new Vector<IndividualObject>(); cm = ComponentManager.getInstance(); @@ -351,12 +339,12 @@ if (id.equals("equivalent classes")) { // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class - lp = cm.learningProblem(PosNegDefinitionLP.class, rs); + lp = cm.learningProblem(PosNegDefinitionLP.class, reasoner); } if (id.equals("super classes")) { // sets the learning problem to PosNegInclusionLP when the dllearner // should suggest a subclass - lp = cm.learningProblem(PosNegInclusionLP.class, rs); + lp = cm.learningProblem(PosNegInclusionLP.class, reasoner); } // adds the positive examples cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); @@ -376,7 +364,7 @@ try { // sets the learning algorithm to ROlearner this.la = cm.learningAlgorithm(ExampleBasedROLComponent.class, lp, - rs); + reasoner); } catch (LearningProblemUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -397,21 +385,25 @@ */ public void run() { error = "Learning succesful"; - + setKnowledgeSource(); + setReasoner(); + setPositiveAndNegativeExamples(); + setLearningProblem(); + setLearningAlgorithm(); String message = "To view details about why a class description was suggested, please doubleclick on it."; // start the algorithm and print the best concept found la.start(); - description = new Description[la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts()) - .size()]; - addToListModel(); + //description = new Description[la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts()) + // .size()]; + //addToListModel(); // renders the errormessage view.renderErrorMessage(error); view.setHintMessage(message); // reenables the run button - view.getRunButton().setEnabled(true); + //view.getRunButton().setEnabled(true); // disables the cancel button - view.getPosAndNegSelectPanel().setCheckBoxesEnable(true); - view.getSuggestClassPanel().setSuggestList(suggestModel); + //view.getPosAndNegSelectPanel().setCheckBoxesEnable(true); + //view.getSuggestClassPanel().setSuggestList(suggestModel); } /** @@ -424,24 +416,6 @@ } /** - * This method returns the check boxes for the positive examples. - * - * @return Vector of check boxes for positive examples - */ - public Vector<JCheckBox> getPosVector() { - return positiv; - } - - /** - * This method returns the check boxes for the negative examples. - * - * @return Vector of check boxes for negative examples - */ - public Vector<JCheckBox> getNegVector() { - return negativ; - } - - /** * This method gets an error message and storess it. * * @param err @@ -457,10 +431,10 @@ */ public void setPosVector() { setPositiveConcept(); - for (Iterator<Individual> j = rs.getIndividuals().iterator(); j + + for (Iterator<Individual> j = reasoner.getIndividuals().iterator(); j .hasNext();) { Individual ind = j.next(); - normalIndividuals.add(ind.toString()); String indiv = ind.toString(); // checks if individual belongs to the selected concept if (setPositivExamplesChecked(indiv)) { @@ -486,6 +460,10 @@ } } + /** + * This method returns the Vector of IndividualObjects. + * @return individualVector Vector + */ public Vector<IndividualObject> getIndividualVector() { return individualVector; } @@ -495,11 +473,12 @@ */ public void setPositiveConcept() { SortedSet<Individual> individuals = null; + //System.out.println("TEST: " + rs.getNamedClasses()); // checks if selected concept is thing when yes then it selects all // individuals if (!current.getRootObject().toString().equals("Thing")) { - - for (Iterator<NamedClass> i = rs.getNamedClasses().iterator(); i + + for (Iterator<NamedClass> i = reasoner.getAtomicConceptsList().iterator(); i .hasNext();) { // if individuals is null if (individuals == null) { @@ -509,31 +488,35 @@ "#" + current.getRootObject().toString())) { // if individuals is not null it gets all individuals of // the concept - if (rs.getIndividuals(concept) != null) { - individual = rs.getIndividuals(concept); + if (reasoner.getIndividuals(concept) != null) { + individual = reasoner.getIndividuals(concept); break; } } } } } else { - individual = rs.getIndividuals(); + individual = reasoner.getIndividuals(); } } - public boolean hasIndividuals(OWLClass OWLConcept) { + + /** + * This Method checks if the selected class has any individuals. + * @param owlConcept OWLClass + * @return boolean hasIndividuals + */ + public boolean hasIndividuals(OWLClass owlConcept) { boolean hasIndividuals = false; NamedClass concept = null; NamedClass selectedConcept = null; Iterator<NamedClass> it = reasoner.getNamedClasses().iterator(); while(it.hasNext()) { concept = it.next(); - if (concept.toManchesterSyntaxString(ontologyURI, prefixes).equals(OWLConcept.toString())) { + if (concept.toManchesterSyntaxString(ontologyURI, prefixes).equals(owlConcept.toString())) { selectedConcept = concept; break; } } - System.out.println("CON: "+ concept); - System.out.println("SIZE: "+ reasoner.getIndividuals(concept).size()); if (reasoner.getIndividuals(selectedConcept).size() > 0) { hasIndividuals = true; } @@ -572,8 +555,6 @@ individualVector.removeAllElements(); posListModel.removeAllElements(); negListModel.removeAllElements(); - positiv.removeAllElements(); - negativ.removeAllElements(); } /** @@ -587,10 +568,18 @@ description = list; } + /** + * This method returns the PosListModel. + * @return DefaultListModel posListModel + */ public DefaultListModel getPosListModel() { return posListModel; } + /** + * This method returns the NegListModel. + * @return DefaultListModel negListModel + */ public DefaultListModel getNegListModel() { return negListModel; } @@ -605,30 +594,6 @@ } /** - * This method gets an integer to return the positive examples check box on - * that position. - * - * @param i - * integer for the position in the vector - * @return Positive examples check box on position i. - */ - public JCheckBox getPositivJCheckBox(int i) { - return positiv.get(i); - } - - /** - * This method gets an integer to return the negative examples check box on - * that position. - * - * @param i - * integer for the position in the vector - * @return Negative examples check box on position i. - */ - public JCheckBox getNegativJCheckBox(int i) { - return negativ.get(i); - } - - /** * This method resets the array of concepts from the DL_Learner. It is * called after the DL-Learner tab is closed. */ @@ -639,27 +604,6 @@ } /** - * This method unchecks the checkboxes that are checked after the process of - * learning. - */ - public void unsetJCheckBoxen() { - for (int j = 0; j < positiv.size(); j++) { - // unselect all check poxes of the positive examples - if (positiv.get(j).isSelected()) { - JCheckBox i = positiv.get(j); - i.setSelected(false); - positiv.set(j, i); - } - // unselect all check boxes of the negative examples - if (negativ.get(j).isSelected()) { - JCheckBox i = negativ.get(j); - i.setSelected(false); - negativ.set(j, i); - } - } - } - - /** * This method resets the model for the suggest panel. It is called befor * the DL-Learner learns the second time or when the DL-Learner tab is * closed. @@ -750,7 +694,7 @@ */ private void setOldConceptOWLAPI() { // gets all individuals - SortedSet<Individual> indi = rs.getIndividuals(); + SortedSet<Individual> indi = reasoner.getIndividuals(); // Iterator of Individuals for (Iterator<Individual> i = indi.iterator(); i.hasNext();) { Individual indi2 = i.next(); @@ -823,7 +767,7 @@ return alreadyLearned; } - private boolean isConsistent(EvaluatedDescription eDescription) { + public boolean isConsistent(EvaluatedDescription eDescription) { boolean isConsistent = false; if (eDescription.getNotCoveredPositives().isEmpty()) { isConsistent = true; @@ -841,4 +785,8 @@ public URI getURI() { return editor.getModelManager().getActiveOntology().getURI(); } + + public void setSuggestList(List<EvaluatedDescription> list) { + evalDescriptions = list; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -1,29 +1,74 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.tools.protege; - +/** + * This Class handles the manchester String, the normal string and if the Individual is a positive Individual. + * @author Christian Koetteritzsch + * + */ public class IndividualObject { private String normalIndividual; private String manchesterIndividual; private boolean isPos; + /** + * Constructor for the IndividualObject. + * @param normal String + * @param manchester String + * @param pos boolean + */ public IndividualObject(String normal, String manchester, boolean pos) { normalIndividual = normal; manchesterIndividual = manchester; isPos = pos; } + /** + * This method returns the String of the Individual. + * @return String normalIndividual + */ public String getIndividualString() { return normalIndividual; } + /** + * This method returns the manchester String of the Individual. + * @return String manchesterIndividual + */ public String getManchesterIndividual() { return manchesterIndividual; } + /** + * This method returns if the Example is a positive Example. + * @return boolean isPos + */ public boolean isPositiveExample() { return isPos; } + /** + * This method sets the example positive or negative if changed to the othe list. + * @param pos boolean + */ public void setExamplePositive(boolean pos) { isPos = pos; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -71,10 +71,6 @@ private JDialog detailPopup; - // Panel where the informations of the selected panel are rendered - - //private JPanel examplePanel; - // Text area that shows the covered positive examples private JTextArea posCoveredText; @@ -135,8 +131,8 @@ */ public void renderDetailPanel(EvaluatedDescription desc) { eval = desc; - JPanel posBox = new JPanel(new GridLayout(0,2)); - JPanel negBox = new JPanel(new GridLayout(0,2)); + JPanel posBox = new JPanel(new GridLayout(0, 2)); + JPanel negBox = new JPanel(new GridLayout(0, 2)); Box exampleBox = Box.createVerticalBox(); concept = new JTextArea("Class Description:"); concept.setEditable(false); @@ -148,12 +144,12 @@ coveredNegativeExamples.setForeground(colorRed); notCoveredNegativeExamples = new JLabel("Not Covered Negative Examples"); notCoveredNegativeExamples.setForeground(colorGreen); - conceptPanel = new JPanel(new GridLayout(0,1)); - accuracyPanel = new JPanel(new GridLayout(0,1)); - posCoveredPanel = new JPanel(new GridLayout(0,1)); - posNotCoveredPanel = new JPanel(new GridLayout(0,1)); - negCoveredPanel = new JPanel(new GridLayout(0,1)); - negNotCoveredPanel = new JPanel(new GridLayout(0,1)); + conceptPanel = new JPanel(new GridLayout(0, 1)); + accuracyPanel = new JPanel(new GridLayout(0, 1)); + posCoveredPanel = new JPanel(new GridLayout(0, 1)); + posNotCoveredPanel = new JPanel(new GridLayout(0, 1)); + negCoveredPanel = new JPanel(new GridLayout(0, 1)); + negNotCoveredPanel = new JPanel(new GridLayout(0, 1)); accuracy = new JTextArea("Accuracy:"); accuracy.setEditable(false); conceptText = new JTextArea(); @@ -178,7 +174,6 @@ //sets accuracy text area not editable accuracyText.setEditable(false); //panel for the informations of the selected concept - //examplePanel = new JPanel(new GridLayout(0,2)); //this method adds the informations for the selected concept to the panel setInformation(); @@ -225,28 +220,24 @@ JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); posLabel.setForeground(colorGreen); posCoveredPanel.add(posLabel); - //posCoveredText.append(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)+"\n"); } //sets the positive examples that are not covered for(Iterator<Individual> i = eval.getNotCoveredPositives().iterator(); i.hasNext();) { JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); posLabel.setForeground(colorRed); posNotCoveredPanel.add(posLabel); - //posNotCoveredText.append(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)+"\n"); } //sets the negative examples that are covered for(Iterator<Individual> i = eval.getCoveredNegatives().iterator(); i.hasNext();) { JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); posLabel.setForeground(colorRed); negCoveredPanel.add(posLabel); - //negCoveredText.append(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)+"\n"); } //sets the negative examples that are not covered for(Iterator<Individual> i = eval.getNotCoveredNegatives().iterator(); i.hasNext();) { JLabel posLabel = new JLabel(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)); posLabel.setForeground(colorGreen); negNotCoveredPanel.add(posLabel); - //negNotCoveredText.append(i.next().toManchesterSyntaxString(model.getURI().toString()+"#", null)+"\n"); } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -315,8 +315,6 @@ private JButton run; - // private JButton why; - // This is the label for the advanced button. private JLabel adv; @@ -360,7 +358,7 @@ private JTextArea hint; // This is the Panel for more details of the suggested concept private MoreDetailForSuggestedConceptsPanel detail; - OWLFrame<OWLClass> frame; + //private OWLFrame<OWLClass> frame; private URL pluginURL; /** @@ -374,7 +372,7 @@ public DLLearnerView(OWLFrame<OWLClass> current, String label, OWLClassDescriptionEditorWithDLLearnerTab dlLearner) { classSelectorPanel = new OWLClassSelectorPanel(editorKit); mainWindow = dlLearner; - frame = current; + //frame = current; try { pluginURL = new URL("http://dl-learner.org/wiki/ProtegePlugin"); } catch (MalformedURLException e) { @@ -549,7 +547,6 @@ */ public void updateWindow() { mainWindow.getHandler().handleEditingFinished(mainWindow.getEditedObjects()); - mainWindow.dispose(); } /** * Returns all added descriptions. @@ -579,15 +576,8 @@ posPanel.unsetPosAndNegPanel(); learner.removeAll(); } + /** - * This method returns the nummers of Individuals present in the Ontology. - * @return int amount of Individuals in the Ontology - */ - public int getNrOfIndividuals() { - int counter = model.getPosVector().size(); - return counter; - } - /** * Renders the error message when an error occured. * @param s String */ @@ -615,7 +605,6 @@ * Destroys the view after the plugin is closed. */ public void dispose() { - System.out.println("hier"); run.removeActionListener(action); accept.removeActionListener(action); advanced.removeActionListener(action); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.tools.protege; import java.awt.Dimension; @@ -28,8 +47,8 @@ public OptionPanel() { setPreferredSize(new Dimension(490, 120)); - setLayout(new GridLayout(0,1)); - optionPanel = new JPanel(new GridLayout(0,2)); + setLayout(new GridLayout(0, 1)); + optionPanel = new JPanel(new GridLayout(0, 2)); minAccuracyLabel = new JLabel("minimum accuracy"); maxExecutionTimeLabel = new JLabel("maximum execution time"); nrOfConceptsLabel = new JLabel("maximum number of results"); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -41,11 +41,6 @@ private static final long serialVersionUID = 23632947283479L; - // This is the Panel here the check boxes, the labels, and the help buttons - // are in. - - //private JPanel posAndNegPanel; - // this is the Panel where the check boxes are. private JPanel posAndNegSelectPanel; @@ -93,9 +88,6 @@ // This is the Text area where the help message is displayed. private OptionPanel optionPanel; - //private JComboBox optionBox; - //private JPanel optionBoxPanel; - //private ActionHandler action; private DefaultListModel posListModel; private DefaultListModel negListModel; private JPanel examplePanel; @@ -109,6 +101,7 @@ * DLLearnerModel * @param act * ActionHandler + * @param v DLLearnerView */ public PosAndNegSelectPanel(DLLearnerModel model, ActionHandler act, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView v) { //set layout for parent Panel @@ -191,6 +184,8 @@ /** * This method adds the check boxes, the labels and the help buttons for * positive and negative examples. + * @param posData DefaultListModel + * @param negData DefaultListModel */ public void setExampleList(DefaultListModel posData, DefaultListModel negData) { posListModel = posData; @@ -199,10 +194,18 @@ negList.setModel(negListModel); } + /** + * This method returns the pos button. + * @return JButton + */ public JButton getAddToPosPanelButton() { return addToPosExamples; } + /** + * This method returns the neg button. + * @return JButton + */ public JButton getAddToNegPanelButton() { return addToNegExamples; } @@ -226,10 +229,18 @@ } + /** + * Nothing. + * @param act ActionHandler + */ public void removeListeners(ActionHandler act) { } + /** + * Nothing. + * @param enable boolean + */ public void setCheckBoxesEnable(boolean enable) { } @@ -244,14 +255,6 @@ } /** - * This method unselect the selected check boxes after learning. - */ - public void unsetCheckBoxes() { - // after the learning the check boxes will be unset. - model.unsetJCheckBoxen(); - } - - /** * This message displays the help message after the help button is pressed. * * @param assistance String @@ -262,12 +265,17 @@ } + /** + * this method sets the example to the other list when button is pressed. + * @param toPos boolean + * @param example String + */ public void setExampleToOtherList(boolean toPos, String example) { if (toPos) { for(int i = 0; i < negListModel.size(); i++) { if(negListModel.get(i).equals(example)) { negListModel.remove(i); - for (int j = 0; j < model.getIndividualVector().size(); j++ ) { + for (int j = 0; j < model.getIndividualVector().size(); j++) { if (model.getIndividualVector().get(j).getManchesterIndividual().equals(example)) { model.getIndividualVector().get(j).setExamplePositive(true); break; @@ -281,7 +289,7 @@ for(int i = 0; i < posListModel.size(); i++) { if(posListModel.get(i).equals(example)) { posListModel.remove(i); - for (int j = 0; j < model.getIndividualVector().size(); j++ ) { + for (int j = 0; j < model.getIndividualVector().size(); j++) { if (model.getIndividualVector().get(j).getManchesterIndividual().equals(example)) { model.getIndividualVector().get(j).setExamplePositive(false); } @@ -300,8 +308,8 @@ /** * This method adds the Action listener to the help buttons. * - * @param a - * ActionHandler + * @param handle + * PosAndNegSelectPanelHandler */ public void addHelpButtonListener(PosAndNegSelectPanelHandler handle) { // adds listener to the help button for the positive examples @@ -309,19 +317,35 @@ // adds listener to the help button for the negative examples helpForNegExamples.addActionListener(handle); } - + /** + * This Method removes the listeners for the help button. + * @param a ActionHandler + */ public void removeHelpButtonListener(ActionHandler a) { helpForPosExamples.removeActionListener(a); helpForNegExamples.removeActionListener(a); } + + /** + * This method returns the option panel. + * @return OptionPanel + */ public OptionPanel getOptionPanel() { return optionPanel; } + /** + * This method returns the list of positive examples. + * @return JList posExampleList + */ public JList getPosExampleList() { return posList; } + /** + * This method returns the list of negative examples. + * @return JList negExampleList + */ public JList getNegExampleList() { return negList; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-11-14 11:48:57 UTC (rev 1512) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-11-14 15:04:06 UTC (rev 1513) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.tools.protege; import java.awt.event.ActionEvent; @@ -2,7 +21,10 @@ import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; - +/** + * This class handles the commands for the example panel. + * @author christian Koetteritzsch + * + */ public class PosAndNegSelectPanelHandler implements ActionListener, MouseListener { @@ -12,33 +34,29 @@ // This is the DLLearnerModel. -private DLLearnerModel model; +//private DLLearnerModel model; private PosAndNegSelectPanel panel; // This is the view of the DL-Learner tab. private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; /** - * This is the constructor for the action handler. - * - * @param a - * ActionHandler + * This is the constructor for the PosAndNegSelectPanelHandler. * @param m * DLLearnerModel - * @param view - * DLlearner tab - * @param i - * id if it is a subclass or an equivalent class - * @param editor OWLEditorKit + * @param v + * OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView + * @param p + * PosAndNegSelectPanel */ public PosAndNegSelectPanelHandler(DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView v, PosAndNegSelectPanel p) { - model = m; + //model = m; panel = p; view = v; } /** * When a Button is pressed this method select the right. - * @param z ActionEvent + * @param action ActionEvent */ public void actionPerformed(ActionEvent action) { @@ -66,44 +84,9 @@ } } -/** - * select/deselect the Check boxes. - * @param i ItemEvent - */ -public void itemStateChanged(ItemEvent i) { - if (i.getItem().toString().contains("Positive")) { - for (int j = 0; j < model.getPosVector().size(); j++) { - if (i.getItem().toString().contains( - model.getPosVector().get(j).getText().toString())) { - if (!model.getPosVector().get(j).isSelected()) { - model.getPosVector().get(j).setSelected(true); - break; - } - if (model.getPosVector().get(j).isSelected()) { - model.getPosVector().get(j).setSelected(false); - break; - } - } - } - } - if (i.getItem().toString().contains("Negative")) { - for (int j = 0; j < model.getNegVector().size(); j++) { - if (i.getItem().toString().contains( - model.getNegVector().get(j).getText().toString())) { - if (!model.getNegVector().get(j).isSelected()) { - model.getNegVector().get(j).setSelected(true); - break; - } - if (model.getNegVector().get(j).isSelected()) { - model.getNegVector().get(j).setSelected(false); - break; - } - } - } - } -} + /** * Nothing happens here. * @param m MouseEvent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-14 11:59:10
|
Revision: 1512 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1512&view=rev Author: jenslehmann Date: 2008-11-14 11:48:57 +0000 (Fri, 14 Nov 2008) Log Message: ----------- - added reasoning method to get all object property relationships for an individual - added some more methods to OWLAPIConverter Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java Modified: trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java 2008-11-12 16:25:45 UTC (rev 1511) +++ trunk/src/dl-learner/org/dllearner/core/IndividualReasoner.java 2008-11-14 11:48:57 UTC (rev 1512) @@ -106,6 +106,16 @@ public Set<Constant> getRelatedValues(Individual individual, DatatypeProperty datatypeProperty); /** + * A map of properties related to an individual, e.g. + * {hasChild => {eric,anna}, hasSibling => {sebastian}}. + * + * @param individual An individual. + * @return A map of of properties connected to the individual as keys and the individuals + * they point to as values. + */ + public Map<ObjectProperty,Set<Individual>> getObjectPropertyRelationships(Individual individual); + + /** * Computes and returns all connections between individuals through the specified * property, e.g. {eric => {maria, anna}, anna => {eric}}. * @param objectProperty An object property. Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-12 16:25:45 UTC (rev 1511) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-14 11:48:57 UTC (rev 1512) @@ -398,6 +398,21 @@ } @Override + public final Map<ObjectProperty,Set<Individual>> getObjectPropertyRelationships(Individual individual) { + try { + return getObjectPropertyRelationshipsImpl(individual); + } catch (ReasoningMethodUnsupportedException e) { + handleExceptions(e); + return null; + } + } + + protected Map<ObjectProperty,Set<Individual>> getObjectPropertyRelationshipsImpl(Individual individual) throws ReasoningMethodUnsupportedException { + throw new ReasoningMethodUnsupportedException(); + } + + + @Override public final Set<Individual> getRelatedIndividuals(Individual individual, ObjectProperty objectProperty) { try { Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-12 16:25:45 UTC (rev 1511) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-14 11:48:57 UTC (rev 1512) @@ -34,12 +34,14 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; +import java.util.Map.Entry; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.ReasoningMethodUnsupportedException; import org.dllearner.core.configurators.OWLAPIReasonerConfigurator; import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.ConfigOption; @@ -64,6 +66,7 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.utilities.owl.ConceptComparator; import org.dllearner.utilities.owl.OWLAPIAxiomConvertVisitor; +import org.dllearner.utilities.owl.OWLAPIConverter; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.dllearner.utilities.owl.RoleComparator; import org.semanticweb.owl.apibinding.OWLManager; @@ -118,7 +121,7 @@ // the data factory is used to generate OWL API objects private OWLDataFactory factory; // static factory - private static OWLDataFactory staticFactory = OWLManager.createOWLOntologyManager().getOWLDataFactory(); +// private static OWLDataFactory staticFactory = OWLManager.createOWLOntologyManager().getOWLDataFactory(); private ConceptComparator conceptComparator = new ConceptComparator(); private RoleComparator roleComparator = new RoleComparator(); @@ -511,7 +514,7 @@ protected TreeSet<ObjectProperty> getSuperPropertiesImpl(ObjectProperty role) { Set<Set<OWLObjectProperty>> properties; try { - properties = reasoner.getSuperProperties(getOWLAPIDescription(role)); + properties = reasoner.getSuperProperties(OWLAPIConverter.getOWLAPIObjectProperty(role)); } catch (OWLReasonerException e) { e.printStackTrace(); throw new Error("OWL API classification error."); @@ -523,7 +526,7 @@ protected TreeSet<ObjectProperty> getSubPropertiesImpl(ObjectProperty role) { Set<Set<OWLObjectProperty>> properties; try { - properties = reasoner.getSubProperties(getOWLAPIDescription(role)); + properties = reasoner.getSubProperties(OWLAPIConverter.getOWLAPIObjectProperty(role)); } catch (OWLReasonerException e) { e.printStackTrace(); throw new Error("OWL API classification error."); @@ -534,7 +537,7 @@ private TreeSet<DatatypeProperty> getMoreGeneralDatatypePropertiesImpl(DatatypeProperty role) { Set<Set<OWLDataProperty>> properties; try { - properties = reasoner.getSuperProperties(getOWLAPIDescription(role)); + properties = reasoner.getSuperProperties(OWLAPIConverter.getOWLAPIDataProperty(role)); } catch (OWLReasonerException e) { e.printStackTrace(); throw new Error("OWL API classification error."); @@ -545,7 +548,7 @@ private TreeSet<DatatypeProperty> getMoreSpecialDatatypePropertiesImpl(DatatypeProperty role) { Set<Set<OWLDataProperty>> properties; try { - properties = reasoner.getSubProperties(getOWLAPIDescription(role)); + properties = reasoner.getSubProperties(OWLAPIConverter.getOWLAPIDataProperty(role)); } catch (OWLReasonerException e) { e.printStackTrace(); throw new Error("OWL API classification error."); @@ -606,7 +609,7 @@ @Override public Description getDomainImpl(ObjectProperty objectProperty) { - OWLObjectProperty prop = getOWLAPIDescription(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 @@ -625,7 +628,7 @@ @Override public Description getDomainImpl(DatatypeProperty datatypeProperty) { - OWLDataProperty prop = getOWLAPIDescription(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 @@ -644,7 +647,7 @@ @Override public Description getRangeImpl(ObjectProperty objectProperty) { - OWLObjectProperty prop = getOWLAPIDescription(objectProperty); + OWLObjectProperty prop = OWLAPIConverter.getOWLAPIObjectProperty(objectProperty); try { Set<OWLDescription> set = reasoner.getRanges(prop); if(set.size()==0) @@ -658,7 +661,7 @@ @Override public Map<Individual, SortedSet<Individual>> getPropertyMembersImpl(ObjectProperty atomicRole) { - OWLObjectProperty prop = getOWLAPIDescription(atomicRole); + OWLObjectProperty prop = OWLAPIConverter.getOWLAPIObjectProperty(atomicRole); Map<Individual, SortedSet<Individual>> map = new TreeMap<Individual, SortedSet<Individual>>(); for(Individual i : individuals) { OWLIndividual ind = factory.getOWLIndividual(URI.create(i.getName())); @@ -681,9 +684,27 @@ } @Override + protected Map<ObjectProperty,Set<Individual>> getObjectPropertyRelationshipsImpl(Individual individual) { + OWLIndividual ind = factory.getOWLIndividual(URI.create(individual.getName())); + Map<OWLObjectProperty,Set<OWLIndividual>> mapAPI = null; + try { + mapAPI = reasoner.getObjectPropertyRelationships(ind); + } catch (OWLReasonerException e) { + e.printStackTrace(); + } + Map<ObjectProperty,Set<Individual>> map = new TreeMap<ObjectProperty, Set<Individual>>(); + for(Entry<OWLObjectProperty,Set<OWLIndividual>> entry : mapAPI.entrySet()) { + ObjectProperty prop = OWLAPIConverter.convertObjectProperty(entry.getKey()); + Set<Individual> inds = OWLAPIConverter.convertIndividuals(entry.getValue()); + map.put(prop, inds); + } + return map; + } + + @Override public Set<Individual> getRelatedIndividualsImpl(Individual individual, ObjectProperty objectProperty) { OWLIndividual ind = factory.getOWLIndividual(URI.create(individual.getName())); - OWLObjectProperty prop = getOWLAPIDescription(objectProperty); + OWLObjectProperty prop = OWLAPIConverter.getOWLAPIObjectProperty(objectProperty); Set<OWLIndividual> inds = null; try { inds = reasoner.getRelatedIndividuals(ind, prop); @@ -701,18 +722,18 @@ @Override public Set<Constant> getRelatedValuesImpl(Individual individual, DatatypeProperty datatypeProperty) { OWLIndividual ind = factory.getOWLIndividual(URI.create(individual.getName())); - OWLDataProperty prop = getOWLAPIDescription(datatypeProperty); + OWLDataProperty prop = OWLAPIConverter.getOWLAPIDataProperty(datatypeProperty); Set<OWLConstant> constants = null; try { constants = reasoner.getRelatedValues(ind, prop); } catch (OWLReasonerException e) { e.printStackTrace(); } - return convertConstants(constants); + return OWLAPIConverter.convertConstants(constants); } public Map<Individual, SortedSet<Double>> getDoubleValues(DatatypeProperty datatypeProperty) { - OWLDataProperty prop = getOWLAPIDescription(datatypeProperty); + OWLDataProperty prop = OWLAPIConverter.getOWLAPIDataProperty(datatypeProperty); Map<Individual, SortedSet<Double>> map = new TreeMap<Individual, SortedSet<Double>>(); for(Individual i : individuals) { OWLIndividual ind = factory.getOWLIndividual(URI.create(i.getName())); @@ -738,7 +759,7 @@ @Override public Map<Individual, SortedSet<Constant>> getDatatypeMembersImpl(DatatypeProperty datatypeProperty) { - OWLDataProperty prop = getOWLAPIDescription(datatypeProperty); + OWLDataProperty prop = OWLAPIConverter.getOWLAPIDataProperty(datatypeProperty); Map<Individual, SortedSet<Constant>> map = new TreeMap<Individual, SortedSet<Constant>>(); for(Individual i : individuals) { OWLIndividual ind = factory.getOWLIndividual(URI.create(i.getName())); @@ -757,7 +778,7 @@ // for typed constants we have to figure out the correct // data type and value if(oi instanceof OWLTypedConstant) { - Datatype dt = convertDatatype(((OWLTypedConstant)oi).getDataType()); + Datatype dt = OWLAPIConverter.convertDatatype(((OWLTypedConstant)oi).getDataType()); is.add(new TypedConstant(oi.getLiteral(),dt)); // for untyped constants we have to figure out the value // and language tag (if any) @@ -832,14 +853,10 @@ private Set<Description> owlClassesToAtomicConcepts(Set<OWLClass> owlClasses) { Set<Description> concepts = new HashSet<Description>(); for(OWLClass owlClass : owlClasses) - concepts.add(owlClassToAtomicConcept(owlClass)); + concepts.add(OWLAPIConverter.convertClass(owlClass)); return concepts; } - private Description owlClassToAtomicConcept(OWLClass owlClass) { - return new NamedClass(owlClass.getURI().toString()); - } - public static void exportKBToOWL(File owlOutputFile, KB kb, URI ontologyURI) { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); //URI ontologyURI = URI.create("http://example.com"); @@ -864,66 +881,6 @@ } } - public static Set<Constant> convertConstants(Set<OWLConstant> constants) { - SortedSet<Constant> is = new TreeSet<Constant>(); - for(OWLConstant oi : constants) { - is.add(convertConstant(oi)); - } - return is; - } - - public static Constant convertConstant(OWLConstant constant) { - Constant c; - // for typed constants we have to figure out the correct - // data type and value - if(constant instanceof OWLTypedConstant) { - Datatype dt = convertDatatype(((OWLTypedConstant)constant).getDataType()); - c = new TypedConstant(constant.getLiteral(),dt); - // for untyped constants we have to figure out the value - // and language tag (if any) - } else { - OWLUntypedConstant ouc = (OWLUntypedConstant) constant; - if(ouc.hasLang()) - c = new UntypedConstant(ouc.getLiteral(), ouc.getLang()); - else - c = new UntypedConstant(ouc.getLiteral()); - } - return c; - } - - public static Datatype convertDatatype(OWLDataType dataType) { - URI uri = dataType.getURI(); - if(uri.equals(Datatype.BOOLEAN.getURI())) - return Datatype.BOOLEAN; - else if(uri.equals(Datatype.DOUBLE.getURI())) - return Datatype.DOUBLE; - else if(uri.equals(Datatype.INT.getURI())) - return Datatype.INT; - - throw new Error("Unsupported datatype " + dataType + ". Please inform a DL-Learner developer to add it."); - } - - private static OWLObjectProperty getOWLAPIDescription(ObjectProperty role) { - return staticFactory.getOWLObjectProperty(URI.create(role.getName())); - } - - private static OWLDataProperty getOWLAPIDescription(DatatypeProperty datatypeProperty) { - return staticFactory.getOWLDataProperty(URI.create(datatypeProperty.getName())); - } - - private static OWLEntity getOWLAPIEntity(Entity entity) { - if(entity instanceof ObjectProperty) { - return staticFactory.getOWLObjectProperty(URI.create(entity.getName())); - } else if(entity instanceof DatatypeProperty) { - return staticFactory.getOWLDataProperty(URI.create(entity.getName())); - } else if(entity instanceof NamedClass) { - return staticFactory.getOWLClass(URI.create(entity.getName())); - } else if(entity instanceof OWLIndividual) { - return staticFactory.getOWLIndividual(URI.create(entity.getName())); - } - throw new Error("OWL API entity conversion for " + entity + " not supported."); - } - /** * Test * @@ -1035,14 +992,14 @@ } @Override - @SuppressWarnings("all") + @SuppressWarnings("unchecked") public Set<Constant> getLabelImpl(Entity entity) { - OWLEntity owlEntity = getOWLAPIEntity(entity); + OWLEntity owlEntity = OWLAPIConverter.getOWLAPIEntity(entity); Set<OWLAnnotation> labelAnnotations = owlEntity.getAnnotations(owlAPIOntologies.get(0), URI.create("http://www.w3.org/2000/01/rdf-schema#label")); Set<Constant> annotations = new HashSet<Constant>(); for(OWLAnnotation label : labelAnnotations) { OWLConstant c = ((OWLLabelAnnotation)label).getAnnotationValue(); - annotations.add(convertConstant(c)); + annotations.add(OWLAPIConverter.convertConstant(c)); } return annotations; } Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2008-11-12 16:25:45 UTC (rev 1511) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2008-11-14 11:48:57 UTC (rev 1512) @@ -19,10 +19,37 @@ */ package org.dllearner.utilities.owl; +import java.net.URI; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + import org.dllearner.core.owl.Axiom; +import org.dllearner.core.owl.Constant; +import org.dllearner.core.owl.Datatype; +import org.dllearner.core.owl.DatatypeProperty; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Entity; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Nothing; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Thing; +import org.dllearner.core.owl.TypedConstant; +import org.dllearner.core.owl.UntypedConstant; +import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLConstant; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDataProperty; +import org.semanticweb.owl.model.OWLDataType; import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLEntity; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObjectProperty; +import org.semanticweb.owl.model.OWLTypedConstant; +import org.semanticweb.owl.model.OWLUntypedConstant; /** * A collection of methods for exchanging objects between OWL API and @@ -33,6 +60,8 @@ */ public final class OWLAPIConverter { + private static OWLDataFactory staticFactory = OWLManager.createOWLOntologyManager().getOWLDataFactory(); + /** * Converts a DL-Learner axiom into an OWL API axiom. * @@ -40,7 +69,7 @@ * @param axiom The axiom to convert. * @return An OWL API axiom. */ - public static OWLAxiom convertAxiom(Axiom axiom) { + public static OWLAxiom getOWLAPIAxiom(Axiom axiom) { return OWLAPIAxiomConvertVisitor.convertAxiom(axiom); } @@ -51,9 +80,103 @@ * @param description DL-Learner description. * @return Corresponding OWL API description. */ - public static OWLDescription getOWLDescription(Description description) { + public static OWLDescription getOWLAPIDescription(Description description) { return OWLAPIDescriptionConvertVisitor.getOWLDescription(description); + } + + public static OWLIndividual getOWLAPIIndividual(Individual individual) { + return staticFactory.getOWLIndividual(URI.create(individual.getName())); } + public static OWLObjectProperty getOWLAPIObjectProperty(ObjectProperty role) { + return staticFactory.getOWLObjectProperty(URI.create(role.getName())); + } + public static OWLDataProperty getOWLAPIDataProperty(DatatypeProperty datatypeProperty) { + return staticFactory.getOWLDataProperty(URI.create(datatypeProperty.getName())); + } + + public static OWLEntity getOWLAPIEntity(Entity entity) { + if(entity instanceof ObjectProperty) { + return staticFactory.getOWLObjectProperty(URI.create(entity.getName())); + } else if(entity instanceof DatatypeProperty) { + return staticFactory.getOWLDataProperty(URI.create(entity.getName())); + } else if(entity instanceof NamedClass) { + return staticFactory.getOWLClass(URI.create(entity.getName())); + } else if(entity instanceof OWLIndividual) { + return staticFactory.getOWLIndividual(URI.create(entity.getName())); + } + // should never happen + throw new Error("OWL API entity conversion for " + entity + " not supported."); + } + + public static Individual convertIndividual(OWLIndividual individual) { + return new Individual(individual.getURI().toString()); + } + + public static Set<Individual> convertIndividuals(Set<OWLIndividual> individuals) { + Set<Individual> inds = new TreeSet<Individual>(); + for(OWLIndividual individual : individuals) { + inds.add(convertIndividual(individual)); + } + return inds; + } + + public static ObjectProperty convertObjectProperty(OWLObjectProperty property) { + return new ObjectProperty(property.getURI().toString()); + } + + public static DatatypeProperty convertIndividual(OWLDataProperty property) { + return new DatatypeProperty(property.getURI().toString()); + } + + public static Description convertClass(OWLClass owlClass) { + if(owlClass.isOWLThing()) { + return Thing.instance; + } else if(owlClass.isOWLNothing()) { + return Nothing.instance; + } else { + return new NamedClass(owlClass.getURI().toString()); + } + } + + public static Constant convertConstant(OWLConstant constant) { + Constant c; + // for typed constants we have to figure out the correct + // data type and value + if(constant instanceof OWLTypedConstant) { + Datatype dt = OWLAPIConverter.convertDatatype(((OWLTypedConstant)constant).getDataType()); + c = new TypedConstant(constant.getLiteral(),dt); + // for untyped constants we have to figure out the value + // and language tag (if any) + } else { + OWLUntypedConstant ouc = (OWLUntypedConstant) constant; + if(ouc.hasLang()) + c = new UntypedConstant(ouc.getLiteral(), ouc.getLang()); + else + c = new UntypedConstant(ouc.getLiteral()); + } + return c; + } + + public static Set<Constant> convertConstants(Set<OWLConstant> constants) { + SortedSet<Constant> is = new TreeSet<Constant>(); + for(OWLConstant oi : constants) { + is.add(convertConstant(oi)); + } + return is; + } + + public static Datatype convertDatatype(OWLDataType dataType) { + URI uri = dataType.getURI(); + if(uri.equals(Datatype.BOOLEAN.getURI())) + return Datatype.BOOLEAN; + else if(uri.equals(Datatype.DOUBLE.getURI())) + return Datatype.DOUBLE; + else if(uri.equals(Datatype.INT.getURI())) + return Datatype.INT; + + throw new Error("Unsupported datatype " + dataType + ". Please inform a DL-Learner developer to add it."); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-12 16:25:49
|
Revision: 1511 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1511&view=rev Author: jenslehmann Date: 2008-11-12 16:25:45 +0000 (Wed, 12 Nov 2008) Log Message: ----------- small fix Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-11-12 16:16:24 UTC (rev 1510) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-11-12 16:25:45 UTC (rev 1511) @@ -130,6 +130,9 @@ } } + // print solution(s) + logger.info("solution : " + bestEvaluatedDescriptions.getBest()); + isRunning = false; } Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-11-12 16:16:24 UTC (rev 1510) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-11-12 16:25:45 UTC (rev 1511) @@ -69,11 +69,11 @@ } public EvaluatedDescription getBest() { - return set.last(); + return set.first(); } public EvaluatedDescription getWorst() { - return set.first(); + return set.last(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-12 16:16:29
|
Revision: 1510 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1510&view=rev Author: jenslehmann Date: 2008-11-12 16:16:24 +0000 (Wed, 12 Nov 2008) Log Message: ----------- - continued EL learning algorithm: although other parts are not yet complete, it already passed the "father test" - slightly changed CLI logging (can now also log to an HTML file in addition to console output) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/Component.java trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.HashSet; +import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.NavigableSet; @@ -399,6 +400,28 @@ return str; } + public String toDescriptionString() { + String str = ""; + if(label.isEmpty()) { + str = "TOP"; + } else { + Iterator<NamedClass> it = label.iterator(); + while(it.hasNext()) { + NamedClass nc = it.next(); + if(it.hasNext()) { + str += nc.toString() + " AND "; + } else { + str += nc.toString(); + } + } + } + for(ELDescriptionEdge edge : edges) { + str += " AND EXISTS " + edge.getLabel().toString() + ".("; + str += edge.getTree().toDescriptionString() + ")"; + } + return str; + } + public ELDescriptionNode getParent() { return parent; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -443,4 +443,13 @@ public String toString() { return rootNode.toString(); } + + /** + * Returns a string of the tree description (without the overhead of converting + * the tree into a description). + * @return A string for the description the tree stands for. + */ + public String toDescriptionString() { + return rootNode.toDescriptionString(); + } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -26,6 +26,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.apache.log4j.Logger; import org.dllearner.core.ComponentInitException; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; @@ -36,7 +37,6 @@ import org.dllearner.core.configurators.ELLearningAlgorithmConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Thing; -import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.refinementoperators.ELDown; import org.dllearner.utilities.owl.EvaluatedDescriptionSet; @@ -52,6 +52,7 @@ */ public class ELLearningAlgorithm extends LearningAlgorithm { + private static Logger logger = Logger.getLogger(ELLearningAlgorithm.class); private ELLearningAlgorithmConfigurator configurator; private ELDown operator; @@ -64,12 +65,16 @@ private SearchTreeNode startNode; private ELHeuristic heuristic; - private SortedSet<SearchTreeNode> candidates; + private TreeSet<SearchTreeNode> candidates; public ELLearningAlgorithm(PosNegLP problem, ReasonerComponent reasoner) { super(problem, reasoner); } + public static String getName() { + return "standard EL learning algorithm"; + } + public static Collection<Class<? extends LearningProblem>> supportedLearningProblems() { Collection<Class<? extends LearningProblem>> problems = new LinkedList<Class<? extends LearningProblem>>(); problems.add(PosNegLP.class); @@ -101,18 +106,28 @@ isRunning = true; reset(); + // create start node ELDescriptionTree top = new ELDescriptionTree(reasoner, Thing.instance); addDescriptionTree(top, null); + // main loop + int loop = 0; while(!stop && !stoppingCriteriaSatisfied()) { // pick the best candidate according to the heuristic - SearchTreeNode best = candidates.last(); + SearchTreeNode best = candidates.pollLast(); // apply operator Set<ELDescriptionTree> refinements = operator.refine(best.getDescriptionTree()); // add all refinements to search tree, candidates, best descriptions for(ELDescriptionTree refinement : refinements) { addDescriptionTree(refinement, best); } + loop++; + // logging + if(logger.isTraceEnabled()) { + logger.trace("Choosen node " + best); + logger.trace(startNode.getTreeString()); + logger.trace("Loop " + loop + " completed."); + } } isRunning = false; @@ -146,18 +161,16 @@ // check whether we want to add it to the best evaluated descriptions; // to do this we pick the worst considered evaluated description - // (remember that the set has limited size, so it's likely not the worst overall) - EvaluatedDescription worst = bestEvaluatedDescriptions.getSet().first(); + // (remember that the set has limited size, so it's likely not the worst overall); // the description has a chance to make it in the set if it has // at least as high accuracy - if not we can save the reasoner calls // for fully computing the evaluated description - if(worst.getCoveredNegatives().size() >= node.getCoveredNegatives()) { + if(bestEvaluatedDescriptions.size() == 0 || bestEvaluatedDescriptions.getWorst().getCoveredNegatives().size() >= node.getCoveredNegatives()) { Score score = learningProblem.computeScore(description); EvaluatedDescription ed = new EvaluatedDescription(description, score); bestEvaluatedDescriptions.add(ed); } - // TODO add a method to EvaluatedDescriptionSet for returning the - // minimum accuracy required + } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -19,8 +19,11 @@ */ package org.dllearner.algorithms.el; +import java.util.LinkedList; import java.util.List; +import org.dllearner.algorithms.refinement.Node; + /** * A node in the search tree of an EL algorithm. * @@ -31,7 +34,7 @@ private ELDescriptionTree descriptionTree; - private List<SearchTreeNode> children; + private List<SearchTreeNode> children = new LinkedList<SearchTreeNode>(); private int coveredNegatives; private boolean tooWeak = false; @@ -87,4 +90,32 @@ return children; } + @Override + public String toString() { + String ret = descriptionTree.toDescriptionString() + " [q:"; + if(tooWeak) + ret += "tw"; + else + ret += coveredNegatives; + ret += ", children:" + children.size() + "]"; + return ret; + } + + public String getTreeString() { + return getTreeString(0).toString(); + } + + private StringBuilder getTreeString(int depth) { + StringBuilder treeString = new StringBuilder(); + for(int i=0; i<depth-1; i++) + treeString.append(" "); + if(depth!=0) + treeString.append("|--> "); + treeString.append(toString()+"\n"); + for(SearchTreeNode child : children) { + treeString.append(child.getTreeString(depth+1)); + } + return treeString; + } + } Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -37,11 +37,11 @@ import org.apache.log4j.ConsoleAppender; import org.apache.log4j.FileAppender; +import org.apache.log4j.HTMLLayout; import org.apache.log4j.Layout; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; -import org.apache.log4j.SimpleLayout; import org.dllearner.Info; import org.dllearner.algorithms.BruteForceLearner; import org.dllearner.algorithms.RandomGuesser; @@ -104,7 +104,8 @@ */ public class Start { - private static Logger logger = Logger.getRootLogger(); + private static Logger logger = Logger.getLogger(Start.class); + private static Logger rootLogger = Logger.getRootLogger(); private static ConfMapper confMapper = new ConfMapper(); @@ -145,28 +146,51 @@ // logger 1 is the console, where we print only info messages; // the logger is plain, i.e. does not output log level etc. Layout layout = new PatternLayout(); + ConsoleAppender consoleAppender = new ConsoleAppender(layout); + // setting a threshold suppresses log messages below this level; + // this means that if you want to e.g. see all trace messages on + // console, you have to set the threshold and log level to trace + // (but we recommend just setting the log level to trace and observe + // the log file) consoleAppender.setThreshold(Level.INFO); // logger 2 is writes to a file; it records all debug messages - // and includes the log level - Layout layout2 = new SimpleLayout(); + // (you can choose HTML or TXT) + boolean htmlLog = false; + Layout layout2 = null; FileAppender fileAppenderNormal = null; - File f = new File("log/sparql.txt"); + String fileName; + if(htmlLog) { + layout2 = new HTMLLayout(); + fileName = "log/log.html"; + } else { + // simple variant: layout2 = new SimpleLayout(); + layout2 = new PatternLayout("%r [%t] %-5p %c :\n%m%n\n"); + fileName = "log/log.txt"; + } try { - fileAppenderNormal = new FileAppender(layout2, "log/log.txt", false); - f.delete(); - f.createNewFile(); + fileAppenderNormal = new FileAppender(layout2, fileName, false); } catch (IOException e) { e.printStackTrace(); + } + + // add both loggers + rootLogger.removeAllAppenders(); + rootLogger.addAppender(consoleAppender); + rootLogger.addAppender(fileAppenderNormal); + rootLogger.setLevel(Level.DEBUG); + + // SPARQL log + File f = new File("log/sparql.txt"); + f.delete(); + try { + f.createNewFile(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); } -// fileAppenderNormal.setThreshold(Level.DEBUG); - logger.removeAllAppenders(); - logger.addAppender(consoleAppender); - logger.addAppender(fileAppenderNormal); - logger.setLevel(Level.DEBUG); - // Logger.getLogger(KnowledgeSource.class).setLevel(Level.WARN); // Logger.getLogger(SparqlKnowledgeSource.class).setLevel(Level.WARN); // Logger.getLogger(TypedSparqlQuery.class).setLevel(Level.WARN); @@ -640,19 +664,19 @@ } else if (name.equals("logLevel")) { String level = cliOption.getStringValue(); if (level.equals("off")) - logger.setLevel(Level.OFF); + rootLogger.setLevel(Level.OFF); else if (level.equals("trace")) - logger.setLevel(Level.TRACE); + rootLogger.setLevel(Level.TRACE); else if (level.equals("info")) - logger.setLevel(Level.INFO); + rootLogger.setLevel(Level.INFO); else if (level.equals("debug")) - logger.setLevel(Level.DEBUG); + rootLogger.setLevel(Level.DEBUG); else if (level.equals("warn")) - logger.setLevel(Level.WARN); + rootLogger.setLevel(Level.WARN); else if (level.equals("error")) - logger.setLevel(Level.ERROR); + rootLogger.setLevel(Level.ERROR); else if (level.equals("fatal")) - logger.setLevel(Level.FATAL); + rootLogger.setLevel(Level.FATAL); } else handleError("Unknown CLI option \"" + name + "\"."); } Modified: trunk/src/dl-learner/org/dllearner/core/Component.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Component.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/core/Component.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -51,7 +51,8 @@ /** * Returns the name of this component. By default, "unnamed * component" is returned, but all implementations of components - * are strongly encouraged to overwrite this method. + * are strongly encouraged to provide a static method returning + * the name. * @return The name of this component. */ public static String getName() { Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-11-12 12:07:48 UTC (rev 1509) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-11-12 16:16:24 UTC (rev 1510) @@ -64,6 +64,18 @@ } } + public int size() { + return set.size(); + } + + public EvaluatedDescription getBest() { + return set.last(); + } + + public EvaluatedDescription getWorst() { + return set.first(); + } + /** * @return the set */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-12 12:07:55
|
Revision: 1509 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1509&view=rev Author: jenslehmann Date: 2008-11-12 12:07:48 +0000 (Wed, 12 Nov 2008) Log Message: ----------- - started EL learning algorithm - object property hierarchy creation now also implemented directly in reasoner component (ignored roles not working yet) Modified Paths: -------------- trunk/lib/components.ini trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/NodeComparatorStable.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java trunk/src/dl-learner/org/dllearner/core/Component.java trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELHeuristic.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/StableHeuristic.java trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java Modified: trunk/lib/components.ini =================================================================== --- trunk/lib/components.ini 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/lib/components.ini 2008-11-12 12:07:48 UTC (rev 1509) @@ -24,3 +24,4 @@ org.dllearner.algorithms.gp.GP org.dllearner.algorithms.DBpediaNavigationSuggestor org.dllearner.algorithms.SimpleSuggestionLearningAlgorithm +org.dllearner.algorithms.el.ELLearningAlgorithm \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -287,7 +287,7 @@ } } - @Override +// @Override public Score getSolutionScore() { return bestScore; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -189,7 +189,7 @@ return learner.getCurrentlyBestEvaluatedDescriptions(nrOfDescriptions, accuracyThreshold, filterNonMinimalDescriptions); } - @Override +// @Override public Score getSolutionScore() { return learner.getSolutionScore(); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -120,7 +120,7 @@ logger.info("fitness: " + bestFitness); } - @Override +// @Override public Score getSolutionScore() { return bestScore; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -94,7 +94,7 @@ } - @Override +// @Override public Score getSolutionScore() { return solutionScore; } Added: trunk/src/dl-learner/org/dllearner/algorithms/el/ELHeuristic.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELHeuristic.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELHeuristic.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.algorithms.el; + +import java.util.Comparator; + +/** + * Marker interface for heuristics in the EL learning + * algorithms. A heuristic implements a method + * to decide which one of two given nodes seems to be more + * promising with respect to the learning problem we consider. + * + * @author Jens Lehmann + * + */ +public interface ELHeuristic extends Comparator<SearchTreeNode> { + +} Added: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -0,0 +1,215 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.algorithms.el; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.Score; +import org.dllearner.core.configurators.Configurator; +import org.dllearner.core.configurators.ELLearningAlgorithmConfigurator; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Thing; +import org.dllearner.learningproblems.PosNegDefinitionLP; +import org.dllearner.learningproblems.PosNegLP; +import org.dllearner.refinementoperators.ELDown; +import org.dllearner.utilities.owl.EvaluatedDescriptionSet; + +/** + * A learning algorithm for EL, which will be based on a (hopefully) + * ideal refinement operator. + * + * TODO redundancy check + * + * @author Jens Lehmann + * + */ +public class ELLearningAlgorithm extends LearningAlgorithm { + + private ELLearningAlgorithmConfigurator configurator; + + private ELDown operator; + + private boolean isRunning = false; + private boolean stop = false; + + // a set with limited size (currently the ordering is defined in the class itself) + private EvaluatedDescriptionSet bestEvaluatedDescriptions = new EvaluatedDescriptionSet(LearningAlgorithm.MAX_NR_OF_RESULTS); + + private SearchTreeNode startNode; + private ELHeuristic heuristic; + private SortedSet<SearchTreeNode> candidates; + + public ELLearningAlgorithm(PosNegLP problem, ReasonerComponent reasoner) { + super(problem, reasoner); + } + + public static Collection<Class<? extends LearningProblem>> supportedLearningProblems() { + Collection<Class<? extends LearningProblem>> problems = new LinkedList<Class<? extends LearningProblem>>(); + problems.add(PosNegLP.class); + return problems; + } + + // we can assume a PosNegLP, because it is the only supported one + private PosNegLP getLearningProblem() { + return (PosNegLP) learningProblem; + } + + @Override + public Configurator getConfigurator() { + return configurator; + } + + @Override + public void init() throws ComponentInitException { + // currently we use the stable heuristic + heuristic = new StableHeuristic(); + candidates = new TreeSet<SearchTreeNode>(heuristic); + + operator = new ELDown(reasoner); + } + + @Override + public void start() { + stop = false; + isRunning = true; + reset(); + + ELDescriptionTree top = new ELDescriptionTree(reasoner, Thing.instance); + addDescriptionTree(top, null); + + while(!stop && !stoppingCriteriaSatisfied()) { + // pick the best candidate according to the heuristic + SearchTreeNode best = candidates.last(); + // apply operator + Set<ELDescriptionTree> refinements = operator.refine(best.getDescriptionTree()); + // add all refinements to search tree, candidates, best descriptions + for(ELDescriptionTree refinement : refinements) { + addDescriptionTree(refinement, best); + } + } + + isRunning = false; + } + + // evaluates a description in tree form + private void addDescriptionTree(ELDescriptionTree descriptionTree, SearchTreeNode parentNode) { + + // create search tree node + SearchTreeNode node = new SearchTreeNode(descriptionTree); + + // convert tree to standard description + Description description = descriptionTree.transformToDescription(); + int negCovers = getLearningProblem().coveredNegativeExamplesOrTooWeak(description); + if(negCovers == -1) { + node.setTooWeak(); + } else { + node.setCoveredNegatives(negCovers); + } + + // link to parent (unless start node) + if(parentNode == null) { + startNode = node; + } else { + parentNode.addChild(node); + } + + if(!node.isTooWeak()) { + // add as candidate + candidates.add(node); + + // check whether we want to add it to the best evaluated descriptions; + // to do this we pick the worst considered evaluated description + // (remember that the set has limited size, so it's likely not the worst overall) + EvaluatedDescription worst = bestEvaluatedDescriptions.getSet().first(); + // the description has a chance to make it in the set if it has + // at least as high accuracy - if not we can save the reasoner calls + // for fully computing the evaluated description + if(worst.getCoveredNegatives().size() >= node.getCoveredNegatives()) { + Score score = learningProblem.computeScore(description); + EvaluatedDescription ed = new EvaluatedDescription(description, score); + bestEvaluatedDescriptions.add(ed); + } + // TODO add a method to EvaluatedDescriptionSet for returning the + // minimum accuracy required + } + + } + + private boolean stoppingCriteriaSatisfied() { + // stop if we have a node covering all positives and none of the negatives + SearchTreeNode bestNode = candidates.last(); + return (bestNode.getCoveredNegatives() == 0); + } + + private void reset() { + // set all values back to their default values (used for running + // the algorithm more than once) + candidates.clear(); + bestEvaluatedDescriptions.getSet().clear(); + } + + @Override + public void stop() { + stop = true; + } + + @Override + public boolean isRunning() { + return isRunning; + } + + @Override + public Description getCurrentlyBestDescription() { + return getCurrentlyBestEvaluatedDescription().getDescription(); + } + + @Override + public List<Description> getCurrentlyBestDescriptions() { + return bestEvaluatedDescriptions.toDescriptionList(); + } + + @Override + public EvaluatedDescription getCurrentlyBestEvaluatedDescription() { + return bestEvaluatedDescriptions.getSet().last(); + } + + @Override + public SortedSet<EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions() { + return bestEvaluatedDescriptions.getSet(); + } + + /** + * @return the startNode + */ + public SearchTreeNode getStartNode() { + return startNode; + } + +} Added: trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/SearchTreeNode.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -0,0 +1,90 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.algorithms.el; + +import java.util.List; + +/** + * A node in the search tree of an EL algorithm. + * + * @author Jens Lehmann + * + */ +public class SearchTreeNode { + + private ELDescriptionTree descriptionTree; + + private List<SearchTreeNode> children; + + private int coveredNegatives; + private boolean tooWeak = false; + + public SearchTreeNode(ELDescriptionTree descriptionTree) { + this.descriptionTree = descriptionTree; + } + + /** + * @return the tooWeak + */ + public boolean isTooWeak() { + return tooWeak; + } + + /** + * @param tooWeak the tooWeak to set + */ + public void setTooWeak() { + tooWeak = true; + } + + /** + * @param coveredNegatives the coveredNegatives to set + */ + public void setCoveredNegatives(int coveredNegatives) { + this.coveredNegatives = coveredNegatives; + tooWeak = false; + } + + /** + * @return the coveredNegatives + */ + public int getCoveredNegatives() { + return coveredNegatives; + } + + public void addChild(SearchTreeNode node) { + children.add(node); + } + + /** + * @return the descriptionTree + */ + public ELDescriptionTree getDescriptionTree() { + return descriptionTree; + } + + /** + * @return the children + */ + public List<SearchTreeNode> getChildren() { + return children; + } + +} Added: trunk/src/dl-learner/org/dllearner/algorithms/el/StableHeuristic.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/StableHeuristic.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/StableHeuristic.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.algorithms.el; + +/** + * A stable comparator for search tree nodes. Stable means that the order + * of nodes will not change during the run of the learning algorithm. In + * this implementation, this is ensured by using only covered examples + * and tree size as criteria. + * + * @author Jens Lehmann + * + */ +public class StableHeuristic implements ELHeuristic { + + @Override + public int compare(SearchTreeNode o1, SearchTreeNode o2) { + // TODO Auto-generated method stub + return 0; + } + +} Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -946,7 +946,7 @@ System.exit(0); } - @Override +// @Override public Score getSolutionScore() { return bestScore; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -430,7 +430,7 @@ algorithm.start(); } - @Override +// @Override public Score getSolutionScore() { return algorithm.getSolutionScore(); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/NodeComparatorStable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/NodeComparatorStable.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/NodeComparatorStable.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -26,7 +26,7 @@ /** * This comparator is stable, because it only takes covered examples, concept - * length and the concepts itself (using again a stable comparator) into a + * length and the concepts itself (using again a stable comparator) into * account, which do not change during the run of the algorithm. * * @author Jens Lehmann Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -1099,7 +1099,7 @@ return best; } - @Override +// @Override public Score getSolutionScore() { if(posOnly) return posOnlyLearningProblem.computeScore(getCurrentlyBestDescription()); Modified: trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -28,6 +28,7 @@ import org.dllearner.algorithms.BruteForceLearner; import org.dllearner.algorithms.DBpediaNavigationSuggestor; import org.dllearner.algorithms.RandomGuesser; +import org.dllearner.algorithms.el.ELLearningAlgorithm; import org.dllearner.algorithms.gp.GP; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; @@ -89,7 +90,8 @@ learningAlgorithmMapping.put("gp", GP.class); learningAlgorithmMapping.put("refinement", ROLearner.class); learningAlgorithmMapping.put("refexamples", ExampleBasedROLComponent.class); - learningAlgorithmMapping.put("dbpediaNavigationSuggestor", DBpediaNavigationSuggestor.class); + learningAlgorithmMapping.put("dbpediaNavigationSuggestor", DBpediaNavigationSuggestor.class); + learningAlgorithmMapping.put("el", ELLearningAlgorithm.class); // you do not need to edit anything below Modified: trunk/src/dl-learner/org/dllearner/core/Component.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Component.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/Component.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -36,14 +36,18 @@ */ public abstract class Component { -protected Configurator configurator; + protected Configurator configurator; + /** + * For each component, a configurator class is generated in package + * org.dllearner.core.configurators using the script + * {@link org.dllearner.scripts.ConfigJavaGenerator}. The configurator + * provides set and get methods for the configuration options of + * a component. + * @return An object allowing to configure this component. + */ public abstract Configurator getConfigurator(); - //return configurator; - //} - - /** * Returns the name of this component. By default, "unnamed * component" is returned, but all implementations of components @@ -83,6 +87,15 @@ * perform an action (usually setting an internal variable to * an appropriate value). * + * Since the availability of configurators, it is optional for + * components to implement this method. Instead of using this method + * to take an action based on a configuration value, components can + * also use the getters defined in the components configurator. + * + * Important note: Never call this method directly. All calls are + * done via the {@link org.dllearner.core.ComponentManager}. + * + * @see #getConfigurator() * @param <T> Type of the config entry (Integer, String etc.). * @param entry A configuration entry. * @throws InvalidConfigOptionValueException This exception is thrown if the @@ -94,15 +107,8 @@ * an interval for the value). This means that, as a component developer, you * often do not need to implement further validity checks. */ - public abstract <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException; + protected <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { + + } - /** - * Gets the value of a configuration option of this component. - * - * @param <T> Option type. - * @param option A configuration option of this component. - * @return Current value of the configuration option. - */ -// now implemented in ComponentManager -// public abstract <T> T getConfigValue(ConfigOption<T> option) throws UnknownConfigOptionException; } Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -96,9 +96,10 @@ /** * This is the maximum number of results, which the learning - * algorithms need to keep. (Often algorithms do not need - * to store any results except the best one, so this limit - * is used to limit the performance cost for storing results.) + * algorithms are asked to store. (Note, that algorithms are not + * required to store any results except the best one, so this limit + * is used to limit the performance cost for those which + * choose to store results.) */ public static final int MAX_NR_OF_RESULTS = 100; @@ -143,8 +144,8 @@ * * @return Best score. */ - @Deprecated - public abstract Score getSolutionScore(); +// @Deprecated +// public abstract Score getSolutionScore(); /** * @see #getCurrentlyBestEvaluatedDescription() Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -47,6 +47,7 @@ import org.dllearner.utilities.datastructures.SortedSetTuple; import org.dllearner.utilities.owl.ConceptComparator; import org.dllearner.utilities.owl.OWLVocabulary; +import org.dllearner.utilities.owl.RoleComparator; /** * Abstract component representing a reasoner. Only a few reasoning operations @@ -770,21 +771,37 @@ return getObjectPropertyHierarchy().getMoreGeneralRoles(role); } + protected SortedSet<ObjectProperty> getSuperPropertiesImpl(ObjectProperty role) throws ReasoningMethodUnsupportedException { + throw new ReasoningMethodUnsupportedException(); + } + @Override public final SortedSet<ObjectProperty> getSubProperties(ObjectProperty role) { return getObjectPropertyHierarchy().getMoreSpecialRoles(role); } + protected SortedSet<ObjectProperty> getSubPropertiesImpl(ObjectProperty role) throws ReasoningMethodUnsupportedException { + throw new ReasoningMethodUnsupportedException(); + } + @Override public final TreeSet<ObjectProperty> getMostGeneralProperties() { return getObjectPropertyHierarchy().getMostGeneralRoles(); } +// protected SortedSet<ObjectProperty> getMostGeneralPropertiesImpl(ObjectProperty role) throws ReasoningMethodUnsupportedException { +// throw new ReasoningMethodUnsupportedException(); +// } + @Override public final TreeSet<ObjectProperty> getMostSpecialProperties() { return getObjectPropertyHierarchy().getMostSpecialRoles(); } +// protected SortedSet<ObjectProperty> getMostSpecialPropertiesImpl(ObjectProperty role) throws ReasoningMethodUnsupportedException { +// throw new ReasoningMethodUnsupportedException(); +// } + @Override public final SortedSet<DatatypeProperty> getSuperProperties(DatatypeProperty role) { return getDatatypePropertyHierarchy().getMoreGeneralRoles(role); @@ -810,7 +827,8 @@ * called explicitly, it is called the first time, it is needed). * * @return The class hierarchy. - * @throws ReasoningMethodUnsupportedException + * @throws ReasoningMethodUnsupportedException If any method needed to + * create the hierarchy is not supported by the underlying reasoner. */ public final ClassHierarchy prepareSubsumptionHierarchy() throws ReasoningMethodUnsupportedException { ConceptComparator conceptComparator = new ConceptComparator(); @@ -824,8 +842,6 @@ subsumptionHierarchyUp.put(Thing.instance, new TreeSet<Description>()); subsumptionHierarchyDown.put(Thing.instance, tmp); - - // ... bottom ... tmp = getSuperClassesImpl(Nothing.instance); subsumptionHierarchyUp.put(Nothing.instance, tmp); @@ -849,8 +865,6 @@ subsumptionHierarchyUp.put(atom, tmp); } - - return new ClassHierarchy(subsumptionHierarchyUp, subsumptionHierarchyDown); } @@ -873,13 +887,28 @@ * * @return The object property hierarchy. * @throws ReasoningMethodUnsupportedException - * Thrown if object property hierarchy creation is not supported - * by the reasoner. + * Thrown if a reasoning method for object property + * hierarchy creation is not supported by the reasoner. */ public ObjectPropertyHierarchy prepareRoleHierarchy() throws ReasoningMethodUnsupportedException { - throw new ReasoningMethodUnsupportedException( - "Object property hierarchy creation not supported by this reasoner."); + + RoleComparator roleComparator = new RoleComparator(); + TreeMap<ObjectProperty, SortedSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, SortedSet<ObjectProperty>>( + roleComparator); + TreeMap<ObjectProperty, SortedSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, SortedSet<ObjectProperty>>( + roleComparator); + + // refinement of atomic concepts + Set<ObjectProperty> atomicRoles = getObjectProperties(); + for (ObjectProperty role : atomicRoles) { + roleHierarchyDown.put(role, getSubPropertiesImpl(role)); + roleHierarchyUp.put(role, getSuperPropertiesImpl(role)); + } + + roleHierarchy = new ObjectPropertyHierarchy(atomicRoles, roleHierarchyUp, + roleHierarchyDown); + return roleHierarchy; } @Override Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -26,6 +26,7 @@ import org.dllearner.algorithms.DBpediaNavigationSuggestor; import org.dllearner.algorithms.RandomGuesser; import org.dllearner.algorithms.SimpleSuggestionLearningAlgorithm; +import org.dllearner.algorithms.el.ELLearningAlgorithm; import org.dllearner.algorithms.gp.GP; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; @@ -121,7 +122,7 @@ /** * @param positiveExamples positive examples * @param negativeExamples negative examples -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @return a component ready for initialization PosNegDefinitionLP **/ public static PosNegDefinitionLP getPosNegDefinitionLP(ReasonerComponent reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { @@ -131,7 +132,7 @@ /** * @param positiveExamples positive examples * @param negativeExamples negative examples -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @return a component ready for initialization PosNegDefinitionLPStrict **/ public static PosNegDefinitionLPStrict getPosNegDefinitionLPStrict(ReasonerComponent reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { @@ -141,7 +142,7 @@ /** * @param positiveExamples positive examples * @param negativeExamples negative examples -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @return a component ready for initialization PosNegInclusionLP **/ public static PosNegInclusionLP getPosNegInclusionLP(ReasonerComponent reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { @@ -150,7 +151,7 @@ /** * @param positiveExamples positive examples -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @return a component ready for initialization PosOnlyDefinitionLP **/ public static PosOnlyDefinitionLP getPosOnlyDefinitionLP(ReasonerComponent reasoningService, Set<String> positiveExamples) { @@ -159,7 +160,7 @@ /** * @param positiveExamples positive examples -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @return a component ready for initialization PosOnlyInclusionLP **/ public static PosOnlyInclusionLP getPosOnlyInclusionLP(ReasonerComponent reasoningService, Set<String> positiveExamples) { @@ -168,7 +169,7 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see * @return a component ready for initialization BruteForceLearner **/ @@ -178,7 +179,7 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see * @return a component ready for initialization DBpediaNavigationSuggestor **/ @@ -188,7 +189,7 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see * @return a component ready for initialization RandomGuesser **/ @@ -198,7 +199,7 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see * @return a component ready for initialization SimpleSuggestionLearningAlgorithm **/ @@ -208,8 +209,18 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see +* @return a component ready for initialization ELLearningAlgorithm +**/ +public static ELLearningAlgorithm getELLearningAlgorithm(LearningProblem learningProblem, ReasonerComponent reasoningService) throws LearningProblemUnsupportedException { +return ELLearningAlgorithmConfigurator.getELLearningAlgorithm(learningProblem, reasoningService); +} + +/** +* @param learningProblem see LearningProblem +* @param reasoningService see ReasoningService +* @throws LearningProblemUnsupportedException see * @return a component ready for initialization GP **/ public static GP getGP(LearningProblem learningProblem, ReasonerComponent reasoningService) throws LearningProblemUnsupportedException { @@ -218,7 +229,7 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see * @return a component ready for initialization ExampleBasedROLComponent **/ @@ -228,7 +239,7 @@ /** * @param learningProblem see LearningProblem -* @param reasoningService see ReasonerComponent +* @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see * @return a component ready for initialization ROLearner **/ Added: trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.core.configurators; + +import org.dllearner.algorithms.el.ELLearningAlgorithm; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class ELLearningAlgorithmConfigurator implements Configurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private ELLearningAlgorithm eLLearningAlgorithm; + +/** +* @param eLLearningAlgorithm see ELLearningAlgorithm +**/ +public ELLearningAlgorithmConfigurator(ELLearningAlgorithm eLLearningAlgorithm){ +this.eLLearningAlgorithm = eLLearningAlgorithm; +} + +/** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see +* @return ELLearningAlgorithm +**/ +public static ELLearningAlgorithm getELLearningAlgorithm(LearningProblem learningProblem, ReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ +ELLearningAlgorithm component = ComponentManager.getInstance().learningAlgorithm(ELLearningAlgorithm.class, learningProblem, reasoningService); +return component; +} + + + +/** +* true, if this component needs reinitializsation. +* @return boolean +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -153,7 +153,7 @@ /** * saveExtractedFragment Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.Some DBpedia URI will make the XML invalid. * mandatory: false| reinit necessary: true -* default value: true +* default value: false * @return boolean **/ public boolean getSaveExtractedFragment() { @@ -365,7 +365,7 @@ /** * @param saveExtractedFragment Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.Some DBpedia URI will make the XML invalid. * mandatory: false| reinit necessary: true -* default value: true +* default value: false **/ public void setSaveExtractedFragment(boolean saveExtractedFragment) { ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "saveExtractedFragment", saveExtractedFragment); Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -55,8 +55,6 @@ this.subsumptionHierarchyUp = subsumptionHierarchyUp; this.subsumptionHierarchyDown = subsumptionHierarchyDown; - - } public SortedSet<Description> getSuperClasses(Description concept) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Jens Lehmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -27,23 +27,20 @@ import org.dllearner.utilities.owl.RoleComparator; /** - * Represents a hierarchy of roles. + * Represents a hierarchy of object properties (roles in Description Logics). * - * TODO: Currently, the role hierarchy pruning algorithm (analogous to the - * subsumption hierarchy) is not implemented. - * * @author Jens Lehmann * */ public class ObjectPropertyHierarchy { RoleComparator rc = new RoleComparator(); - TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyUp; - TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyDown; + TreeMap<ObjectProperty,SortedSet<ObjectProperty>> roleHierarchyUp; + TreeMap<ObjectProperty,SortedSet<ObjectProperty>> roleHierarchyDown; TreeSet<ObjectProperty> mostGeneralRoles = new TreeSet<ObjectProperty>(rc); TreeSet<ObjectProperty> mostSpecialRoles = new TreeSet<ObjectProperty>(rc); - public ObjectPropertyHierarchy(Set<ObjectProperty> atomicRoles, TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyUp , TreeMap<ObjectProperty,TreeSet<ObjectProperty>> roleHierarchyDown) { + public ObjectPropertyHierarchy(Set<ObjectProperty> atomicRoles, TreeMap<ObjectProperty,SortedSet<ObjectProperty>> roleHierarchyUp , TreeMap<ObjectProperty,SortedSet<ObjectProperty>> roleHierarchyDown) { this.roleHierarchyUp = roleHierarchyUp; this.roleHierarchyDown = roleHierarchyDown; @@ -56,17 +53,15 @@ } } - @SuppressWarnings("unchecked") public SortedSet<ObjectProperty> getMoreGeneralRoles(ObjectProperty role) { // we clone all concepts before returning them such that they cannot be // modified externally - return (TreeSet<ObjectProperty>) roleHierarchyUp.get(role).clone(); + return new TreeSet<ObjectProperty>(roleHierarchyUp.get(role)); } - @SuppressWarnings("unchecked") public SortedSet<ObjectProperty> getMoreSpecialRoles(ObjectProperty role) { - return (TreeSet<ObjectProperty>) roleHierarchyDown.get(role).clone(); - } + return new TreeSet<ObjectProperty>(roleHierarchyDown.get(role)); + } /** * Implements a subsumption check using the hierarchy (no further @@ -99,7 +94,7 @@ return str; } - private String toString(TreeMap<ObjectProperty,TreeSet<ObjectProperty>> hierarchy, ObjectProperty role, int depth) { + private String toString(TreeMap<ObjectProperty,SortedSet<ObjectProperty>> hierarchy, ObjectProperty role, int depth) { String str = ""; for(int i=0; i<depth; i++) str += " "; Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -81,7 +81,7 @@ /** * This method computes (using the reasoner) whether a concept is too weak. - * If it is not weak, it returns the number of covered negative example. It + * If it is not weak, it returns the number of covered negative examples. It * can use retrieval or instance checks for classification. * * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -268,22 +268,22 @@ * * TODO Does not yet take ignored roles into account. */ - public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) { - TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( - roleComparator); - TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( - roleComparator); - - // Refinement atomarer Konzepte - for (ObjectProperty role : atomicRoles) { - roleHierarchyDown.put(role, getMoreSpecialRolesDIG(role)); - roleHierarchyUp.put(role, getMoreGeneralRolesDIG(role)); - } +// public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) { +// TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( +// roleComparator); +// TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( +// roleComparator); +// +// // Refinement atomarer Konzepte +// for (ObjectProperty role : atomicRoles) { +// roleHierarchyDown.put(role, getMoreSpecialRolesDIG(role)); +// roleHierarchyUp.put(role, getMoreGeneralRolesDIG(role)); +// } +// +// roleHierarchy = new ObjectPropertyHierarchy(allowedRoles, roleHierarchyUp, +// roleHierarchyDown); +// } - roleHierarchy = new ObjectPropertyHierarchy(allowedRoles, roleHierarchyUp, - roleHierarchyDown); - } - // eigentlich müsste man klonen um sicherzustellen, dass der parent-Link // bei null bleibt; bei der aktuellen Implementierung ist der parent-Link // nicht immer null, was bei GP negative Auswirkungen haben könnte @@ -562,7 +562,8 @@ return resultsSet; } - private TreeSet<ObjectProperty> getMoreGeneralRolesDIG(ObjectProperty role) { + @Override + protected TreeSet<ObjectProperty> getSuperPropertiesImpl(ObjectProperty role) { String moreGeneralRolesDIG = asksPrefix; moreGeneralRolesDIG += "<rparents id=\"query_parents\">"; moreGeneralRolesDIG += "<ratom name=\"" + role.getName() + "\" />"; @@ -587,7 +588,8 @@ return resultsSet; } - private TreeSet<ObjectProperty> getMoreSpecialRolesDIG(ObjectProperty role) { + @Override + protected TreeSet<ObjectProperty> getSubPropertiesImpl(ObjectProperty role) { String moreSpecialRolesDIG = asksPrefix; moreSpecialRolesDIG += "<rchildren id=\"query_children\">"; moreSpecialRolesDIG += "<ratom name=\"" + role.getName() + "\" />"; Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -534,6 +534,26 @@ return intDatatypeProperties; } + @Override + protected SortedSet<Description> getSuperClassesImpl(Description concept) throws ReasoningMethodUnsupportedException { + return rc.getSuperClassesImpl(concept); + } + + @Override + protected SortedSet<Description> getSubClassesImpl(Description concept) throws ReasoningMethodUnsupportedException { + return rc.getSubClassesImpl(concept); + } + + @Override + protected SortedSet<ObjectProperty> getSuperPropertiesImpl(ObjectProperty role) throws ReasoningMethodUnsupportedException { + return rc.getSuperPropertiesImpl(role); + } + + @Override + protected SortedSet<ObjectProperty> getSubPropertiesImpl(ObjectProperty role) throws ReasoningMethodUnsupportedException { + return rc.getSubPropertiesImpl(role); + } + /* * (non-Javadoc) * Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -56,7 +56,6 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; import org.dllearner.core.owl.ObjectProperty; -import org.dllearner.core.owl.ObjectPropertyHierarchy; import org.dllearner.core.owl.Thing; import org.dllearner.core.owl.TypedConstant; import org.dllearner.core.owl.UntypedConstant; @@ -124,7 +123,7 @@ private ConceptComparator conceptComparator = new ConceptComparator(); private RoleComparator roleComparator = new RoleComparator(); // private ClassHierarchy subsumptionHierarchy; - private ObjectPropertyHierarchy roleHierarchy; +// private ObjectPropertyHierarchy roleHierarchy; private DatatypePropertyHierarchy datatypePropertyHierarchy; // private Set<Description> allowedConceptsInSubsumptionHierarchy; @@ -405,46 +404,46 @@ return ReasonerType.OWLAPI_PELLET; } - @Override - public ObjectPropertyHierarchy prepareRoleHierarchy() { - // code copied from DIG reasoner - - TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( - roleComparator); - TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( - roleComparator); - - // refinement of atomic concepts - for (ObjectProperty role : atomicRoles) { - roleHierarchyDown.put(role, getMoreSpecialRolesImpl(role)); - roleHierarchyUp.put(role, getMoreGeneralRolesImpl(role)); - } - - roleHierarchy = new ObjectPropertyHierarchy(atomicRoles, roleHierarchyUp, - roleHierarchyDown); - return roleHierarchy; - } +// @Override +// public ObjectPropertyHierarchy prepareRoleHierarchy() { +// // code copied from DIG reasoner +// +// TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( +// roleComparator); +// TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( +// roleComparator); +// +// // refinement of atomic concepts +// for (ObjectProperty role : atomicRoles) { +// roleHierarchyDown.put(role, getMoreSpecialRolesImpl(role)); +// roleHierarchyUp.put(role, getMoreGeneralRolesImpl(role)); +// } +// +// roleHierarchy = new ObjectPropertyHierarchy(atomicRoles, roleHierarchyUp, +// roleHierarchyDown); +// return roleHierarchy; +// } /* (non-Javadoc) * @see org.dllearner.core.Reasoner#prepareRoleHierarchy(java.util.Set) */ - public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) { - // code copied from DIG reasoner - - TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( - roleComparator); - TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( - roleComparator); - - // refinement of atomic concepts - for (ObjectProperty role : atomicRoles) { - roleHierarchyDown.put(role, getMoreSpecialRolesImpl(role)); - roleHierarchyUp.put(role, getMoreGeneralRolesImpl(role)); - } - - roleHierarchy = new ObjectPropertyHierarchy(allowedRoles, roleHierarchyUp, - roleHierarchyDown); - } +// public void prepareRoleHierarchy(Set<ObjectProperty> allowedRoles) { +// // code copied from DIG reasoner +// +// TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyUp = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( +// roleComparator); +// TreeMap<ObjectProperty, TreeSet<ObjectProperty>> roleHierarchyDown = new TreeMap<ObjectProperty, TreeSet<ObjectProperty>>( +// roleComparator); +// +// // refinement of atomic concepts +// for (ObjectProperty role : atomicRoles) { +// roleHierarchyDown.put(role, getMoreSpecialRolesImpl(role)); +// roleHierarchyUp.put(role, getMoreGeneralRolesImpl(role)); +// } +// +// roleHierarchy = new ObjectPropertyHierarchy(allowedRoles, roleHierarchyUp, +// roleHierarchyDown); +// } // @Override // public ObjectPropertyHierarchy getRoleHierarchy() { @@ -508,7 +507,8 @@ return getFirstClasses(classes); } - private TreeSet<ObjectProperty> getMoreGeneralRolesImpl(ObjectProperty role) { + @Override + protected TreeSet<ObjectProperty> getSuperPropertiesImpl(ObjectProperty role) { Set<Set<OWLObjectProperty>> properties; try { properties = reasoner.getSuperProperties(getOWLAPIDescription(role)); @@ -519,7 +519,8 @@ return getFirstObjectProperties(properties); } - private TreeSet<ObjectProperty> getMoreSpecialRolesImpl(ObjectProperty role) { + @Override + protected TreeSet<ObjectProperty> getSubPropertiesImpl(ObjectProperty role) { Set<Set<OWLObjectProperty>> properties; try { properties = reasoner.getSubProperties(getOWLAPIDescription(role)); Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-11-11 17:06:49 UTC (rev 1508) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-11-12 12:07:48 UTC (rev 1509) @@ -21,10 +21,13 @@ import java.util.Collection; import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.owl.Description; /** * A set of evaluated descriptions, which is bound by a maximum @@ -68,4 +71,11 @@ return set; } + public List<Description> toDescriptionList() { + List<Description> list = new LinkedList<Description>(); + for(EvaluatedDescription ed : set) { + list.add(ed.getDescription()); + } + return list; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |