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: <lor...@us...> - 2008-09-21 12:49:00
|
Revision: 1233 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1233&view=rev Author: lorenz_b Date: 2008-09-21 12:48:48 +0000 (Sun, 21 Sep 2008) Log Message: ----------- some javadoc and checkstyle Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/Main.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java trunk/src/dl-learner/org/dllearner/tools/ore/SavePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/SavePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/UndoLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/Wizard.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardModel.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelNotFoundException.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -29,7 +29,11 @@ import javax.swing.JPanel; import org.semanticweb.owl.model.OWLOntologyChange; - +/** + * JPanel where an ontology change and his undo function is listed. + * @author Lorenz Buehmann + * + */ public class ChangePanel extends JPanel{ /** @@ -38,7 +42,7 @@ private static final long serialVersionUID = -934113184795465461L; /** - * Constructor for a JPanel where an ontology change and his undo function is listed + * Constructor * @param label * @param changes * @param mL Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -28,12 +28,13 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.border.BevelBorder; - +/** + * JPanel where all ontology changes are shown. + * @author Lorenz Buehmann + * + */ public class ChangesPanel extends JPanel{ - /** - * - */ private static final long serialVersionUID = -7538532926820669891L; public ChangesPanel(){ @@ -45,7 +46,10 @@ } - + /** + * Refresh the actual panel. + * @param cont + */ public void updatePanel(Container cont){ remove(cont); SwingUtilities.updateComponentTreeUI(this); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -36,7 +36,11 @@ import org.jdesktop.swingx.icon.EmptyIcon; import org.jdesktop.swingx.painter.BusyPainter; - +/** + * Wizard panel where atomic classes are shown in list. + * @author Lorenz Buehmann + * + */ public class ClassPanelOWL extends JPanel{ private static final long serialVersionUID = 3026319637264844550L; @@ -78,7 +82,7 @@ contentPanel = getContentPanel(); setLayout(new java.awt.BorderLayout()); - add(contentPanel,BorderLayout.CENTER); + add(contentPanel, BorderLayout.CENTER); add(labelPanel, BorderLayout.SOUTH); } @@ -89,7 +93,7 @@ conceptList = new JList(model); - scroll.setPreferredSize(new Dimension(400,400)); + scroll.setPreferredSize(new Dimension(400, 400)); scroll.setViewportView(conceptList); contentPanel1.add(scroll); @@ -102,10 +106,8 @@ return model; } - public void setModel(DefaultListModel dm){ - conceptList.setModel(dm); - } + public void addSelectionListener(ListSelectionListener l){ conceptList.addListSelectionListener(l); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -27,12 +27,17 @@ - +/** + * Wizard panel descriptor for selecting one of the atomic classes in OWL-ontology that + * has to be (re)learned. + * @author Lorenz Buehmann + * + */ public class ClassPanelOWLDescriptor extends WizardPanelDescriptor implements ListSelectionListener{ public static final String IDENTIFIER = "CLASS_CHOOSE_OWL_PANEL"; public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " + - "Select one of them which should be (re)learned from then press \"Next-Button\""; + "Select one of them which should be (re)learned from, then press \"Next-Button\""; private ClassPanelOWL owlClassPanel; @@ -65,7 +70,7 @@ public void valueChanged(ListSelectionEvent e) { setNextButtonAccordingToConceptSelected(); if (!e.getValueIsAdjusting()) - getWizardModel().getOre().setConcept((NamedClass)owlClassPanel.getList().getSelectedValue()); + getWizardModel().getOre().setClassToLearn((NamedClass)owlClassPanel.getList().getSelectedValue()); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -33,7 +33,11 @@ import org.jdesktop.swingx.icon.EmptyIcon; import org.jdesktop.swingx.painter.BusyPainter; - +/** + * Wizard Panel for SPARQL-Mode. + * @author Lorenz Buehmann + * + */ public class ClassPanelSparql extends JPanel{ private static final long serialVersionUID = 3026319637264844550L; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -20,10 +20,11 @@ package org.dllearner.tools.ore; - - - - +/** + * Class for SPARQL-Mode + * @author Lorenz Buehmann + * + */ public class ClassPanelSparqlDescriptor extends WizardPanelDescriptor{ public static final String IDENTIFIER = "CLASS_CHOOSE_SPARQL_PANEL"; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -30,6 +30,11 @@ import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; +/** + * List cell renderer for colored lines to provide better view on list values. + * @author Lorenz Buehmann + * + */ public class ColorListCellRenderer extends JLabel implements ListCellRenderer { private static final long serialVersionUID = -7592805113197759247L; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -43,6 +43,11 @@ import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.Thing; +/** + * Label that might have menu items when clicked on it. + * @author Lorenz Buehmann + * + */ public class DescriptionLabel extends JLabel implements MouseListener{ /** * @@ -84,7 +89,7 @@ } /** - * initialize description label with solution + * initialize description label with solution. */ public void init(){ baseURI = ore.getBaseURI(); @@ -241,14 +246,14 @@ /** - * returns actual description + * returns actual description. */ public Description getDescription(){ return desc; } /** - * adds action listeners to menu items + * adds action listeners to menu items. * @param aL */ public void addActionListeners(ActionListener aL){ @@ -275,6 +280,9 @@ } + /** + * Underlining label when mouse over. + */ public void mouseEntered(MouseEvent e) { setText("<html><u>" + ((Description) desc).toManchesterSyntaxString(ore @@ -286,6 +294,9 @@ } + /** + * Removing underlining when mosue relased. + */ public void mouseExited(MouseEvent e) { setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -24,6 +24,11 @@ import org.dllearner.core.owl.Description; +/** + * Item for possible repair action. + * @author Lorenz Buehmann + * + */ public class DescriptionMenuItem extends JMenuItem { /** @@ -57,11 +62,18 @@ this.action = action; } - + /** + * Returns the description part where item is asserted to. + * @return description + */ public Description getDescription(){ return desc; } + /** + * Returns action type represented as number.. + * @return number + */ public int getActionID(){ return action; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -33,6 +33,11 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; +/** + * Panel where learned class description is shown, and parts that might occur errors are red colored. + * @author Lorenz Buehmann + * + */ public class DescriptionPanel extends JPanel{ /** @@ -44,7 +49,7 @@ private Individual ind; private ActionListener aL; private String mode; - boolean correct = false; + private boolean correct = false; private Description newClassDescription; public DescriptionPanel(ORE ore, Individual ind, ActionListener aL, String mode){ @@ -52,7 +57,7 @@ setBackground(Color.WHITE); setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); this.ore = ore; - this.newClassDescription = ore.getNewClassDescription(); + this.newClassDescription = ore.getNewClassDescription().getDescription(); this.ind = ind; this.aL = aL; this.mode = mode; @@ -70,7 +75,7 @@ } } else if(mode.equals("pos")){ - for(JLabel jL : ore.DescriptionToJLabelPos(ind, newClassDescription)){ + for(JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)){ add(jL); if(jL instanceof DescriptionLabel){ @@ -84,6 +89,9 @@ } } + /** + * Updates the panel. + */ public void updatePanel(){ for(Component c : getComponents()) if(c instanceof JLabel) @@ -104,7 +112,7 @@ } } else if(mode.equals("pos")){ - for (JLabel jL : ore.DescriptionToJLabelPos(ind, newClassDescription)) { + for (JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)) { add(jL); if (jL instanceof DescriptionLabel) { ((DescriptionLabel) jL).setIndOre(ore, ind); @@ -119,7 +127,10 @@ } - + /** + * Checks whether description is covered by positive example, or not covered by negative example. + * @return true if description is covered by positive example, or not covered by negative example, otherwise false is returned + */ public boolean isCorrect(){ return correct; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -32,7 +32,11 @@ import javax.swing.JTextArea; import javax.swing.UIManager; - +/** + * Wizard panel with introduction text. + * @author Lorenz Buehmann + * + */ public class IntroductionPanel extends JPanel { private static final long serialVersionUID = 7184544803724152044L; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanelDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanelDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -21,7 +21,11 @@ package org.dllearner.tools.ore; - +/** + * Wizard panel descriptor with some informations for the tool. + * @author Lorenz Buehmann + * + */ public class IntroductionPanelDescriptor extends WizardPanelDescriptor { public static final String IDENTIFIER = "INTRODUCTION_PANEL"; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -39,6 +39,12 @@ import javax.swing.event.DocumentListener; import javax.swing.filechooser.FileFilter; +/** + * Wizard panel where radio buttons for choosing knowledge source type, button for browsing + * file system and textfields for inserting file name or SPARQL-URL are added. + * @author Lorenz Buehmann + * + */ public class KnowledgeSourcePanel extends JPanel{ private static final long serialVersionUID = -3997200565180270088L; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -26,7 +26,11 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; - +/** + * Wizard panel descriptor where knowledge source is selected. + * @author Lorenz Buehmann + * + */ public class KnowledgeSourcePanelDescriptor extends WizardPanelDescriptor implements ActionListener, DocumentListener{ public static final String IDENTIFIER = "KNOWLEDGESOURCE_CHOOSE_PANEL"; @@ -66,6 +70,9 @@ setNextButtonAccordingToExistingOWLFile(); } + /** + * Actions for buttons. + */ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if(cmd.equals("browse")){ @@ -110,7 +117,7 @@ setNextButtonAccordingToExistingOWLFile(); } - public KnowledgeSourcePanel getPanel() { + public KnowledgeSourcePanel getPanel() { return knowledgePanel; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -47,7 +47,11 @@ import org.jdesktop.swingx.painter.BusyPainter; - +/** + * The wizard panel where list and buttons for learning step are shown. + * @author Lorenz Buehmann + * + */ public class LearningPanel extends JPanel{ private static final long serialVersionUID = -7411197973240429632L; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -33,12 +33,16 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.owl.Description; - +/** + * Wizard panel descriptor where learned class description are shown. + * @author Lorenz Buehmann + * + */ public class LearningPanelDescriptor extends WizardPanelDescriptor implements ActionListener, ListSelectionListener{ public static final String IDENTIFIER = "LEARNING_PANEL"; @@ -94,13 +98,14 @@ // Description de = new NamedClass("http://example.com/father#male"); if (!e.getValueIsAdjusting()){ - getWizardModel().getOre().setNewClassDescription((Description)(learnPanel.getResultList().getSelectedValue())); - - + getWizardModel().getOre().setNewClassDescription(((EvaluatedDescription) (learnPanel.getResultList().getSelectedValue()))); } } + /** + * Actions for pressing start- or stop-button. + */ public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("Start")){ learnPanel.getListModel().clear(); @@ -120,12 +125,8 @@ } - - } - - private void setNextButtonAccordingToConceptSelected() { if (learnPanel.getResultList().getSelectedValue()!= null){ @@ -136,35 +137,51 @@ } + /** + * Returns the swing worker thread instance. + * @return swing worker + */ public LearnSwingWorker getWorkerThread(){ return worker; } + /** + * Returns the timer instance. + * @return timer + */ public Timer getTimer(){ return timer; } + /** + * Returns the learning algorithm instance. + * @return learning algorithm + */ public LearningAlgorithm getLa() { return la; } + /** + * Clear list and loading message. + */ public void setPanelDefaults(){ learnPanel.getListModel().clear(); learnPanel.getStatusLabel().setText(""); } - - class LearnSwingWorker extends SwingWorker<List<Description>, List<Description>> { - - + /** + * Inner class, containing the background thread for learning class descriptions. + * @author Lorenz Buehmann + * + */ + class LearnSwingWorker extends SwingWorker<List<EvaluatedDescription>, List<EvaluatedDescription>> { + Thread t; - - @SuppressWarnings("unchecked") @Override - public List<Description> doInBackground() { + public List<EvaluatedDescription> doInBackground() { learnPanel.getResultList().setCellRenderer(new ColumnListCellRenderer(getWizardModel().getOre())); learnPanel.getLoadingLabel().setBusy(true); @@ -177,8 +194,7 @@ @Override public void run() { if(la != null){ - - publish(la.getCurrentlyBestDescriptions(30, true)); + publish(la.getCurrentlyBestEvaluatedDescriptions(30, 0.0, true)); } } @@ -204,7 +220,7 @@ // TODO Auto-generated catch block e.printStackTrace(); } - List<Description> result = getWizardModel().getOre().getLearningResults(30); + List<EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions(30, 0.0, true); return result; } @@ -213,7 +229,7 @@ public void done() { timer.cancel(); - List<Description> result = null; + List<EvaluatedDescription> result = null; try { result = get(); } catch (InterruptedException e) { @@ -230,16 +246,16 @@ } @Override - protected void process(List<List<Description>> resultLists) { + protected void process(List<List<EvaluatedDescription>> resultLists) { // panel4.getModel().clear(); - for (List<Description> list : resultLists) { + for (List<EvaluatedDescription> list : resultLists) { updateList(list); } } - void updateList(final List<Description> result) { + void updateList(final List<EvaluatedDescription> result) { Runnable doUpdateList = new Runnable() { @@ -247,7 +263,7 @@ DefaultListModel dm = new DefaultListModel(); public void run() { // learnPanel.getListModel().clear(); - for (Description d : result) { + for (EvaluatedDescription d : result) { dm.addElement(d); // panel4.getModel().addElement(d); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -28,6 +28,11 @@ import javax.swing.JLabel; import javax.swing.JPanel; +/** + * Navigation panel where it's shown the actual wizard step and former and following steps. + * @author Lorenz Buehmann + * + */ public class LeftPanel extends JPanel{ private static final long serialVersionUID = -1205252523136710091L; @@ -56,6 +61,10 @@ } + /** + * Sets the actual step, that has to be printed bold in the navigation panel. + * @param i number of the step + */ public void set(int i){ removeAll(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/Main.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/Main.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/Main.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -26,9 +26,17 @@ import javax.swing.UnsupportedLookAndFeelException; - +/** + * Main class starting the wizard and registering wizard panels. + * @author Lorenz Buehmann + * + */ public class Main { + /** + * main method. + * @param args possible is to use OWL-File as parameter + */ public static void main(String[] args) { try { UIManager.setLookAndFeel( Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -21,8 +21,7 @@ package org.dllearner.tools.ore; import java.io.File; -import java.math.BigDecimal; -import java.util.ArrayList; +import java.net.MalformedURLException; import java.util.Collection; import java.util.HashSet; import java.util.List; @@ -37,6 +36,7 @@ import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; 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.LearningProblemUnsupportedException; @@ -54,7 +54,11 @@ import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; - +/** + * This class contains init methods, and is used as broker between wizard and OWL-API. + * @author Lorenz Buehmann + * + */ public class ORE { private LearningAlgorithm la; @@ -69,9 +73,9 @@ private SortedSet<Individual> posExamples; private SortedSet<Individual> negExamples; - private NamedClass ignoredConcept; - private Description newClassDescription; - private Set<NamedClass> allAtomicConcepts; + private NamedClass classToLearn; + private EvaluatedDescription newClassDescription; + private OntologyModifier modifier; @@ -89,12 +93,19 @@ // step 1: detect knowledge sources + /** + * Applying knowledge source. + */ public void setKnowledgeSource(File f) { - Class<OWLFile> owl = OWLFile.class; - ks = cm.knowledgeSource(owl); + ks = cm.knowledgeSource(OWLFile.class); - cm.applyConfigEntry(ks, "url", f.toURI().toString()); + try { + cm.applyConfigEntry(ks, "url", f.toURI().toURL()); + } catch (MalformedURLException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } try { ks.init(); @@ -106,7 +117,9 @@ } - + /** + * Initialize the reasoners. + */ public void initReasoners(){ fastReasoner = cm.reasoner(FastInstanceChecker.class, ks); @@ -127,22 +140,24 @@ e.printStackTrace(); } rs = cm.reasoningService(fastReasoner); - modifier = new OntologyModifier(owlReasoner); + modifier = new OntologyModifier(owlReasoner, rs); baseURI = fastReasoner.getBaseURI(); prefixes = fastReasoner.getPrefixes(); } + /** + * Returns the reasoningservice. + * @return reasoning service + */ public ReasoningService getReasoningService(){ return rs; } - public SortedSet<Individual> getPosExamples(){ - return posExamples; - } + public void setPosNegExamples(){ - posExamples = rs.retrieval(ignoredConcept); + posExamples = rs.retrieval(classToLearn); negExamples = rs.getIndividuals(); for (Individual pos : posExamples){ @@ -150,16 +165,13 @@ } } - public SortedSet<Individual> getNegExamples(){ - return negExamples; - } - + public OntologyModifier getModifier() { return modifier; } - public Description getNewClassDescription() { + public EvaluatedDescription getNewClassDescription() { return newClassDescription; } @@ -200,7 +212,7 @@ Set<String> t = new TreeSet<String>(); - t.add(ignoredConcept.getName()); + t.add(classToLearn.getName()); cm.applyConfigEntry(la, "ignoredConcepts", t); cm.applyConfigEntry(la, "guaranteeXgoodDescriptions", 10); try { @@ -212,8 +224,12 @@ } - public void setConcept(NamedClass concept){ - this.ignoredConcept = concept; + /** + * Sets the class that has to be learned. + * @param oldClass class that is choosen to be (re)learned + */ + public void setClassToLearn(NamedClass oldClass){ + this.classToLearn = oldClass; } public void init(){ @@ -230,9 +246,13 @@ } - public LearningAlgorithm start(){ + /** + * Starts the learning algorithm, setting noise value and ignored concepts. + * + */ + public void start(){ Set<String> t = new TreeSet<String>(); - t.add(ignoredConcept.getName()); + t.add(classToLearn.getName()); cm.applyConfigEntry(la, "ignoredConcepts", t); cm.applyConfigEntry(la, "noisePercentage", noise); try { @@ -243,119 +263,10 @@ } la.start(); - return la; - } - - public List<Description> getLearningResults(int anzahl){ - return la.getCurrentlyBestDescriptions(anzahl, true); - } - - /** - * returns accuracy of a description - * @param d - * @return - */ - public BigDecimal computeAccuracy(Description d){ - int numberPosExamples = 0; - int numberNegExamples = 0; - double result_tmp = 0.0f; - for(Individual ind : posExamples){ - if(rs.instanceCheck(d, ind)) - numberPosExamples++; - } - for(Individual ind : negExamples){ - if(!rs.instanceCheck(d, ind)) - numberNegExamples++; - } - - result_tmp = ((float)(numberPosExamples) + (float)(numberNegExamples))/((float)(posExamples.size())+(float)(negExamples.size())) * 100; - BigDecimal result = new BigDecimal( result_tmp ); - result = result.setScale( 2, BigDecimal.ROUND_HALF_UP ); - return result; - - } - - public HashSet<Individual> getNegFailureExamples(){ - FastInstanceChecker instanceReasoner = cm.reasoner(FastInstanceChecker.class, ks); - try { - instanceReasoner.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - ReasoningService instanceRs = cm.reasoningService(instanceReasoner); - HashSet<Individual> negFailureExamples = new HashSet<Individual>() ; - - for(Individual ind : negExamples){ - if(instanceRs.instanceCheck(newClassDescription, ind)) - negFailureExamples.add(ind); - - } - - return negFailureExamples; - } - - public List<HashSet<Individual>> getFailureExamples(){ - List<HashSet<Individual>> list = new ArrayList<HashSet<Individual>>(); - - FastInstanceChecker instanceReasoner = cm.reasoner(FastInstanceChecker.class, ks); - try { - instanceReasoner.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - ReasoningService instanceRs = cm.reasoningService(instanceReasoner); - - HashSet<Individual> posFailureExamples = new HashSet<Individual>() ; - for(Individual ind : posExamples){ - if(!instanceRs.instanceCheck(newClassDescription, ind)) - posFailureExamples.add(ind); - } - - HashSet<Individual> negFailureExamples = new HashSet<Individual>() ; - for(Individual ind : negExamples){ - if(instanceRs.instanceCheck(newClassDescription, ind)) - negFailureExamples.add(ind); - } - - list.add(posFailureExamples); - list.add(negFailureExamples); - - - - return list; - - } - public HashSet<Individual> getPosFailureExamples(){ - FastInstanceChecker instanceReasoner = cm.reasoner(FastInstanceChecker.class, ks); - try { - instanceReasoner.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - ReasoningService instanceRs = cm.reasoningService(instanceReasoner); - - HashSet<Individual> posFailureExamples = new HashSet<Individual>() ; - - - for(Individual ind : posExamples){ - if(!instanceRs.instanceCheck(newClassDescription, ind)) - posFailureExamples.add(ind); - - } - - return posFailureExamples; - } - - public void setNewClassDescription(Description newClassDescription) { + public void setNewClassDescription(EvaluatedDescription newClassDescription) { this.newClassDescription = newClassDescription; } @@ -364,15 +275,13 @@ } public NamedClass getIgnoredConcept() { - return ignoredConcept; + return classToLearn; } - public void setAllAtomicConcepts(Set<NamedClass> allAtomicConcepts) { - this.allAtomicConcepts = allAtomicConcepts; - } + /** - * finds out description parts that might cause inconsistency - for negative examples only + * retrieves description parts that might cause inconsistency - for negative examples only * @param ind * @param desc * @return @@ -404,7 +313,7 @@ return criticals; } /** - * finds the description that might cause inconsistency for negative examples + * Retrieves the description parts, that might cause inconsistency - for negative examples. * @param ind * @param desc * @return vector of JLabel @@ -467,12 +376,12 @@ } /** - * finds the description that might cause inconsistency for positive examples + * Retrieves the description parts that might cause inconsistency - for positive examples. * @param ind * @param desc * @return vector of JLabel */ - public Collection<JLabel> DescriptionToJLabelPos(Individual ind, Description desc){ + public Collection<JLabel> descriptionToJLabelPos(Individual ind, Description desc){ Collection<JLabel> criticals = new Vector<JLabel>(); List<Description> children = desc.getChildren(); @@ -485,17 +394,17 @@ if(desc instanceof Union){ criticals.add(new JLabel("(")); for(int i = 0; i<children.size()-1; i++){ - criticals.addAll(DescriptionToJLabelPos(ind, desc.getChild(i))); + criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(i))); criticals.add(new JLabel("or")); } - criticals.addAll(DescriptionToJLabelPos(ind, desc.getChild(children.size()-1))); + criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); criticals.add(new JLabel(")")); } else if(desc instanceof Intersection){ criticals.add(new JLabel("(")); for(int i = 0; i<children.size()-1; i++){ if(!fastReasoner.instanceCheck(desc.getChild(i), ind)){ - criticals.addAll(DescriptionToJLabelPos(ind, desc.getChild(i))); + criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(i))); } else{ criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); @@ -503,7 +412,7 @@ criticals.add(new JLabel("and")); } if(!fastReasoner.instanceCheck(desc.getChild(children.size()-1), ind)){ - criticals.addAll(DescriptionToJLabelPos(ind, desc.getChild(children.size()-1))); + criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); } else{ criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); @@ -529,7 +438,7 @@ } /** - * returns individuals that are in range of property + * Returns individuals that are in range of property. * @param objRestr * @param ind * @return @@ -543,7 +452,7 @@ } /** - * returns individuals that are not in range of property + * Returns individuals that are not in range of property. * @param objRestr * @param ind * @return @@ -569,6 +478,11 @@ return allIndividuals; } + /** + * Returns classes where individual might moved to. + * @param ind the individual + * @return set of classes + */ public Set<NamedClass> getpossibleClassesMoveTo(Individual ind){ Set<NamedClass> moveClasses = new HashSet<NamedClass>(); for(NamedClass nc : rs.getNamedClasses()){ @@ -576,11 +490,16 @@ moveClasses.add(nc); } } - moveClasses.remove(ignoredConcept); + moveClasses.remove(classToLearn); return moveClasses; } + /** + * Returns classes where individual might moved from. + * @param ind the individual + * @return set of classes + */ public Set<NamedClass> getpossibleClassesMoveFrom(Individual ind){ Set<NamedClass> moveClasses = new HashSet<NamedClass>(); for(NamedClass nc : rs.getNamedClasses()){ @@ -588,11 +507,14 @@ moveClasses.add(nc); } } - moveClasses.remove(ignoredConcept); + moveClasses.remove(classToLearn); return moveClasses; } + /** + * Update reasoners ontology. + */ public void updateReasoner(){ fastReasoner = cm.reasoner(FastInstanceChecker.class, new OWLAPIOntology(modifier.getOntology())); try { @@ -614,7 +536,7 @@ } /** - * get the complement classes where individual is asserted to + * Get the complement classes where individual is asserted to. * @param desc * @param ind * @return @@ -622,10 +544,11 @@ public Set<NamedClass> getComplements(Description desc, Individual ind){ Set<NamedClass> complements = new HashSet<NamedClass>(); for(NamedClass nc : owlReasoner.getAtomicConcepts()){ - - if(owlReasoner.instanceCheck(nc, ind)){ - if(modifier.isComplement(desc, nc)){ - complements.add(nc); + if(!(nc.toString().endsWith("Thing"))){ + if(owlReasoner.instanceCheck(nc, ind)){ + if(modifier.isComplement(desc, nc)){ + complements.add(nc); + } } } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -28,6 +28,7 @@ import java.util.List; import java.util.Set; +import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; @@ -66,24 +67,30 @@ import org.semanticweb.owl.model.UnknownOWLOntologyException; import org.semanticweb.owl.util.OWLEntityRemover; +/** + * This class provides several methods to modify the ontology by using OWL-API. + * @author Lorenz Buehmann + * + */ public class OntologyModifier { private OWLOntology ontology; private OWLAPIReasoner reasoner; private OWLDataFactory factory; private OWLOntologyManager manager; + private ReasoningService rs; - public OntologyModifier(OWLAPIReasoner reasoner){ + public OntologyModifier(OWLAPIReasoner reasoner, ReasoningService rs){ this.reasoner = reasoner; this.manager = OWLManager.createOWLOntologyManager(); this.factory = manager.getOWLDataFactory(); this.ontology = reasoner.getOWLAPIOntologies().get(0); - + this.rs = rs; } /** - * Adds an EquivalentClassesAxiom axiom to the ontology + * Adds an EquivalentClassesAxiom axiom to the ontology. * @param newDesc new axiom to add * @param oldDesc old description * @return @@ -113,11 +120,11 @@ } /** - * rewrite ontology by replacing old class with new learned class description + * Rewrite ontology by replacing old class with new learned class description. * @param newDesc * @param oldClass */ - public void rewriteClassDescription(Description newDesc, Description oldClass){ + public List<OWLOntologyChange> rewriteClassDescription(Description newDesc, Description oldClass){ OWLDescription newClassDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(newDesc); // OWLDescription oldClassDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(oldClass); @@ -150,10 +157,12 @@ e.printStackTrace(); } + return changes; + } /** - * saves the ontology as RDF-file + * Saves the ontology as RDF-file. */ public void saveOntology(){ @@ -173,7 +182,7 @@ } /** - * Deletes the complete individual from the ontology + * Deletes the complete individual from the ontology. * @param ind the individual to delete */ public List<OWLOntologyChange> deleteIndividual(Individual ind){ @@ -201,7 +210,7 @@ } /** - * Removes a classAssertion + * Removes a classAssertion. * @param ind the individual which has to removed from class * @param desc the class to which the individual is asserted * @return changes that have been done @@ -231,7 +240,7 @@ } /** - * adds a classAssertion + * Adds a classAssertion. * @param ind the individual which has to be asserted to class * @param desc the class to which the individual has to be asserted * @return changes that have been done @@ -264,7 +273,7 @@ } /** - * removes classAssertion between individual to a old class, and creates a new classAssertion + * Removes classAssertion between individual to a old class, and creates a new classAssertion. * @param ind individual which has to be moved * @param oldClass class where individual is asserted before * @param newClass class where individual is moved to @@ -304,7 +313,7 @@ } /** - * + * Removes all object property assertions with role, and it's inverse. * @param ind the individual which property has to be removed * @param objSome the property which has to be removed * @return changes that have been done @@ -321,22 +330,29 @@ OWLObjectPropertyExpression invProperty = null; - for(OWLInverseObjectPropertiesAxiom inv : invProperties) - if(propertyOWLAPI.equals(inv.getSecondProperty())) + for(OWLInverseObjectPropertiesAxiom inv : invProperties){ + if(propertyOWLAPI.equals(inv.getSecondProperty())){ invProperty = inv.getFirstProperty(); - else + } + else{ invProperty = inv.getSecondProperty(); + } + } List<RemoveAxiom> removeList = new LinkedList<RemoveAxiom>(); for(OWLObjectPropertyAssertionAxiom o :properties){ - if( (o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(individualOWLAPI))) + if( (o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(individualOWLAPI))){ removeList.add(new RemoveAxiom(ontology, o)); - if(invProperty != null) - for(OWLObjectPropertyAssertionAxiom ob :ontology.getObjectPropertyAssertionAxioms(o.getObject())) - if(ob.getProperty().equals(invProperty) && ob.getObject().equals(individualOWLAPI)) + } + if(invProperty != null){ + for(OWLObjectPropertyAssertionAxiom ob :ontology.getObjectPropertyAssertionAxioms(o.getObject())){ + if(ob.getProperty().equals(invProperty) && ob.getObject().equals(individualOWLAPI)){ removeList.add(new RemoveAxiom(ontology, ob)); + } + } + } } @@ -356,7 +372,7 @@ /** - * removes an object property assertion from the ontology if the axiom is existing in the ontology + * Removes an object property assertion from the ontology if the axiom is existing in the ontology. * @param subject * @param objSome * @param object @@ -396,7 +412,7 @@ } /** - * + * Adds an object property assertion to the ontology. * @param subInd the individual which is subject in the objectProperty * @param objSome the property which has to be added to subject * @param objInd the individual which is object in the objectProperty @@ -457,7 +473,7 @@ } /** - * checks whether desc1 and desc2 are complement of each other + * checks whether desc1 and desc2 are disjoint. * @param desc1 class 1 * @param desc2 class 2 * @return @@ -467,25 +483,35 @@ OWLClass owlClass1 = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc1).asOWLClass(); OWLClass owlClass2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc2).asOWLClass(); - //superclasses and class1 - Set<OWLDescription> superClasses1 = owlClass1.getSuperClasses(ontology); +// Set<OWLDescription> superClasses1 = owlClass1.getSuperClasses(ontology); + Set<OWLDescription> superClasses1 = new HashSet<OWLDescription>(); + for(Description d : rs.getMoreGeneralConcepts(desc1)){ + superClasses1.add(OWLAPIDescriptionConvertVisitor.getOWLDescription(d)); + } superClasses1.add(owlClass1); +// System.out.println(desc1 + "::" + superClasses1); //superclasses and class2 - Set<OWLDescription> superClasses2 = owlClass2.getSuperClasses(ontology); +// Set<OWLDescription> superClasses2 = owlClass2.getSuperClasses(ontology); + Set<OWLDescription> superClasses2 = new HashSet<OWLDescription>(); + for(Description d : rs.getMoreGeneralConcepts(desc2)){ + superClasses2.add(OWLAPIDescriptionConvertVisitor.getOWLDescription(d)); + } superClasses2.add(owlClass2); for(OWLAxiom ax : ontology.getAxioms()){ for(OWLDescription o1 : superClasses1){ + OWLDescription negO1 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o1.toString()))); for(OWLDescription o2 : superClasses2){ +// System.out.println(o1 + " " + o2); OWLDescription negO2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o2.toString()))); - - if(ax.equals(factory.getOWLDisjointClassesAxiom(o1, o2))){ + System.out.println(factory.getOWLDisjointClassesAxiom(o1, o2)); + if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o1, o2).toString())){ return true; - }else if(ax.equals(factory.getOWLDisjointClassesAxiom(o2, o1))){ + }else if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o2, o1).toString())){ return true; }else if(ax.toString().equals(factory.getOWLEquivalentClassesAxiom(o1, negO2).toString())){ return true; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -54,6 +54,12 @@ import org.dllearner.core.owl.ObjectSomeRestriction; import org.semanticweb.owl.model.OWLOntologyChange; +/** + * The repair dialog where the learned class description (including error parts), + * the statistics and the undo options are shown. + * @author Lorenz Buehmann + * + */ public class RepairDialog extends JDialog implements ActionListener, MouseListener{ /** @@ -130,6 +136,10 @@ } + /** + * Initializing and making dialog visible. + * @return integer value + */ public int showDialog(){ baseURI = ore.getBaseURI(); prefixes = ore.getPrefixes(); @@ -200,6 +210,9 @@ } + /** + * Method controls action events triggered by clicking on red labels in class description at the top of the dialog. + */ public void actionPerformed(ActionEvent e) { if(e.getSource() instanceof DescriptionMenuItem){ Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -28,15 +28,12 @@ import java.awt.Insets; import java.awt.event.ActionListener; import java.awt.event.MouseListener; -import java.awt.geom.Ellipse2D; -import java.awt.geom.RoundRectangle2D; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -44,43 +41,37 @@ import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionListener; -import org.jdesktop.swingx.JXBusyLabel; -import org.jdesktop.swingx.icon.EmptyIcon; -import org.jdesktop.swingx.painter.BusyPainter; - +/** + * JPanel for repairing action. + * @author Lorenz Buehmann + * + */ public class RepairPanel extends JPanel{ private static final long serialVersionUID = -7411197973240429632L; private JPanel contentPanel; - private DefaultListModel posFailureModel; private DefaultListModel negFailureModel; - - private JLabel statusLabel; - private JXBusyLabel loadingLabel; - - - private JPanel posPanel; - private JList posList; private JScrollPane posScrollPane; - private JScrollPane negScrollPane; + private JList posList; + private JPanel posButtonPanel; private JButton pos_repairButton; private JButton pos_deleteButton; private JButton pos_removeButton; - private JPanel posButtonPanel; + + private JPanel negPanel; + private JScrollPane negScrollPane; + private JList negList; + private JPanel negButtonPanel; private JButton neg_repairButton; private JButton neg_deleteButton; private JButton neg_addButton; - private JPanel negButtonPanel; - private JList negList; - private JPanel negPanel; - @SuppressWarnings("unchecked") public RepairPanel() { super(); @@ -90,21 +81,7 @@ this.setLayout(new java.awt.BorderLayout()); JPanel labelPanel = new JPanel(); - statusLabel = new JLabel(); - - loadingLabel = new JXBusyLabel(new Dimension(15,15)); - BusyPainter painter = new BusyPainter( - new RoundRectangle2D.Float(0, 0,6.0f,2.6f,10.0f,10.0f), - new Ellipse2D.Float(2.0f,2.0f,11.0f,11.0f)); - painter.setTrailLength(2); - painter.setPoints(7); - painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15,15)); - loadingLabel.setIcon(new EmptyIcon(15,15)); - loadingLabel.setBusyPainter(painter); - labelPanel.add(loadingLabel); - labelPanel.add(statusLabel); - + contentPanel = getContentPanel(); add(contentPanel,BorderLayout.CENTER); @@ -247,43 +224,51 @@ return contentPanel; } - - - public JLabel getStatusLabel() { - return statusLabel; - } - - public JXBusyLabel getLoadingLabel() { - return loadingLabel; - } - + /** + * Returns the list model for positive examples. + * @return list model + */ public DefaultListModel getPosFailureModel() { return posFailureModel; } + /** + * Returns the list model for negative examples. + * @return list model + */ public DefaultListModel getNegFailureModel() { return negFailureModel; } + /** + * Returns the list for positive examples. + * @return positive list + */ public javax.swing.JList getPosFailureList() { return posList; } + /** + * Returns the list for negative examples. + * @return negative list + */ public javax.swing.JList getNegFailureList() { return negList; } + /** + * adds the list selection listener for lists. + * @param l list selection listener + */ public void addSelectionListeners(ListSelectionListener l){ posList.addListSelectionListener(l); negList.addListSelectionListener(l); } - - public void addMouseListeners(MouseListener mL){ - posList.addMouseListener(mL); - negList.addMouseListener(mL); - } - + /** + * Adds the action listener to buttons. + * @param aL action listener + */ public void addActionListeners(ActionListener aL){ pos_removeButton.addActionListener(aL); pos_deleteButton.addActionListener(aL); @@ -293,6 +278,19 @@ neg_repairButton.addActionListener(aL); } + /** + * Adds mouse listener to lists. + * @param mL mouse listener + */ + public void addMouseListeners(MouseListener mL){ + posList.addMouseListener(mL); + negList.addMouseListener(mL); + } + + /** + * Sets custom cell renderer to the lists. + * @param ore + */ public void setCellRenderers(ORE ore){ ColorListCellRenderer cell = new ColorListCellRenderer(ore); posList.setCellRenderer(cell); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -27,6 +27,7 @@ import java.util.HashSet; import java.util.Set; +import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -36,7 +37,11 @@ - +/** + * Wizard panel descriptor where it is possible torepair wrong examples. + * @author Lorenz Buehmann + * + */ public class RepairPanelDescriptor extends WizardPanelDescriptor implements ActionListener, ListSelectionListener, MouseListener{ public static final String IDENTIFIER = "REPAIR_PANEL"; @@ -56,7 +61,7 @@ repairPanel.addActionListeners(this); repairPanel.addSelectionListeners(this); repairPanel.addMouseListeners(this); - + setPanelDescriptorIdentifier(IDENTIFIER); setPanelComponent(repairPanel); ontologyChanges = new HashSet<OWLOntologyChange>(); @@ -79,23 +84,34 @@ getWizard().getInformationField().setText(INFORMATION); } - public void clearLists(){ - repairPanel.getNegFailureModel().clear(); - repairPanel.getPosFailureModel().clear(); + /** + * Adds the wrong negative and positive examples to the lists. + */ + public void refreshExampleLists(){ + this.ore = getWizardModel().getOre(); + repairPanel.setCellRenderers(ore); + + DefaultListModel negModel = repairPanel.getNegFailureModel(); + negModel.clear(); + for(Individual ind : ore.getNewClassDescription().getCoveredNegatives()){ + negModel.addElement(ind); + } + + DefaultListModel posModel = repairPanel.getPosFailureModel(); + posModel.clear(); + for(Individual ind : ore.getNewClassDescription().getNotCoveredPositives()){ + posModel.addElement(ind); + } + + } - - - public void valueChanged(ListSelectionEvent e) { - -// if (!e.getValueIsAdjusting()) -// System.err.println(panel4.getNegFailureList().getSelectedValue()); - - } - + /** + * Method to control actions by button pressed. + */ public void actionPerformed(ActionEvent event) { - ore = getWizardModel().getOre(); +// ore = getWizardModel().getOre(); modi = ore.getModifier(); String actionName = ((JButton)event.getSource()).getName(); String actionType = ((JButton)event.getSource()).getParent().getName(); @@ -152,6 +168,9 @@ } + /** + * Method provides repair action by double click on list element. + */ public void mouseClicked(MouseEvent e) { if(e.getClickCount() == 2){ @@ -186,22 +205,6 @@ } public void mouseEntered(MouseEvent e) { -// JList negList = repairPanel.getNegFailureList(); -// DefaultListModel negModel = repairPanel.getNegFailureModel(); -// if(e.getSource() instanceof JList){ -// int index = negList.locationToIndex(e.getPoint()); -// if (-1 < index) { -// Individual ind = (Individual)negModel.getElementAt(index); -// StringBuffer strBuf = new StringBuffer(); -// strBuf.append("<html><b><u>classes:</b></u><br><br><BLOCKQUOTE>"); -// -// for(NamedClass n: getWizardModel().getOre().reasoner2.getConcepts(ind)) -// strBuf.append("<br>" + n ); -// strBuf.append("</BLOCKQUOTE></html>"); -// negList.setToolTipText(strBuf.toString()); -// } -// } - } @@ -220,13 +223,20 @@ } - + /** + * Returns all ontology changes been done by repairing ontology. + * @return + */ public Set<OWLOntologyChange> getOntologyChanges() { return ontologyChanges; } + + @Override + public void valueChanged(ListSelectionEvent arg0) { + // TODO Auto-generated method stub + + } - - } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -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.ore; import java.util.SortedSet; @@ -7,11 +26,17 @@ import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; +import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL; import org.dllearner.utilities.learn.LearnSPARQLConfiguration; import org.dllearner.utilities.learn.LearnSparql; +/** + * Test class for SPARQL mode. + * @author Lorenz Buehmann + * + */ public class SPARQLTest{ public static void main(String[] args){ @@ -31,15 +56,17 @@ LearnSparql learn = new LearnSparql(conf); LearningAlgorithm la = null; -// try { -// la = learn.learn(posExamples, negExamples); -// } catch (ComponentInitException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (LearningProblemUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// la.start(); + + try { + la = learn.learn(posExamples, negExamples, OWLAPIReasoner.class); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + la.start(); } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SavePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SavePanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SavePanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -25,7 +25,11 @@ import javax.swing.JButton; import javax.swing.JPanel; - +/** + * JPanel where to buttons are added to save and go back to class choose panel. + * @author Lorenz Buehmann + * + */ public class SavePanel extends JPanel{ /** @@ -43,6 +47,10 @@ add(saveGoBack); } + /** + * Adds the action listener to both buttons. + * @param aL action listener + */ public void addActionListeners(ActionListener aL){ saveExit.addActionListener(aL); saveGoBack.addActionListener(aL); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SavePanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SavePanelDescriptor.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SavePanelDescriptor.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -23,6 +23,11 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +/** + * Wizard panel descriptor that provides saving ontology and going back to class choose panel. + * @author Lorenz Buehmann + * + */ public class SavePanelDescriptor extends WizardPanelDescriptor implements ActionListener{ public static final String IDENTIFIER = "SAVE_PANEL"; public static final String INFORMATION = "Press 'Save and exit' button to save the changes you made and exit the program, " + Modified: trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java 2008-09-19 11:53:26 UTC (rev 1232) +++ trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java 2008-09-21 12:48:48 UTC (rev 1233) @@ -40,10 +40,13 @@ import org.jdesktop.swingx.JXTaskPane; import org.jdesktop.swingx.JXTaskPaneContainer; +/** + * Here are shown the name of the individual, class assertions and object properties of the individual which is selected to repair. + * @author Lorenz B... [truncated message content] |
From: <lor...@us...> - 2008-09-17 07:54:24
|
Revision: 1229 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1229&view=rev Author: lorenz_b Date: 2008-09-17 14:54:20 +0000 (Wed, 17 Sep 2008) Log Message: ----------- added method getInconsistentOWLClasses() Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-17 13:26:39 UTC (rev 1228) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-17 14:54:20 UTC (rev 1229) @@ -979,5 +979,18 @@ } return concepts; } + + + public Set<OWLClass> getInconsistentOWLClasses(){ + + try { + return reasoner.getInconsistentClasses(); + } catch (OWLReasonerException e) { + e.printStackTrace(); + throw new Error("Inconsistens classes check error in OWL API."); + } + + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-17 02:38:30
|
Revision: 1227 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1227&view=rev Author: sknappe Date: 2008-09-17 09:38:27 +0000 (Wed, 17 Sep 2008) Log Message: ----------- Made some changes with the layout and also with getting instances from concepts ("easy" concepts of the form http://... AND http://.. OR http://... are processed with help of the database, changed the algorithm a bit, so that not only the yago class itself is tested for instances but also the subclasses, have to test that further) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -49,7 +49,6 @@ $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth",1); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); - //$this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useLits", true); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", "DBPEDIA"); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", $settings->useCache); @@ -66,8 +65,8 @@ $this->client->setPositiveExamples($this->id, $posExamples); if(!empty($negExamples)) $this->client->setNegativeExamples($this->id, $negExamples); - $this->client->setLearningAlgorithm($this->id, "dbpediaNavigationSuggestor"); - + $algorithmID=$this->client->setLearningAlgorithm($this->id, "dbpediaNavigationSuggestor"); + $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "forceRefinementLengthIncrease", true); $start = microtime(true); $this->client->initAll($this->id); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -49,7 +49,7 @@ print $content; print '$$$'; - print "Searchresult for Category \"".$label."\""; + print "Instances of Class \"".$label."\""; print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -15,24 +15,34 @@ setRunning($id,"true"); - $concept=html_entity_decode($concept); + $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$manchester); - $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$such); - $content=""; if ($test){ - preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$such,$treffer,PREG_OFFSET_CAPTURE); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + + preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$manchester,$treffer,PREG_OFFSET_CAPTURE); $final=''; $i=1; $pos=0; foreach ($treffer[0] as $tref){ - $final.=substr($such,$pos,$tref[1]-$pos); - $final.='cat'.$i.'.category=\''.substr($such,$tref[1],strlen($tref[0])).'\''; + $final.=substr($manchester,$pos,$tref[1]-$pos).'('; + $category=substr($manchester,$tref[1],strlen($tref[0])); + $query='SELECT child FROM classhierarchy WHERE father=\''.$category.'\''; + $res=$databaseConnection->query($query); + while ($result=$databaseConnection->nextEntry($res)){ + $final.='cat'.$i.'.category=\''.$result['child'].'\' OR '; + } + $final.='cat'.$i.'.category=\''.$category.'\')'; $i++; $pos=$tref[1]+strlen($tref[0]); } - $final.=substr($such,$pos); + $final.=substr($manchester,$pos); $temp='SELECT cat1.name FROM '; for ($j=0;$j<$i-1;$j++) if ($j!=$i-2) $temp.='articlecategories as cat'.($j+1).','; @@ -43,12 +53,6 @@ $query=$temp.'('.$final.') LIMIT '.$number; - //connect to the database - $settings=new Settings(); - $databaseConnection=new DatabaseConnection($settings->database_type); - $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); - $databaseConnection->select_database($settings->database_name); - $res=$databaseConnection->query($query); $bestsearches=""; if ($databaseConnection->numberOfEntries($res)>0){ Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -30,7 +30,7 @@ $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -349,7 +349,7 @@ } $ret.='<table border="0" style="text-align:left;width:100%">'; - $ret.='<tr><td style="width:90%"><b>Father classes</b></td></tr>'; + $ret.='<tr><td style="width:90%;font-size:14px;"><b>Father classes</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'.$fathers.'</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; @@ -357,7 +357,7 @@ if ($fatherButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&number=10\');" title="Search Instances of Father class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Father class in class view."/>'; $ret.='</td></tr>'; $ret.='<tr style="height:20px"><td><hr/></td></tr>'; - $ret.='<tr><td><b>Current class</b></td></tr>'; + $ret.='<tr><td style="font-size:14px;"><b>Current class</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td><b>'.$title.'</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; @@ -365,7 +365,7 @@ $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&number=10\');" title="Search Instances of Shown class."/>'; $ret.='</td></tr>'; $ret.='<tr style="height:20px"><td><hr/></td></tr>'; - $ret.='<tr><td style="width:30%"><b>Child classes</b></td></tr>'; + $ret.='<tr><td style="width:30%;font-size:14px;"><b>Child classes</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'.$childs.'</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/index.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -54,7 +54,7 @@ <div id="conceptlink" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> -</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> +</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none;font-weight:bold;color:#ff0000;">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-09-17 02:00:07
|
Revision: 1225 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1225&view=rev Author: heeroyuy Date: 2008-09-17 08:59:58 +0000 (Wed, 17 Sep 2008) Log Message: ----------- some warnings fixed Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-09-17 08:15:45 UTC (rev 1224) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-09-17 08:59:58 UTC (rev 1225) @@ -253,8 +253,7 @@ eDescription = i.next(); if (desc.equals(eDescription.getDescription() .toManchesterSyntaxString( - editorKit.getOWLModelManager() - .getActiveOntology().getURI() + editorKit.getModelManager().getActiveOntology().getURI() + "#", null))) { evaluatedDescription = eDescription; break; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2008-09-17 08:15:45 UTC (rev 1224) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2008-09-17 08:59:58 UTC (rev 1225) @@ -41,7 +41,7 @@ * @param editorKit EditorKit from Protege */ public ButtonList(OWLEditorKit editorKit) { - super(editorKit.getOWLModelManager().getOWLOntologyManager()); + super(editorKit.getModelManager().getOWLOntologyManager()); // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin // to the // OWLClassDescritpionEditor Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-17 08:15:45 UTC (rev 1224) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-17 08:59:58 UTC (rev 1225) @@ -113,8 +113,8 @@ // This is the count of Concepts which you get after learning // TODO make those configurable via user interface - private static final int nrOfDisplayedDescriptions = 6; - private static final double minAccuracy = 0.8; + private static final int NR_OF_DISPLAYED_DESCRIPTIONS = 6; + private static final double MIN_ACCURACY = 0.8; // A Array of Concepts which the DL-Learner suggested @@ -265,11 +265,11 @@ * This method adds the solutions from the DL-Learner to the List Model. */ private void addToListModel() { - evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(nrOfDisplayedDescriptions, minAccuracy, true); + evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(NR_OF_DISPLAYED_DESCRIPTIONS, MIN_ACCURACY, true); for (int j = 0; j < evalDescriptions.size(); j++) { suggestModel.add(j, evalDescriptions.get(j) .getDescription().toManchesterSyntaxString( - editor.getOWLModelManager().getActiveOntology() + editor.getModelManager().getActiveOntology() .getURI().toString() + "#", null)); } @@ -326,7 +326,7 @@ * OWLAPIOntology will be available. */ public void setKnowledgeSource() { - this.source = new OWLAPIOntology(editor.getOWLModelManager() + this.source = new OWLAPIOntology(editor.getModelManager() .getActiveOntology()); } @@ -404,7 +404,7 @@ // start the algorithm and print the best concept found la.start(); description = new Description[la.getCurrentlyBestEvaluatedDescriptions( - nrOfDisplayedDescriptions).size()]; + NR_OF_DISPLAYED_DESCRIPTIONS).size()]; addToListModel(); // renders the errormessage view.renderErrorMessage(error); @@ -757,7 +757,7 @@ axiomOWLAPI = factory.getOWLSubClassAxiom(oldConceptOWLAPI, newConceptOWLAPI); } - OWLOntology onto = editor.getOWLModelManager().getActiveOntology(); + OWLOntology onto = editor.getModelManager().getActiveOntology(); AddAxiom axiom = new AddAxiom(onto, axiomOWLAPI); try { // adds the new concept to the ontology @@ -792,6 +792,6 @@ * @return URI Ontology URI */ public URI getURI() { - return editor.getOWLModelManager().getActiveOntology().getURI(); + return editor.getModelManager().getActiveOntology().getURI(); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-17 08:15:45 UTC (rev 1224) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-17 08:59:58 UTC (rev 1225) @@ -25,7 +25,7 @@ import org.protege.editor.owl.OWLEditorKit; import org.protege.editor.owl.ui.frame.AbstractOWLFrameSectionRowObjectEditor; import org.protege.editor.owl.ui.clsdescriptioneditor.ExpressionEditor; -import org.protege.editor.owl.ui.clsdescriptioneditor.OWLDescriptionChecker; +//import org.protege.editor.owl.ui.clsdescriptioneditor.OWLDescriptionChecker; import org.protege.editor.owl.ui.selector.OWLClassSelectorPanel; import org.protege.editor.owl.ui.selector.OWLObjectPropertySelectorPanel; import org.semanticweb.owl.model.OWLDataFactory; @@ -67,7 +67,7 @@ private OWLEditorKit editorKit; - private OWLDescriptionChecker checker; + //private OWLDescriptionChecker checker; private ExpressionEditor<OWLDescription> editor; @@ -219,7 +219,7 @@ try { if (editor.isWellFormed()) { String expression = editor.getText(); - return editorKit.getOWLModelManager().getOWLDescriptionParser() + return editorKit.getModelManager().getOWLDescriptionParser() .createOWLDescription(expression); } if (!dllearner.getSollutions().isEmpty()) { @@ -230,6 +230,7 @@ } catch (OWLException e) { return null; } + } /** * Removes everything after protege is closed. @@ -247,7 +248,7 @@ } private OWLDataFactory getDataFactory() { - return editorKit.getOWLModelManager().getOWLDataFactory(); + return editorKit.getModelManager().getOWLDataFactory(); } /** * Adds a Status Changed Listener to all components of the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-16 23:20:55
|
Revision: 1223 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1223&view=rev Author: jenslehmann Date: 2008-09-17 06:20:53 +0000 (Wed, 17 Sep 2008) Log Message: ----------- changed learning algorithm call in Prot?\195?\169g?\195?\169 plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/test/ComponentTest.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -247,6 +247,9 @@ } if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed.getDescription())) { + // before we add the description we replace EXISTS r.TOP with + // EXISTS r.range(r) if range(r) is atomic +// ConceptTransformation.replaceRange(ed.getDescription(), reasoningService); returnList.add(ed); } Modified: trunk/src/dl-learner/org/dllearner/test/ComponentTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -98,7 +98,7 @@ // start the algorithm and print the best concept found la.start(); - System.out.println(la.getCurrentlyBestEvaluatedDescriptions()); + System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true)); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -112,7 +112,9 @@ // This is the count of Concepts which you get after learning - private static final int ANZAHL = 6; + // TODO make those configurable via user interface + private static final int nrOfDisplayedDescriptions = 6; + private static final double minAccuracy = 0.8; // A Array of Concepts which the DL-Learner suggested @@ -205,7 +207,7 @@ // This is a List of evaluated descriptions to get more information of the // suggested concept - private List<EvaluatedDescription> evalDescription; + private List<EvaluatedDescription> evalDescriptions; /** * This is the constructor for DL-Learner model. @@ -263,10 +265,9 @@ * This method adds the solutions from the DL-Learner to the List Model. */ private void addToListModel() { - evalDescription = la.getCurrentlyBestEvaluatedDescriptions(ANZAHL); - for (int j = 0; j < la.getCurrentlyBestEvaluatedDescriptions(ANZAHL).size(); j++) { - suggestModel.add(j, la - .getCurrentlyBestEvaluatedDescriptions(ANZAHL).get(j) + evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(nrOfDisplayedDescriptions, minAccuracy, true); + for (int j = 0; j < evalDescriptions.size(); j++) { + suggestModel.add(j, evalDescriptions.get(j) .getDescription().toManchesterSyntaxString( editor.getOWLModelManager().getActiveOntology() .getURI().toString() @@ -317,7 +318,7 @@ * @return list of evaluated descriptions */ public List<EvaluatedDescription> getEvaluatedDescriptionList() { - return evalDescription; + return evalDescriptions; } /** @@ -403,7 +404,7 @@ // start the algorithm and print the best concept found la.start(); description = new Description[la.getCurrentlyBestEvaluatedDescriptions( - ANZAHL).size()]; + nrOfDisplayedDescriptions).size()]; addToListModel(); // renders the errormessage view.renderErrorMessage(error); Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -28,10 +28,12 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.ObjectAllRestriction; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.Union; @@ -443,4 +445,22 @@ return false; } + // replaces EXISTS hasChild.TOP with EXISTS hasChild.Person, + // i.e. TOP is replaced by the range of the property; + // this is semantically equivalent, but easier to read for some people + public static void replaceRange(Description description, ReasoningService rs) { + if(description instanceof ObjectSomeRestriction && description.getChild(0) instanceof Thing) { + ObjectPropertyExpression p = ((ObjectSomeRestriction)description).getRole(); + if(p instanceof ObjectProperty) { + // replace TOP with range of propery + description.removeChild(description.getChild(0)); + description.addChild(rs.getRange((ObjectProperty)p)); + } + } + + for(Description child : description.getChildren()) { + replaceRange(child, rs); + } + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-16 22:30:34
|
Revision: 1222 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1222&view=rev Author: jenslehmann Date: 2008-09-17 05:30:32 +0000 (Wed, 17 Sep 2008) Log Message: ----------- small fix Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-16 18:17:33 UTC (rev 1221) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-17 05:30:32 UTC (rev 1222) @@ -848,7 +848,7 @@ // it is often useful to continue expanding until a longer node is // reached (to replace atomic concepts with more specific ones) - if(forceRefinementLengthIncrease) { + if(forceRefinementLengthIncrease && !newNode.isTooWeak()) { // extend node again if its concept has the same length if(node.getConcept().getLength() == newNode.getConcept().getLength()) { extendNodeProper(newNode, refinement, maxLength, recDepth + 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-16 11:17:35
|
Revision: 1221 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1221&view=rev Author: jenslehmann Date: 2008-09-16 18:17:33 +0000 (Tue, 16 Sep 2008) Log Message: ----------- added new option forceRefinementLengthIncrease to ROL based learner, which enforces that nodes are expanded until all successors have higher length (i.e. the subsumption hierarchy is traversed until no further children exists or the concept is too weak) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-16 10:53:25 UTC (rev 1220) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-16 18:17:33 UTC (rev 1221) @@ -128,6 +128,7 @@ // refactor this private static int maxPosOnlyExpansionDefault = 4; private int maxPosOnlyExpansion = maxPosOnlyExpansionDefault; + private boolean forceRefinementLengthIncrease = false; //extended Options //in seconds private int maxExecutionTimeInSeconds = CommonConfigOptions.maxExecutionTimeInSecondsDefault; @@ -204,6 +205,7 @@ noisePercentage.setUpperLimit(100); 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")); return options; } @@ -274,6 +276,8 @@ guaranteeXgoodDescriptions = (Integer) entry.getValue(); } else if(name.equals("logLevel")) { logLevel = ((String)entry.getValue()).toUpperCase(); + } else if(name.equals("forceRefinementLengthIncrease")) { + forceRefinementLengthIncrease = (Boolean) entry.getValue(); } } @@ -385,8 +389,9 @@ maxPosOnlyExpansion, maxExecutionTimeInSeconds, minExecutionTimeInSeconds, - guaranteeXgoodDescriptions - ); + guaranteeXgoodDescriptions, + forceRefinementLengthIncrease + ); // note: used concepts and roles do not need to be passed // as argument, because it is sufficient to prepare the // concept and role hierarchy accordingly Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-16 10:53:25 UTC (rev 1220) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-16 18:17:33 UTC (rev 1221) @@ -131,6 +131,15 @@ // (this is called irregularly e.g. every 100 seconds) private boolean useTreeTraversal = false; + // if this variable is set to true, then the refinement operator + // is applied until all concept of equal length have been found + // e.g. TOP -> A1 -> A2 -> A3 is found in one loop; the disadvantage + // are potentially more method calls, but the advantage is that + // the algorithm is better in locating relevant concept in the + // subsumption hierarchy (otherwise, if the most general concept + // is not promising, it may never get expanded) + private boolean forceRefinementLengthIncrease; + // candidate reduction: using this mechanism we can simulate // the divide&conquer approach in many ILP programs using a // clause by clause search; after a period of time the candidate @@ -233,7 +242,7 @@ boolean useTooWeakList, boolean useOverlyGeneralList, boolean useShortConceptConstruction, boolean usePropernessChecks, int maxPosOnlyExpansion, int maxExecutionTimeInSeconds, int minExecutionTimeInSeconds, - int guaranteeXgoodDescriptions) { + int guaranteeXgoodDescriptions, boolean forceRefinementLengthIncrease) { if (learningProblem instanceof PosNegLP) { PosNegLP lp = (PosNegLP) learningProblem; @@ -278,6 +287,7 @@ this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; this.minExecutionTimeInSeconds = minExecutionTimeInSeconds; this.guaranteeXgoodDescriptions = guaranteeXgoodDescriptions; + this.forceRefinementLengthIncrease = forceRefinementLengthIncrease; // logger.setLevel(Level.DEBUG); } @@ -835,6 +845,16 @@ // System.out.println(newNode.getConcept() + " " + quality); node.addChild(newNode); + + // it is often useful to continue expanding until a longer node is + // reached (to replace atomic concepts with more specific ones) + if(forceRefinementLengthIncrease) { + // extend node again if its concept has the same length + if(node.getConcept().getLength() == newNode.getConcept().getLength()) { + extendNodeProper(newNode, refinement, maxLength, recDepth + 1); + } + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-09-16 03:53:27
|
Revision: 1220 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1220&view=rev Author: heeroyuy Date: 2008-09-16 10:53:25 +0000 (Tue, 16 Sep 2008) Log Message: ----------- -necessary change to run plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-16 10:51:40 UTC (rev 1219) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-16 10:53:25 UTC (rev 1220) @@ -102,8 +102,8 @@ OWLDescription description, OWLFrame<OWLClass> frame, String label) { this.editorKit = editorKit; // this.initialDescription = description; - checker = new OWLDescriptionChecker(editorKit); - editor = new ExpressionEditor<OWLDescription>(editorKit, checker); + //checker = new OWLDescriptionChecker(editorKit); + editor = new ExpressionEditor<OWLDescription>(editorKit, editorKit.getModelManager().getOWLExpressionCheckerFactory().getOWLDescriptionChecker()); editor.setExpressionObject(description); dllearner = new DLLearnerView(frame, label); action = new ActionHandler(this.action, null, dllearner, null, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-09-16 03:51:43
|
Revision: 1219 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1219&view=rev Author: heeroyuy Date: 2008-09-16 10:51:40 +0000 (Tue, 16 Sep 2008) Log Message: ----------- -add new necessary libraries to run the protege plugin Modified Paths: -------------- trunk/lib/protege/org.protege.editor.core.application.jar trunk/lib/protege/org.protege.editor.owl.jar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-16 03:18:53
|
Revision: 1218 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1218&view=rev Author: sknappe Date: 2008-09-16 10:18:49 +0000 (Tue, 16 Sep 2008) Log Message: ----------- had to change the separation symbol between texts and also changed the way instances of concepts for some special concepts are found, cant test now, because I only get bad concepts Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/ajax_to_negative.php trunk/src/dbpedia-navigator/ajax_to_positive.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -232,16 +232,16 @@ $interests=show_Interests($_SESSION); print $content; - print '$$'; + print '$$$'; print $artTitle; - print '$$'; + print '$$$'; print $lastArticles; - print '$$'; + print '$$$'; print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; - print '$$'; + print '$$$'; print $lat; - print '$$'; + print '$$$'; print $long; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -116,8 +116,8 @@ } print $content; - print '$$'; + print '$$$'; print "Class: ".$title; - print '$$'; + print '$$$'; print $lastClasses; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -48,8 +48,8 @@ $content.="Your Search brought no results."; print $content; - print '$$'; + print '$$$'; print "Searchresult for Category \"".$label."\""; - print '$$'; + print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -1,8 +1,12 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); - $manchester=$_POST['manchester']; - $kb=$_POST['kb']; + $manchester=html_entity_decode($_POST['manchester']); + $kb=html_entity_decode($_POST['kb']); + $number=$_POST['number']; + $label=$_POST['label']; session_start(); $id=$_SESSION['id']; @@ -13,12 +17,57 @@ $concept=html_entity_decode($concept); - $test=preg_match("/(http:\/\/dbpedia\.org\/class\/yago\/[^\040]+(\040)*(AND|OR)*)+/",$manchester); + $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$such); + $content=""; if ($test){ + preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$such,$treffer,PREG_OFFSET_CAPTURE); + + $final=''; + $i=1; + $pos=0; + foreach ($treffer[0] as $tref){ + $final.=substr($such,$pos,$tref[1]-$pos); + $final.='cat'.$i.'.category=\''.substr($such,$tref[1],strlen($tref[0])).'\''; + $i++; + $pos=$tref[1]+strlen($tref[0]); + } + $final.=substr($such,$pos); + $temp='SELECT cat1.name FROM '; + for ($j=0;$j<$i-1;$j++) + if ($j!=$i-2) $temp.='articlecategories as cat'.($j+1).','; + else $temp.='articlecategories as cat'.($j+1); + $temp.=' WHERE '; + for ($j=1;$j<$i-1;$j++) + $temp.='cat'.$j.'.name=cat'.($j+1).'.name AND '; + $query=$temp.'('.$final.') LIMIT '.$number; + + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + + $res=$databaseConnection->query($query); + $bestsearches=""; + if ($databaseConnection->numberOfEntries($res)>0){ + $names=array(); + $labels=array(); + while ($result=$databaseConnection->nextEntry($res)){ + $names[]=$result['name']; + $query="SELECT label FROM rank WHERE name='".$result['name']."' LIMIT 1"; + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); + $labels[]=$result2['label']; + } + $content.=getConceptResultsTable($names,$labels,htmlentities($manchester),htmlentities($kb),$label,$number); + $bestsearches=getBestSearches($names,$labels); + } + else + $content.="Your Search brought no results."; } - $content=""; + else{ /*try{ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); @@ -27,8 +76,11 @@ } catch (Exception $e){ $content=$e->getMessage(); }*/ + } - print $test."ho"; - print '$$'; - print "Instances for Concept ".$concept; + print $content; + print '$$$'; + print "Instances for Concept \"".$label."\""; + print '$$$'; + print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -30,7 +30,7 @@ $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -10,6 +10,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -10,6 +10,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -65,8 +65,8 @@ $content.="Your Search brought no results."; print $content; - print '$$'; + print '$$$'; print "Searchresult for \"".$label."\""; - print '$$'; + print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -42,6 +42,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_to_negative.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_negative.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_to_negative.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -20,6 +20,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_to_positive.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_positive.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_to_positive.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -20,6 +20,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -150,6 +150,48 @@ return $ret; } +function getConceptResultsTable($names,$labels,$manchester,$kb,$label,$number) +{ + $ret="<p>These are your results. Show best "; + for ($k=10;$k<125;){ + $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('manchester=".$manchester."&kb=".$kb."&label=".$label."number=".$k."');return false;\""; + if ($k==$number) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k)."</a>"; + if ($k!=100) $ret.=" | "; + if($k==10) $k=25; + else $k=$k+25; + } + $ret.="</p><br/>"; + $i=0; + $display="block"; + $ret.="<div id=\"results\">"; + while($i*25<count($names)) + { + for ($j=0;($j<25)&&(($i*25+$j)<count($names));$j++) + { + $name=$names[$i*25+$j]; + $label=$labels[$i*25+$j]; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a class="all" href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; + } + $i++; + $display="none"; + } + $ret.='<input type="hidden" id="hidden_class" value="all"/><input type="hidden" id="hidden_number" value="0"/></div><br/><p style="width:100%;text-align:center;" id="sitenumbers">'; + for ($k=0;$k<$i;$k++){ + $ret.="<span>"; + if ($k!=0) $ret.=" | "; + $ret.="<a href=\"#\" onclick=\"document.getElementById('hidden_number').value='".(25*$k)."';show_results(document.getElementById('hidden_class').value,".(25*$k).");\""; + if ($k==0) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k+1)."</a>"; + $ret.="</span>"; + } + $ret.="</p>"; + return $ret; +} + function getBestSearches($names,$labels) { $ret="<div id=\"best-results\">"; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-09-16 10:18:49 UTC (rev 1218) @@ -14,7 +14,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; if (response[2].length>0){ @@ -45,7 +45,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; document.getElementById('lastarticles').innerHTML=response[2]; @@ -83,7 +83,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; document.getElementById('lastclasses').innerHTML=response[2]; @@ -111,7 +111,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -137,7 +137,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -211,7 +211,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -237,7 +237,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -315,9 +315,13 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; + if (response[2].length>0){ + document.getElementById('searchcontent').innerHTML=response[2]; + document.getElementById('SearchResultBox').style.display='block'; + } } } @@ -341,7 +345,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; if (response[2].length>0){ @@ -371,7 +375,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-16 00:19:04
|
Revision: 1217 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1217&view=rev Author: sknappe Date: 2008-09-16 07:19:01 +0000 (Tue, 16 Sep 2008) Log Message: ----------- wsdl changed Modified Paths: -------------- trunk/src/dbpedia-navigator/def0.xsd trunk/src/dbpedia-navigator/main.wsdl Modified: trunk/src/dbpedia-navigator/def0.xsd =================================================================== --- trunk/src/dbpedia-navigator/def0.xsd 2008-09-16 07:09:53 UTC (rev 1216) +++ trunk/src/dbpedia-navigator/def0.xsd 2008-09-16 07:19:01 UTC (rev 1217) @@ -8,6 +8,8 @@ <xs:element name="LearningProblemUnsupportedException" type="tns:LearningProblemUnsupportedException"></xs:element> + <xs:element name="MalformedURLException" type="tns:MalformedURLException"></xs:element> + <xs:element name="ParseException" type="tns:ParseException"></xs:element> <xs:element name="SparqlQueryException" type="tns:SparqlQueryException"></xs:element> @@ -55,4 +57,10 @@ <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> </xs:sequence> </xs:complexType> + + <xs:complexType name="MalformedURLException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> </xs:schema> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl 2008-09-16 07:09:53 UTC (rev 1216) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-09-16 07:19:01 UTC (rev 1217) @@ -52,6 +52,9 @@ <message name="ClientNotKnownException"> <part element="tns:ClientNotKnownException" name="fault"></part> </message> + <message name="MalformedURLException"> + <part element="tns:MalformedURLException" name="fault"></part> + </message> <message name="removeKnowledgeSource"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -157,6 +160,13 @@ <part name="arg3" type="xsd:string"></part> </message> <message name="applyConfigEntryStringResponse"></message> + <message name="applyConfigEntryURL"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:string"></part> + </message> + <message name="applyConfigEntryURLResponse"></message> <message name="applyConfigEntryStringArray"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -190,6 +200,14 @@ <message name="getConfigOptionValueStringResponse"> <part name="return" type="xsd:string"></part> </message> + <message name="getConfigOptionValueURL"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueURLResponse"> + <part name="return" type="xsd:string"></part> + </message> <message name="getConfigOptionValueDouble"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -326,6 +344,12 @@ <message name="SparqlRetrievalResponse"> <part name="return" type="xsd:string"></part> </message> + <message name="getNaturalDescription"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="getNaturalDescriptionResponse"> + <part name="return" type="xsd:string"></part> + </message> <message name="getNegativeExamples"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -388,6 +412,7 @@ <output message="tns:addKnowledgeSourceResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:MalformedURLException" name="MalformedURLException"></fault> </operation> <operation name="removeKnowledgeSource" parameterOrder="arg0 arg1"> <input message="tns:removeKnowledgeSource"></input> @@ -476,6 +501,13 @@ <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> </operation> + <operation name="applyConfigEntryURL" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryURL"></input> + <output message="tns:applyConfigEntryURLResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:MalformedURLException" name="MalformedURLException"></fault> + </operation> <operation name="applyConfigEntryStringArray" parameterOrder="arg0 arg1 arg2 arg3"> <input message="tns:applyConfigEntryStringArray"></input> <output message="tns:applyConfigEntryStringArrayResponse"></output> @@ -502,6 +534,13 @@ <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> </operation> + <operation name="getConfigOptionValueURL" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueURL"></input> + <output message="tns:getConfigOptionValueURLResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> <operation name="getConfigOptionValueDouble" parameterOrder="arg0 arg1 arg2"> <input message="tns:getConfigOptionValueDouble"></input> <output message="tns:getConfigOptionValueDoubleResponse"></output> @@ -606,6 +645,11 @@ <output message="tns:SparqlRetrievalResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> </operation> + <operation name="getNaturalDescription" parameterOrder="arg0"> + <input message="tns:getNaturalDescription"></input> + <output message="tns:getNaturalDescriptionResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4"> <input message="tns:getNegativeExamples"></input> <output message="tns:getNegativeExamplesResponse"></output> @@ -714,6 +758,9 @@ <fault name="UnknownComponentException"> <soap:fault name="UnknownComponentException" use="literal"></soap:fault> </fault> + <fault name="MalformedURLException"> + <soap:fault name="MalformedURLException" use="literal"></soap:fault> + </fault> </operation> <operation name="removeKnowledgeSource"> <soap:operation soapAction=""></soap:operation> @@ -928,6 +975,24 @@ <soap:fault name="UnknownComponentException" use="literal"></soap:fault> </fault> </operation> + <operation name="applyConfigEntryURL"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="MalformedURLException"> + <soap:fault name="MalformedURLException" use="literal"></soap:fault> + </fault> + </operation> <operation name="applyConfigEntryStringArray"> <soap:operation soapAction=""></soap:operation> <input> @@ -994,6 +1059,24 @@ <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> </fault> </operation> + <operation name="getConfigOptionValueURL"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> <operation name="getConfigOptionValueDouble"> <soap:operation soapAction=""></soap:operation> <input> @@ -1249,6 +1332,18 @@ <soap:fault name="ParseException" use="literal"></soap:fault> </fault> </operation> + <operation name="getNaturalDescription"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> <operation name="getNegativeExamples"> <soap:operation soapAction=""></soap:operation> <input> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-16 00:09:56
|
Revision: 1216 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1216&view=rev Author: sknappe Date: 2008-09-16 07:09:53 +0000 (Tue, 16 Sep 2008) Log Message: ----------- changed some files to work with the new way natural language description is called and put old files into a folder Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php Added Paths: ----------- trunk/src/dbpedia-navigator/database.sql trunk/src/dbpedia-navigator/old/ trunk/src/dbpedia-navigator/old/NaturalConcepts.php trunk/src/dbpedia-navigator/old/ajax.php trunk/src/dbpedia-navigator/old/ajaxfunctions.php trunk/src/dbpedia-navigator/old/index-old.php Removed Paths: ------------- trunk/src/dbpedia-navigator/NaturalConcepts.php trunk/src/dbpedia-navigator/ajax.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index-old.php trunk/src/dbpedia-navigator/localhost.sql Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -113,6 +113,11 @@ return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } + function getNaturalDescription($concept) + { + return $this->client->getNaturalDescription($concept); + } + function getConceptDepth() { return $this->client->getConceptDepth($this->id,3)->item; Deleted: trunk/src/dbpedia-navigator/NaturalConcepts.php =================================================================== --- trunk/src/dbpedia-navigator/NaturalConcepts.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/NaturalConcepts.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,121 +0,0 @@ -<?php - -class NaturalConcepts -{ - private $concept; - - function NaturalConcepts($conc){ - $this->concept=$conc; - } - - function getNaturalConcept(){ - $identifiedConcepts=$this->identifyConcepts(); - $labels=$this->getLabels($identifiedConcepts); - return $identifiedConcepts; - } - - function identifyConcepts() - { - $temp=$this->concept; - $ret=array(); - $offset=0; - while (true){ - $nextpos=strpos($temp,"http",$offset); - if (!$nextpos) break; - $nextend=preg_match("/\040|.TOP|.BOTTOM|.EXISTS|.ALL|.\(/",$temp,$treffer,PREG_OFFSET_CAPTURE,$nextpos); - if (!$nextend){ - $uri=substr($temp,$nextpos,strlen($temp)-$nextpos); - $ret[]=$uri; - break; - } - $uri=substr($temp,$nextpos,$treffer[0][1]-$nextpos); - $ret[]=$uri; - $offset=$treffer[0][1]; - } - - return $ret; - } - - function getLabels($conc) - { - $query="SELECT DISTINCT "; - for ($i=0;$i<count($conc)-1;$i++) - $query.="?obj".$i.", "; - $query.="?obj".$i."\n"; - $query.="WHERE {\n"; - foreach ($conc as $key=>$con){ - $query.="<".$con."> <http://www.w3.org/2000/01/rdf-schema#label> ?obj".$key.".\n"; - } - $query.="}"; - print $query; - return $query; - } - - function getSparqlQuery() - { - $temp=$this->concept; - $andOrParts=$this->getAndOrParts($temp); - print_r($andOrParts); - } - - function getAndOrParts($temp) - { - $split=preg_split("/(OR)|(AND)/",$temp,-1,PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); - $bracket=0; - $arr=array(); - $temppart=""; - foreach ($split as $part){ - $part=trim($part); - if (strpos($part,"(")===0){ - $bracket+=substr_count($part,"("); - } - if ($bracket>0){ - if (($part=="AND")||($part=="OR")) $temppart.=" ".$part." "; - else $temppart.=$part; - } - else{ - if ((!strpos($part,"AND"))&&(!strpos($part,"OR"))) $arr[]=$part; - else $arr[]=$this->getAndOrParts($part); - } - if ((strrpos($part,')')==(strlen($part)-1))&&($bracket>0)){ - $bracket-=substr_count($part,")"); - if ($bracket==0){ - if ((!strpos($temppart,"AND"))&&(!strpos($temppart,"OR"))) $arr[]=substr($temppart,1,strlen($temppart)-2); - else $arr[]=$this->getAndOrParts(substr($temppart,1,strlen($temppart)-2)); - $temppart=""; - } - } - } - return $arr; - } - - function isExistsConstruct($construct) - { - if (!(strpos($construct,"EXISTS")===0)) return false; - $split=preg_split("/(EXISTS \".*\")\./",$construct,-1,PREG_SPLIT_NO_EMPTY); - $afterdot=$split[0]; - print $afterdot; - $bracket=0; - $offset=0; - do{ - $nextBracketOn=strpos($afterdot,"(",$offset); - $nextBracketOff=strpos($afterdot,")",$offset); - print "On: ".$nextBracketOn+1; - print "Off: ".$nextBracketOff+1; - $min=min($nextBracketOn,$nextBracketOff); - print $min+1; - if ($nextBracketOn==$min) $bracket++; - if ($nextBracketOff==$min) $bracket--; - $offset=$min; - } while(($bracket>0)||($offset>=strlen($afterdot)-1)); - print ($offset); - return true; - } -} - -//$conc="(EXISTS http://dbpedia.org/property/website.(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin) OR (http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)) OR http://dbpedia.org/resource/Berlin"; -$conc="EXISTS \"http://dbpedia.org/property/website\".(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)"; -$nc=new NaturalConcepts($conc); -$ic=$nc->isExistsConstruct($conc); -//print_r($ic); -?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/ajax.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/ajax.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,33 +0,0 @@ -<?php -require_once ("xajax/xajax_core/xajax.inc.php"); -$sid = session_id(); -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -$xajax = new xajax($path."ajaxfunctions.php?sid=$sid&path=".$path); -$xajax->configureMany(array('debug'=>true)); - -$xajax->register(XAJAX_FUNCTION, 'getsubjects', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); -$xajax->register(XAJAX_FUNCTION,'getarticle', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); -$xajax->register(XAJAX_FUNCTION,'learnConcept', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); -$xajax->register(XAJAX_FUNCTION,'getSubjectsFromConcept', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); - $xajax->registerFunction('toPositive'); -$xajax->registerFunction('toNegative'); -$xajax->registerFunction('clearPositives'); -$xajax->registerFunction('clearNegatives'); -$xajax->registerFunction('removePosInterest'); -$xajax->registerFunction('removeNegInterest'); -$xajax->registerFunction('stopServerCall'); -?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -29,7 +29,8 @@ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Deleted: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,616 +0,0 @@ -<?php -ini_set('max_execution_time',200); - -require("ajax.php"); -$xajax->processRequest(); - -function getsubjects($label,$list) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - - setRunning($id,"true"); - - //get parts of the list - $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); - - //initialise content - $content=""; - try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - - $subjects=$sc->getSubjects($label,$checkedInstances); - - $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); - $content.=getResultsTable($subjects['subjects']); - } catch (Exception $e){ - $content=$e->getMessage(); - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("ArticleTitle","innerHTML","Searchresult for ".$label); - return $objResponse; -} - -function getarticle($subject,$fromCache) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - setRunning($id,"true"); - - //get first Letter of label big - $uri=subjectToURI($subject); - - //if article is in session, get it out of the session - if (isset($articles)){ - foreach ($articles as $key => $value) - { - if ($value['subject']==$subject){ - $fromCache=$key; - break; - } - } - } - - //initialize the content variables - $content=""; - $searchResult=""; - $lastArticles=""; - $artTitle=""; - - $objResponse = new xajaxResponse(); - - //get the article - //if $fromCache is -2, no new SearchResults should be processed - //if $fromCache is -1, everything is normal - //if $fromCache is >=0, the article is taken out of the cache - if ($fromCache<0) { - //if there are errors see catch block - try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - $triples=$sc->getTriples($uri); - - //BUILD ARTICLE - // goal: display the data in a nice (DBpedia specific way), maybe similar to - // dbpedia.org/search - - // display a picture if there is one - if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; - - //display where it was redirected from, if it was redirected - $redirect=""; - if (isset($triples['http://dbpedia.org/property/redirect'])){ - $content.="<span id=\"redirectedFrom\">redirected from '$subject'</span>"; - $redirect=$triples['http://dbpedia.org/property/redirect'][0]['value']; - } - - // add short description in english - $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0]['value'])."</p>"; - - // give the link to the corresponding Wikipedia article - if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt="Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0]['value'].'">view Wikipedia article</a>, '; - $content .= '<a href="'.$uri.'">view DBpedia resource description</a></p>'; - - // display a list of classes - if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; - - if(isset($triples['http://dbpedia.org/property/reference'])) { - $content .= '<p>references: <ul>'; - foreach($triples['http://dbpedia.org/property/reference'] as $reference) - $content .= '<li><a href="'.$reference['value'].'">'.$reference['value'].'</a></li>'; - $content .= '</ul></p>'; - } - - //display a Google Map if Geo-koordinates are available - if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ - $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:25px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0]['value'].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0]['value'].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']."');return false;\">Toggle a map of the location</a><br/><br/><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; - } - - //display photo collection, if there is one - if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ - $content.="<br/><img src=\"".$_GET['path']."images/flickr.jpg\" alt=\"Flickr\" style=\"max-width:25px;\" /> <a href=\"".$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value']."\">view a photo collection</a><br/>"; - } - - //skos-subjects - if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])){ - $content .= '<br/><p>skos subjects: <ul>'; - foreach($triples['http://www.w3.org/2004/02/skos/core#subject'] as $skos) - $content .= '<li><a href="'.$skos['value'].'">'.$skos['value'].'</a></li>'; - $content .= '</ul></p>'; - } - - //BUILD ARTICLE TITLE - $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; - - // filter out uninteresting properties and properties which - // have already been displayed - unset($triples['http://xmlns.com/foaf/0.1/page']); - unset($triples['http://xmlns.com/foaf/0.1/depiction']); - unset($triples['http://dbpedia.org/property/abstract']); - unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); - unset($triples['http://dbpedia.org/property/redirect']); - unset($triples['http://dbpedia.org/property/reference']); - unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); - unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat']); - unset($triples['http://dbpedia.org/property/hasPhotoCollection']); - unset($triples['http://www.w3.org/2004/02/skos/core#subject']); - unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); - - // display the remaining properties as list which can be used for further navigation - $content .= '<br/><br/><br/>'.get_triple_table($triples); - - //Restart the Session - session_start(); - - //store article in session, to navigate between last 5 articles quickly - $contentArray=array('content' => $content,'subject' => $artTitle); - if (!isset($_SESSION['nextArticle'])){ - $_SESSION['nextArticle']=0; - $_SESSION['articles']=array(); - } - if ($_SESSION['nextArticle']==5) $_SESSION['nextArticle']=0; - $_SESSION['articles'][$_SESSION['nextArticle']]=$contentArray; - $_SESSION['currentArticle']=$_SESSION['nextArticle']; - $_SESSION['nextArticle']++; - - //Add Positives to Session - if (!isset($_SESSION['positive'])){ - if ($redirect!=""){ - $array=array($redirect => $redirect); - } - else $array=array("http://dbpedia.org/resource/".str_replace(" ","_",$subject) => "http://dbpedia.org/resource/".str_replace(" ","_",$subject)); - $_SESSION['positive']=$array; - } - else{ - $array=$_SESSION['positive']; - if ($redirect!="") $array[$redirect] = $redirect; - else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); - $_SESSION['positive']=$array; - } - - } catch (Exception $e) - { - $content=$e->getMessage(); - $artTitle="No Result"; - $objResponse->call('xajax_getsubjects',$subject); - } - } - else { - session_start(); - //Article is in session - $content=$_SESSION['articles'][$fromCache]['content']; - $artTitle=$_SESSION['articles'][$fromCache]['subject']; - } - - //Build lastArticles - if (isset($_SESSION['articles'])){ - foreach ($_SESSION['articles'] as $key => $value) - { - $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; - } - } - - //add Positives and Negatives to Interests - $posInterests=""; - if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - $negInterests=""; - if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("ArticleTitle","innerHTML",$artTitle); - $objResponse->assign("lastarticles","innerHTML",$lastArticles); - $objResponse->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - $objResponse->call('xajax_learnConcept'); - return $objResponse; -} - -function toPositive($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['negative'][$subject]); - if (!isset($_SESSION['positive'])){ - $array=array($subject => $subject); - $_SESSION['positive']=$array; - } - else{ - $array=$_SESSION['positive']; - $array[$subject]=$subject; - $_SESSION['positive']=$array; - } - - //add Positives and Negatives to Interests - $posInterests=""; - if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - $negInterests=""; - if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - - $objResponse = new xajaxResponse(); - $objResponse->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function toNegative($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['positive'][$subject]); - if (!isset($_SESSION['negative'])){ - $array=array($subject => $subject); - $_SESSION['negative']=$array; - } - else{ - $array=$_SESSION['negative']; - $array[$subject]=$subject; - $_SESSION['negative']=$array; - } - - //add Positives and Negatives to Interests - $posInterests=""; - if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - $negInterests=""; - if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - - $objResponse = new xajaxResponse(); - $objResponse->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function clearPositives() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['positive']); - - $objResponse = new xajaxResponse(); - $objResponse->assign("Positives", "innerHTML", ""); - return $objResponse; -} - -function clearNegatives() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['negative']); - - $objResponse = new xajaxResponse(); - $objResponse->assign("Negatives", "innerHTML", ""); - return $objResponse; -} - -function removePosInterest($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['positive'][$subject]); - - //add Positives and Negatives to Interests - $posInterests=""; - if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - $negInterests=""; - if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - - $objResponse = new xajaxResponse(); - $objResponse->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function removeNegInterest($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['negative'][$subject]); - - //add Positives and Negatives to Interests - $posInterests=""; - if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - $negInterests=""; - if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - - $objResponse = new xajaxResponse(); - $objResponse->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function learnConcept() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - - if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; - if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - setRunning($id,"true"); - $concept=""; - $conceptinformation=""; - if (isset($positives)) - { - $posArray=array(); - foreach ($positives as $pos) - $posArray[]=$pos; - $negArray=array(); - if (isset($negatives)) - foreach ($negatives as $neg) - $negArray[]=$neg; - - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id, $ksID); - try{ - $concepts=$sc->getConceptFromExamples($posArray,$negArray); - $conceptDepth=$sc->getConceptDepth(); - $conceptArity=$sc->getConceptArity(); - - $concept.="<table border=0>\n"; - $i=1; - foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".urlencode($con)."');return false;\" onMouseOver=\"showdiv('div".$i."');showdiv('ConceptBox');\" onMouseOut=\"hidediv('div".$i."');hidediv('ConceptBox');\" />".$con."</a></td></tr>"; - //put information about concepts in divs - $conceptinformation.="<div id=\"div".$i."\" style=\"display:none\">Concept Depth: ".$conceptDepth[$i-1]."<br/>Concept Arity: ".$conceptArity[$i-1]."<br/>Concept Length: ".$sc->getConceptLength($con)."</div>"; - $i++; - } - $concept.="</table>"; - } catch(Exception $e){ - $concept.=$e->getMessage(); - } - } - else $concept="You must choose at least one positive example."; - - $objResponse = new xajaxResponse(); - $objResponse->assign("conceptlink", "innerHTML", $concept); - $objResponse->assign("ConceptInformation", "innerHTML", $conceptinformation); - return $objResponse; -} - -function getSubjectsFromConcept($concept) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - - setRunning($id,"true"); - - $concept=html_entity_decode($concept); - $content=""; - try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - $subjects=$sc->getSubjectsFromConcept($concept); - $content.=getResultsTable($subjects); - } catch (Exception $e){ - $content=$e->getMessage(); - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("ArticleTitle", "innerHTML", "Search Results"); - return $objResponse; -} - -function stopServerCall() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - $id=$_SESSION['id']; - session_write_close(); - setRunning($id,"false"); - $objResponse=new xajaxResponse(); - return $objResponse; -} - -/////////////////////// -// Helper Functions. // -/////////////////////// - -function subjectToURI($subject) -{ - //if the subject is already a URI return it - if (strpos($subject,"http://dbpedia.org/resource/")===0) - return $subject; - //delete whitespaces at beginning and end - $subject=trim($subject); - //get first letters big - $subject=ucfirst($subject); - //replace spaces with _ - $subject=str_replace(' ','_',$subject); - //add the uri - $subject="http://dbpedia.org/resource/".$subject; - - return $subject; -} - -function getTagCloud($tags,$label) -{ - $max=max($tags); - $min=min($tags); - $diff=$max-$min; - $distribution=$diff/3; - - $ret="<p>"; - foreach ($tags as $tag=>$count){ - if ($count==$min) $style="font-size:xx-small;"; - else if ($count==$max) $style="font-size:xx-large;"; - else if ($count>($min+2*$distribution)) $style="font-size:large;"; - else if ($count>($min+$distribution)) $style="font-size:medium;"; - else $style="font-size:small;"; - - $tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag_with_entities.'\');">'.$label[$tag].'</a>'; - } - $ret.="</p>"; - return $ret; -} - -function getResultsTable($results) -{ - $ret="<p>Your search brought ".count($results)." results.</p><br/>"; - $i=0; - $display="block"; - while($i*30<count($results)) - { - $ret.="<div id='results".$i."' style='display:".$display."'>Seite ".($i+1)."<br/><br/>"; - for ($j=0;($j<30)&&(($i*30+$j)<count($results));$j++) - { - $result=$results[$i*30+$j]; - $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".$result."',-1);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; - } - $ret.="</div>"; - $i++; - $display="none"; - } - $ret.="<br/><p style='width:100%;text-align:center;'>"; - for ($k=0;$k<$i;$k++){ - $ret.="<a href=\"\" onClick=\"showdiv('results".($k)."');"; - for ($l=0;$l<$i;$l++) - { - if ($l!=$k) $ret.="hidediv('results".$l."');"; - } - $ret.="return false;\">".($k+1)."</a>"; - if ($k!=($i-1)) $ret.=" | "; - } - $ret.="</p>"; - return $ret; -} - -function setRunning($id,$running) -{ - if(!is_dir("temp")) mkdir("temp"); - $file=fopen("./temp/".$id.".temp","w"); - fwrite($file, $running); - fclose($file); -} - -function get_triple_table($triples) { - - $table = '<table border="0"><tr><td>predicate</td><td>object</td></tr>'; - $i=1; - foreach($triples as $predicate=>$object) { - if ($i>0) $backgroundcolor="eee"; - else $backgroundcolor="ffffff"; - $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'">'.nicePredicate($predicate).'</a></td>'; - $table .= '<td><ul>'; - foreach($object as $element) { - if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'">'.$element['value'].'</a></li>'; - else $table .= '<li>'.$element['value'].'</li>'; - } - $table .= '</ul></td>'; - $i*=-1; - } - $table .= '</table>'; - return $table; -} - -function nicePredicate($predicate) -{ - if (strripos ($predicate, "#")>strripos ($predicate, "/")){ - $namespace=substr ($predicate,0,strripos ($predicate, "#")); - $name=substr ($predicate,strripos ($predicate, "#")+1); - } - else{ - $namespace=substr ($predicate,0,strripos ($predicate, "/")); - $name=substr ($predicate,strripos ($predicate, "/")+1); - } - - switch ($namespace){ - case "http://www.w3.org/2000/01/rdf-schema": $namespace="rdfs"; - break; - case "http://www.w3.org/2002/07/owl": $namespace="owl"; - break; - case "http://xmlns.com/foaf/0.1": $namespace="foaf"; - break; - case "http://dbpedia.org/property": $namespace="p"; - break; - case "http://www.w3.org/2003/01/geo/wgs84_pos": $namespace="geo"; - break; - case "http://www.w3.org/2004/02/skos/core": $namespace="skos"; - break; - } - - return $namespace.':'.$name; -} - -function formatClassArray($ar) { - $string = formatClass($ar[0]['value']); - for($i=1; $i<count($ar); $i++) { - $string .= ', ' . formatClass($ar[$i]['value']); - } - return $string; -} - -// format a class nicely, i.e. link to it and possibly display -// it in a better way -function formatClass($className) { - $yagoPrefix = 'http://dbpedia.org/class/yago/'; - if(substr($className,0,30)==$yagoPrefix) { - return '<a href="'.$className.'">'.substr($className,30).'</a>'; - // DBpedia is Linked Data, so it makes always sense to link it - // ToDo: instead of linking to other pages, the resource should better - // be openened within DBpedia Navigator - } else if(substr($className,0,14)=='http://dbpedia') { - return '<a href="'.$className.'">'.$className.'</a>'; - } else { - return $className; - } -} - -function arrayToCommaSseparatedList($ar) { - $string = $ar[0]; - for($i=1; $i<count($ar); $i++) { - $string .= ', ' . $ar[$i]; - } - return $string; -} - -?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/database.sql (from rev 1124, trunk/src/dbpedia-navigator/localhost.sql) =================================================================== --- trunk/src/dbpedia-navigator/database.sql (rev 0) +++ trunk/src/dbpedia-navigator/database.sql 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,90 @@ +-- phpMyAdmin SQL Dump +-- version 2.9.1 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 20. August 2008 um 12:05 +-- Server Version: 5.0.67 +-- PHP-Version: 5.2.5 +-- +-- Datenbank: `navigator_db` +-- +CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `navigator_db`; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `articlecategories` +-- + +CREATE TABLE `articlecategories` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(330) NOT NULL, + `category` varchar(330) NOT NULL, + `number` int(8) default '0', + PRIMARY KEY (`id`), + KEY `Category` (`category`), + KEY `Names` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `articlecategories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `categories` +-- + +CREATE TABLE `categories` ( + `category` varchar(330) NOT NULL, + `label` varchar(330) NOT NULL, + PRIMARY KEY (`category`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `categories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `classhierarchy` +-- + +CREATE TABLE `classhierarchy` ( + `id` int(11) NOT NULL auto_increment, + `father` varchar(330) NOT NULL, + `child` varchar(330) NOT NULL, + PRIMARY KEY (`id`), + KEY `Father` (`father`), + KEY `Child` (`child`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `classhierarchy` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `rank` +-- + +CREATE TABLE `rank` ( + `name` varchar(330) NOT NULL, + `label` varchar(330) default NULL, + `number` int(8) NOT NULL default '0', + PRIMARY KEY (`name`), + FULLTEXT KEY `Label` (`label`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `rank` +-- + Deleted: trunk/src/dbpedia-navigator/index-old.php =================================================================== --- trunk/src/dbpedia-navigator/index-old.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/index-old.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,255 +0,0 @@ -<?php - -ini_set('error_reporting',E_ALL); -ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); - -session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; - -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -require_once 'Settings.php'; -$settings=new Settings(); - -//what happens onLoad -$onLoad="onLoad=\""; -if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; - unset($_GET['resource']); -} -else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; -} -$onLoad.="\""; - -require("ajax.php"); - -echo '<?xml version="1.0" encoding="UTF-8"?>'; -?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>DBpedia Navigator</title> - <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> - <link rel="stylesheet" href="<?php print $path;?>default.css"/> - <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> - <?php $xajax->printJavascript($path.'xajax/'); ?> - <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" - type="text/javascript"></script> - <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> - <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> - <script type="text/javascript"> - showLoading = function() { - xajax.$('Loading').style.display='inline'; - }; - hideLoading = function() { - xajax.$('Loading').style.display = 'none'; - //xajax.$('SearchResultBox').style.display = 'block'; - xajax.$('LastArticlesBox').style.display = 'block'; - }; - - function showdiv(id){ - document.getElementById(id).style.display='block'; - } - - function hidediv(id) { - document.getElementById(id).style.display='none'; - } - - function loadGoogleMap(Lat,Lng,Label) { - if (document.getElementById("map").style.display=="none"){ - document.getElementById("map").style.display='block'; - if (GBrowserIsCompatible()) { - // Create and Center a Map - var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 12); - map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); - var marker=new GMarker(new GLatLng(Lat, Lng)); - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(Label); - }); - map.addOverlay(marker); - } - } - else { - document.getElementById("map").style.display='none'; - } - } - </script> - </head> - <body <?php print $onLoad;?>> - -<!-- <h1>DBpedia Navigator</h1> --> -<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> -<div id="layer" style="display:none"> - <div id="layerContent" style="display:none"></div> -</div> - -<div id="wrapper"> - <div id="leftSidebar"> - - <div class="box"> - <div class="boxtitle">Search DBpedia</div> - <div class="boxcontent" id="search"> - <!-- Search:<br/> --> - <form onSubmit="xajax_getarticle(document.getElementById('label').value,-1);return false;"> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="xajax_getarticle(document.getElementById('label').value,-1);return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();xajax_getsubjects(document.getElementById('label').value,list);return false;" /> - <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> - </form> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> - <div class="boxcontent"> - <div id="searchcontent" style="display:block"></div> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="NavigationBox"> - <div class="boxtitle">Navigate</div> - <div class="boxcontent"> - <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); - tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); - tree.enableCheckBoxes(1); - tree.setOnClickHandler(doOnClick); - function doOnClick(nodeId){ - var myUrl = tree.getUserData(nodeId,"myurl"); - xajax_getSubjectsFromConcept(myUrl); - } - tree.setXMLAutoLoading("processTreeMenu.php"); - tree.loadXML("processTreeMenu.php?id=0"); - </script> - - - <div class="box" id="credits"> - <p>DBpedia Navigator is powered by ... <br /> - <a href="http://dl-learner.org">DL-Learner</a><br /> - <a href="http//dbpedia.org">DBpedia</a><br/> - <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and - Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> - - <a href="http://www.w3.org/2004/OWL/"><img src="<?php print $path;?>images/sw-owl-green.png" alt="OWL logo" /></a> - <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="<?php print $path;?>images/sw-sparql-green.png" alt="SPARQL logo"/></a> - </div> - - </div><!-- END leftSidebar --> - - <div id="content"> - <div class="box"> - <div class="boxtitle" id="ArticleTitle">Welcome</div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"> - <br /><br /> - Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia - and uses the background knowledge in DBpedia to suggest possible interesting navigation - links. - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - </div><!-- content --> - - <div id="rightSidebar"> - - <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> - <div class="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - </div><!-- rightSidebar --> - - <!-- <div id="clear"></div> --> - -</div><!-- wrapper --> -<div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source - project.<br />Copyright © Jens Lehmann 2007-2008 </p> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - - echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; - echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - ?> - </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> -</div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> -</ul> -</div> - - <div class="box" id="ConceptBox" style="position:absolute;top:15px;right:15px;width:18%;opacity:0.90;display:none;z-index:5;"> - <div class="boxtitle">Detailed Concept Information</div> - <div class="boxcontent" id="ConceptInformation"></div> - </div> - - </body> -</html> - \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/localhost.sql =================================================================== --- trunk/src/dbpedia-navigator/localhost.sql 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/localhost.sql 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,90 +0,0 @@ --- phpMyAdmin SQL Dump --- version 2.9.1 --- http://www.phpmyadmin.net --- --- Host: localhost --- Erstellungszeit: 20. August 2008 um 12:05 --- Server Version: 5.0.67 --- PHP-Version: 5.2.5 --- --- Datenbank: `navigator_db` --- -CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -USE `navigator_db`; - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `articlecategories` --- - -CREATE TABLE `articlecategories` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(330) NOT NULL, - `category` varchar(330) NOT NULL, - `number` int(8) default '0', - PRIMARY KEY (`id`), - KEY `Category` (`category`), - KEY `Names` (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Daten für Tabelle `articlecategories` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `categories` --- - -CREATE TABLE `categories` ( - `category` varchar(330) NOT NULL, - `label` varchar(330) NOT NULL, - PRIMARY KEY (`category`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Daten für Tabelle `categories` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `classhierarchy` --- - -CREATE TABLE `classhierarchy` ( - `id` int(11) NOT NULL auto_increment, - `father` varchar(330) NOT NULL, - `child` varchar(330) NOT NULL, - PRIMARY KEY (`id`), - KEY `Father` (`father`), - KEY `Child` (`child`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Daten für Tabelle `classhierarchy` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `rank` --- - -CREATE TABLE `rank` ( - `name` varchar(330) NOT NULL, - `label` varchar(330) default NULL, - `number` int(8) NOT NULL default '0', - PRIMARY KEY (`name`), - FULLTEXT KEY `Label` (`label`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Daten für Tabelle `rank` --- - Copied: trunk/src/dbpedia-navigator/old/NaturalConcepts.php (from rev 1124, trunk/src/dbpedia-navigator/NaturalConcepts.php) =================================================================== --- trunk/src/dbpedia-navigator/old/NaturalConcepts.php (rev 0) +++ trunk/src/dbpedia-navigator/old/NaturalConcepts.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,121 @@ +<?php + +class NaturalConcepts +{ + private $concept; + + function NaturalConcepts($conc){ + $this->concept=$conc; + } + + function getNaturalConcept(){ + $identifiedConcepts=$this->identifyConcepts(); + $labels=$this->getLabels($identifiedConcepts); + return $identifiedConcepts; + } + + function identifyConcepts() + { + $temp=$this->concept; + $ret=array(); + $offset=0; + while (true){ + $nextpos=strpos($temp,"http",$offset); + if (!$nextpos) break; + $nextend=preg_match("/\040|.TOP|.BOTTOM|.EXISTS|.ALL|.\(/",$temp,$treffer,PREG_OFFSET_CAPTURE,$nextpos); + if (!$nextend){ + $uri=substr($temp,$nextpos,strlen($temp)-$nextpos); + $ret[]=$uri; + break; + } + $uri=substr($temp,$nextpos,$treffer[0][1]-$nextpos); + $ret[]=$uri; + $offset=$treffer[0][1]; + } + + return $ret; + } + + function getLabels($conc) + { + $query="SELECT DISTINCT "; + for ($i=0;$i<count($conc)-1;$i++) + $query.="?obj".$i.", "; + $query.="?obj".$i."\n"; + $query.="WHERE {\n"; + foreach ($conc as $key=>$con){ + $query.="<".$con."> <http://www.w3.org/2000/01/rdf-schema#label> ?obj".$key.".\n"; + } + $query.="}"; + print $query; + return $query; + } + + function getSparqlQuery() + { + $temp=$this->concept; + $andOrParts=$this->getAndOrParts($temp); + print_r($andOrParts); + } + + function getAndOrParts($temp) + { + $split=preg_split("/(OR)|(AND)/",$temp,-1,PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); + $bracket=0; + $arr=array(); + $temppart=""; + foreach ($split as $part){ + $part=trim($part); + if (strpos($part,"(")===0){ + $bracket+=substr_count($part,"("); + } + if ($bracket>0){ + if (($part=="AND")||($part=="OR")) $temppart.=" ".$part." "; + else $temppart.=$part; + } + else{ + if ((!strpos($part,"AND"))&&(!strpos($part,"OR"))) $arr[]=$part; + else $arr[]=$this->getAndOrParts($part); + } + if ((strrpos($part,')')==(strlen($part)-1))&&($bracket>0)){ + $bracket-=substr_count($part,")"); + if ($bracket==0){ + if ((!strpos($temppart,"AND"))&&(!strpos($temppart,"OR"))) $arr[]=substr($temppart,1,strlen($temppart)-2); + else $arr[]=$this->getAndOrParts(substr($temppart,1,strlen($temppart)-2)); + $temppart=""; + } + } + } + return $arr; + } + + function isExistsConstruct($construct) + { + if (!(strpos($construct,"EXISTS")===0)) return false; + $split=preg_split("/(EXISTS \".*\")\./",$construct,-1,PREG_SPLIT_NO_EMPTY); + $afterdot=$split[0]; + print $afterdot; + $bracket=0; + $offset=0; + do{ + $nextBracketOn=strpos($afterdot,"(",$offset); + $nextBracketOff=strpos($afterdot,")",$offset); + print "On: ".$nextBracketOn+1; + print "Off: ".$nextBracketOff+1; + $min=min($nextBracketOn,$nextBracketOff); + print $min+1; + if ($nextBracketOn==$min) $bracket++; + if ($nextBracketOff==$min) $bracket--; + $offset=$min; + } while(($bracket>0)||($offset>=strlen($afterdot)-1)); + print ($offset); + return true; + } +} + +//$conc="(EXISTS http://dbpedia.org/property/website.(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin) OR (http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)) OR http://dbpedia.org/resource/Berlin"; +$conc="EXISTS \"http://dbpedia.org/property/website\".(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)"; +$nc=new NaturalConcepts($conc); +$ic=$nc->isExistsConstruct($conc); +//print_r($ic); +?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/old/ajax.php (from rev 1124, trunk/src/dbpedia-navigator/ajax.php) =================================================================== --- trunk/src/dbpedia-navigator/old/ajax.php (rev 0) +++ trunk/src/dbpedia-navigator/old/ajax.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,33 @@ +<?php +require_once ("xajax/xajax_core/xajax.inc.php"); +$sid = session_id(); +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +$xajax = new xajax($path."ajaxfunctions.php?sid=$sid&path=".$path); +$xajax->configureMany(array('debug'=>true)); + +$xajax->register(XAJAX_FUNCTION, 'getsubjects', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); +$xajax->register(XAJAX_FUNCTION,'getarticle', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); +$xajax->register(XAJAX_FUNCTION,'learnConcept', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); +$xajax->register(XAJAX_FUNCTION,'getSubjectsFromConcept', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); + $xajax->registerFunction('toPositive'); +$xajax->registerFunction('toNegative'); +$xajax->registerFunction('clearPositives'); +$xajax->registerFunction('clearNegatives'); +$xajax->registerFunction('removePosInterest'); +$xajax->registerFunction('removeNegInterest'); +$xajax->registerFunction('stopServerCall'); +?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/old/ajaxfunctions.php (from rev 1124, trunk/src/dbpedia-navigator/ajaxfunctions.php) =================================================================== --- trunk/src/dbpedia-navigator/old/ajaxfunctions.php (rev 0) +++ trunk/src/dbpedia-navigator/old/ajaxfunctions.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,616 @@ +<?php +ini_set('max_execution_time',200); + +require("ajax.php"); +$xajax->processRequest(); + +function getsubjects($label,$list) +{ + $sid = $_GET['sid']; + session_id($sid); + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + + setRunning($id,"true"); + + //get parts of the list + $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); + + //initialise content + $content=""; + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + + $subjects=$sc->getSubjects($label,$checkedInstances); + + $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); + $content.=getResultsTable($subjects['subjects']); + } catch (Exception $e){ + $content=$e->getMessage(); + } + + $objResponse = new xajaxResponse(); + $objResponse->assign("articlecontent", "innerHTML", $content); + $objResponse->assign("ArticleTitle","innerHTML","Searchresult for ".$label); + return $objResponse; +} + +function getarticle($subject,$fromCache) +{ + $sid = $_GET['sid']; + session_id($sid); + session_start(); + if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + + //get first Letter of label big + $uri=subjectToURI($subject); + + //if article is in session, get it out of the session + if (isset($articles)){ + foreach ($articles as $key => $value) + { + if ($value['subject']==$subject){ + $fromCache=$key; + break; + } + } + } + + //initialize the content variables + $content=""; + $searchResult=""; + $lastArticles=""; + $artTitle=""; + + $objResponse = new xajaxResponse(); + + //get the article + //if $fromCache is -2, no new SearchResults should be processed + //if $fromCache is -1, everything is normal + //if $fromCache is >=0, the article is taken out of the cache + if ($fromCache<0) { + //if there are errors see catch block + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $triples=$sc->getTriples($uri); + + //BUILD ARTICLE + // goal: display the data in a nice (DBpedia specific way), maybe similar to + // dbpedia.org/search + + // display a picture if there is one + if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; + + //display where it was redirected from, if it was redirected + $redirect=""; + if (isset($triples['http://dbpedia.org/property/redirect'])){ + $content.="<span id=\"redirectedFrom\">redirected from '$subject'</span>"; + $redirect=$triples['http://dbpedia.org/property/redirect'][0]['value']; + } + + // add short description in english + $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0]['value'])."</p>"; + + // give the link to the corresponding Wikipedia article + if(isset($triples['http://xmlns.com/foaf/0.1/page'])) + $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt="Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0]['value'].'">view Wikipedia article</a>, '; + $content .= '<a href="'.$uri.'">view DBpedia resource description</a></p>'; + + // display a list of classes + if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) + $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + + if(isset($triples['http://dbpedia.org/property/reference'])) { + $content .= '<p>references: <ul>'; + foreach($triples['http://dbpedia.org/property/reference'] as $reference) + $content .= '<li><a href="'.$reference['value'].'">'.$reference['value'].'</a></li>'; + $content .= '</ul></p>'; + } + + //display a Google Map if Geo-koordinates are available + if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ + $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:25px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0]['value'].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0]['value'].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']."');return false;\">Toggle a map of the location</a><br/><br/><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + } + + //display photo collection, if there is one + if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ + $content.="<br/><img src=\"".$_GET['path']."images/flickr.jpg\" alt=\"Flickr\" style=\"max-width:25px;\" /> <a href=\"".$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value']."\">view a photo collection</a><br/>"; + } + + //skos-subjects + if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])){ + $content .= '<br/><p>skos subjects: <ul>'; + foreach($triples['http://www.w3.org/2004/02/skos/core#subject'] as $skos) + $content .= '<li><a href="'.$skos['value'].'">'.$skos['value'].'</a></li>'; + $content .= '</ul></p>'; + } + + //BUILD ARTICLE TITLE + $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; + + // filter out uninteresting properties and properties which + // have already been displayed + unset($triples['http://xmlns.com/foaf/0.1/page']); + unset($triples['http://xmlns.com/foaf/0.1/depiction']); + unset($triples['http://dbpedia.org/property/abstract']); + unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); + unset($triples['http://dbpedia.org/property/redirect']); + unset($triples['http://dbpedia.org/property/reference']); + unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); + ... [truncated message content] |
From: <sk...@us...> - 2008-09-16 00:08:40
|
Revision: 1215 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1215&view=rev Author: sknappe Date: 2008-09-16 07:08:33 +0000 (Tue, 16 Sep 2008) Log Message: ----------- Changed the Evaluated Description, so that the NaturalDescription is not automatically generated with it, instead a seperate webservice is now used to generate it. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Modified: trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-09-15 17:28:02 UTC (rev 1214) +++ trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-09-16 07:08:33 UTC (rev 1215) @@ -23,6 +23,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; +import org.dllearner.kb.sparql.NaturalLanguageDescriptionConvertVisitor; import org.dllearner.kb.sparql.SparqlQueryDescriptionConvertVisitor; import org.dllearner.learningproblems.ScoreTwoValued; import org.dllearner.reasoning.OWLAPIDescriptionConvertVisitor; @@ -162,12 +163,6 @@ return SparqlQueryDescriptionConvertVisitor.getSparqlQuery(description, limit); } - public String getNaturalDescription(){ - // TODO only works for DBpedia !! (no DBpedia SPARQL queries should be made to convert the description) -// return NaturalLanguageDescriptionConvertVisitor.getNaturalLanguageDescription(description); - return ""; - } - /** * This convenience method can be used to store and exchange evaluated * descriptions by transforming them to a JSON string. @@ -179,8 +174,8 @@ object.put("descriptionManchesterSyntax", description.toManchesterSyntaxString(null, null)); OWLDescription d = OWLAPIDescriptionConvertVisitor.getOWLDescription(description); object.put("descriptionOWLXML", OWLAPIRenderers.toOWLXMLSyntax(d)); + object.put("descriptionKBSyntax", description.toKBSyntaxString()); object.put("accuracy", score.getAccuracy()); - object.put("NaturalLanguage", getNaturalDescription()); object.put("coveredPositives", getJSONArray(score.getCoveredPositives())); object.put("coveredNegatives", getJSONArray(score.getCoveredNegatives())); object.put("notCoveredPositives", getJSONArray(score.getNotCoveredPositives())); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java 2008-09-15 17:28:02 UTC (rev 1214) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java 2008-09-16 07:08:33 UTC (rev 1215) @@ -68,7 +68,7 @@ return ret; } - public static String getSparqlQuery(String descriptionKBSyntax) throws ParseException + public static String getNaturalLanguageDescription(String descriptionKBSyntax) throws ParseException { Description d = KBParser.parseConcept(descriptionKBSyntax); NaturalLanguageDescriptionConvertVisitor visitor=new NaturalLanguageDescriptionConvertVisitor(); @@ -98,7 +98,7 @@ s.add("NOT \"http://dbpedia.org/class/yago/Person100007846\""); s.add("(\"http://dbpedia.org/class/yago/HeadOfState110164747\" AND (\"http://dbpedia.org/class/yago/Negotiator110351874\" AND \"http://dbpedia.org/class/yago/Representative110522035\"))"); for (String kbsyntax : s) { - result.put(kbsyntax,NaturalLanguageDescriptionConvertVisitor.getSparqlQuery(kbsyntax)); + result.put(kbsyntax,NaturalLanguageDescriptionConvertVisitor.getNaturalLanguageDescription(kbsyntax)); } System.out.println("************************"); for (String string : result.keySet()) { Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-15 17:28:02 UTC (rev 1214) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-16 07:08:33 UTC (rev 1215) @@ -61,6 +61,7 @@ import org.dllearner.core.owl.ObjectProperty; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.Cache; +import org.dllearner.kb.sparql.NaturalLanguageDescriptionConvertVisitor; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.kb.sparql.SparqlQueryDescriptionConvertVisitor; @@ -707,6 +708,12 @@ } @WebMethod + public String getNaturalDescription(String conceptString) throws ParseException { + // call parser to parse concept + return NaturalLanguageDescriptionConvertVisitor.getNaturalLanguageDescription(conceptString); + } + + @WebMethod public String[] getNegativeExamples(int sessionID, int componentID,String[] positives, int results, String namespace) throws ClientNotKnownException { int sparqlResultSetLimit = 500; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-15 17:28:36
|
Revision: 1214 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1214&view=rev Author: jenslehmann Date: 2008-09-15 17:28:02 +0000 (Mon, 15 Sep 2008) Log Message: ----------- - fixed and improved search tree display - fixed some conf files according to unit test Modified Paths: -------------- trunk/examples/arch/arch_owl.conf trunk/examples/conflict/arch_refexamples_owlAPI.conf trunk/examples/conflict/test_ZERO_ONE_refexamples_owlAPI.conf trunk/examples/cross-benchmark/arch/arch_gp.conf trunk/examples/cross-benchmark/arch/arch_hybrid.conf trunk/examples/cross-benchmark/arch/arch_refexamples.conf trunk/examples/cross-benchmark/forte/uncle_gp.conf trunk/examples/cross-benchmark/forte/uncle_hybrid.conf trunk/examples/cross-benchmark/forte/uncle_refexamples.conf trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_gp.conf trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_hybrid.conf trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_refexamples.conf trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_gp.conf trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_hybrid.conf trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_refexamples.conf trunk/examples/cross-benchmark/poker/pair_gp.conf trunk/examples/cross-benchmark/poker/pair_hybrid.conf trunk/examples/cross-benchmark/poker/pair_refexamples.conf trunk/examples/cross-benchmark/poker/straight_gp.conf trunk/examples/cross-benchmark/poker/straight_hybrid.conf trunk/examples/cross-benchmark/poker/straight_refexamples.conf trunk/examples/cross-benchmark/trains/trains_gp.conf trunk/examples/cross-benchmark/trains/trains_hybrid.conf trunk/examples/cross-benchmark/trains/trains_refexamples.conf trunk/examples/family/father_posonly.conf trunk/examples/krk/complete_no_draw.conf trunk/examples/semantic_bible/normal.conf trunk/examples/semantic_bible/normal_retrieval_special.conf trunk/examples/semantic_bible/sparqlbible.conf trunk/examples/semantic_bible/woman.conf trunk/examples/sparql/govtrack.conf trunk/examples/sparql/musicbrainz.conf trunk/examples/sparql/roles_notworking/Roles_fixed_DBPedia_monarch_range_yago.conf trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java trunk/src/dl-learner/org/dllearner/gui/RunPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/SearchTree.java Modified: trunk/examples/arch/arch_owl.conf =================================================================== --- trunk/examples/arch/arch_owl.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/arch/arch_owl.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -16,8 +16,9 @@ * Copyright (C) 2007, Sebastian Hellmann */ +refexamples.writeSearchTree = true; +refexamples.searchTreeFile = "log/test.txt"; - /** background knowledge **/ import("arch.owl"); Modified: trunk/examples/conflict/arch_refexamples_owlAPI.conf =================================================================== --- trunk/examples/conflict/arch_refexamples_owlAPI.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/conflict/arch_refexamples_owlAPI.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -17,7 +17,7 @@ */ algorithm = refexamples; -reasoner=owlAPI; +reasoner=owlAPIReasoner; Modified: trunk/examples/conflict/test_ZERO_ONE_refexamples_owlAPI.conf =================================================================== --- trunk/examples/conflict/test_ZERO_ONE_refexamples_owlAPI.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/conflict/test_ZERO_ONE_refexamples_owlAPI.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -11,7 +11,7 @@ algorithm = refexamples; -reasoner=owlAPI; +reasoner=owlAPIReasoner; refexamples.useAllConstructor = false; Modified: trunk/examples/cross-benchmark/arch/arch_gp.conf =================================================================== --- trunk/examples/cross-benchmark/arch/arch_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/arch/arch_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -10,7 +10,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("arch.owl"); Modified: trunk/examples/cross-benchmark/arch/arch_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/arch/arch_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/arch/arch_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -10,7 +10,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("arch.owl"); Modified: trunk/examples/cross-benchmark/arch/arch_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/arch/arch_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/arch/arch_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -1,5 +1,5 @@ algorithm = refexamples; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("arch.owl"); +c1 Modified: trunk/examples/cross-benchmark/forte/uncle_gp.conf =================================================================== --- trunk/examples/cross-benchmark/forte/uncle_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/forte/uncle_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -27,7 +27,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("forte_family.owl"); /** examples **/ Modified: trunk/examples/cross-benchmark/forte/uncle_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/forte/uncle_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/forte/uncle_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -28,7 +28,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("forte_family.owl"); /** examples **/ Modified: trunk/examples/cross-benchmark/forte/uncle_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/forte/uncle_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/forte/uncle_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -18,7 +18,7 @@ algorithm = refexamples; refexamples.useCardinalityRestrictions = false; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("forte_family.owl"); /** examples **/ Modified: trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_gp.conf =================================================================== --- trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -20,7 +20,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /** background knowledge **/ import("moral_43instances_complex.owl"); Modified: trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -20,7 +20,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /** background knowledge **/ import("moral_43instances_complex.owl"); Modified: trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_complex_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -10,7 +10,7 @@ ***********************/ algorithm = refexamples; refexamples.useCardinalityRestrictions = false; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /** background knowledge **/ import("moral_43instances_complex.owl"); Modified: trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_gp.conf =================================================================== --- trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -21,7 +21,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /** background knowledge **/ import("moral_43instances.owl"); Modified: trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -20,7 +20,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /** background knowledge **/ import("moral_43instances.owl"); Modified: trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/moral_reasoner/moral_43examples_simple_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -10,7 +10,7 @@ ***********************/ algorithm = refexamples; refexamples.useCardinalityRestrictions = false; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /** background knowledge **/ import("moral_43instances.owl"); Modified: trunk/examples/cross-benchmark/poker/pair_gp.conf =================================================================== --- trunk/examples/cross-benchmark/poker/pair_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/poker/pair_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -17,7 +17,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /*Background knowledge*/ import("pair50.owl"); Modified: trunk/examples/cross-benchmark/poker/pair_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/poker/pair_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/poker/pair_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -17,7 +17,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /*Background knowledge*/ import("pair50.owl"); Modified: trunk/examples/cross-benchmark/poker/pair_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/poker/pair_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/poker/pair_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -6,7 +6,7 @@ */ algorithm = refexamples; refexamples.useCardinalityRestrictions = false; -reasoner = owlAPI; +reasoner = owlAPIReasoner; /*Background knowledge*/ import("pair50.owl"); Modified: trunk/examples/cross-benchmark/poker/straight_gp.conf =================================================================== --- trunk/examples/cross-benchmark/poker/straight_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/poker/straight_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -18,7 +18,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("straight.owl"); /*Examples*/ Modified: trunk/examples/cross-benchmark/poker/straight_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/poker/straight_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/poker/straight_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -18,7 +18,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("straight.owl"); /*Examples*/ Modified: trunk/examples/cross-benchmark/poker/straight_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/poker/straight_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/poker/straight_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -8,7 +8,7 @@ /*Background knowledge*/ algorithm = refexamples; refexamples.useCardinalityRestrictions = false; -reasoner = owlAPI; +reasoner = owlAPIReasoner; import("straight.owl"); /*Examples*/ Modified: trunk/examples/cross-benchmark/trains/trains_gp.conf =================================================================== --- trunk/examples/cross-benchmark/trains/trains_gp.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/trains/trains_gp.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -17,7 +17,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; hidePrefix = "http://example.com/foo#"; Modified: trunk/examples/cross-benchmark/trains/trains_hybrid.conf =================================================================== --- trunk/examples/cross-benchmark/trains/trains_hybrid.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/trains/trains_hybrid.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -17,7 +17,7 @@ gp.hillClimbingProbability = 0; posNegDefinitionLP.percentPerLenghtUnit = 0.02; gp.maxConceptLength = 30; -reasoner = owlAPI; +reasoner = owlAPIReasoner; hidePrefix = "http://example.com/foo#"; /*Background knowledge*/ Modified: trunk/examples/cross-benchmark/trains/trains_refexamples.conf =================================================================== --- trunk/examples/cross-benchmark/trains/trains_refexamples.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/cross-benchmark/trains/trains_refexamples.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -7,7 +7,7 @@ algorithm = refexamples; refexamples.useCardinalityRestrictions = false; -reasoner = owlAPI; +reasoner = owlAPIReasoner; hidePrefix = "http://example.com/foo#"; /*Background knowledge*/ Modified: trunk/examples/family/father_posonly.conf =================================================================== --- trunk/examples/family/father_posonly.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/family/father_posonly.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -13,7 +13,7 @@ import("father.kb"); problem = posOnlyDefinitionLP; -reasoner = owlAPI; +reasoner = owlAPIReasoner; algorithm = refexamples; refexamples.usePropernessChecks = true; refexamples.maxPosOnlyExpansion = 4; Modified: trunk/examples/krk/complete_no_draw.conf =================================================================== --- trunk/examples/krk/complete_no_draw.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/krk/complete_no_draw.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -23,7 +23,7 @@ algorithm = refexamples; reasoner=fastInstanceChecker; -//reasoner=owlAPI; +//reasoner=owlAPIReasoner; //fastInstanceChecker.reasonerType = fact; refexamples.useAllConstructor = false; Modified: trunk/examples/semantic_bible/normal.conf =================================================================== --- trunk/examples/semantic_bible/normal.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/semantic_bible/normal.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -16,7 +16,7 @@ //refexamples.ignoredConcepts = {"http://semanticbible.org/ns/2006/NTNames#God"}; //reasoner = fastInstanceChecker; -reasoner = owlAPI; +reasoner = owlAPIReasoner; owlAPIReasoner.reasonerType = pellet; /** examples **/ Modified: trunk/examples/semantic_bible/normal_retrieval_special.conf =================================================================== --- trunk/examples/semantic_bible/normal_retrieval_special.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/semantic_bible/normal_retrieval_special.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -16,7 +16,7 @@ //refexamples.ignoredConcepts = {"http://semanticbible.org/ns/2006/NTNames#God"}; //reasoner = fastInstanceChecker; -reasoner = owlAPI; +reasoner = owlAPIReasoner; owlAPIReasoner.reasonerType = pellet; problem = posNegDefinitionLP; Modified: trunk/examples/semantic_bible/sparqlbible.conf =================================================================== --- trunk/examples/semantic_bible/sparqlbible.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/semantic_bible/sparqlbible.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -16,7 +16,7 @@ //refexamples.ignoredConcepts = {"http://semanticbible.org/ns/2006/NTNames#God"}; //reasoner = fastInstanceChecker; -reasoner = owlAPI; +reasoner = owlAPIReasoner; owlAPIReasoner.reasonerType = pellet; /** examples **/ Modified: trunk/examples/semantic_bible/woman.conf =================================================================== --- trunk/examples/semantic_bible/woman.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/semantic_bible/woman.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -14,7 +14,7 @@ //refexamples.ignoredConcepts = {"http://semanticbible.org/ns/2006/NTNames#God"}; reasoner = fastInstanceChecker; -//reasoner = owlAPI; +//reasoner = owlAPIReasoner; //owlAPIReasoner.reasonerType = pellet; /** examples **/ Modified: trunk/examples/sparql/govtrack.conf =================================================================== --- trunk/examples/sparql/govtrack.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/sparql/govtrack.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -4,7 +4,7 @@ sparql.useLits = true; algorithm = refexamples; -reasoner = owlAPI; +reasoner = owlAPIReasoner; // reasoner = fastInstanceChecker; import("http://www.govtrack.us/sparql","SPARQL"); Modified: trunk/examples/sparql/musicbrainz.conf =================================================================== --- trunk/examples/sparql/musicbrainz.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/sparql/musicbrainz.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -13,7 +13,7 @@ sparql.useLits=true; algorithm = refexamples; -//reasoner = owlAPI; +//reasoner = owlAPIReasoner; reasoner = fastInstanceChecker; Modified: trunk/examples/sparql/roles_notworking/Roles_fixed_DBPedia_monarch_range_yago.conf =================================================================== --- trunk/examples/sparql/roles_notworking/Roles_fixed_DBPedia_monarch_range_yago.conf 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/examples/sparql/roles_notworking/Roles_fixed_DBPedia_monarch_range_yago.conf 2008-09-15 17:28:02 UTC (rev 1214) @@ -18,7 +18,7 @@ sparql2.predefinedFilter=1; // use DBpedia endpoint -import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL"); //***********ROLE SPECIFIC Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedNode.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -178,6 +178,29 @@ return ret; } + public String getShortDescriptionHTML(int nrOfPositiveExamples, int nrOfNegativeExamples, String baseURI) { + String ret = "<html> " + concept.toString(baseURI,null) + " <i>["; + + if(isTooWeak) + ret += "q:tw"; + else { + double accuracy = 100 * (coveredPositives.size() + nrOfNegativeExamples - coveredNegatives.size())/(double)(nrOfPositiveExamples+nrOfNegativeExamples); + 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); + ret += "h:" +df.format(heuristicScore) + " "; + + int wrongPositives = nrOfPositiveExamples - coveredPositives.size(); + ret += "q:" + wrongPositives + "p-" + coveredNegatives.size() + "n"; + } + + ret += " ("+qualityEvaluationMethod+"), he:" + horizontalExpansion; + ret += " c:" + children.size() + "]"; + + return ret + "</i></html>"; + } + //TODO integrate this method with the one above public String getStats(int nrOfPositiveExamples, int nrOfNegativeExamples) { String ret = " ["; Modified: trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -22,6 +22,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.SortedSet; import java.util.TreeMap; import javax.swing.event.TreeModelEvent; @@ -92,6 +93,7 @@ } + @SuppressWarnings("unused") private void fireTreeStructureChanged(ExampleBasedNode node) { TreeModelEvent e = new TreeModelEvent(this, new Object[] {node}); @@ -102,13 +104,25 @@ // convert the set of children to a list and store it in this model private List<ExampleBasedNode> getChildren(ExampleBasedNode node) { +// System.out.println("asking for children of " + node); + List<ExampleBasedNode> children = childrenMap.get(node); // if the children have not been cached or the list is outdated // (node has more children now) we do an update if(children == null || children.size() != node.getChildren().size()) { - children = new LinkedList<ExampleBasedNode>(node.getChildren()); + SortedSet<ExampleBasedNode> childrenSet = node.getChildren(); + children = new LinkedList<ExampleBasedNode>(childrenSet); + + // we need to ensure that the children are sorted correctly +// children = new LinkedList<ExampleBasedNode>(); +// for(ExampleBasedNode child : childrenSet) { +// children.add(child); +// } + childrenMap.put(node, children); - fireTreeStructureChanged(node); + +// fireTreeStructureChanged(node); +// System.out.println("updating children of " + node); } return children; } Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -31,7 +31,9 @@ import javax.swing.*; +import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.core.EvaluatedDescription; +import org.dllearner.learningproblems.PosNegDefinitionLP; /** * @author Tilo Hielscher @@ -82,8 +84,10 @@ stopButton.setEnabled(false); stopButton.addActionListener(this); showPanel.add(stopButton); + treeButton = new JButton("Tree"); treeButton.addActionListener(this); + treeButton.setEnabled(false); showPanel.add(treeButton); infoPanel.setLayout(gridbag); @@ -182,8 +186,8 @@ } // tree if (e.getSource() == treeButton) { - @SuppressWarnings("unused") TreeWindow a = new TreeWindow(config); + a.setLocationRelativeTo(startGUI); } } @@ -348,7 +352,17 @@ * Method is called when algorithm has terminated successfully. */ public void algorithmTerminated() { + // the methods called are similar to those when the stop button is pressed stopButton.setEnabled(false); runButton.setEnabled(true); + startGUI.enableTabbedPane(); + + System.out.println("TEST"); + + // enable tree button + if((config.getLearningAlgorithm() instanceof ExampleBasedROLComponent) + && (config.getLearningProblem() instanceof PosNegDefinitionLP)) { + treeButton.setEnabled(true); + } } } Added: trunk/src/dl-learner/org/dllearner/gui/SearchTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/SearchTree.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/SearchTree.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -0,0 +1,57 @@ +/** + * 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.gui; + +import javax.swing.JTree; + +import org.dllearner.algorithms.refexamples.ExampleBasedNode; + +/** + * Own JTree implemenation with improved formatting. + * + * @author Jens Lehmann + * + */ +public class SearchTree extends JTree { + + private static final long serialVersionUID = 4509903171856747400L; + + private int nrOfNegativeExamples; + private int nrOfPositiveExamples; + private String baseURI; + + public SearchTree(EBNodeTreeModel model, int nrOfPositiveExamples, int nrOfNegativeExamples, String baseURI) { + super(model); + this.nrOfPositiveExamples = nrOfPositiveExamples; + this.nrOfNegativeExamples = nrOfNegativeExamples; + this.baseURI = baseURI; + } + + @Override + public String convertValueToText(Object value, + boolean selected, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { + ExampleBasedNode node = (ExampleBasedNode) value; + return node.getShortDescriptionHTML(nrOfPositiveExamples, nrOfNegativeExamples, baseURI); + } +} Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -171,6 +171,11 @@ setVisible(true); updateTabs(); + // load file + if(file != null) { + config.loadFile(file); + } + // Register a change listener tabPane.addChangeListener(new ChangeListener() { // This method is called whenever the selected tab changes Modified: trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -20,13 +20,18 @@ * */ -import javax.swing.*; +import java.util.Set; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTree; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeWillExpandListener; import javax.swing.tree.ExpandVetoException; -import org.dllearner.algorithms.refexamples.*; +import org.dllearner.algorithms.refexamples.ExampleBasedNode; +import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; +import org.dllearner.learningproblems.PosNegDefinitionLP; /** * TreeWindow @@ -42,13 +47,14 @@ private EBNodeTreeModel ebNodeModel; private ExampleBasedNode rootNode; private JTree tree; - + + @SuppressWarnings("unchecked") public TreeWindow(Config config) { this.config = config; this.setTitle("DL-Learner Tree"); this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); - this.setLocationByPlatform(true); - this.setSize(640, 300); +// this.setLocationByPlatform(true); + this.setSize(800, 600); // set icon if (this.getClass().getResource("icon.gif") != null) @@ -61,7 +67,7 @@ .getLearningAlgorithm(); this.rootNode = ebrol.getStartNode(); - System.out.println("childs1: " + rootNode.getChildren()); +// System.out.println("childs1: " + rootNode.getChildren()); this.ebNodeModel = new EBNodeTreeModel(rootNode); @@ -71,15 +77,23 @@ // System.out.println("childs2: " + // ebNodeModel.getChildren((ExampleBasedNode) first)); - - tree = new JTree(ebNodeModel); - tree.addTreeWillExpandListener(this); + + // collect some helper values for display and accuracy calculations + PosNegDefinitionLP lp = (PosNegDefinitionLP) config.getLearningProblem(); + Set<String> posExamples = lp.getConfigurator().getPositiveExamples(); + Set<String> negExamples = lp.getConfigurator().getNegativeExamples(); + String baseURI = config.getReasoningService().getBaseURI(); + int nrOfPositiveExamples = posExamples.size(); + int nrOfNegativeExamples = negExamples.size(); + + tree = new SearchTree(ebNodeModel, nrOfPositiveExamples, nrOfNegativeExamples, baseURI); +// tree.addTreeWillExpandListener(this); this.add(new JScrollPane(tree)); } // } - this.repaint(); - this.setVisible(true); +// this.repaint(); + setVisible(true); } /* Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2008-09-15 13:30:02 UTC (rev 1213) +++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2008-09-15 17:28:02 UTC (rev 1214) @@ -83,6 +83,8 @@ ignore.add("./examples/sparql/scrobble.conf"); // HTTP 502 Proxy Error ignore.add("./examples/family-benchmark/Cousin.conf"); // Out of Memory Error ignore.add("./examples/sparql/SilentBobWorking2.conf"); // Out of Memory Error + ignore.add("./examples/family/father_posonly.conf"); // ArrayOutOfBoundsException in Pellet - main problem: pos only not working + ignore.add("./examples/sparql/difference/DBPediaSKOS_kohl_vs_angela.conf"); // Pellet: literal cannot be cast to individual for (String path : confFiles.keySet()) { for (String file : confFiles.get(path)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-15 13:30:10
|
Revision: 1213 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1213&view=rev Author: jenslehmann Date: 2008-09-15 13:30:02 +0000 (Mon, 15 Sep 2008) Log Message: ----------- small fixes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/RunPanel.java trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-15 13:17:51 UTC (rev 1212) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-15 13:30:02 UTC (rev 1213) @@ -614,7 +614,7 @@ return false; } } else if(component instanceof KBFile) { - if(cm.getConfigOptionValue(source, "url") == null && cm.getConfigOptionValue(source, "filename") == null) { + if(cm.getConfigOptionValue(source, "url") == null) { return false; } } else if(component instanceof PosNegLP) { Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-15 13:17:51 UTC (rev 1212) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-15 13:30:02 UTC (rev 1213) @@ -343,4 +343,12 @@ } return string; } + + /** + * Method is called when algorithm has terminated successfully. + */ + public void algorithmTerminated() { + stopButton.setEnabled(false); + runButton.setEnabled(true); + } } Modified: trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2008-09-15 13:17:51 UTC (rev 1212) +++ trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2008-09-15 13:30:02 UTC (rev 1213) @@ -53,6 +53,7 @@ } // show final stats runPanel.showStats(); + runPanel.algorithmTerminated(); } catch (InterruptedException e) { e.printStackTrace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-15 13:18:02
|
Revision: 1212 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1212&view=rev Author: jenslehmann Date: 2008-09-15 13:17:51 +0000 (Mon, 15 Sep 2008) Log Message: ----------- large number of GUI fixes and improvements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringTupleList.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/tutorial.html Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -328,7 +328,7 @@ * this way the CLI will automatically support any configuration options * supported by the component */ - public static void configureComponent(ComponentManager cm, Component component, + private static void configureComponent(ComponentManager cm, Component component, ConfParser parser) { String prefix = confMapper.getComponentString(component.getClass()); if (prefix != null) Modified: trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -28,7 +28,7 @@ private static final long serialVersionUID = -7678275020058043937L; private Config config; -// private StartGUI startGUI; + private StartGUI startGUI; private List<Class<? extends Component>> selectableComponents; private OptionPanel optionPanel; private Class<? extends Component> panelClass; @@ -46,7 +46,7 @@ super(new BorderLayout()); this.config = config; -// this.startGUI = startGUI; + this.startGUI = startGUI; this.panelClass = panelClass; // get all classes of the correct type @@ -99,11 +99,14 @@ public void actionPerformed(ActionEvent e) { if(e.getSource() == comboBox) { - System.out.println("TESTzz"); // change component and update option panel Class<? extends Component> c = selectableComponents.get(comboBox.getSelectedIndex()); currentComponent = changeInstance(c); updateOptionPanel(); + // if the component does not have mandatory values, we can + // enable the following tabs + config.enableComponentsIfPossible(); + startGUI.updateTabs(); } else if (e.getSource() == clearButton) { // clearing everything corresponds to changing to an unconfigured // component of the same type Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -40,6 +40,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.kb.KBFile; import org.dllearner.kb.OWLFile; +import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.PosNegLP; /** @@ -530,7 +531,7 @@ cm.applyConfigEntry(component, entry); // enable tabs if setting the value completed mandatory settings - enableTabsIfPossible(); + enableComponentsIfPossible(); // invalidate components if(component instanceof KnowledgeSource) { needsInit[0] = true; @@ -563,22 +564,49 @@ gui.updateTabs(); } - private void enableTabsIfPossible() { - if(mandatoryOptionsSpecified(source)) { - isEnabled[0] = true; - } - if(mandatoryOptionsSpecified(reasoner) && isEnabled[0]) { - isEnabled[1] = true; - } - if(mandatoryOptionsSpecified(lp) && isEnabled[1]) { - isEnabled[2] = true; - } - if(mandatoryOptionsSpecified(la) && isEnabled[1] && isEnabled[2]) { - isEnabled[3] = true; + // note it can also happend that components become + // disabled if mandatory fields are cleared + public void enableComponentsIfPossible() { + // 0: reasoner + // 1: problem + // 2: algorithm + // 3: run + + isEnabled[0] = mandatoryOptionsSpecified(source); + isEnabled[1] = isEnabled[0] && mandatoryOptionsSpecified(reasoner); + isEnabled[2] = isEnabled[0] && isEnabled[1] && mandatoryOptionsSpecified(lp); + isEnabled[3] = isEnabled[0] && isEnabled[1] && isEnabled[2] && mandatoryOptionsSpecified(la); + + + /* + // enable reasoner iff source has all options + isEnabled[0] = mandatoryOptionsSpecified(source); + + // enable problem if reasoner has all options + if(isEnabled[0]) { + isEnabled[1] = mandatoryOptionsSpecified(reasoner); + } else { + isEnabled[1] = false; } + + // enable algorithm if reasoner enabled and problem + // has all options + if(isEnabled[0]) { + isEnabled[2] = mandatoryOptionsSpecified(lp); + } else { + isEnabled[2] = false; + } + + // enable run panel if al + isEnabled[3] = mandatoryOptionsSpecified(la); + + if(isEnabled[1] && isEnabled[2]) { + isEnabled[3] = mandatoryOptionsSpecified(la); + }*/ } // TODO use specification of mandatory variables + @SuppressWarnings("unchecked") public boolean mandatoryOptionsSpecified(Component component) { // System.out.println("check mandatory options for " + component.getClass().getName()); if(component instanceof OWLFile) { @@ -590,10 +618,17 @@ return false; } } else if(component instanceof PosNegLP) { - if(cm.getConfigOptionValue(component, "positiveExamples")==null || cm.getConfigOptionValue(component, "negativeExamples") == null) { + if(cm.getConfigOptionValue(component, "positiveExamples")==null || cm.getConfigOptionValue(component, "negativeExamples") == null + || ((Set<String>)cm.getConfigOptionValue(component, "positiveExamples")).size()==0 + || ((Set<String>)cm.getConfigOptionValue(component, "negativeExamples")).size()==0) { return false; } + } else if(component instanceof SparqlKnowledgeSource) { + if(cm.getConfigOptionValue(component, "instances")==null || ((Set<String>)cm.getConfigOptionValue(component, "instances")).size()==0) { + return false; + } } + return true; } Modified: trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -19,16 +19,20 @@ */ package org.dllearner.gui; -import java.awt.Dimension; +import java.awt.BorderLayout; +import java.net.URL; import javax.swing.JFrame; import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; +import javax.swing.SwingWorker; /** * Window displaying a tutorial for the DL-Learner GUI. * * @author Jens Lehmann - * + * */ public class TutorialWindow extends JFrame { @@ -39,35 +43,74 @@ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLocationByPlatform(true); setSize(300, 600); + setVisible(true); + + getContentPane().setLayout(new BorderLayout()); + final JLabel label = new JLabel("Loading HTML help page."); + add(label, BorderLayout.NORTH); + final JTextPane tp = new JTextPane(); + JScrollPane js = new JScrollPane(); + js.getViewport().add(tp); + add(js, BorderLayout.CENTER); + + SwingWorker<Boolean, Boolean> worker = new SwingWorker<Boolean, Boolean>() { + @Override + public Boolean doInBackground() { + + try { + URL url = getClass().getResource("tutorial.html"); + tp.setPage(url); + } catch (Exception e) { + e.printStackTrace(); + } + +// label.setText("Displaying tutorial.html."); + remove(label); + repaint(); + + return true; + } + }; + worker.execute(); + // display tutorial text - String text = "<html><h2>Quick Tutorial</h2><p align=\"justify\">DL-Learner has a component" + - " based design to make it easier to extend and use. There are four " + - "components corresponding to the tabs you see: knowledge source, " + - "reasoner, learning problem, and learning algorithm. There are various " + - "components available of each type (selectable at the top of each tab). " + - "Each component has configuration options associated with it (middle of the" + - " tab, scrollable), which you can use to specify the settings for the component.</p>" + - "<br /><p align=\"justify\">In order to create a learning problem, " + - "you have to choose and configure all four types of components." + - " The run tab plays a special role: It is used to start the learning algorithm" + - " and display statistical information.</p>" + - "<br /><p><i>Tab color explanation:</i> <br />gray = cannot be configured yet (mandatory configuration values missing)<br />" + - "red = needs to be initialised<br />black = component has been initialised</p>" + - "<br /><p><i>Further references:</i><br />" + - "Homepage: <a href=\"http://dl-learner.org\">http://dl-learner.org</a><br />" + - "DL-Learner Architecture: <a href=\"http://dl-learner.org/wiki/Architecture\">http://dl-learner.org/wiki/Architecture</a>" + - "</p><br /><p>Please send questions to le...@in....</p></html>"; - JLabel label = new JLabel(text); - label.setMaximumSize(new Dimension(300,500)); - add(label); -// JScrollPane scrollPane = new JScrollPane(label); -// scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); -// scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); -// scrollPane.setPreferredSize(new Dimension(300,500)); -// add(scrollPane); - - setVisible(true); - } - + // String text = "<html><h2>Quick Tutorial</h2><p + // align=\"justify\">DL-Learner has a component" + + // " based design to make it easier to extend and use. There are four " + // + + // "components corresponding to the tabs you see: knowledge source, " + + // "reasoner, learning problem, and learning algorithm. There are + // various " + + // "components available of each type (selectable at the top of each + // tab). " + + // "Each component has configuration options associated with it (middle + // of the" + + // " tab, scrollable), which you can use to specify the settings for the + // component.</p>" + + // "<br /><p align=\"justify\">In order to create a learning problem, " + // + + // "you have to choose and configure all four types of components." + + // " The run tab plays a special role: It is used to start the learning + // algorithm" + + // " and display statistical information.</p>" + + // "<br /><p><i>Tab color explanation:</i> <br />gray = cannot be + // configured yet (mandatory configuration values missing)<br />" + + // "red = needs to be initialised<br />black = component has been + // initialised</p>" + + // "<br /><p><i>Further references:</i><br />" + + // "Homepage: <a + // href=\"http://dl-learner.org\">http://dl-learner.org</a><br />" + + // "DL-Learner Architecture: <a + // href=\"http://dl-learner.org/wiki/Architecture\">http://dl-learner.org/wiki/Architecture</a>" + // + + // "</p><br /><p>Please send questions to + // le...@in....</p></html>"; + // JLabel label = new JLabel(text); + // label.setMaximumSize(new Dimension(300,500)); + // add(label); + + // setVisible(true); + } + } Added: trunk/src/dl-learner/org/dllearner/gui/tutorial.html =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/tutorial.html (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/tutorial.html 2008-09-15 13:17:51 UTC (rev 1212) @@ -0,0 +1,42 @@ +<html> + <head> + <title>Quick Tutorial for DL-Learner GUI</title> + </head> + <body style="font-family: Verdana"> + +<h2>Quick Tutorial</h2> + +<p align=\"justify\"> +DL-Learner has a component based design to make it easier to +extend and use. There are four components corresponding to the +tabs you see: knowledge source, reasoner, learning problem, and +learning algorithm. There are various components available of +each type (selectable at the top of each tab). Each component +has configuration options associated with it (middle of the tab, +scrollable), which you can use to specify the settings for the +component. +</p><br /> + +<p align=\"justify\"> +In order to create a learning problem, you have to choose and +configure all four types of components. The run tab plays a +special role: It is used to start the learning algorithm +and display statistical information. +</p><br /> + +<p> +<i>Tab heads explanation:</i><br /> +gray/disabled = cannot be configured yet (mandatory configuration values missing)<br /> +red = needs to be initialised<br /> +black = component has been initialised +</p><br /> + +<p><i>Further references:</i><br /> +Homepage: <a href="http://dl-learner.org">http://dl-learner.org</a><br /> +DL-Learner Architecture: <a href="http://dl-learner.org/wiki/Architecture">http://dl-learner.org/wiki/Architecture</a> +</p><br /> + +<p>Please send questions to le...@in....</p> + + </body> +</html> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -26,8 +26,6 @@ import org.dllearner.core.Component; import org.dllearner.core.config.BooleanConfigOption; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.gui.Config; /** @@ -55,39 +53,10 @@ else value = true; - BooleanConfigOption specialOption; - specialOption = (BooleanConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Boolean: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Boolean: not valid value"); + fireValueChanged(value); + } - public void setEntry() { - BooleanConfigOption specialOption; - specialOption = (BooleanConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Boolean: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Boolean: not valid value"); - } - @Override public void buildWidgetPanel() { add(getLabel()); @@ -96,8 +65,8 @@ if (value == null) value = false; - else - setEntry(); +// else +// setEntry(); // set cb-index String[] kbBoxItems = { "false", "true" }; Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -20,16 +20,16 @@ * */ +import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; +import javax.swing.JLabel; import javax.swing.JTextField; import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.DoubleConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.gui.Config; /** @@ -44,6 +44,7 @@ private static final long serialVersionUID = 5238903690721116289L; private JButton setButton = new JButton("Set"); + private JLabel problemLabel; // private Class<? extends Component> componentOption; @@ -56,31 +57,23 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == setButton) { - setEntry(); + // TODO need better way for double parsing than throwing an + // exception + try { + double value = Integer.valueOf(doubleField.getText()); + fireValueChanged(value); + problemLabel.setText(""); + } catch(NumberFormatException e1) { + problemLabel.setText("Please enter a valid double value."); + } } } - public void setEntry() { - DoubleConfigOption specialOption; - value = Double.parseDouble(doubleField.getText()); // get from input - specialOption = (DoubleConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Double> specialEntry = new ConfigEntry<Double>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Double: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Double: not valid value"); - } - @Override public void buildWidgetPanel() { add(getLabel()); + problemLabel = new JLabel(); + problemLabel.setForeground(Color.RED); value = config.getConfigOptionValue(component, configOption); @@ -90,7 +83,7 @@ value = 0.0; else { doubleField.setText(value.toString()); - setEntry(); +// setEntry(); } doubleField.setText(value.toString()); Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -20,16 +20,16 @@ * */ +import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; +import javax.swing.JLabel; import javax.swing.JTextField; import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.IntegerConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.gui.Config; /** @@ -37,16 +37,18 @@ * org.dllearner.core.config.IntegerConfigOption. * * @author Tilo Hielscher + * @author Jens Lehmann * */ public class WidgetPanelInteger extends AbstractWidgetPanel<Integer> implements ActionListener { private static final long serialVersionUID = -1802111225835164644L; - private JButton setButton = new JButton("Set"); + private JButton setButton; // = new JButton("Set"); + private JLabel problemLabel ; //= new JLabel(); private Integer value; - private JTextField integerField = new JTextField(3); + private JTextField integerField; // = new JTextField(3); public WidgetPanelInteger(Config config, Component component, IntegerConfigOption configOption) { super(config, component, configOption); @@ -54,31 +56,24 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == setButton) { - setEntry(); - } - } - public void setEntry() { - IntegerConfigOption specialOption; - value = Integer.parseInt(integerField.getText()); // get from input - specialOption = (IntegerConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { + // TODO need better way for integer parsing than throwing an + // exception try { - ConfigEntry<Integer> specialEntry = new ConfigEntry<Integer>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Integer: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); + int value = Integer.valueOf(integerField.getText()); + fireValueChanged(value); + problemLabel.setText(""); + } catch(NumberFormatException e1) { + problemLabel.setText("Please enter a valid integer value."); } - } else - System.out.println("Integer: not valid value"); + } } @Override public void buildWidgetPanel() { add(getLabel()); + problemLabel = new JLabel(); + problemLabel.setForeground(Color.RED); value = config.getConfigOptionValue(component, configOption); @@ -88,13 +83,14 @@ value = 0; else { integerField.setText(value.toString()); - setEntry(); +// setEntry(); } integerField.setText(value.toString()); integerField.setToolTipText(configOption.getAllowedValuesDescription()); setButton.addActionListener(this); add(integerField); - add(setButton); + add(setButton); + add(problemLabel); } } Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -23,14 +23,11 @@ import java.awt.event.ActionListener; import javax.swing.JButton; -import javax.swing.JFileChooser; import javax.swing.JTextField; import org.dllearner.core.Component; import org.dllearner.core.config.StringConfigOption; import org.dllearner.gui.Config; -import org.dllearner.gui.ExampleFileChooser; -import org.dllearner.kb.OWLFile; /** * Panel for option String, defined in @@ -44,11 +41,10 @@ private static final long serialVersionUID = -2169739820989891226L; -// private JPanel widgetPanel = new JPanel(); - private JButton setButton; // = new JButton("Set"); + private JButton setButton; private String value; - private JTextField stringField; // = new JTextField(35); + private JTextField stringField; public WidgetPanelString(Config config, Component component, StringConfigOption configOption) { super(config, component, configOption); @@ -56,49 +52,12 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == setButton) { - if (configOption.getName().equals("filename") || configOption.getName().equals("url")) { - JFileChooser fc; - if(component instanceof OWLFile) { - fc = new ExampleFileChooser("owl"); - } else { - fc = new ExampleFileChooser("kb"); - } - - int returnVal = fc.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - value = fc.getSelectedFile().toString(); - stringField.setText(value); - } - } + // fire value changed event value = stringField.getText(); fireValueChanged(value); -// setEntry(); - // if url and value not "" - // necessary for init knowledge source - if (configOption.getName().equalsIgnoreCase("url") && !value.equalsIgnoreCase("")) { - } } } - /* - public void setEntry() { - StringConfigOption specialOption; - value = stringField.getText(); // get from input - specialOption = (StringConfigOption) config.getComponentManager().getConfigOption( - componentOption, configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<String> specialEntry = new ConfigEntry<String>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set String: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("String: not valid value"); - }*/ - @Override public void buildWidgetPanel() { add(getLabel()); @@ -108,24 +67,25 @@ // default values can be null, so we interpret this as empty string if (value == null) { value = ""; - } - + } + // text field for strings stringField = new JTextField(35); stringField.setText(value); stringField.setToolTipText(configOption.getAllowedValuesDescription()); - - // set button (value is only updated when this button is pressed => would better without set) + + // set button (value is only updated when this button is pressed => + // would better without set) setButton = new JButton("Set"); setButton.addActionListener(this); - + add(stringField); add(setButton); - + // special handling for filename option if (configOption.getName().equals("filename")) setButton.setText("choose local file"); - + } } Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -38,8 +38,6 @@ import javax.swing.JTextField; import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; @@ -55,6 +53,7 @@ * options. Second layout shows a list of JCheckBox's. * * @author Tilo Hielscher + * @author Jens Lehmann * */ public class WidgetPanelStringSet extends AbstractWidgetPanel<Set<String>> implements ActionListener { @@ -64,17 +63,17 @@ private GridBagLayout gridbag = new GridBagLayout(); private GridBagConstraints constraints = new GridBagConstraints(); - private JPanel widgetPanel = new JPanel(); - private JButton addButton = new JButton("add"); - private JButton removeButton = new JButton("remove"); - private JButton clearButton = new JButton("clear"); - private JTextField stringField = new JTextField(30); + private JPanel widgetPanel; // = new JPanel(); + private JButton addButton; // = new JButton("add"); + private JButton removeButton; // = new JButton("remove"); + private JButton clearButton; // = new JButton("clear"); + private JTextField stringField; // = new JTextField(30); private Set<String> value = new HashSet<String>(); - private JList stringList = new JList(); - private DefaultListModel listModel = new DefaultListModel(); + private JList stringList; // = new JList(); + private DefaultListModel listModel; // = new DefaultListModel(); - private CheckBoxList cBL = new CheckBoxList(this); + private CheckBoxList cBL; // = new CheckBoxList(this); public WidgetPanelStringSet(Config config, Component component, StringSetConfigOption configOption) { super(config, component, configOption); @@ -86,6 +85,7 @@ Set<String> exampleSet = new HashSet<String>(); // add to list if (e.getSource() == addButton && !listModel.contains(stringField.getText())) { + System.out.println("add event"); listModel.addElement(stringField.getText()); } // remove selection @@ -108,41 +108,12 @@ } // set entry value = exampleSet; - setEntry(); +// setEntry(); + fireValueChanged(value); } } /** - * Use this, to set entry for layout 2. - */ - /* - public void specialSet() { - if (isSpecial()) { - this.value = cBL.getSelections(); - setEntry(); - } - }*/ - - public void setEntry() { - StringSetConfigOption specialOption; - specialOption = (StringSetConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Set<String>> specialEntry = new ConfigEntry<Set<String>>(specialOption, - value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set StringSet: " + configOption.getName() - // + " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("StringSet: not valid value"); - - } - - /** * Define GridBagConstraints */ private void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, @@ -183,7 +154,7 @@ listModel = new DefaultListModel(); // fill list if (value != null) { - setEntry(); +// setEntry(); for (Iterator<String> iterator = value.iterator(); iterator.hasNext();) { String item = iterator.next(); listModel.addElement(item); Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringTupleList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringTupleList.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringTupleList.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -39,8 +39,6 @@ import javax.swing.JTextField; import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringTupleListConfigOption; import org.dllearner.gui.Config; import org.dllearner.utilities.datastructures.StringTuple; @@ -58,19 +56,19 @@ private GridBagLayout gridbag = new GridBagLayout(); private GridBagConstraints constraints = new GridBagConstraints(); - private JPanel widgetPanel = new JPanel(); - private JButton addButton = new JButton("add"); - private JButton removeButton = new JButton("remove"); - private JButton clearButton = new JButton("clear"); - private JTextField stringFieldA = new JTextField(10); - private JTextField stringFieldB = new JTextField(10); - private List<StringTuple> exampleList = new LinkedList<StringTuple>(); + private JPanel widgetPanel; // = new JPanel(); + private JButton addButton; // = new JButton("add"); + private JButton removeButton; // = new JButton("remove"); + private JButton clearButton; // = new JButton("clear"); + private JTextField stringFieldA; // = new JTextField(10); + private JTextField stringFieldB; // = new JTextField(10); + private List<StringTuple> exampleList; // = new LinkedList<StringTuple>(); - private List<StringTuple> value = new LinkedList<StringTuple>(); - private JList stringList = new JList(); - private DefaultListModel listModel = new DefaultListModel(); + private List<StringTuple> value; // = new LinkedList<StringTuple>(); + private JList stringList; // = new JList(); + private DefaultListModel listModel; // = new DefaultListModel(); - private JButton setButton = new JButton("set"); + private JButton setButton; // = new JButton("set"); public WidgetPanelStringTupleList(Config config, Component component, StringTupleListConfigOption configOption) { super(config, component, configOption); @@ -102,9 +100,11 @@ } // set entry value = exampleList; - setEntry(); +// setEntry(); + fireValueChanged(value); } + /* public void setEntry() { StringTupleListConfigOption specialOption; specialOption = (StringTupleListConfigOption) config.getComponentManager().getConfigOption( @@ -121,7 +121,7 @@ } } else System.out.println("StringTupleList: not valid value"); - } + }*/ /** * Define GridBagConstraints @@ -162,7 +162,7 @@ value = config.getConfigOptionValue(component, configOption); if (value != null) { - setEntry(); +// setEntry(); exampleList = value; } Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2008-09-15 11:53:03 UTC (rev 1211) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2008-09-15 13:17:51 UTC (rev 1212) @@ -113,14 +113,18 @@ setButton = new JButton("Set"); setButton.addActionListener(this); - chooseLocalButton = new JButton("Choose Local File"); - chooseLocalButton.addActionListener(this); - add(stringField); - add(setButton); - add(new JLabel(" or ")); - add(chooseLocalButton); + add(setButton); + // if the URL can refer to a file, we add the possibility to + // choose a local file + if(((URLConfigOption)configOption).refersToFile()) { + chooseLocalButton = new JButton("Choose Local File"); + chooseLocalButton.addActionListener(this); + add(new JLabel(" or ")); + add(chooseLocalButton); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-15 11:19:43
|
Revision: 1210 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1210&view=rev Author: jenslehmann Date: 2008-09-15 11:19:37 +0000 (Mon, 15 Sep 2008) Log Message: ----------- improved starting and stopping algorithms in GUI Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/gui/ThreadRun.java trunk/src/dl-learner/org/dllearner/gui/ThreadStatistics.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-15 09:20:10 UTC (rev 1209) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-15 11:19:37 UTC (rev 1210) @@ -283,6 +283,7 @@ } public void start() { + stop = false; isRunning = true; runtime = System.currentTimeMillis(); Monitor totalLearningTime = JamonMonitorLogger.getTimeMonitor(ExampleBasedROLComponent.class, "totalLearningTime") Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-15 09:20:10 UTC (rev 1209) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-15 11:19:37 UTC (rev 1210) @@ -72,9 +72,9 @@ private boolean[] isEnabled = new boolean[4]; // learning algorithm status - private boolean threadIsRunning = false; - private Long algorithmRunStartTime = null; - private Long algorithmRunStopTime = null; +// private boolean threadIsRunning = false; +// private Long algorithmRunStartTime = null; +// private Long algorithmRunStopTime = null; private StartGUI gui; @@ -409,6 +409,7 @@ * * @param isThreadRunning */ + /* public void setThreadIsRunning(Boolean isThreadRunning) { if (isThreadRunning) algorithmRunStartTime = System.nanoTime(); @@ -416,16 +417,17 @@ if (algorithmRunStartTime < System.nanoTime()) algorithmRunStopTime = System.nanoTime(); this.threadIsRunning = isThreadRunning; - } + }*/ /** * Get true if algorithm has started, false if not. * * @return true if algorithm is running, false if not. */ + /* public Boolean getThreadIsRunning() { return this.threadIsRunning; - } + }*/ /** * Get time in ns for run of algorithm. If algorithm is still running return @@ -433,6 +435,7 @@ * * @return time in ns */ + /* public Long getAlgorithmRunTime() { if (algorithmRunStartTime != null) if (algorithmRunStopTime != null) { @@ -441,7 +444,7 @@ } else return System.nanoTime() - algorithmRunStartTime; return null; - } + }*/ /** * It is necessary for init LearningProblem. Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-15 09:20:10 UTC (rev 1209) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-15 11:19:37 UTC (rev 1210) @@ -45,9 +45,9 @@ private JButton runButton, stopButton, treeButton; private JTextArea infoArea; private Config config; - //private StartGUI startGUI; + private StartGUI startGUI; - private ThreadRun thread; + private long algorithmStartTime = 0; private GridBagLayout gridbag = new GridBagLayout(); private GridBagConstraints constraints = new GridBagConstraints(); @@ -67,16 +67,19 @@ private JLabel[] time = new JLabel[5]; private JLabel[] percent = new JLabel[5]; + + RunPanel(Config config, StartGUI startGUI) { super(new BorderLayout()); this.config = config; - //this.startGUI = startGUI; + this.startGUI = startGUI; runButton = new JButton("Run"); runButton.addActionListener(this); showPanel.add(runButton); stopButton = new JButton("Stop"); + stopButton.setEnabled(false); stopButton.addActionListener(this); showPanel.add(stopButton); treeButton = new JButton("Tree"); @@ -147,17 +150,35 @@ public void actionPerformed(ActionEvent e) { // start - if (e.getSource() == runButton && config.getLearningAlgorithm() != null - && !config.getThreadIsRunning()) { - thread = new ThreadRun(config); + if (e.getSource() == runButton) { + + // separate thread for learning algorithm + Thread algorithmThread = new Thread() { + @Override + public void run() { + setPriority(Thread.MIN_PRIORITY); + config.getLearningAlgorithm().start(); + } + }; + config.getReasoningService().resetStatistics(); - thread.start(); - ThreadStatistics threadStatistics = new ThreadStatistics(config, this); + algorithmThread.start(); + algorithmStartTime = System.nanoTime(); + StatisticsThread threadStatistics = new StatisticsThread(config, this); threadStatistics.start(); + runButton.setEnabled(false); + stopButton.setEnabled(true); + // disable other panes (we do not want changes while + // algorithm is running) + startGUI.disableTabbedPane(); } // stop - if (e.getSource() == stopButton && config.getLearningAlgorithm() != null) { - thread.exit(); + if (e.getSource() == stopButton) { + config.getLearningAlgorithm().stop(); + runButton.setEnabled(true); + stopButton.setEnabled(false); + // enable panels + startGUI.enableTabbedPane(); } // tree if (e.getSource() == treeButton) { @@ -170,12 +191,11 @@ * Show Statistics. */ public void showStats() { - System.out.println("stat update " + System.currentTimeMillis()); - Long algorithmRunTime = null; - Long overallReasoningTime = null; - Long instanceCheckReasoningTime = null; - Long retrievalReasoningTime = null; - Long subsumptionReasoningTime = null; +// System.out.println("stat update " + System.currentTimeMillis()); + long overallReasoningTime = 0; // = null; + long instanceCheckReasoningTime = 0; // = null; + long retrievalReasoningTime = 0; // = null; + long subsumptionReasoningTime = 0; // = null; infoArea.setText(""); // best solutions @@ -189,19 +209,18 @@ // + config.getLearningAlgorithm().getSolutionScore().toString() // + "\n\n"); - // reasoner statistics - if (config.getAlgorithmRunTime() != null) { - algorithmRunTime = config.getAlgorithmRunTime(); - bar[0].update(1.0); - time[0].setText(makeTime(algorithmRunTime)); - percent[0].setText("100%"); - } - if (config.getReasoningService() != null) { + // update algorith runtime + long algorithmRunTime = System.nanoTime() - algorithmStartTime; + bar[0].update(1.0); + time[0].setText(makeTime(algorithmRunTime)); + percent[0].setText("100%"); + + // update overall reasoning time overallReasoningTime = config.getReasoningService().getOverallReasoningTimeNs(); bar[1].update((double) overallReasoningTime / (double) algorithmRunTime); time[1].setText(makeTime(overallReasoningTime)); percent[1].setText(Percent(overallReasoningTime, algorithmRunTime)); - } + if (config.getReasoningService().getNrOfInstanceChecks() > 0) { instanceCheckReasoningTime = config.getReasoningService() .getInstanceCheckReasoningTimeNs(); Copied: trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java (from rev 1208, trunk/src/dl-learner/org/dllearner/gui/ThreadStatistics.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2008-09-15 11:19:37 UTC (rev 1210) @@ -0,0 +1,61 @@ +/** + * 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.gui; + +/** + * This thread is responsible for sending update events to the GUI. + * In regular intervals it tests whether the learning algorithm is + * running and calls methods to update the statistics in the run + * panel. + * + * @author Tilo Hielscher + * @author Jens Lehmann + */ +public class StatisticsThread extends Thread { + + private Config config; + private RunPanel runPanel; + + public StatisticsThread(Config config, RunPanel runPanel) { + this.config = config; + this.runPanel = runPanel; + } + + /** + * Calls {@link RunPanel#showStats()} in regular intervals. + */ + @Override + public void run() { + try { + // initial delay of one second + sleep(1000); + while (config.getLearningAlgorithm().isRunning()) { + // update statistics every 3 seconds + runPanel.showStats(); + sleep(3000); + } + // show final stats + runPanel.showStats(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } +} Deleted: trunk/src/dl-learner/org/dllearner/gui/ThreadRun.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ThreadRun.java 2008-09-15 09:20:10 UTC (rev 1209) +++ trunk/src/dl-learner/org/dllearner/gui/ThreadRun.java 2008-09-15 11:19:37 UTC (rev 1210) @@ -1,58 +0,0 @@ -package org.dllearner.gui; - -/** - * 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/>. - * - */ - -/** - * Start algorithm in a new thread. - * - * @author Tilo Hielscher - */ -public class ThreadRun extends Thread { - - Config config; - - public ThreadRun(Config config) { - this.config = config; - } - - /** - * method to start thread - */ - @Override - public void run() { - if (config.getLearningAlgorithm() != null) { - config.setThreadIsRunning(true); - this.setPriority(Thread.MIN_PRIORITY); - config.getLearningAlgorithm().start(); - config.setThreadIsRunning(false); - } - } - - /** - * stop thread - */ - public void exit() { - if (config.getLearningAlgorithm() != null) - config.getLearningAlgorithm().stop(); - config.setThreadIsRunning(false); - System.out.println("stop run"); - } -} Deleted: trunk/src/dl-learner/org/dllearner/gui/ThreadStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ThreadStatistics.java 2008-09-15 09:20:10 UTC (rev 1209) +++ trunk/src/dl-learner/org/dllearner/gui/ThreadStatistics.java 2008-09-15 11:19:37 UTC (rev 1210) @@ -1,60 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.gui; - -/** - * Start statistics in a new thread. - * - * @author Tilo Hielscher - */ -public class ThreadStatistics extends Thread { - - private Config config; - private RunPanel runPanel; - - public ThreadStatistics(Config config, RunPanel runPanel) { - this.config = config; - this.runPanel = runPanel; - } - - /** - * method to start thread - */ - @Override - public void run() { - //this.setPriority(4); - if (config.getThreadIsRunning()) { - try { - sleep(1000); // sleep 1 second - } catch (InterruptedException e) { - e.printStackTrace(); - } - while (config.getThreadIsRunning()) { - try { - runPanel.showStats(); - sleep(3000); // sleep 3 seconds - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - runPanel.showStats(); - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-15 09:20:13
|
Revision: 1209 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1209&view=rev Author: jenslehmann Date: 2008-09-15 09:20:10 +0000 (Mon, 15 Sep 2008) Log Message: ----------- added error handling for incorrect component names in conf files Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java trunk/src/dl-learner/org/dllearner/cli/Start.java Modified: trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java 2008-09-15 07:59:19 UTC (rev 1208) +++ trunk/src/dl-learner/org/dllearner/cli/ConfMapper.java 2008-09-15 09:20:10 UTC (rev 1209) @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.TreeMap; import java.util.Map.Entry; @@ -148,5 +149,26 @@ public String getComponentTypeString(Class<? extends Component> typeClass) { return inverseTypeMapping.get(typeClass); - } + } + + public Set<String> getKnowledgeSources() { + return knowledgeSourceMapping.keySet(); + } + + public Set<String> getReasoners() { + return reasonerMapping.keySet(); + } + + public Set<String> getLearningProblems() { + return learningProblemMapping.keySet(); + } + + public Set<String> getLearningAlgorithms() { + return learningAlgorithmMapping.keySet(); + } + + public Set<String> getComponents() { + return componentMapping.keySet(); + } + } Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-15 07:59:19 UTC (rev 1208) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-15 09:20:10 UTC (rev 1209) @@ -216,7 +216,10 @@ ConfFileOption reasonerOption = parser.getConfOptionsByName("reasoner"); Class<? extends ReasonerComponent> rcClass; if(reasonerOption != null) { - rcClass = confMapper.getReasonerComponentClass(reasonerOption.getStringValue()); + rcClass = confMapper.getReasonerComponentClass(reasonerOption.getStringValue()); + if(rcClass == null) { + handleError("Invalid value \"" + reasonerOption.getStringValue() + "\" in " + reasonerOption + ". Valid values are " + confMapper.getReasoners() + "."); + } } else { rcClass = FastInstanceChecker.class; } @@ -231,7 +234,10 @@ ConfFileOption problemOption = parser.getConfOptionsByName("problem"); Class<? extends LearningProblem> lpClass; if(problemOption != null) { - lpClass = confMapper.getLearningProblemClass(problemOption.getStringValue()); + lpClass = confMapper.getLearningProblemClass(problemOption.getStringValue()); + if(lpClass == null) { + handleError("Invalid value \"" + problemOption.getStringValue() + "\" in " + problemOption + ". Valid values are " + confMapper.getLearningProblems() + "."); + } } else { lpClass = PosNegDefinitionLP.class; } @@ -250,7 +256,10 @@ ConfFileOption algorithmOption = parser.getConfOptionsByName("algorithm"); Class<? extends LearningAlgorithm> laClass; if(problemOption != null) { - laClass = confMapper.getLearningAlgorithmClass(algorithmOption.getStringValue()); + laClass = confMapper.getLearningAlgorithmClass(algorithmOption.getStringValue()); + if(laClass == null) { + handleError("Invalid value \"" + algorithmOption.getStringValue() + "\" in " + algorithmOption + ". Valid values are " + confMapper.getLearningAlgorithms() + "."); + } } else { laClass = ExampleBasedROLComponent.class; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-15 07:59:23
|
Revision: 1208 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1208&view=rev Author: sknappe Date: 2008-09-15 07:59:19 +0000 (Mon, 15 Sep 2008) Log Message: ----------- put all javascript functions into js files Modified Paths: -------------- trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/DatabaseConnection.php trunk/src/dbpedia-navigator/js/navigator.js Added: trunk/src/dbpedia-navigator/DatabaseConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DatabaseConnection.php (rev 0) +++ trunk/src/dbpedia-navigator/DatabaseConnection.php 2008-09-15 07:59:19 UTC (rev 1208) @@ -0,0 +1,42 @@ +<?php + +//handles connection to the database, at the moment only supports mysql-Database +class DatabaseConnection{ + + var $type; + + function DatabaseConnection($type){ + $this->type=$type; + } + + function connect($server,$user,$pass){ + if ($this->type=='mysql'){ + mysql_connect($server,$user,$pass); + } + } + + function select_database($database){ + if ($this->type=='mysql'){ + mysql_select_db($database); + } + } + + function query($query){ + if ($this->type=='mysql'){ + return mysql_query($query); + } + } + + function nextEntry($result){ + if ($this->type=='mysql'){ + return mysql_fetch_array($result); + } + } + + function numberOfEntries($result){ + if ($this->type=='mysql'){ + return mysql_num_rows($result); + } + } +} +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-15 07:55:05 UTC (rev 1207) +++ trunk/src/dbpedia-navigator/index.php 2008-09-15 07:59:19 UTC (rev 1208) @@ -41,70 +41,7 @@ <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" type="text/javascript"></script> <script src="js/ajax.js"></script> - <script type="text/javascript"> - function setRunning(running) - { - if (running) document.getElementById('Loading').style.display='inline'; - else document.getElementById('Loading').style.display='none'; - } - - function loadGoogleMap(Lat,Lng,Label) { - if (GBrowserIsCompatible()) { - // Create and Center a Map - var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 12); - map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); - var marker=new GMarker(new GLatLng(Lat, Lng)); - map.addOverlay(marker); - } - } - - function show_results(class, number) - { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - var names; - var hasClass; - for (var i=0;i<links.length;i++){ - if (class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else{ - names=links[i].getElementsByTagName('a')[0].className.split(' '); - hasClass=false; - for (var k=0;k<names.length;k++){ - if (names[k]==class){ - hasClass=true; - break; - } - } - if (hasClass){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; - } - } - if (j<number){ - show_results(class,0); - return; - } - - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; - } - } - </script> + <script src="js/navigator.js"></script> </head> <body <?php print $onLoad;?>> Added: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js (rev 0) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-15 07:59:19 UTC (rev 1208) @@ -0,0 +1,63 @@ +function setRunning(running) +{ + if (running) document.getElementById('Loading').style.display='inline'; + else document.getElementById('Loading').style.display='none'; +} + +function loadGoogleMap(Lat,Lng,Label) +{ + if (GBrowserIsCompatible()) { + // Create and Center a Map + var map = new GMap2(document.getElementById("map")); + map.setCenter(new GLatLng(Lat, Lng), 12); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + var marker=new GMarker(new GLatLng(Lat, Lng)); + map.addOverlay(marker); + } +} + +function show_results(class, number) +{ + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + var names; + var hasClass; + for (var i=0;i<links.length;i++){ + if (class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else{ + names=links[i].getElementsByTagName('a')[0].className.split(' '); + hasClass=false; + for (var k=0;k<names.length;k++){ + if (names[k]==class){ + hasClass=true; + break; + } + } + if (hasClass){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-15 07:55:09
|
Revision: 1207 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1207&view=rev Author: kurzum Date: 2008-09-15 07:55:05 +0000 (Mon, 15 Sep 2008) Log Message: ----------- Modified Paths: -------------- trunk/examples/semantic_bible/normal_test.conf Modified: trunk/examples/semantic_bible/normal_test.conf =================================================================== --- trunk/examples/semantic_bible/normal_test.conf 2008-09-15 07:50:37 UTC (rev 1206) +++ trunk/examples/semantic_bible/normal_test.conf 2008-09-15 07:55:05 UTC (rev 1207) @@ -1,6 +1,5 @@ -// SPARQL options +// -refexamples.maxExecutionTimeInSeconds = 250; import("NTNcombined.owl"); algorithm = refexamples; @@ -8,7 +7,9 @@ refexamples.useNegation = true; refexamples.useCardinalityRestrictions = true; refexamples.guaranteeXgoodDescriptions = 1; +refexamples.maxExecutionTimeInSeconds = 250; + reasoner = owlAPI; owlAPIReasoner.reasonerType = pellet; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-15 07:50:42
|
Revision: 1206 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1206&view=rev Author: kurzum Date: 2008-09-15 07:50:37 +0000 (Mon, 15 Sep 2008) Log Message: ----------- not working example Added Paths: ----------- trunk/examples/semantic_bible/normal_test.conf Added: trunk/examples/semantic_bible/normal_test.conf =================================================================== --- trunk/examples/semantic_bible/normal_test.conf (rev 0) +++ trunk/examples/semantic_bible/normal_test.conf 2008-09-15 07:50:37 UTC (rev 1206) @@ -0,0 +1,34 @@ +// SPARQL options + +refexamples.maxExecutionTimeInSeconds = 250; +import("NTNcombined.owl"); + +algorithm = refexamples; +refexamples.useAllConstructor = true; +refexamples.useNegation = true; +refexamples.useCardinalityRestrictions = true; +refexamples.guaranteeXgoodDescriptions = 1; + +reasoner = owlAPI; +owlAPIReasoner.reasonerType = pellet; + +/** +("http://semanticbible.org/ns/2006/NTNames#GeographicLocation" OR (NOT "http://semanticbible.org/ns/2006/NTNames#FreshWaterArea" OR (NOT "http://semanticbible.org/ns/2006/NTNames#Woman" AND EXISTS "http://semanticbible.org/ns/2006/NTNames#parentOf".TOP))) +(http://semanticbible.org/ns/2006/NTNames#GeographicLocation OR (NOT http://semanticbible.org/ns/2006/NTNames#FreshWaterArea) OR ((NOT http://semanticbible.org/ns/2006/NTNames#Woman) AND EXISTS http://semanticbible.org/ns/2006/NTNames#parentOf.TOP))(accuracy: 1.0) + +**/ + + +/**EXAMPLES**/ ++"http://semanticbible.org/ns/2006/NTNames#AlexandriaGeodata" ++"http://semanticbible.org/ns/2006/NTNames#Barachiah" ++"http://semanticbible.org/ns/2006/NTNames#Capernaum" ++"http://semanticbible.org/ns/2006/NTNames#Dalmanutha" ++"http://semanticbible.org/ns/2006/NTNames#Eliud" + +-"http://semanticbible.org/ns/2006/NTNames#Italy" +-"http://semanticbible.org/ns/2006/NTNames#Jews" +-"http://semanticbible.org/ns/2006/NTNames#Medes" +-"http://semanticbible.org/ns/2006/NTNames#SimeonTheProphet" +-"http://semanticbible.org/ns/2006/NTNames#Sosthenes" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-15 07:50:04
|
Revision: 1205 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1205&view=rev Author: kurzum Date: 2008-09-15 07:50:00 +0000 (Mon, 15 Sep 2008) Log Message: ----------- small changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-15 07:43:31 UTC (rev 1204) +++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible2.java 2008-09-15 07:50:00 UTC (rev 1205) @@ -124,8 +124,11 @@ ComponentManager cm =ComponentManager.getInstance(); try{ - + int i=0; for (File f : confs) { + if(i!=80){ + i++; continue; + } Cache.getDefaultCache().clearCache(); String fileContent = Files.readFile(f); @@ -396,7 +399,7 @@ "sparql.predefinedEndpoint = \"LOCALJOSEKIBIBLE\";\n"+ "sparql.getPropertyInformation = true;\n"+ "refexamples.maxExecutionTimeInSeconds = "+sparqllMaxExecution+";\n"+ - "import(\"lalala\",\"SPARQL\");\n"+ + "import(\"http://localhost:2020/bible\",\"SPARQL\");\n"+ getCombinedOptions()+ ""; return s; Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java 2008-09-15 07:43:31 UTC (rev 1204) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java 2008-09-15 07:50:00 UTC (rev 1205) @@ -21,6 +21,7 @@ package org.dllearner.utilities.owl; import java.io.File; +import java.net.URL; import java.util.List; import org.dllearner.core.ComponentManager; @@ -69,7 +70,7 @@ // knowledge source KnowledgeSource ks = cm.knowledgeSource(OWLFile.class); - String fileURL = new File(ontologyFile).toURI().toString(); + URL fileURL = new File(ontologyFile).toURI().toURL(); cm.applyConfigEntry(ks, "url", fileURL); ks.init(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-15 07:43:36
|
Revision: 1204 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1204&view=rev Author: sknappe Date: 2008-09-15 07:43:31 +0000 (Mon, 15 Sep 2008) Log Message: ----------- changed the database connection, now use a class to connect to the database, this should make the connection more generic, other databases than mysql could be used, at the moment only support for mysql Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/helper_functions.php Removed Paths: ------------- trunk/src/dbpedia-navigator/images/csh_bluebooks/ Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=30000000; + public $learnttl=60000000; public $language="en"; @@ -48,12 +48,16 @@ public $useCache=true; + //the type of database server + public $database_type='mysql'; //the server, where the mysql databank is located - public $mysqlServer='localhost'; + public $database_server='localhost'; //the user, that has rights to access the navigator databank - public $mysqlUser='navigator'; + public $database_user='navigator'; //the password of that user - public $mysqlPass='dbpedia'; + public $database_pass='dbpedia'; + //the name of the used database + public $database_name='navigator_db'; } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,6 +1,7 @@ <?php - include('helper_functions.php'); - include('Settings.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); + include_once('helper_functions.php'); $class=$_POST['class']; $fromCache=$_POST['cache']; @@ -35,17 +36,20 @@ if ($fromCache<0) { //if there are errors see catch block try{ - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); //build Select box with Child Classes $query="SELECT child FROM classhierarchy WHERE father='$class'"; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $childClasses=''; - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $query="SELECT label FROM categories WHERE category='".$result['child']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['child'], "/"), 1))); if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); $childClasses.='<option value="'.$result['child'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; @@ -56,12 +60,12 @@ //build Select box with Father Classes $query="SELECT father FROM classhierarchy WHERE child='$class'"; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $fatherClasses=''; - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $query="SELECT label FROM categories WHERE category='".$result['father']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['father'], "/"), 1))); if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); $fatherClasses.='<option value="'.$result['father'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; @@ -71,8 +75,8 @@ //build Title $query="SELECT label FROM categories WHERE category='$class' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $title=$result['label']; $content.=getClassView($fatherClasses,$childClasses,$title,$class); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,5 +1,7 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); $category=$_POST['category']; $number=$_POST['number']; @@ -14,26 +16,29 @@ $content=""; $bestsearches=""; - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); //get label of the category $query="SELECT label FROM categories WHERE category='$category' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $label=$result['label']; $query="SELECT name FROM articlecategories WHERE category='$category' ORDER BY number DESC LIMIT ".$number; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $bestsearches=""; - if (mysql_num_rows($res)>0){ + if ($databaseConnection->numberOfEntries($res)>0){ $names=array(); $labels=array(); - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $names[]=$result['name']; $query="SELECT label FROM rank WHERE name='".$result['name']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); $labels[]=$result2['label']; } $content.=getCategoryResultsTable($names,$labels,$category,$number); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,7 +1,8 @@ <?php include('helper_functions.php'); - $concept=$_POST['concept']; + $manchester=$_POST['manchester']; + $kb=$_POST['kb']; session_start(); $id=$_SESSION['id']; @@ -12,8 +13,11 @@ $concept=html_entity_decode($concept); - $test=preg_match("/^http://dbpedia.org/class/yago/[^/]+$/",$concept); + $test=preg_match("/(http:\/\/dbpedia\.org\/class\/yago\/[^\040]+(\040)*(AND|OR)*)+/",$manchester); + if ($test){ + + } $content=""; /*try{ require_once("DLLearnerConnection.php"); Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -29,7 +29,7 @@ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".htmlentities($con['descriptionManchesterSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,5 +1,7 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); $label=urldecode($_POST['label']); $number=$_POST['number']; @@ -12,24 +14,28 @@ //initialise content $content=""; - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $bestsearches=""; - if (mysql_num_rows($res)>0){ + if ($databaseConnection->numberOfEntries($res)>0){ $names=array(); $labels=array(); $classes=array(); $tags=array(); $catlabels=array(); - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $labels[]=$result['label']; $names[]=$result['name']; $query="SELECT category FROM articlecategories WHERE name='".$result['name']."'"; - $res3=mysql_query($query); + $res3=$databaseConnection->query($query); $arr=array(); - while ($result3=mysql_fetch_array($res3)){ + while ($result3=$databaseConnection->nextEntry($res3)){ $arr[]=$result3['category']; } if (count($arr)==0){ @@ -44,8 +50,8 @@ if (!isset($tags[$arr[$i]])) $tags[$arr[$i]]=1; else $tags[$arr[$i]]++; $query="SELECT label FROM categories WHERE category='".$arr[$i]."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); if (!isset($catlabels[$arr[$i]])) $catlabels[$arr[$i]]=$result2['label']; } } Modified: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,5 +1,7 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); $positives=$_POST['positives']; $negatives=$_POST['negatives']; @@ -9,22 +11,25 @@ if (strlen($negatives)>0) $negatives=explode('][',substr($negatives,1,strlen($negatives)-2)); else $negatives=array(); - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); $ptemp=array(); foreach ($positives as $pos){ $query="SELECT label FROM rank WHERE name='$pos' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $ptemp[$pos]=$result['label']; } $ntemp=array(); foreach ($negatives as $neg){ $query="SELECT label FROM rank WHERE name='$neg' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $ntemp[$neg]=$result['label']; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -235,13 +235,19 @@ } function formatClassArray($ar) { - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + $string="<ul>"; for($i=0; $i<count($ar); $i++) { $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person") $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; } return $string."</ul>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-12 16:51:31
|
Revision: 1201 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1201&view=rev Author: jenslehmann Date: 2008-09-12 16:51:26 +0000 (Fri, 12 Sep 2008) Log Message: ----------- fixed tricky multi-threading issue when querying currently best class descriptions Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/gui/RunPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/utilities/owl/DescriptionSet.java trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-12 12:35:09 UTC (rev 1200) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-12 16:51:26 UTC (rev 1201) @@ -21,6 +21,7 @@ import java.io.File; import java.text.DecimalFormat; +import java.util.ConcurrentModificationException; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; @@ -30,9 +31,11 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import java.util.concurrent.ConcurrentSkipListSet; import org.apache.log4j.Logger; import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; @@ -51,6 +54,7 @@ import org.dllearner.utilities.owl.ConceptComparator; import org.dllearner.utilities.owl.ConceptTransformation; import org.dllearner.utilities.owl.EvaluatedDescriptionComparator; +import org.dllearner.utilities.owl.EvaluatedDescriptionSet; import com.jamonapi.Monitor; @@ -160,9 +164,13 @@ // an ordering which does not change during the run of the algorithm private NodeComparatorStable nodeComparatorStable = new NodeComparatorStable(); // stable candidate set; it has no functional part in the algorithm, - // but is a list of the currently best concepts found - private TreeSet<ExampleBasedNode> candidatesStable = new TreeSet<ExampleBasedNode>( + // but is a list of the currently best concepts found; + // it is very important to use a concurrent set here as other threads will + // access it (usual iterating is likely to throw a ConcurrentModificationException) + private NavigableSet<ExampleBasedNode> candidatesStable = new ConcurrentSkipListSet<ExampleBasedNode>( nodeComparatorStable); + // evaluated descriptions +// private EvaluatedDescriptionSet evaluatedDescriptions = new EvaluatedDescriptionSet(LearningAlgorithm.MAX_NR_OF_RESULTS); // comparator used to create ordered sets of concepts private ConceptComparator conceptComparator = new ConceptComparator(); @@ -1191,12 +1199,13 @@ } return best; } - + public SortedSet<EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions() { + Iterator<ExampleBasedNode> it = candidatesStable.descendingIterator(); int count = 0; - SortedSet<ExampleBasedNode> rev = candidatesStable.descendingSet(); SortedSet<EvaluatedDescription> cbd = new TreeSet<EvaluatedDescription>(edComparator); - for (ExampleBasedNode eb : rev) { + while(it.hasNext()) { + ExampleBasedNode eb = it.next(); cbd.add(new EvaluatedDescription(eb.getConcept(), getScore(eb.getConcept()))); // return a maximum of 200 elements (we need a maximum, because the // candidate set can be very large) Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-12 12:35:09 UTC (rev 1200) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-09-12 16:51:26 UTC (rev 1201) @@ -170,6 +170,7 @@ * Show Statistics. */ public void showStats() { + System.out.println("stat update " + System.currentTimeMillis()); Long algorithmRunTime = null; Long overallReasoningTime = null; Long instanceCheckReasoningTime = null; @@ -178,7 +179,7 @@ infoArea.setText(""); // best solutions - if (config.getLearningAlgorithm().getCurrentlyBestDescriptions() != null) { + if (config.getLearningAlgorithm().getCurrentlyBestDescription() != null) { infoArea.append("Best class descriptions in Manchester OWL Syntax: \n\n" + getSolutionString(config.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(10)) + "\n"); } Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-12 12:35:09 UTC (rev 1200) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-12 16:51:26 UTC (rev 1201) @@ -232,7 +232,7 @@ Logger logger = Logger.getRootLogger(); logger.removeAllAppenders(); logger.addAppender(consoleAppender); - logger.setLevel(Level.TRACE); + logger.setLevel(Level.DEBUG); File file = null; if (args.length > 0) Added: trunk/src/dl-learner/org/dllearner/utilities/owl/DescriptionSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/DescriptionSet.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/DescriptionSet.java 2008-09-12 16:51:26 UTC (rev 1201) @@ -0,0 +1,71 @@ +/** + * 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.owl; + +import java.util.Collection; +import java.util.Iterator; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.core.owl.Description; + +/** + * A set of descriptions, which is bound by a maximum + * size. Can be used by algorithms to store the most promising + * n class descriptions. + * + * @author Jens Lehmann + * + */ +public class DescriptionSet { + + private ConceptComparator comp = new ConceptComparator(); + + private SortedSet<Description> set = new TreeSet<Description>(comp); + + private int maxSize; + + public DescriptionSet(int maxSize) { + this.maxSize = maxSize; + } + + public void add(Description ed) { + set.add(ed); + if(set.size()>maxSize) { + Iterator<Description> it = set.iterator(); + it.next(); + it.remove(); + } + } + + public void addAll(Collection<Description> eds) { + for(Description ed : eds) { + add(ed); + } + } + + /** + * @return the set + */ + public SortedSet<Description> getSet() { + return set; + } + +} Added: trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/EvaluatedDescriptionSet.java 2008-09-12 16:51:26 UTC (rev 1201) @@ -0,0 +1,71 @@ +/** + * 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.owl; + +import java.util.Collection; +import java.util.Iterator; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.core.EvaluatedDescription; + +/** + * A set of evaluated descriptions, which is bound by a maximum + * size. Can be used by algorithms to store the most promising + * n class descriptions. + * + * @author Jens Lehmann + * + */ +public class EvaluatedDescriptionSet { + + private EvaluatedDescriptionComparator comp = new EvaluatedDescriptionComparator(); + + private SortedSet<EvaluatedDescription> set = new TreeSet<EvaluatedDescription>(comp); + + private int maxSize; + + public EvaluatedDescriptionSet(int maxSize) { + this.maxSize = maxSize; + } + + public void add(EvaluatedDescription ed) { + set.add(ed); + if(set.size()>maxSize) { + Iterator<EvaluatedDescription> it = set.iterator(); + it.next(); + it.remove(); + } + } + + public void addAll(Collection<EvaluatedDescription> eds) { + for(EvaluatedDescription ed : eds) { + add(ed); + } + } + + /** + * @return the set + */ + public SortedSet<EvaluatedDescription> getSet() { + return set; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |