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: <hee...@us...> - 2009-11-05 08:51:11
|
Revision: 1908 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1908&view=rev Author: heeroyuy Date: 2009-11-05 08:51:04 +0000 (Thu, 05 Nov 2009) Log Message: ----------- -fixed design bug Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-11-05 08:32:54 UTC (rev 1907) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-11-05 08:51:04 UTC (rev 1908) @@ -83,9 +83,9 @@ checkBoxPanel = new JPanel(); checkBoxPanel.setLayout(new GridLayout(1, 6)); - minAccuracyLabel = new JLabel("noise in %: "); - maxExecutionTimeLabel = new JLabel("maximum execution time: "); - nrOfConceptsLabel = new JLabel("max. number of results: "); + minAccuracyLabel = new JLabel("<html>noise in %: </html>"); + maxExecutionTimeLabel = new JLabel("<html>maximum execution time: </html>"); + nrOfConceptsLabel = new JLabel("<html>max. number of results: </html>"); minAccuracy = new JSlider(0, 50, 5); minAccuracy.setPaintTicks(true); @@ -107,21 +107,21 @@ nrOfConcepts.setMinorTickSpacing(1); nrOfConcepts.setPaintLabels(true); - owlRadioButton = new JRadioButton("OWL 2", true); - elProfileButton = new JRadioButton("EL Profile", false); + owlRadioButton = new JRadioButton("<html>OWL 2</html>", true); + elProfileButton = new JRadioButton("<html>EL Profile</html>", false); owlRadioButton.setEnabled(true); owlRadioButton.addItemListener(optionHandler); elProfileButton.addItemListener(optionHandler); - allBox = new JCheckBox("all", true); + allBox = new JCheckBox("<html>all</html>", true); allBox.addItemListener(optionHandler); - someBox = new JCheckBox("some", true); + someBox = new JCheckBox("<html>some</html>", true); someBox.addItemListener(optionHandler); - notBox = new JCheckBox("not", true); + notBox = new JCheckBox("<html>not</html>", true); notBox.addItemListener(optionHandler); - valueBox = new JCheckBox("value", true); + valueBox = new JCheckBox("<html>value</html>", true); valueBox.addItemListener(optionHandler); - moreBox = new JCheckBox("<=x, >=x with max.:", true); + moreBox = new JCheckBox("<html> ‹=x, ›=x with max.:</html>", true); moreBox.addItemListener(optionHandler); countMoreBox = new JComboBox(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-11-05 08:33:03
|
Revision: 1907 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1907&view=rev Author: heeroyuy Date: 2009-11-05 08:32:54 +0000 (Thu, 05 Nov 2009) Log Message: ----------- -fixed bug -make errors red on panel -some javadoc Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-11-04 16:20:27 UTC (rev 1906) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-11-05 08:32:54 UTC (rev 1907) @@ -265,7 +265,7 @@ try { currentConceptURL = new URL(currentConcept.toString()); } catch (MalformedURLException e1) { - String error = "<html>Cannot convert to URL.</html>"; + String error = "<html><font size=\"3\" color=\"red\">Cannot convert to URL.</font></html>"; view.setHintMessage(error); e1.printStackTrace(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 16:20:27 UTC (rev 1906) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-05 08:32:54 UTC (rev 1907) @@ -145,6 +145,7 @@ wikiPane = new JTextPane(); wikiPane.setContentType("text/html"); wikiPane.setBackground(learnerScroll.getBackground()); + wikiPane.setEditable(false); wikiPane.setText(WIKI_STRING); URL iconUrl = this.getClass().getResource("arrow.gif"); icon = new ImageIcon(iconUrl); @@ -512,10 +513,10 @@ */ public void algorithmTerminated() { CELOE celoe = (CELOE) model.getLearningAlgorithm(); - String message = "<html><font size=\"3\">Learning successful. All expressions up to length " + (celoe.getMinimumHorizontalExpansion()-1) + " and some expressions up to <br>length " + celoe.getMaximumHorizontalExpansion() + " searched."; + String message = "<html><font size=\"3\" color=\"black\">Learning successful. All expressions up to length " + (celoe.getMinimumHorizontalExpansion()-1) + " and some expressions up to <br>length " + celoe.getMaximumHorizontalExpansion() + " searched."; hint.setForeground(Color.RED); if(isInconsistent) { - message +="<br>Class expressions marked red will lead to an inconsistent ontology. <br>Please double click on them to view detail information.</font></html>"; + message +="<font size=\"3\" color=\"red\"><br>Class expressions marked red will lead to an inconsistent ontology. <br>Please double click on them to view detail information.</font></html>"; } else { message +="<br>To view details about why a class expression was suggested, please click on it.</font><html>"; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java 2009-11-04 16:20:27 UTC (rev 1906) +++ trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java 2009-11-05 08:32:54 UTC (rev 1907) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.tools.protege; import java.awt.Cursor; @@ -12,10 +31,20 @@ import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException; import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException; +/** + * This is the Hyperlink Handler that handles what happens when a + * hyperlink is clicked. + * @author Christian Koetteritzsch + * + */ public class HyperLinkHandler implements HyperlinkListener { private BrowserLauncher launcher; + /** + * This is the constructor that instantiate the + * BrowserLauncher. + */ public HyperLinkHandler() { try { launcher = new BrowserLauncher(); @@ -29,6 +58,9 @@ } @Override + /** + * This methode handles what happens when a hyperlink is clicked. + */ public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ENTERED) { ((JEditorPane) event.getSource()).setCursor(Cursor Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-11-04 16:20:27 UTC (rev 1906) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-11-05 08:32:54 UTC (rev 1907) @@ -186,7 +186,7 @@ } else { view.getRunButton().setEnabled(false); view.getHintPanel().setVisible(true); - String message ="<html><font size=\"3\">There are no Instances for " + current + " available. Please insert some Instances.</font></html>"; + String message ="<html><font size=\"3\" color=\"red\">There are no Instances for " + current + " available. Please insert some Instances.</font></html>"; view.getHintPanel().setForeground(Color.RED); view.setHintMessage(message); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-11-04 16:20:35
|
Revision: 1906 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1906&view=rev Author: heeroyuy Date: 2009-11-04 16:20:27 +0000 (Wed, 04 Nov 2009) Log Message: ----------- -added new library for protege plugin Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2009-11-04 16:18:47 UTC (rev 1905) +++ trunk/build.xml 2009-11-04 16:20:27 UTC (rev 1906) @@ -4,7 +4,7 @@ <!-- directory settings --> <property name="lib_dir" value="lib" /> <property name="source_dir" value="src/dl-learner" /> - <property name="protege_dir" value="/home/jl/programme/Protege_4.0_beta/plugins" /> + <property name="protege_dir" value="C:\Program Files\Protege_4.0\plugins" /> <property name="class_dir" value="classes" /> <property name="ontowiki_dir" value="${user.home}/workspace/ontowiki/ontowiki/src/extensions/components/dllearner/dllearner" /> @@ -349,12 +349,12 @@ <mkdir dir="${temp}/lib" /> <mkdir dir="${temp}/lib/pellet" /> <mkdir dir="${temp}/lib/jena" /> - <mkdir dir="${temp}/lib/ore-tools" /> + <mkdir dir="${temp}/lib/ore-tool" /> <copy toDir="${temp}/META-INF" > <fileset dir="${source}/META-INF" includes="MANIFEST.MF," /> </copy> <copy toDir="${temp}/lib/ore-tool" > - <fileset dir="${lib_dir}/ore-tool" includes="swingx-1.0.jar" /> + <fileset dir="${lib_dir}/ore-tool" includes="swingx-1.0.jar,BrowserLauncher2-all-1_3.jar" /> </copy> <copy toDir="${temp}/lib" > <fileset dir="${lib_dir}" includes="junit-4.4.jar,jamon-2.7.jar" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-11-04 16:18:58
|
Revision: 1905 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1905&view=rev Author: heeroyuy Date: 2009-11-04 16:18:47 +0000 (Wed, 04 Nov 2009) Log Message: ----------- -added new HyperLinkListener -some small changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-11-04 10:26:47 UTC (rev 1904) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-11-04 16:18:47 UTC (rev 1905) @@ -30,7 +30,7 @@ import javax.swing.DefaultListModel; import javax.swing.JOptionPane; -import javax.swing.JTextArea; +import javax.swing.JTextPane; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; @@ -51,6 +51,7 @@ // This is the DLLearnerModel. private final DLLearnerModel model; + private HyperLinkHandler hyperHandler; // This is the id that checks if the equivalent class or subclass button is // pressed in protege @@ -66,7 +67,7 @@ private final Color colorGreen = new Color(0, 139, 0); private final DLLearnerView view; private static final String HELP_BUTTON_STRING = "help"; - private JTextArea help; + private JTextPane help; private static final String ADD_BUTTON_STRING = "<html>ADD</html>"; private static final String ADVANCED_BUTTON_STRING = "Advanced"; private static final String EQUIVALENT_CLASS_LEARNING_STRING = "<html>suggest equivalent class expression</html>"; @@ -85,6 +86,7 @@ this.view = view; this.model = m; toggled = false; + hyperHandler = view.getHyperLinkHandler(); } @@ -108,10 +110,10 @@ view.getHintPanel().setForeground(Color.RED); CELOE celoe = (CELOE) model.getLearningAlgorithm(); - String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + String moreInformationsMessage = "<html><font size=\"3\">Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " - + celoe.getMaximumHorizontalExpansion() + "."; + + celoe.getMaximumHorizontalExpansion() + ".</font></html>"; view.setHelpButtonVisible(true); view.setHintMessage(moreInformationsMessage); retriever = new SuggestionRetriever(); @@ -130,7 +132,7 @@ .getSuggestClassPanel().getSuggestList() .getSelectedValue()); } - String message = "class expression added"; + String message = "<html><font size=\"3\">class expression added</font></html>"; view.setHintMessage(message); view.setHelpButtonVisible(false); } @@ -146,18 +148,21 @@ } } if (z.toString().contains(HELP_BUTTON_STRING)) { - String helpText = "What does a sentence like 'Learning started. Currently searching class expressions with length between 4 and 7.' mean?\n" - + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words needed to write down the class expression.\n\n" - + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general expression owl:Thing and then further specializes it.\n" - + "Those class expressions, which fit the existing instances of a given class ($currentClass in this case) get a high accuracy and are displayed as suggestions.\n" - + "The learning algorithm prefers short expressions. 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3\n" - + "or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7. If you want to search for longer expressions, then you have to increase\n" - + "the maximum runtime setting (it is set to $defaultRuntime seconds by default).\n\n" - + "See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for more details."; + String helpText = "<html><font size=\"3\">What does a sentence like 'Learning started. Currently searching class expressions with length between 4 and 7.' mean?<br>" + + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words needed to write down the class expression.<br><br>" + + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general expression owl:Thing and then further specializes it.<br>" + + "Those class expressions, which fit the existing instances of a given class ($currentClass in this case) get a high accuracy and are displayed as suggestions.<br>" + + "The learning algorithm prefers short expressions. 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3<br>" + + "or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7. If you want to search for longer expressions, then you have to increase<br>" + + "the maximum runtime setting (it is set to $defaultRuntime seconds by default).<br><br>" + + "See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for more details.</font></html>"; - help = new JTextArea(); + help = new JTextPane(); help.setEditable(false); + help.setContentType("text/html"); help.setForeground(Color.black); + help.addHyperlinkListener(hyperHandler); + help.setBackground(view.getLearnerView().getBackground()); help.setText(helpText); JOptionPane.showMessageDialog(null, help, "Help", @@ -212,10 +217,10 @@ .getNrOfConcepts())); CELOE celoe = (CELOE) model.getLearningAlgorithm(); view.getHintPanel().setForeground(Color.RED); - String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + String moreInformationsMessage = "<html><font size=\"3\">Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " - + celoe.getMaximumHorizontalExpansion() + "."; + + celoe.getMaximumHorizontalExpansion() + ".</font></html>"; view.setHintMessage(moreInformationsMessage); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-11-04 10:26:47 UTC (rev 1904) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-11-04 16:18:47 UTC (rev 1905) @@ -265,8 +265,8 @@ try { currentConceptURL = new URL(currentConcept.toString()); } catch (MalformedURLException e1) { - String error = "Cannot convert to URL."; - view.renderErrorMessage(error); + String error = "<html>Cannot convert to URL.</html>"; + view.setHintMessage(error); e1.printStackTrace(); } cm.applyConfigEntry(lp, "classToDescribe", currentConceptURL); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 10:26:47 UTC (rev 1904) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 16:18:47 UTC (rev 1905) @@ -36,7 +36,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTextArea; +import javax.swing.JTextPane; import javax.swing.JToggleButton; import org.dllearner.algorithms.celoe.CELOE; @@ -54,6 +54,8 @@ private static final long serialVersionUID = 624829578325729385L; + //TODO: gucken wie geht + private HyperLinkHandler hyperHandler; // this is the Component which shows the view of the dllearner private final JComponent learner; @@ -69,14 +71,6 @@ private final JLabel adv; - // This is the color for the error message. It is red. - - private final Color colorRed = Color.red; - - // This is the text area for the error message when an error occurred - - private final JTextArea errorMessage; - // Advanced Button to activate/deactivate the example select panel private final JToggleButton advanced; @@ -103,10 +97,10 @@ // Picture of the advanced button when it is toggled private final JPanel addButtonPanel; - private final JLabel wikiPane; + private final JTextPane wikiPane; private final ImageIcon toggledIcon; private ImageIcon helpIcon; - private final JTextArea hint; + private final JTextPane hint; private JButton helpButton; private final JPanel runPanel; private final JPanel advancedPanel; @@ -129,6 +123,7 @@ private int individualSize; private SuggestClassPanelHandler sugPanelHandler; private StatusBar stat; + private static final String WIKI_STRING = "<html><font size=\"3\">See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for an introduction.</font></html>"; /** * The constructor for the DL-Learner tab in the class description @@ -147,7 +142,10 @@ learnerPanel.setLayout(new BorderLayout()); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); action = new ActionHandler(model, this); - wikiPane = new JLabel("<html>See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for an introduction.</html>"); + wikiPane = new JTextPane(); + wikiPane.setContentType("text/html"); + wikiPane.setBackground(learnerScroll.getBackground()); + wikiPane.setText(WIKI_STRING); URL iconUrl = this.getClass().getResource("arrow.gif"); icon = new ImageIcon(iconUrl); URL toggledIconUrl = this.getClass().getResource("arrow2.gif"); @@ -167,12 +165,12 @@ accept = new JButton("<html>ADD</html>"); addButtonPanel = new JPanel(new BorderLayout()); stat = new StatusBar(); - errorMessage = new JTextArea(); - errorMessage.setEditable(false); - hint = new JTextArea(); + hint = new JTextPane(); + hint.setBackground(learnerScroll.getBackground()); + hint.setContentType("text/html"); hint.setEditable(false); - hint.setText("To get suggestions for class expression, please click the button above."); - hint.setPreferredSize(new Dimension(485, 30)); + hint.setText("<html><font size=\"3\">To get suggestions for class expression, please click the button above.</font></html>"); + hint.addHyperlinkListener(hyperHandler); learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(new GridBagLayout()); @@ -186,6 +184,7 @@ sugPanelHandler = new SuggestClassPanelHandler(this, model, action); sugPanel.addSuggestPanelMouseListener(sugPanelHandler); sugPanel.getSuggestList().addListSelectionListener(sugPanelHandler); + hyperHandler = new HyperLinkHandler(); this.addAcceptButtonListener(this.action); this.addRunButtonListener(this.action); this.addAdvancedButtonListener(this.action); @@ -216,7 +215,7 @@ helpButton.setVisible(false); hint.setForeground(Color.BLACK); - hint.setText("To get suggestions for class expression, please click the button above."); + hint.setText("<html><font size=\"3\">To get suggestions for class expression, please click the button above.</font></html>"); String currentConcept = editorKit.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass().toString(); if(!labels.equals(currentConcept) || individualSize != editorKit.getModelManager().getActiveOntology().getIndividualAxioms().size()) { if(individualSize != editorKit.getModelManager().getActiveOntology().getIndividualAxioms().size()) { @@ -281,7 +280,6 @@ c.weighty = 0.0; c.gridx = 0; c.gridy = 3; - hint.setPreferredSize(new Dimension(450, 60)); helpButton.setPreferredSize(new Dimension(30, 30)); hintPanel.add(BorderLayout.CENTER, hint); hintPanel.add(BorderLayout.EAST, helpButton); @@ -318,7 +316,6 @@ detail.setVisible(true); sugPanel.setVisible(true); learnerScroll.setViewportView(learner); - this.renderErrorMessage(""); this.getSuggestClassPanel().getSuggestModel().clear(); } @@ -396,7 +393,7 @@ * This method returns the hint panel. * @return hint panel */ - public JTextArea getHintPanel() { + public JTextPane getHintPanel() { return hint; } @@ -451,19 +448,10 @@ public void unsetEverything() { run.setEnabled(true); model.getNewOWLDescription().clear(); - errorMessage.setText(""); learner.removeAll(); } /** - * Renders the error message when an error occured. - * @param s String - */ - public void renderErrorMessage(String s) { - errorMessage.setForeground(colorRed); - errorMessage.setText(s); - } - /** * This Method returns the panel for more details for the chosen concept. * @return MoreDetailForSuggestedConceptsPanel */ @@ -524,18 +512,16 @@ */ public void algorithmTerminated() { CELOE celoe = (CELOE) model.getLearningAlgorithm(); - String error = "Learning successful. All expressions up to length " + (celoe.getMinimumHorizontalExpansion()-1) + " and some expressions up to \nlength " + celoe.getMaximumHorizontalExpansion() + " searched."; + String message = "<html><font size=\"3\">Learning successful. All expressions up to length " + (celoe.getMinimumHorizontalExpansion()-1) + " and some expressions up to <br>length " + celoe.getMaximumHorizontalExpansion() + " searched."; hint.setForeground(Color.RED); - this.setHintMessage(error); - String message = ""; if(isInconsistent) { - message ="\nClass expressions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; + message +="<br>Class expressions marked red will lead to an inconsistent ontology. <br>Please double click on them to view detail information.</font></html>"; } else { - message ="\nTo view details about why a class expression was suggested, please click on it."; + message +="<br>To view details about why a class expression was suggested, please click on it.</font><html>"; } run.setEnabled(true); // start the algorithm and print the best concept found; - hint.append(message); + this.setHintMessage(message); } /** @@ -591,4 +577,9 @@ public StatusBar getStatusBar() { return stat; } + + public HyperLinkHandler getHyperLinkHandler() { + return hyperHandler; + } + } Added: trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/HyperLinkHandler.java 2009-11-04 16:18:47 UTC (rev 1905) @@ -0,0 +1,52 @@ +package org.dllearner.tools.protege; + +import java.awt.Cursor; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.swing.JEditorPane; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; + +import edu.stanford.ejalbert.BrowserLauncher; +import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException; +import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException; + +public class HyperLinkHandler implements HyperlinkListener { + + private BrowserLauncher launcher; + + public HyperLinkHandler() { + try { + launcher = new BrowserLauncher(); + } catch (BrowserLaunchingInitializingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedOperatingSystemException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void hyperlinkUpdate(HyperlinkEvent event) { + if (event.getEventType() == HyperlinkEvent.EventType.ENTERED) { + ((JEditorPane) event.getSource()).setCursor(Cursor + .getPredefinedCursor(Cursor.HAND_CURSOR)); + } else if (event.getEventType() == HyperlinkEvent.EventType.EXITED) { + ((JEditorPane) event.getSource()).setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } else if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + URL url; + try { + url = new URL(event.getDescription()); + launcher.openURLinBrowser(url.toString()); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + +} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF 2009-11-04 10:26:47 UTC (rev 1904) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/MANIFEST.MF 2009-11-04 16:18:47 UTC (rev 1905) @@ -6,7 +6,7 @@ Bundle-Description: Protege DL-Learner Plugin Bundle-Vendor: DL-Learner Project Bundle-DocURL: http://dl-learner.org/wiki/ProtegePlugin -Bundle-ClassPath: .,lib/junit-4.4.jar,lib/jamon-2.7.jar,lib/pellet/pellet-core.jar,lib/pellet/pellet-datatypes.jar,lib/pellet/pellet-el.jar,lib/pellet/pellet-explanation.jar,lib/pellet/pellet-owlapi.jar,lib/pellet/pellet-rules.jar,lib/pellet/aterm-java-1.6.jar,lib/jena/json.jar,lib/pellet/relaxngDatatype.jar,lib/pellet/xsdlib.jar,lib/jena/commons-logging-1.1.1.jar,lib/ore-tool/swingx-0.9.2.jar +Bundle-ClassPath: .,lib/junit-4.4.jar,lib/jamon-2.7.jar,lib/pellet/pellet-core.jar,lib/pellet/pellet-datatypes.jar,lib/ore-tool/BrowserLauncher2-all-1_3.jar,lib/pellet/pellet-el.jar,lib/pellet/pellet-explanation.jar,lib/pellet/pellet-owlapi.jar,lib/pellet/pellet-rules.jar,lib/pellet/aterm-java-1.6.jar,lib/jena/json.jar,lib/pellet/relaxngDatatype.jar,lib/pellet/xsdlib.jar,lib/jena/commons-logging-1.1.1.jar,lib/ore-tool/swingx-0.9.2.jar Import-Package: org.osgi.framework,org.apache.log4j Export-Package: lib Bundle-Version: 0.5.2 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-11-04 10:26:47 UTC (rev 1904) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-11-04 16:18:47 UTC (rev 1905) @@ -87,7 +87,6 @@ if(current != null) { SortedSet<Individual> individuals = null; hasIndividuals = false; - System.out.println("hier: " + editor.getOWLModelManager().getActiveOntology().getAxioms(current)); // checks if selected concept is thing when yes then it selects all // individuals if (!(current.toString().equals("Thing"))) { @@ -167,7 +166,7 @@ @Override public void run() { - String loading ="loading instances..."; + String loading ="<html><font size=\"3\">loading instances...</font></html>"; view.getHintPanel().setForeground(Color.RED); view.setHintMessage(loading); if(!model.isReasonerSet() || model.getIsKnowledgeSourceIsUpdated() == true) { @@ -182,12 +181,12 @@ if (this.hasIndividuals()) { view.getRunButton().setEnabled(true); view.getHintPanel().setForeground(Color.BLACK); - view.setHintMessage("To get suggestions for class descriptions, please click the button above."); + view.setHintMessage("<html><font size=\"3\">To get suggestions for class descriptions, please click the button above.</font></html>"); } else { view.getRunButton().setEnabled(false); view.getHintPanel().setVisible(true); - String message ="There are no Instances for " + current + " available. Please insert some Instances."; + String message ="<html><font size=\"3\">There are no Instances for " + current + " available. Please insert some Instances.</font></html>"; view.getHintPanel().setForeground(Color.RED); view.setHintMessage(message); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-11-04 10:26:58
|
Revision: 1904 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1904&view=rev Author: heeroyuy Date: 2009-11-04 10:26:47 +0000 (Wed, 04 Nov 2009) Log Message: ----------- -fixed a bug Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-11-04 09:15:48 UTC (rev 1903) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-11-04 10:26:47 UTC (rev 1904) @@ -67,7 +67,10 @@ private final DLLearnerView view; private static final String HELP_BUTTON_STRING = "help"; private JTextArea help; + private static final String ADD_BUTTON_STRING = "<html>ADD</html>"; private static final String ADVANCED_BUTTON_STRING = "Advanced"; + private static final String EQUIVALENT_CLASS_LEARNING_STRING = "<html>suggest equivalent class expression</html>"; + private static final String SUPER_CLASS_LEARNING_STRING = "<html>suggest super class expression</html>"; /** * This is the constructor for the action handler. @@ -93,9 +96,9 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("suggest equivalent class expression") + if (z.getActionCommand().equals(EQUIVALENT_CLASS_LEARNING_STRING) || z.getActionCommand() - .equals("suggest super class expression")) { + .equals(SUPER_CLASS_LEARNING_STRING)) { model.setKnowledgeSource(); view.getSuggestClassPanel().getSuggestModel().clear(); view.getSuggestClassPanel().repaint(); @@ -107,8 +110,8 @@ String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() - + " and" - + celoe.getMaximumHorizontalExpansion() + ". "; + + " and " + + celoe.getMaximumHorizontalExpansion() + "."; view.setHelpButtonVisible(true); view.setHintMessage(moreInformationsMessage); retriever = new SuggestionRetriever(); @@ -116,7 +119,7 @@ retriever.execute(); } - if (z.getActionCommand().equals("ADD")) { + if (z.getActionCommand().equals(ADD_BUTTON_STRING)) { if (evaluatedDescription != null) { model .changeDLLearnerDescriptionsToOWLDescriptions(evaluatedDescription @@ -150,7 +153,7 @@ + "The learning algorithm prefers short expressions. 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3\n" + "or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7. If you want to search for longer expressions, then you have to increase\n" + "the maximum runtime setting (it is set to $defaultRuntime seconds by default).\n\n" - + "See http://dl-learner.org/wiki/ProtegePlugin for more details. "; + + "See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for more details."; help = new JTextArea(); help.setEditable(false); @@ -170,6 +173,14 @@ } /** + * This Methode sets the evaluated class expression that is selected + * in the panel. + * @param desc evaluated descriptions + */ + public void setEvaluatedClassExpression(EvaluatedDescription desc) { + this.evaluatedDescription = desc; + } + /** * Inner Class that retrieves the concepts given by the DL-Learner. * * @author Christian Koetteritzsch Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 09:15:48 UTC (rev 1903) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 10:26:47 UTC (rev 1904) @@ -152,7 +152,7 @@ icon = new ImageIcon(iconUrl); URL toggledIconUrl = this.getClass().getResource("arrow2.gif"); toggledIcon = new ImageIcon(toggledIconUrl); - adv = new JLabel("Advanced Settings"); + adv = new JLabel("<html>Advanced Settings</html>"); advanced = new JToggleButton(icon); advanced.setVisible(true); advancedPanel = new JPanel(); @@ -164,7 +164,7 @@ helpButton.setName("help"); helpButton.addActionListener(action); runPanel = new JPanel(new FlowLayout()); - accept = new JButton("ADD"); + accept = new JButton("<html>ADD</html>"); addButtonPanel = new JPanel(new BorderLayout()); stat = new StatusBar(); errorMessage = new JTextArea(); @@ -183,7 +183,7 @@ learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPEED); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); - sugPanelHandler = new SuggestClassPanelHandler(this, model); + sugPanelHandler = new SuggestClassPanelHandler(this, model, action); sugPanel.addSuggestPanelMouseListener(sugPanelHandler); sugPanel.getSuggestList().addListSelectionListener(sugPanelHandler); this.addAcceptButtonListener(this.action); @@ -234,7 +234,7 @@ } individualSize = editorKit.getModelManager().getActiveOntology().getIndividualAxioms().size(); labels = currentConcept; - run.setText("suggest " + label + " expression"); + run.setText("<html>suggest " + label + " expression</html>"); GridBagConstraints c = new GridBagConstraints(); learner.remove(detail); model.setID(label); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2009-11-04 09:15:48 UTC (rev 1903) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2009-11-04 10:26:47 UTC (rev 1904) @@ -36,6 +36,7 @@ public class SuggestClassPanelHandler implements MouseListener, ListSelectionListener{ private DLLearnerView view; private DLLearnerModel model; + private ActionHandler action; private EvaluatedDescription evaluatedDescription; /** @@ -43,9 +44,10 @@ * @param v DLLearnerView * @param m DLLearnerModel */ - public SuggestClassPanelHandler(DLLearnerView v, DLLearnerModel m) { + public SuggestClassPanelHandler(DLLearnerView v, DLLearnerModel m, ActionHandler a) { this.view = v; this.model = m; + this.action = a; } @@ -68,6 +70,7 @@ if (desc.equals(eDescription.getDescription() .toManchesterSyntaxString(ont, null))) { evaluatedDescription = eDescription; + action.setEvaluatedClassExpression(eDescription); break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-11-04 09:15:54
|
Revision: 1903 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1903&view=rev Author: heeroyuy Date: 2009-11-04 09:15:48 +0000 (Wed, 04 Nov 2009) Log Message: ----------- -removed wrong text after learning is finished Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 09:02:11 UTC (rev 1902) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-11-04 09:15:48 UTC (rev 1903) @@ -524,7 +524,7 @@ */ public void algorithmTerminated() { CELOE celoe = (CELOE) model.getLearningAlgorithm(); - String error = "Learning successful. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " + celoe.getMaximumHorizontalExpansion() + "."; + String error = "Learning successful. All expressions up to length " + (celoe.getMinimumHorizontalExpansion()-1) + " and some expressions up to \nlength " + celoe.getMaximumHorizontalExpansion() + " searched."; hint.setForeground(Color.RED); this.setHintMessage(error); String message = ""; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-11-04 09:02:19
|
Revision: 1902 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1902&view=rev Author: heeroyuy Date: 2009-11-04 09:02:11 +0000 (Wed, 04 Nov 2009) Log Message: ----------- -code cleanup Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-11-01 22:53:41 UTC (rev 1901) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-11-04 09:02:11 UTC (rev 1902) @@ -87,7 +87,6 @@ private final Color darkGreen; private final Color darkRed; private int notCoveredInd; - private final MoreDetailForSuggestedConceptsPanel panel; /** * @@ -97,24 +96,23 @@ * EvaluatedDescription * @param m * DLLearnerModel - * @param concept - * String - * @param p - * MoreDetailForSuggestedConceptsPanel */ - public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, - String concept, MoreDetailForSuggestedConceptsPanel p) { + public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m) { this.setVisible(false); this.setForeground(Color.GREEN); this.setPreferredSize(new Dimension(540, 230)); eval = desc; model = m; - panel = p; id = model.getID(); darkGreen = new Color(0, 100, 0); darkRed = new Color(205, 0, 0); random = new Random(); - conceptNew = concept; + for(String uri : model.getOntologyURIString()) { + if(eval.getDescription().toString().contains(uri)) { + conceptNew = eval.getDescription().toManchesterSyntaxString(uri, null); + } + } + conceptVector = new Vector<String>(); posCovIndVector = new Vector<IndividualPoint>(); posNotCovIndVector = new Vector<IndividualPoint>(); @@ -638,15 +636,6 @@ } /** - * This method returns the MoreDetailForSuggestedConceptsPanel. - * - * @return MoreDetailForSuggestedConceptsPanel - */ - public MoreDetailForSuggestedConceptsPanel getMoreDetailForSuggestedConceptsPanel() { - return panel; - } - - /** * Returns the min. x value of the plus. * * @return int min X Value Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-11-01 22:53:41 UTC (rev 1901) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-11-04 09:02:11 UTC (rev 1902) @@ -56,7 +56,7 @@ } /** - * This is the second Construktor of the class. This should be used if more + * This is the second Constructor of the class. This should be used if more * details for the shown Individuals should be displayed. * @param p display String * @param x coordinate on the x axis @@ -76,14 +76,6 @@ } /** - * This method sets the display string of the individual. - * @param point the point to set - */ - public void setPoint(String point) { - this.point = point; - } - - /** * This method returns the display string of the individual. * @return the point */ @@ -92,14 +84,6 @@ } /** - * This method sets the x axis coordinate. - * @param xAxis the xAxis to set - */ - public void setXAxis(int xAxis) { - this.xAxis = xAxis; - } - - /** * This method returns the x axis coordinate. * @return the xAxis */ @@ -108,14 +92,6 @@ } /** - * This method sets the y axis coordinate. - * @param yAxis the yAxis to set - */ - public void setYAxis(int yAxis) { - this.yAxis = yAxis; - } - - /** * This method returns the y axis coordinate. * @return the yAxis */ Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-11-01 22:53:41 UTC (rev 1901) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-11-04 09:02:11 UTC (rev 1902) @@ -19,14 +19,10 @@ */ package org.dllearner.tools.protege; import java.awt.Dimension; -import java.awt.GridLayout; -import java.util.Set; import javax.swing.JPanel; -import javax.swing.JTextArea; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.learningproblems.EvaluatedDescriptionClass; @@ -45,24 +41,11 @@ // Model of the dllearner private final DLLearnerModel model; - - // Textarea to render the accuracy of the concept - - private final JTextArea accuracy; - - - private final JTextArea accuracyText; - // Evaluated description of the selected concept - private final JPanel conceptPanel; - private EvaluatedDescription eval; - private final JTextArea concept; - private Set<String> ontologiesStrings; - private final JTextArea conceptText; + //private final JTextArea concept; private static final int HEIGHT = 230; private static final int WIDTH = 540; private GraphicalCoveragePanel p; - private final MoreDetailForSuggestedConceptsPanelHandler handler; /** * This is the constructor for the Panel. @@ -73,28 +56,6 @@ setLayout(null); setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.model = model; - handler = new MoreDetailForSuggestedConceptsPanelHandler(this); - concept = new JTextArea("Class Description:"); - - concept.setEditable(false); - - - conceptPanel = new JPanel(new GridLayout(0, 2)); - conceptPanel.setBounds(5, 0, 800, 50); - - accuracy = new JTextArea("Accuracy:"); - accuracy.setEditable(false); - conceptText = new JTextArea(); - conceptText.setEditable(false); - - accuracyText = new JTextArea(); - //sets accuracy text area not editable - accuracyText.setEditable(false); - accuracy.setVisible(false); - accuracyText.setVisible(false); - concept.setVisible(false); - conceptText.setVisible(false); - } /** @@ -102,55 +63,20 @@ * @param desc selected description */ public void renderDetailPanel(EvaluatedDescription desc) { - accuracy.setVisible(false); - accuracyText.setVisible(false); - concept.setVisible(false); - conceptText.setVisible(false); eval = desc; //panel for the informations of the selected concept //this method adds the informations for the selected concept to the panel - this.setInformation(); - p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), this); + p = new GraphicalCoveragePanel(eval, model); p.setBounds(5, 0, 600, 700); //adds all information to the example panel unsetEverything(); - conceptPanel.removeAll(); - conceptPanel.add(concept); - conceptPanel.add(accuracy); - conceptPanel.add(conceptText); - conceptPanel.add(accuracyText); - conceptPanel.setVisible(true); this.add(p); - this.addPropertyChangeListener(handler); } private void unsetEverything() { removeAll(); } - /** - * This method sets the Informations of the selected description. - */ - public void setInformation() { - ontologiesStrings = model.getOntologyURIString(); - if(eval!=null) { - //sets the accuracy of the selected concept - for(String ontoString : ontologiesStrings) { - if(eval.getDescription().toString().contains(ontoString)) { - conceptText.setText(eval.getDescription().toManchesterSyntaxString(ontoString, null)); - break; - } - } - - //sets the accuracy of the concept - double acc = ((EvaluatedDescriptionClass) eval).getAccuracy()*100; - accuracyText.setText(String.valueOf(acc)+"%"); - } - accuracy.setVisible(true); - accuracyText.setVisible(true); - concept.setVisible(true); - conceptText.setVisible(true); - } /** @@ -162,31 +88,12 @@ } /** - * Returns the concept panel. - * @return concept panel - */ - public JPanel getConceptPanel() { - return conceptPanel; - } - - /** * Unsets the panel after plugin is closed. */ public void unsetPanel() { unsetEverything(); - conceptPanel.removeAll(); - accuracy.setVisible(false); - accuracyText.setVisible(false); - concept.setVisible(false); - conceptText.setVisible(false); if(p != null) { p.unsetPanel(); } - conceptPanel.add(concept); - conceptPanel.add(accuracy); - conceptPanel.add(conceptText); - conceptPanel.add(accuracyText); - conceptPanel.setVisible(false); - this.add(conceptPanel); } } Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-11-01 22:53:41 UTC (rev 1901) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-11-04 09:02:11 UTC (rev 1902) @@ -1,49 +0,0 @@ -/** - * Copyright (C) 2007-2009, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.tools.protege; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -/** - * This is the Listener for the MoreDetailForSuggestedConceptsPanel. - * @author Christian Koetteritzsch - * - */ -public class MoreDetailForSuggestedConceptsPanelHandler implements PropertyChangeListener{ -private final MoreDetailForSuggestedConceptsPanel panel; - - /** - * This is the constructor of the class. - * @param m MoreDetailForSuggestedConceptsPanel - */ - public MoreDetailForSuggestedConceptsPanelHandler(MoreDetailForSuggestedConceptsPanel m) { - panel = m; - } - @Override - /** - * This methode sets the Informations on the panel where the - * graphic is shown. - */ - public void propertyChange(PropertyChangeEvent arg0) { - panel.setInformation(); - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <neb...@us...> - 2009-11-01 22:53:57
|
Revision: 1901 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1901&view=rev Author: nebelschwade Date: 2009-11-01 22:53:41 +0000 (Sun, 01 Nov 2009) Log Message: ----------- Added albumSearch Added More Info Tab-Functionality, displaying external RDF-Data for currently playing artist. Minor Bugfixes and Enhancements (Download this song etc.) HTML5/CSS3 Interface Modified Paths: -------------- trunk/src/moosique.net/css/style.css trunk/src/moosique.net/index.php trunk/src/moosique.net/js/moosique.js trunk/src/moosique.net/js/start.js trunk/src/moosique.net/moosique/classes/DataHelper.php trunk/src/moosique.net/moosique/classes/Debugger.php trunk/src/moosique.net/moosique/classes/LastFM.php trunk/src/moosique.net/moosique/classes/RequestHandler.php trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php trunk/src/moosique.net/moosique/classes/View.php trunk/src/moosique.net/moosique/config.ini trunk/src/moosique.net/moosique/main.wsdl Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/css/style.css 2009-11-01 22:53:41 UTC (rev 1901) @@ -13,82 +13,100 @@ @media screen { /*=============== Default Styling ===============*/ -body { font: normal 12px/18px Verdana, Arial, sans-serif; color: #f1f7e4; - background: url('../img/bg.png') top left repeat #3a3a3a; border-top: 5px solid #1fd611; } +body { font: normal 14px/20px Verdana, Arial, sans-serif; color: #f1f7e4; + background: url('../img/bg.png') top left repeat #3a3a3a; } input, select { background: #292929; border: 1px solid #5a5a5a; outline: none; padding: 5px; } input[type=submit] { padding: 5px 10px; } input:focus, select:focus { border: 1px solid #1fd611; } a:hover { color: #1fd611; } a.button { background: #4a4a4a; color: #f1f7e4; padding: 5px 10px; text-decoration: none; } a.button:hover { border: 1px solid #1fd611; padding: 4px 9px; } -h1 { font: 32px/32px Georgia, Times, serif; } -h2 { font: 28px/28px Georgia, Times, serif; } -h3 { font: 20px/20px Georgia, Times, serif; } -h4 { font: 16px/16px Georgia, Times, serif; } -h5 { font: 12px/12px Georgia, Times, serif; } -h6 { font: 10px/10px Georgia, Times, serif; } +h1 { font: 36px/36px Georgia, Times, serif; } +h2 { font: 30px/30px Georgia, Times, serif; } +h3 { font: 24px/24px Georgia, Times, serif; } +h4 { font: 18px/18px Georgia, Times, serif; } +h5 { font: 14px/14px Georgia, Times, serif; } +h6 { font: 12px/12px Georgia, Times, serif; } pre { font: normal 10px/14px Monaco, Courier, monospace; } p, h1, h2, h3, h4, h5, h6, -ul, ol, pre, form { margin-bottom: 18px; } +ul, ol, pre, form { margin-bottom: 20px; } /* Initial hiding */ -#recommendations, #information, +#recommendations, #info, #header h1, #player, #help { display: none; } -/* Rounded Corners */ +/* Rounded Corners and drop shadows, CSS3 */ input, select, a.button { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } #content, #status, #playing, -#playerControls, .results li { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } +#playerControls, .results li, +iframe { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } #nav a { -moz-border-radius-bottomleft: 10px; -moz-border-radius-bottomright: 10px; -webkit-border-bottom-left-radius: 10px; -webkit-border-bottom-right-radius: 10px; - border-bottom-left-radius: 10px; border-top-left-radius: 10px; } + border-bottom-left-radius: 10px; border-bottom-left-radius: 10px; } +#info .linkList li { -moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px; + -webkit-border-top-left-radius: 10px; -webkit-border-top-right-radius: 10px; + border-top-left-radius: 10px; border-top-left-radius: 10px; } +#content, #status, #playing, +#playerControls, #topBorder, +#searchValue, #searchType, +#searchSubmit, #nav a, +#info .linkList li { -moz-box-shadow: 2px 2px 3px #191919; -webkit-box-shadow: 2px 2px 3px #191919; + box-shadow: 2px 2px 3px #191919; } +#nav .active a, .results img, +a.button, #info .image img { -moz-box-shadow: 3px 3px 3px #191919; -webkit-box-shadow: 3px 3px 3px #191919; + box-shadow: 3px 3px 3px #191919; } + /*=============== Default Containers ===============*/ #container, #header, #content, #playlist li { position: relative; } -#container { width: 760px; margin: 0 auto; } -#header { height: 150px; padding-top: 20px; } -#content { background: #292929; padding: 20px; } -#footer { font: normal 10px/14px Verdana, Arial, sans-serif; padding: 20px; text-align: center; } +#topBorder { position: relative; height: 6px; background: #1fd611; z-index: 5; } +#container { width: 900px; margin: 0 auto; } +#header { height: 175px; padding-top: 25px; } +#content { background: #292929; padding: 25px; } +#footer { font: normal 11px/14px Verdana, Arial, sans-serif; padding-top: 40px; text-align: center; } /*=============== Player Controls, Status, Playing ===============*/ -#status, #playing { position: absolute; top: 70px; left: 0; width: 490px; height: 60px; +#status, #playing { position: absolute; top: 85px; left: 0; width: 590px; height: 70px; background: #292929; padding: 10px 20px; } -#playerControls { position: absolute; top: 70px; right: 0; width: 170px; height: 60px; +#playerControls { position: absolute; top: 85px; right: 0; width: 210px; height: 70px; padding: 10px 20px; background: #292929; } #playerControls a:active { position: relative; top: 2px; } -#status { background: #3a3a3a; height: 60px; line-height: 60px; text-align: center; +#status { background: #3a3a3a; line-height: 70px; text-align: center; font-weight: bold; border: 1px solid #1fd611; z-index: 1000; } #playing span { display: block; margin-bottom: 0; font-size: 10px; } -#playing .track { font: bold 12px/32px Verdana, Arial, sans-serif; } +#playing .track { font: bold 14px/32px Verdana, Arial, sans-serif; } #playing .time { position: absolute; bottom: 10px; right: 20px; } +#playing .download { position: absolute; top: 10px; right: 20px; } #prev, #next, #stop, -#playPause, #mute { display: block; width: 20px; height: 40px; text-indent: -10000px; - float: left; margin: 10px 0 0 10px; } +#playPause, #mute { display: block; width: 30px; height: 40px; text-indent: -10000px; + float: left; margin: 15px 0 0 10px; } #prev { background: url(../img/controls.png) 0px -160px no-repeat; } #next { background: url(../img/controls.png) 0px -120px no-repeat; } #stop { background: url(../img/controls.png) 0px -80px no-repeat; } -#mute { background: url(../img/controls.png) 0px -280px no-repeat; margin-right: 0; width: 23px; } -#playPause { background: url(../img/controls.png) 0px 0px no-repeat; width: 26px; } +#mute { background: url(../img/controls.png) 0px -280px no-repeat; margin-right: 0; } +#playPause { background: url(../img/controls.png) 0px 0px no-repeat; width: 37px; } /*=============== Search Form ===============*/ -#searchValue { margin: 0 5px; width: 100px; } +#searchValue { margin: 0 5px; width: 150px; } .spinner { position: absolute; z-index: 10; background: url('../img/bg.png') top left repeat #3a3a3a; } .spinner-img { background: url('../img/spinner.gif') top left no-repeat; width: 24px; height: 24px; margin: 0 auto; } /*=============== Content & General ===============*/ #addRandom { text-decoration: underline; } -#footer a { padding: 0 10px; } +#footer a { padding: 0 12px; color: #5a5a5a; } +#footer a:hover { color: #f1f7e4; } +#help ul { list-style: disc; margin-left: 40px; } - /*=============== Menu ===============*/ #nav ul { position: absolute; top: 0; right: 0; } #nav li { float: left; } -#nav a { display: block; margin-left: 10px; line-height: 30px; height: 30px; - padding: 10px 12px; color: #f1f7e4; background: #4a4a4a; } +#nav a { position: relative; display: block; margin-left: 12px; height: 40px; padding: 10px 12px; color: #f1f7e4; + background: #4a4a4a; font: normal 12px/50px Verdana, Arial, sans-serif; } +#nav .active a { z-index: 10; } #nav .active a, #nav .active a:hover { background: #1fd611; } #nav a:hover { text-decoration: none; background: #5a5a5a; } @@ -96,21 +114,23 @@ /*=============== Search Results, Recommendations & Playlist ===============*/ .results h3 a { font-weight: normal; } -.results img { border: 2px solid #5a5a5a; max-width: 308px; max-height: 308px; } -.results li { float: left; width: 312px; border: 1px solid #5a5a5a; padding: 18px; margin-bottom: 18px; } -.results li.odd { margin-right: 18px; clear: both; } -.results ul ul { list-style: disc; } +.results img { max-width: 373px; max-height: 373px; } +.results li { float: left; width: 373px; border: 1px solid #5a5a5a; padding: 20px; margin-bottom: 20px; } +.results li.odd { margin-right: 20px; clear: both; } +.results ul ul { list-style: disc; margin-bottom: 0; } .results li li, .artistSearch li li, -.tagSearch li li { border: none; display: list-item; padding: 0; margin: 0 0 0 36px; +.tagSearch li li, +#info li li { border: none; display: list-item; padding: 0; margin: 0 0 0 36px; width: auto; height: auto; float: none; } .results h4 { display: inline; } #recommendationResults ul ul, -.tagSearch ul ul { clear: both; } -.results .image { text-align: center; margin-bottom: 18px; } +.tagSearch ul ul, +#info ul ul { clear: both; } +.results .image { text-align: center; margin-bottom: 20px; } #recommendationResults.results .image, -.results .tagSearch .image { margin: 0 18px 18px 0; width: 104px; height: 104px; float: left; } +.results .tagSearch .image { margin: 0 20px 20px 0; width: 104px; height: 104px; float: left; } #autoAdd { float: right; } #playlist, #recently { margin-left: 36px; list-style: decimal; } @@ -129,7 +149,12 @@ /*=============== Information & Help ===============*/ +#info h3 { clear: both; } +#info .image { width: auto; float: left; margin: 0 20px 20px 0;} +#info iframe { border: 1px solid #5a5a5a; width: 100%; height: 600px; } +#info .linkList { overflow: hidden; margin: 0 0 0 20px; } +#info .linkList li { float: left; padding: 10px; margin-right: 10px; background: #4a4a4a; } +#info .linkList li.active { background: #1fd611; } - } /* end @media screen */ \ No newline at end of file Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/index.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -14,78 +14,67 @@ <title>moosique.net</title> </head> <body> +<div id="topBorder"></div> <div id="container"> <div id="header"> <h1>moosique.net</h1> - <div id="nav"> <ul class="clearfix"> - <li class="active"><a href="#" class="home">Search</a></li> - <li><a href="#" class="player">Playlist</a></li> - <li><a href="#" class="recommendations">Recommendations</a></li> - <li><a href="#" class="information">Info</a></li> - <li><a href="#" class="help">?</a></li> + <li class="active"><a href="search/" class="home">Search</a></li> + <li><a href="playlist/" class="player">Playlist</a></li> + <li><a href="recommendations/" class="recommendations">Recommendations</a></li> + <li><a href="more-info/" class="info">More Info</a></li> + <li><a href="help/" class="help">Help</a></li> </ul> </div> - <form id="searchForm" method="get" action="moosique/"> <div> <select name="searchType" id="searchType"> <option value="allSearch">All</option> - <option value="artistSearch">Artist</option> - <option value="tagSearch">Tag</option> - <option value="albumSearch">Album</option> - <option value="songSearch">Song</option> + <option value="artistSearch">Artists</option> + <option value="tagSearch">Tags</option> + <option value="albumSearch">Albums</option> + <option value="songSearch">Songs</option> <option value="lastFM">last.fm</option> </select> <input id="searchValue" name="searchValue" type="text" /> <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" /> </div> </form> - <div id="playerControls"> - <a href="#" id="playPause" title="Play/Pause">Play / Pause</a> - <a href="#" id="stop" title="Stop playing">Stop</a> - <a href="#" id="prev" title="Play previous Track in Playlist">Previous Tack</a> - <a href="#" id="next" title="Play next Track in Playlist">Next Track</a> - <a href="#" id="mute" title="Sound on/off">Mute</a> + <a href="play-pause/" id="playPause" title="Play/Pause">Play / Pause</a> + <a href="stop/" id="stop" title="Stop playing">Stop</a> + <a href="previous/" id="prev" title="Play previous Track in Playlist">Previous Tack</a> + <a href="next/" id="next" title="Play next Track in Playlist">Next Track</a> + <a href="mute/" id="mute" title="Sound on/off">Mute</a> </div> - <div id="status"> </div> <div id="playing"> <span class="info">Player stopped</span> <span class="track">...</span> <span class="time">0:00 / 0:00</span> + <span class="download"><a href="#">Download this song</a></span> </div> </div> - <div id="content"> <div id="home"> - <div id="welcome"> + <div id="results" class="results"> <h2>Welcome to moosique.net!</h2> <p> - Want to listen to some good free music? Just enter an artist or song - name or search for music using tags and let the moogic - happen. By listening to songs you like, the system will automatically learn about + Want to listen to some good free music? Search for something you like and add it to your playlist. + By listening to songs you like, moosique will automatically try to learn about your musical taste and generate recommendations. You can find them in the tab »Recommendations«. - </p> - <p> You can also enter your <a href="http://last.fm">last.fm</a>-username to automatically use your most-used tags to generate a initial list of recommendations. </p> <p> - You can find information about the song currently playing in the tab »Info« and edit and view - your current Playlist in the »Playlist«-Tab. + After you have found something you want to listen to, just add it to your playlist and click the play-button. </p> <p> - Now get started and add something to the Playlist! + Need help? Click on the »Help«-Tab to get more information about how to use moosique.net </p> </div> - <div id="results" class="results"> - - </div> </div> - <div id="recommendations"> <form id="autoAdd" method="get" action=""> <div> @@ -99,24 +88,16 @@ for at least half it's length, assuming that you liked it. You can click on a recommended album to add it to the playlist, or you can <a href="#" id="addRandom">click here to just add a random song from your recommendations</a>.<br /> - </p> <p> <a href="#" id="generateRecommendations" class="button" title="If there is nothing showing up here, you can generate your list of recommendations by clicking here.">Reload recommendations</a> </p> <div id="recommendationResults" class="results"> - - </div> </div> - - <div id="information"> - <h2>About the artist...</h2> - <div id="moreInfo"> - - </div> + <div id="info"> + <h2>Listen to a song to get more info about it.</h2> </div> - <div id="player"> <h2>Playlist</h2> <p> @@ -127,7 +108,6 @@ <li></li> </ol> <p><a href="#" id="resetPlaylist" class="button" title="Click here to delete all tracks from your playlist.">Delete all</a></p> - <h2>Recently Listened to</h2> <p>These are the songs you recently listened to. Click on a song to re-enqueue it to your current playlist.</p> <ol id="recently"> @@ -135,21 +115,45 @@ </ol> <p><a href="#" id="resetRecently" class="button" title="Click here to reset your »recently listened to«-list.">Reset</a></p> </div> - <div id="help"> - + <h2>How to use moosique.net</h2> + <h3>Searching</h3> + <p> + Before you can listen to music, you first have to search for something to add your first song or album to + your playlist. You can search for <em>artists</em>, <em>tags</em>, <em>albums</em> or <em>songs</em>. + If you are lazy and a last.fm-user, you can choose <em>last.fm</em> from the search-dropdown and just enter + your username, moosique.net will then start a search using your most used tags from last.fm.<br /> + If you are searching for tags, and your search is more than one word, the results will be better. + For example: a search for "rock" will give you lots of results, where a search for "hard rock" + will be more specific, giving you better search results. Just try it, you can't break anything. + </p> + <h3>Recommendations</h3> + <p> + moosique.net uses the mighty <a href="http://aksw.org/Projects/DLLearner">DL-Learner</a> to generate recommendations + based on the songs you have listened to. + </p> + <h3>Requirements</h3> + <p> + To use moosique.net you should have: + </p> + <ul> + <li>A decent, modern browser, such as <a href="http://getfirefox.com">Firefox</a>, <a href="http://apple.com/de/safari/download/">Safari</a> or <a href="http://google.com/chrome/">Google Chrome</a></li> + <li>JavaScript activated</li> + <li>The <a href="http://www.adobe.com/se/products/flashplayer/">Adobe Flash Player</a> plugin for your browser</li> + <li>A fast internet connection</li> + <li>Some good headphones or loudspeakers of course. It's moosique after all!</li> + </ul> </div> - </div> <!-- end content --> - <div id="footer"> - <a href="http://aksw.org/Projects/DLLearner">DL-Learner</a> | - <a href="http://jamendo.com">Jamendo</a> | + <a href="http://aksw.org/Projects/DLLearner">DL-Learner</a> + <a href="http://bis.informatik.uni-leipzig.de/">Universität Leipzig BIS</a> + <a href="http://jamendo.com">Jamendo</a> <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> + <a href="http://mootools.net">mootools</a> + <a href="http://webgefrickel.de">webgefrickel.de</a> </div> - </div> <!-- end container --> - <?php include('moosique/classes/Config.php'); $c = new Config(); Modified: trunk/src/moosique.net/js/moosique.js =================================================================== --- trunk/src/moosique.net/js/moosique.js 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/js/moosique.js 2009-11-01 22:53:41 UTC (rev 1901) @@ -11,9 +11,9 @@ // set some default options options: { - messageFadeTime: 5000, // Time until a Status message fades out - timeToScrobble: 0.5, // factor for calculating max time a user has to listen to a track until its scrobbled - minSearchLength: 3 // minimum number of chars for a search value (tag, artist, song) + messageFadeTime: 4000, // Time until a Status message fades out in milliseconds, default: 4000 = 4 seconds + timeToScrobble: 0.5, // factor for max time for scrobbling/recommendations, default: 0.5 = half the song + minSearchLength: 3 // minimum number of chars for a search value (tag, artist, song), default: 3 }, /** @@ -48,6 +48,7 @@ this.nowPlayingInfo = $$('#playing .info'); this.nowPlayingTrack = $$('#playing .track'); this.nowPlayingTime = $$('#playing .time'); + this.download = $$('#playing .download a'); this.status = document.id('status'); // searchForm elements this.searchForm = document.id('searchForm'); @@ -71,7 +72,7 @@ this.nav = document.id('nav'); this.welcome = document.id('welcome'); this.help = document.id('help'); - this.moreInfo = document.id('moreInfo'); + this.info = document.id('info'); }, /** @@ -216,6 +217,7 @@ var trackStart = function() { that.nowPlayingInfo.set('text', 'Currently playing:'); that.nowPlayingTrack.set('text', YAHOO.MediaPlayer.getMetaData().title); + that.download.set('href', YAHOO.MediaPlayer.getMetaData().anchor.get('href')); that.playPause.setStyle('background-position', '0px -40px'); // sprite offset // send a request to gather additional artist-information @@ -224,7 +226,9 @@ method: 'get', url: 'moosique/index.php', onSuccess: function(response) { - that.moreInfo.set('html', response); + that.info.set('html', response); + // make the additionals iframe-clickable + that.addLinkListItemToIframe(); } }).send('info=' + nowPlayingAlbum); }; @@ -327,12 +331,19 @@ addEventsToButtons: function() { var that = this; - // the previous/next-Track Buttons - that.prev.addEvent('click', function() { YAHOO.MediaPlayer.previous(); }); - that.next.addEvent('click', function() { YAHOO.MediaPlayer.next(); }); + that.prev.addEvent('click', function(e) { + e.stop(); + YAHOO.MediaPlayer.previous(); + }); + + that.next.addEvent('click', function(e) { + e.stop(); + YAHOO.MediaPlayer.next(); + }); // the Play-Pause Button - that.playPause.addEvent('click', function() { + that.playPause.addEvent('click', function(e) { + e.stop(); // STOPPED: 0, PAUSED: 1, PLAYING: 2,BUFFERING: 5, ENDED: 7 // see http://mediaplayer.yahoo.com/api/ if (YAHOO.MediaPlayer.getPlayerState() == 0 || @@ -345,12 +356,14 @@ }); // the Stop-Playing Button - that.stop.addEvent('click', function() { + that.stop.addEvent('click', function(e) { + e.stop(); that.stopPlaying(); }); // Mute-Toggle-Switch - that.mute.addEvent('click', function() { + that.mute.addEvent('click', function(e) { + e.stop(); if (YAHOO.MediaPlayer.getVolume() > 0) { YAHOO.MediaPlayer.setVolume(0); that.mute.setStyle('background-position', '0px -240px'); @@ -371,7 +384,6 @@ refreshPlaylist: function() { var that = this; YAHOO.MediaPlayer.addTracks(that.playlist, '', true); - that.displayStatusMessage('Playlist updated.'); }, @@ -385,6 +397,7 @@ that.nowPlayingInfo.set('text', 'Player stopped.'); that.nowPlayingTrack.set('text', '...'); that.nowPlayingTime.set('text', '0:00 / 0:00'); + that.download.set('href', '#'); YAHOO.MediaPlayer.stop(); // and reload the playlist that.refreshPlaylist(); @@ -392,18 +405,23 @@ /** - * Displays a status message + * Displays a status message, fades out nicely * * @param {String} message */ displayStatusMessage: function(message) { // Update Status and fade out var that = this; - that.status.set({ - 'text': message, - 'tween': {duration: that.options.messageFadeTime} + var fadeFX = new Fx.Tween(that.status, { + property: 'opacity', + duration: that.options.messageFadeTime / 2, + transition: Fx.Transitions.Expo.easeOut, + link: 'chain' }); - that.status.tween('opacity', [1, 0]); + + that.status.set('text', message); + fadeFX.start(0, 1); + fadeFX.start(1, 0); }, @@ -463,13 +481,6 @@ spinner.show(); that.searchSubmit.set('disabled', 'disabled'); that.showTab('home'); - // if the welcome-text ist present, cut & paste it to help - if (that.welcome) { - if (that.welcome.get('html').length > 100) { - that.help.set('html', that.welcome.get('html')); - that.welcome.destroy(); - } - } that.results.set('html', '<h2>Searching...</h2><p>Please be patient, this may take up to a minute...</p>'); }, @@ -601,10 +612,12 @@ var songs = Elements.from(response); var randomSong = songs.getRandom(); that.insertIntoPlaylist('<li>' + randomSong.get('html') + '</li>'); + that.displayStatusMessage('Added a random song to your playlist.'); } }).send('get=playlist&playlist=' + href + '&rel=' + rel); } else { - debug.log('You currently have no recommendations, adding a random one will not work.'); + that.displayStatusMessage('You currently have no recommendations, nothing was added.'); + debug.log('You currently have no recommendations, adding a random song will not work.'); } }, @@ -624,6 +637,25 @@ /** + * + * + */ + addLinkListItemToIframe: function() { + var that = this; + that.info.getElements('.linkList a').each(function(a) { + a.addEvent('click', function(e) { + e.stop(); + that.info.getElements('.linkList li').removeClass('active'); + a.getParent().addClass('active'); + href = a.get('href'); + that.info.getElements('iframe').set('src', href); + }); + }); + }, + + + + /** * Converts seconds into a string formatted minutes:seconds * with leading zeros for seconds for a nicer display * Modified: trunk/src/moosique.net/js/start.js =================================================================== --- trunk/src/moosique.net/js/start.js 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/js/start.js 2009-11-01 22:53:41 UTC (rev 1901) @@ -7,5 +7,5 @@ }; // Create an instance of the moosique.net -// TODO 0.025 for debugging purposes -var moo = new Moosique({ timeToScrobble: 0.025 }); +var moo = new Moosique({ timeToScrobble: 0.05 }); // debugging - shorter generation time +// var moo = new Moosique({ timeToScrobble: 0.5 }); Modified: trunk/src/moosique.net/moosique/classes/DataHelper.php =================================================================== --- trunk/src/moosique.net/moosique/classes/DataHelper.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/classes/DataHelper.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -36,8 +36,7 @@ $json = $this->connection->sparqlQuery($query); // convert to useable object $result = json_decode($json); - $resultObject = $result->results->bindings; - + $resultObject = $result->results->bindings; // prepare the data for HTML processing $data = $this->prepareData($resultObject, $type, $search); return $data; @@ -77,7 +76,10 @@ // prepend the album stream-information $mergedArray['albumID'] = $data['albumID']; } - + if ($type == 'info') { // same as artist, but only first array entry needed + $mergedArray = $this->mergeArray($data, 'artist'); + $mergedArray = current($mergedArray); + } // multidimensional array_unique for everything but single-tagSearch and playlist if ($type != 'playlist' && $type != 'tagSearch' && !is_array($search)) { $mergedArray = $this->arrayUnique($mergedArray); Modified: trunk/src/moosique.net/moosique/classes/Debugger.php =================================================================== --- trunk/src/moosique.net/moosique/classes/Debugger.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/classes/Debugger.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -32,7 +32,7 @@ * @param string $label The label for the object to log * @author Steffen Becker */ - public function log($var, $label) { + public function log($var, $label = '') { $this->fb->log($var, $label); } Modified: trunk/src/moosique.net/moosique/classes/LastFM.php =================================================================== --- trunk/src/moosique.net/moosique/classes/LastFM.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/classes/LastFM.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -9,17 +9,14 @@ */ class LastFM extends Config { - private $topTags; // save tags here - /** * Initializing class requires the last.fm username * * @param string $user The last.fm Username * @author Steffen Becker */ - function __construct($user) { + function __construct() { parent::__construct(); // init config - $this->getLastFMTags($user); } @@ -31,7 +28,7 @@ * @return array An array with the top tags for $user * @author Steffen Becker */ - private function getLastFMTags($user) { + public function getTags($user) { $allTags = array(); $requestUrl = $this->getConfigLastFM('topTagsUrl') . '&user=' . $user @@ -57,7 +54,8 @@ if ($this->debugger) $this->debugger->log($user, 'The last.fm-User does not exist. Please try again.'); } if ($this->debugger) $this->debugger->log($allTags, 'Found these Tags for the last.fm-User' . $user); - $this->topTags = $allTags; + + return $allTags; } @@ -113,15 +111,27 @@ /** - * Returns the topTags + * Returns the last.fm artist-page-URL vor a given musicbrainz-ID * - * @return array An Array of strings ('rock', 'doom metal' etc.) with the Top-Tags + * @param string $mbid The musicbrainz-ID + * @return string The URL to the last.fm-page of the artist, or false * @author Steffen Becker */ - public function getTopTags() { - return $this->topTags; + public function getArtistPage($mbid) { + // get the top artists for the user + $requestUrl = $this->getConfigLastFM('artistInfoUrl') + . '&mbid=' . $mbid + . '&api_key=' . $this->getConfigLastFM('apiKey'); + + $artistInfo = @simplexml_load_file($requestUrl); + + if ($artistInfo) { + return $artistInfo->artist->url; + } else { + return false; + } } - + } ?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/RequestHandler.php =================================================================== --- trunk/src/moosique.net/moosique/classes/RequestHandler.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/classes/RequestHandler.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -61,7 +61,11 @@ // concatenating the response from all 4 searches if ($type == 'allSearch') { $response .= $this->createSearch($search, 'artistSearch'); + // do a special search-String-formatting for the tagSearch part + $search = $this->cleanString($_GET['searchValue'], 'tagSearch'); $response .= $this->createSearch($search, 'tagSearch'); + // and reset it afterwards + $search = $this->cleanString($_GET['searchValue'], $type); $response .= $this->createSearch($search, 'albumSearch'); $response .= $this->createSearch($search, 'songSearch'); } @@ -73,8 +77,8 @@ // last.fm search, initiate the lastFM-Class and get the tags for // the user ($search) - then make tagSearches for every result if ($type == 'lastFM') { - $lastFM = new LastFM($search); - $tags = $lastFM->getTopTags(); + $lastFM = new LastFM(); + $tags = $lastFM->getTags($search); // no we have the topTags, do a search for related albums if (!empty($tags)) { foreach($tags as $tag) { @@ -123,8 +127,7 @@ // ========== ARTIST INFORMATION REQUEST ============= // TODO artist info, not yet implemented if (isset($_GET['info']) && !(empty($_GET['info']))) { - $currentAlbum = $_GET['info']; - $response .= '<p>Artist Information coming soon...</p>'; + $response .= $this->createSearch($_GET['info'], 'info'); } @@ -203,7 +206,6 @@ if ((strpos($string, " ") > 0) && ($type == 'lastFM' || $type == 'tagSearch')) { $string = explode(" ", $string); } - return $string; } Modified: trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php =================================================================== --- trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -67,6 +67,7 @@ case 'albumSearch' : $query = $this->queryAlbumSearch($search); break; case 'songSearch' : $query = $this->querySongSearch($search); break; case 'recommendations' : $query = $this->queryRecommendations($search); break; + case 'info' : $query = $this->queryInfo($search); break; } // save the query $this->queryString = $prefixes . $beginStatement . $baseQuery . $query . $endStatement; @@ -86,7 +87,7 @@ tags:taggedWithTag ?tag . OPTIONAL { ?artist foaf:img ?image . } - OPTIONAL { ?artist foaf:homepage ?artistHomepage . } + OPTIONAL { ?artist foaf:homepage ?homepage . } }'; $queryString .= 'FILTER (regex(str(?artistName), "' . $search . '", "i")) . '; @@ -112,8 +113,8 @@ mo:available_as ?playlist . OPTIONAL { - ?record mo:image ?image . - FILTER (regex(str(?image), "1.100.jpg", "i")) . + ?record mo:image ?cover . + FILTER (regex(str(?cover), "1.100.jpg", "i")) . } } '; $queryString .= ' FILTER (regex(str(?tag), "' . $search . '", "i")) . '; @@ -145,8 +146,8 @@ $queryString .= ' mo:available_as ?playlist . OPTIONAL { - ?record mo:image ?image . - FILTER (regex(str(?image), "1.100.jpg", "i")) . + ?record mo:image ?cover . + FILTER (regex(str(?cover), "1.100.jpg", "i")) . } } '; return $queryString; @@ -166,8 +167,8 @@ mo:available_as ?playlist . OPTIONAL { - ?record mo:image ?image . - FILTER (regex(str(?image), "1.100.jpg", "i")) . + ?record mo:image ?cover . + FILTER (regex(str(?cover), "1.100.jpg", "i")) . } } '; @@ -210,22 +211,51 @@ $queryString = ' { ?record mo:available_as ?playlist ; - OPTIONAL { ?artist foaf:img ?artistImage . } - OPTIONAL { ?artist foaf:homepage ?artistHomepage . } OPTIONAL { - ?record mo:image ?image . - FILTER (regex(str(?image), "1.100.jpg", "i")) . + ?record mo:image ?cover . + FILTER (regex(str(?cover), "1.100.jpg", "i")) . } } '; // TODO ?record tags:taggedWithTag ?tag makes the queries blow up high + // TODO: use artistImage/Homepage etc. additional info in display + // OPTIONAL { ?artist foaf:img ?image . } + // OPTIONAL { ?artist foaf:homepage ?artistHomepage . } + // and finally we append the sparql-string from kb-Description-Conversion $queryString .= $search; return $queryString; } - + /** + * Creates the SPARQL-Query part for additional artist information + * + * @param string $search The relation, an album, sth like + * @return void + * @author Steffen Becker + */ + private function queryInfo($search) { + $queryString = ' { + ?artist foaf:made <' . $search . '> . + ?record mo:available_as ?playlist ; + tags:taggedWithTag ?tag . + + OPTIONAL { ?artist foaf:img ?image . } + OPTIONAL { ?artist foaf:homepage ?homepage . } + OPTIONAL { ?artist foaf:based_near ?location . } + OPTIONAL { ?artist owl:sameAs ?sameAs . } + + OPTIONAL { + ?record mo:image ?cover . + FILTER (regex(str(?cover), "1.100.jpg", "i")) . + } + } '; + return $queryString; + } + + + /** * Returns the final Query-String * * @return string The final Complete SPARQL-Query Modified: trunk/src/moosique.net/moosique/classes/View.php =================================================================== --- trunk/src/moosique.net/moosique/classes/View.php 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/classes/View.php 2009-11-01 22:53:41 UTC (rev 1901) @@ -58,11 +58,12 @@ case 'songSearch' : $this->html = '<h2>No songs found for »' . $searchText . '«</h2>'; break; case 'lastFM' : $this->html = '<h2>The last.fm-user »' . $searchText . '« does not exist.</h2>'; break; case 'recommendations' : $this->html = '<h2>' . $data . '</h2>'; break; + case 'info' : $this->html = '<h2>Could not find any information about the currently playing song or artist.</h2>'; } } else { // finally we are producing html, depending on the type of request - // use the limits on the data before creating html, except for the playlist-html - if ($type != 'playlist') { + // use the limits on the data before creating html, except for the playlist-html and more info + if ($type != 'playlist' && $type != 'info') { $data = $this->limitData($data); } @@ -92,6 +93,9 @@ case 'recommendations' : $this->recommendationsHTML($data, $type); break; + case 'info' : + $this->infoHTML($data, $type); + break; case 'playlist' : $this->playlistHTML($data); break; @@ -154,8 +158,7 @@ if (is_array($recordArray)) { foreach($recordArray as $key => $record) { $records .= '<li><a class="addToPlaylist" href="' - // remove the last part of the uri, defaults to mp3, because - // the yahooMediaPlayer can't play ogg + // remove the last part of the uri, defaults to mp3, because the yahooMediaPlayer can't play ogg . str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $artist['playlist']['value'][$key]) . '" rel="' . $artist['record']['value'][$key] . '">' . $this->getValue($artist['artistName']) . ' - ' @@ -170,12 +173,12 @@ } $artistName = $this->getValue($artist['artistName']); - $image = $this->getImage($artist, $artistName); + $image = $this->getImage($artist, 'Image of ' . $artistName); $tags = $this->getTagList($artist['tag']); $homepage = ''; // homepagelink if avaiable - if (!empty($artist['artistHomepage'])) { - $homepage = '<a href="' . $this->getValue($artist['artistHomepage']) . '">(Homepage)</a>'; + if (!empty($artist['homepage'])) { + $homepage = '<a href="' . $this->getValue($artist['homepage']) . '">(Homepage)</a>'; } $this->html .= sprintf($template, @@ -189,13 +192,12 @@ /** - * Returns the HTML for tagSearch results + * Builds the HTML for tagSearch results * This is somewhat special, we first create a list of found tags, * and then we list the albums found for those tags * * @param array $data The result-Array to create HTML from * @param string $type type of search to get the template - * @return string HTML for a tagSearch * @author Steffen Becker */ private function tagSearchHTML($data, $type) { @@ -243,7 +245,7 @@ $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' . $artistName . ' - ' . $albumTitle . '">Click here to add this album to your playlist</a></li>'; - $image = $this->getImage($tag, $artistName. ' - ' . $albumTitle, $j); + $image = $this->getImage($tag, 'Cover for ' . $artistName. ' - ' . $albumTitle, $j, 'cover'); $this->html .= sprintf($template, $class, $image, $artistName, $albumTitle, $addToPlaylist @@ -256,11 +258,10 @@ /** - * Returns the HTML for albumSearch results + * Builds the HTML for albumSearch results * * @param array $data The result-Array to create HTML from * @param string $type type of search to get the template - * @return string HTML for a albumSearch * @author Steffen Becker */ private function albumSearchHTML($data, $type) { @@ -280,7 +281,7 @@ $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' . $artistName . ' - ' . $albumTitle . '">Click here to add this album to your playlist</a></li>'; - $image = $this->getImage($album, $artistName . ' - ' . $albumTitle); + $image = $this->getImage($album, 'Cover for ' . $artistName . ' - ' . $albumTitle, 0, 'cover'); $tags = $this->getTagList($album['tag']); $this->html .= sprintf($template, @@ -294,11 +295,10 @@ /** - * Returns the HTML for songSearch results + * Builds the HTML for songSearch results * * @param array $data The result-Array to create HTML from * @param string $type type of search to get the template - * @return string HTML for a songSearch * @author Steffen Becker */ private function songSearchHTML($data, $type) { @@ -320,7 +320,7 @@ . $artistName . ' - ' . $songTitle . '">Click here to add this song to your playlist</a></li>'; $tags = $this->getTagList($song['tag']); - $image = $this->getImage($song, $artistName); + $image = $this->getImage($song, 'Image of ' . $artistName); $this->html .= sprintf($template, $class, $artistName . ' - ' . $songTitle, $image, $tags, $addToPlaylist @@ -333,11 +333,11 @@ /** - * Returns the HTML for recommendations + * Builds the HTML for recommendations + * TOOD enhance display: more info * * @param array $data The result-Array to create HTML from * @param string $type type of search to get the template - * @return string HTML for recommendations * @author Steffen Becker */ private function recommendationsHTML($data, $type) { @@ -369,7 +369,7 @@ $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' . $artistName . ' - ' . $albumTitle . '">Click here to add this album to your playlist</a></li>'; - $image = $this->getImage($result, $artistName . ' - ' . $albumTitle); + $image = $this->getImage($result, 'Cover for ' . $artistName . ' - ' . $albumTitle, 0, 'cover'); $this->html .= sprintf($template, $class, $image, $artistName, $albumTitle, $addToPlaylist @@ -379,17 +379,97 @@ $this->html .= '</ul>'; } } else { - $this->html = '<h2>Could not create any recommendations...</h2>'; + $this->html = '<h2>Could not create any recommendations.</h2>'; $this->html .= '<p>Listen to some more music or reset your recently listened to list.</p>'; } } + /** + * Builds the HTML for additional information for and artist + * + * @param array $data An array of additional information + * @author Steffen Becker + */ + private function infoHTML($data, $type) { + $template = $this->getTemplate($type); + $albumTemplate = $this->getTemplate('tagSearch'); + $artist = $this->getValue($data['artist']); + $artistName = $this->getValue($data['artistName']); + $image = $this->getImage($data, $artistName); + $tags = $this->getTagList($data['tag']); + $homepage = ''; + if (isset($data['homepage'])) { + $homepage = '<p>Homepage: <a href="' . $this->getValue($data['homepage']) . '">' + . $this->getValue($data['homepage']) . '</a></li>'; + } + $albumList = ''; + $records = $this->getValue($data['record']); + if (is_array($records)) { + // if there is more than one record... + $j = 0; + foreach($records as $key => $record) { + if (($j % 2) == 0) { $class = 'odd'; } else { $class = ''; } + $albumTitles = $this->getValue($data['albumTitle']); + $playlists = $this->getValue($data['playlist']); + $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getValue($data['playlist'], $key)); + $cover = $this->getImage($data, 'Cover for '. $albumTitles[$key], $key, 'cover'); + $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' + . $artistName . ' - ' . $albumTitles[$key] . '">Click here to add this album to your playlist</a></li>'; + // use the template + $albumList .= sprintf($albumTemplate, + $class, $cover, $artistName, $albumTitles[$key], $addToPlaylist + ); + $j++; + } + } else { // only one record + $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getValue($data['playlist'])); + $addToPlaylist = '<li><a rel="' . $records . '" class="addToPlaylist" href="' . $playlist . '" title="' + . $artistName . ' - ' . $this->getValue($data['albumTitle']) . '">Click here to add this album to your playlist</a></li>'; + + $albumList .= sprintf($albumTemplate, + '', $this->getImage($data, 'Cover for '. $this->getValue($data['albumTitle']), 0, 'cover'), + $artistName, $this->getValue($data['albumTitle']), $addToPlaylist + ); + } + + $additionalInfo = ''; + if (isset($data['location'])) { + $additionalInfo .= '<li><a href="' . $this->getValue($data['location']) . '">Geonames Location</a></li>'; + } + if (isset($data['sameAs'])) { + // woot! we have a musicbrainz-ID, fetch more information, and link profiles + $link = $this->getValue($data['sameAs']); + $mbid = str_replace('http://zitgist.com/music/artist/', '', $link); + + $additionalInfo .= '<li><a href="' . $link . '">Zitgist-Dataviewer</a></li>'; + // append musicbrainz-link + $mbLink = 'http://musicbrainz.org/show/artist/?mbid=' . $mbid; + $additionalInfo .= '<li><a href="' . $mbLink . '">Musicbrainz profile</a></li>'; + // append last-fm information, if avaiable + $last = new LastFM(); + $lastfmLink = $last->getArtistPage($mbid); + if ($lastfmLink) { + $additionalInfo .= '<li><a href="' . $lastfmLink . '">Artist page on last.fm</a></li>'; + } + } + // show the frame if we have additional information + if (isset($data['location']) || isset($data['sameAs'])) { + $additionalInfo = '<h3>Information from external sources</h3><ul class="linkList">' . $additionalInfo; + $additionalInfo .= '</ul><iframe src=""></iframe>'; + } + + $this->html .= sprintf($template, + $artistName, $image, $tags, $homepage, $albumList, $additionalInfo + ); + + } + + /** - * Returns a list of <li>s with playlist-entries, no surrounding <ul> + * Builds a list of <li>s with playlist-entries, no surrounding <ul> * * @param array $data An array of playlist-items - * @return string playlist-HTML ready to use * @author Steffen Becker */ private function playlistHTML($data) { @@ -420,15 +500,16 @@ * @param array $image The complete result-array * @param string $altText The alt-Text the image will have * @param int $index optional, used for getValue for specific value-retrieval - * @return void + * @param string $type optional, default is image, can be set to 'cover' + * @return string The <img>-Tag * @author Steffen Becker */ - private function getImage($image, $altText, $index = 0) { + private function getImage($image, $altText, $index = 0, $type = 'image') { // in most cases the image is optional, so it could be empty $img = '<img src="img/noimage.png" alt="No image found..." />'; - if (isset($image['image'])) { - $image = $image['image']; - if (!empty($image)) { + if (isset($image[$type])) { + $image = $image[$type]; + if ($this->getValue($image, $index)) { $img = '<img src="' . $this->getValue($image, $index) . '" alt="' . $altText . '" />'; } } @@ -474,7 +555,7 @@ <strong>Tags:</strong><br/ > <p>%s</p> <p> - <strong>Avaiable records:</strong><br /> + <strong>Avaiable albums:</strong><br /> </p> <ul>%s</ul> <p>Click on an album to add it to your playlist.</p> @@ -492,14 +573,29 @@ } if ($type == 'albumSearch' || $type == 'songSearch') { $template = ' - <li class="clearfix %s"> - <h3>%s</h3> - <div class="image">%s</div> - <p>Tags: %s</p> - <ul>%s</ul> - </li> - '; + <li class="clearfix %s"> + <h3>%s</h3> + <div class="image">%s</div> + <p>Tags: %s</p> + <ul>%s</ul> + </li> + '; } + if ($type == 'info') { + $template = ' + <h2>More Information for »%s«</h2> + <div class="image">%s</div> + <p>Tags: %s</p> + %s + <h3>Avaiable albums</h3> + <div class="results"> + <ul> + %s + </ul> + </div> + %s + '; + } return $template; } @@ -522,7 +618,11 @@ return $value[0]; } if (count($value) > 1 && $index !== false) { - return $value[$index]; + if (isset($value[$index])) { // the index could not be set + return $value[$index]; + } else { + return ''; + } } else { // an array is requested, tagList for example return $value; } Modified: trunk/src/moosique.net/moosique/config.ini =================================================================== --- trunk/src/moosique.net/moosique/config.ini 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/config.ini 2009-11-01 22:53:41 UTC (rev 1901) @@ -37,6 +37,7 @@ topTagsUrl = "http://ws.audioscrobbler.com/2.0/?method=user.gettoptags" topArtistsUrl = "http://ws.audioscrobbler.com/2.0/?method=user.gettopartists" artistsTopTagsUrl = "http://ws.audioscrobbler.com/2.0/?method=artist.gettoptags" +artistInfoUrl = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo" ; number of tags we fetch results for topTags = 5 ; if the user has no tags, number of artists to fetch tags for Modified: trunk/src/moosique.net/moosique/main.wsdl =================================================================== --- trunk/src/moosique.net/moosique/main.wsdl 2009-10-29 08:18:43 UTC (rev 1900) +++ trunk/src/moosique.net/moosique/main.wsdl 2009-11-01 22:53:41 UTC (rev 1901) @@ -0,0 +1,1520 @@ +<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> + <types> + <xsd:schema> + <xsd:import schemaLocation="def0.xsd" namespace="http://server.dllearner.org/"></xsd:import> + </xsd:schema> + <xsd:schema> + <xsd:import schemaLocation="def1.xsd" namespace="http://jaxb.dev.java.net/array"></xsd:import> + </xsd:schema> + </types> + <message name="init"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="initResponse"></message> + <message name="ClientNotKnownException"> + <part element="tns:ClientNotKnownException" name="fault"></part> + </message> + <message name="UnknownComponentException"> + <part element="tns:UnknownComponentException" name="fault"></part> + </message> + <message name="ComponentInitException"> + <part element="tns:ComponentInitException" name="fault"></part> + </message> + <message name="stop"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="stopResponse"></message> + <message name="getBuild"></message> + <message name="getBuildResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="ping"></message> + <message name="pingResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="generateID"></message> + <message name="generateIDResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getComponents"></message> + <message name="getComponentsResponse"> + <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + </message> + <message name="getKnowledgeSources"></message> + <message name="getKnowledgeSourcesResponse"> + <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> + </message> + <message name="getReasoners"></message> + <message name="getReasonersResponse"> + <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> + </message> + <message name="getLearningProblems"></message> + <message name="getLearningProblemsResponse"> + <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> + </message> + <message name="getLearningAlgorithms"></message> + <message name="getLearningAlgorithmsResponse"> + <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> + </message> + <message name="getConfigOptions"> + <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionsResponse"> + <part xmlns:ns6="http://jaxb.dev.java.net/array" name="return" type="ns6:stringArray"></part> + </message> + <message name="addKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="addKnowledgeSourceResponse"> + <part name="return" type="xsd:int"></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> + </message> + <message name="removeKnowledgeSourceResponse"></message> + <message name="setReasoner"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setReasonerResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningProblem"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningProblemResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningAlgorithm"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningAlgorithmResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="LearningProblemUnsupportedException"> + <part element="tns:LearningProblemUnsupportedException" name="fault"></part> + </message> + <message name="initAll"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="initAllResponse"></message> + <message name="learn"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="learnResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnDescriptionsEvaluated"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnDescriptionsEvaluatedResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptions"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptionsResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnDescriptionsEvaluatedLimit"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="learnDescriptionsEvaluatedLimitResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnThreaded"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnThreadedResponse"></message> + <message name="getCurrentlyBestConcept"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestConceptResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConcepts"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConceptsResponse"> + <part xmlns:ns7="http://jaxb.dev.java.net/array" name="return" type="ns7:stringArray"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptionsFiltered"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:double"></part> + <part name="arg3" type="xsd:boolean"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptionsFilteredResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="isAlgorithmRunning"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="... [truncated message content] |
From: <hee...@us...> - 2009-10-29 08:18:50
|
Revision: 1900 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1900&view=rev Author: heeroyuy Date: 2009-10-29 08:18:43 +0000 (Thu, 29 Oct 2009) Log Message: ----------- -fixed bug Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-28 23:45:32 UTC (rev 1899) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-29 08:18:43 UTC (rev 1900) @@ -40,8 +40,9 @@ /** * This class takes care of all events happening in the GraphicalCoveragePanel. - * It renders the Informations for the individual points and sets the + * It renders the Informations for the individual points and sets the * individuals for the popup component. + * * @author Christian Koetteritzsch * */ @@ -104,7 +105,7 @@ panel.getGraphicalCoveragePanel().setToolTipText( "To view all Individuals please click on the plus"); } - + Vector<IndividualPoint> v = panel.getIndividualVector(); FastInstanceChecker reasoner = model.getReasoner(); for (int i = 0; i < v.size(); i++) { @@ -112,28 +113,43 @@ && v.get(i).getXAxis() <= m.getX() + 5 && v.get(i).getYAxis() >= m.getY() - 5 && v.get(i).getYAxis() <= m.getY() + 5) { - String individualInformation = "<html><body>" + v.get(i).getIndividualName().toString(); - Set<NamedClass> types = reasoner.getTypes(v.get(i).getDLLearnerIndividual()); - individualInformation += "<br><b>Types:</b><br>"; - for(NamedClass dlLearnerClass : types) { - individualInformation += dlLearnerClass.toManchesterSyntaxString(v.get(i).getBaseUri(), null) + "<br>"; - } - Map<ObjectProperty,Set<Individual>> objectProperties = reasoner.getObjectPropertyRelationships(v.get(i).getDLLearnerIndividual()); - Set<ObjectProperty> key = objectProperties.keySet(); - individualInformation += "<br><b>Objectproperties:</b><br>"; - for(ObjectProperty objectProperty: key) { - Set<Individual> indiSet = objectProperties.get(objectProperty); - individualInformation = individualInformation + objectProperty.toManchesterSyntaxString(v.get(i).getBaseUri(), null) + " "; - for(Individual indi: indiSet) { - individualInformation += indi.toManchesterSyntaxString(v.get(i).getBaseUri(), null); - if(indiSet.size() > 1) { - individualInformation += ", "; + String individualInformation = "<html><body>" + + v.get(i).getIndividualName().toString(); + if (v.get(i).getDLLearnerIndividual() != null) { + Set<NamedClass> types = reasoner.getTypes(v.get(i) + .getDLLearnerIndividual()); + individualInformation += "<br><b>Types:</b><br>"; + for (NamedClass dlLearnerClass : types) { + individualInformation += dlLearnerClass + .toManchesterSyntaxString( + v.get(i).getBaseUri(), null) + + "<br>"; + } + Map<ObjectProperty, Set<Individual>> objectProperties = reasoner + .getObjectPropertyRelationships(v.get(i) + .getDLLearnerIndividual()); + Set<ObjectProperty> key = objectProperties.keySet(); + individualInformation += "<br><b>Objectproperties:</b><br>"; + for (ObjectProperty objectProperty : key) { + Set<Individual> indiSet = objectProperties + .get(objectProperty); + individualInformation = individualInformation + + objectProperty.toManchesterSyntaxString(v + .get(i).getBaseUri(), null) + " "; + for (Individual indi : indiSet) { + individualInformation += indi + .toManchesterSyntaxString(v.get(i) + .getBaseUri(), null); + if (indiSet.size() > 1) { + individualInformation += ", "; + } } + individualInformation += "<br>"; } - individualInformation += "<br>"; } individualInformation += "</body></htlm>"; - panel.getGraphicalCoveragePanel().setToolTipText(individualInformation); + panel.getGraphicalCoveragePanel().setToolTipText( + individualInformation); } } } @@ -165,9 +181,10 @@ if (i > 0) { for (Individual ind : covInd) { Set<String> uriString = model.getOntologyURIString(); - for(String uri : uriString) { - if(ind.toString().contains(uri)) { - individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + for (String uri : uriString) { + if (ind.toString().contains(uri)) { + individualComboBox.add(ind + .toManchesterSyntaxString(uri, null)); } } } @@ -199,9 +216,10 @@ if (i > 0) { for (Individual ind : addInd) { Set<String> uriString = model.getOntologyURIString(); - for(String uri : uriString) { - if(ind.toString().contains(uri)) { - individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + for (String uri : uriString) { + if (ind.toString().contains(uri)) { + individualComboBox.add(ind + .toManchesterSyntaxString(uri, null)); } } } @@ -227,9 +245,10 @@ if (i > 0) { for (Individual ind : notCovInd) { Set<String> uriString = model.getOntologyURIString(); - for(String uri : uriString) { - if(ind.toString().contains(uri)) { - individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + for (String uri : uriString) { + if (ind.toString().contains(uri)) { + individualComboBox.add(ind + .toManchesterSyntaxString(uri, null)); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <neb...@us...> - 2009-10-28 23:45:41
|
Revision: 1899 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1899&view=rev Author: nebelschwade Date: 2009-10-28 23:45:32 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Nice Code-Documentation and Whitespace for everything. Modified Paths: -------------- trunk/src/moosique.net/README.txt trunk/src/moosique.net/css/index.php trunk/src/moosique.net/css/reset.css trunk/src/moosique.net/css/style.css trunk/src/moosique.net/index.php trunk/src/moosique.net/js/debug.js trunk/src/moosique.net/js/index.php trunk/src/moosique.net/js/moosique.js trunk/src/moosique.net/js/start.js trunk/src/moosique.net/moosique/classes/Config.php trunk/src/moosique.net/moosique/classes/DataHelper.php trunk/src/moosique.net/moosique/classes/Debugger.php trunk/src/moosique.net/moosique/classes/DllearnerConnection.php trunk/src/moosique.net/moosique/classes/LastFM.php trunk/src/moosique.net/moosique/classes/Recommendations.php trunk/src/moosique.net/moosique/classes/RequestHandler.php trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php trunk/src/moosique.net/moosique/classes/View.php trunk/src/moosique.net/moosique/index.php trunk/src/moosique.net/moosique/main.wsdl Modified: trunk/src/moosique.net/README.txt =================================================================== --- trunk/src/moosique.net/README.txt 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/README.txt 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,6 +1,8 @@ Installation-Requirements: ========================== +TODO: write me! + See /moosique/config.ini - PHP 5.2.x Modified: trunk/src/moosique.net/css/index.php =================================================================== --- trunk/src/moosique.net/css/index.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/css/index.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,14 +1,18 @@ <?php -/* This little Script takes all included css-files and +/** + * This little Script takes all included css-files and * compresses them by removing comments, line-breaks and * useless space-characters + * + * @package moosique.net + * @author Steffen Becker */ header('Content-type: text/css'); // set offset to 365 days = 1 year $offset = 60 * 60 * 24 * 365; header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $offset) . ' GMT'); -ob_start('compress'); /* uncomment for deployment, smaller css-files */ +ob_start('compress'); /* comment for development, smaller css-files */ // ob_start(); function compress($buffer) { Modified: trunk/src/moosique.net/css/reset.css =================================================================== --- trunk/src/moosique.net/css/reset.css 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/css/reset.css 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,4 +1,4 @@ -/* default minimal basic css reset */ +/* default minimal basic css reset by Steffen Becker */ /* =================================================================== */ @media all { html, body, div, h1, h2, h3, Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/css/style.css 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,3 +1,16 @@ +/* moosique.net by Steffen Becker + +Colors are: + +Green: 1fd611 +Background-Grey: 3a3a3a +Button-BG-Grey 4a4a4a +Highlight-Grey: 5a5a5a +Dark-Grey: 292929 +White (Text): f1f7e4 + +*/ + @media screen { /*=============== Default Styling ===============*/ body { font: normal 12px/18px Verdana, Arial, sans-serif; color: #f1f7e4; @@ -45,7 +58,7 @@ #playerControls { position: absolute; top: 70px; right: 0; width: 170px; height: 60px; padding: 10px 20px; background: #292929; } #playerControls a:active { position: relative; top: 2px; } -#status { background: #393939; height: 60px; line-height: 60px; text-align: center; +#status { background: #3a3a3a; height: 60px; line-height: 60px; text-align: center; font-weight: bold; border: 1px solid #1fd611; z-index: 1000; } #playing span { display: block; margin-bottom: 0; font-size: 10px; } #playing .track { font: bold 12px/32px Verdana, Arial, sans-serif; } @@ -83,8 +96,8 @@ /*=============== Search Results, Recommendations & Playlist ===============*/ .results h3 a { font-weight: normal; } -.results img { border: 2px solid #545454; max-width: 308px; max-height: 308px; } -.results li { float: left; width: 312px; border: 1px solid #545454; padding: 18px; margin-bottom: 18px; } +.results img { border: 2px solid #5a5a5a; max-width: 308px; max-height: 308px; } +.results li { float: left; width: 312px; border: 1px solid #5a5a5a; padding: 18px; margin-bottom: 18px; } .results li.odd { margin-right: 18px; clear: both; } .results ul ul { list-style: disc; } .results li li, Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/index.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,4 +1,11 @@ -<?php session_start(); ?> +<?php + session_start(); + /* + Welcome to moosique.net - a semantic web based internet-radio + + see README.txt for more details + */ +?> <!DOCTYPE html> <html lang="en"> <head> @@ -146,7 +153,7 @@ <?php include('moosique/classes/Config.php'); $c = new Config(); - if ($c->getConfig('debug') == 1) /* debugging active */ { + if ($c->getConfig('debug') == 1) /* if debugging is active include js without compressing anything */ { ?> <script src="http://mediaplayer.yahoo.com/js"></script> <script src="js/mootools-1.2.4-core-nc.js"></script> Modified: trunk/src/moosique.net/js/debug.js =================================================================== --- trunk/src/moosique.net/js/debug.js 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/js/debug.js 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,4 +1,9 @@ -// New Debugger-Class using the mootools-log +/** + * Debugger-Class using the mootools-log + * + * @package moosique.net + * @author Steffen Becker + */ var Debugger = new Class({ Implements: Log, initialize: function(){ Modified: trunk/src/moosique.net/js/index.php =================================================================== --- trunk/src/moosique.net/js/index.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/js/index.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,8 +1,12 @@ <?php -/* This little Script takes all included js-files and +/** + * This little Script takes all included js-files and * compresses them with the PHP-Variant of js-min * found here: http://code.google.com/p/jsmin-php/ - * This file is only used in non-debugging-mode + * This is only used in non-debugging-mode + * + * @package moosique.net + * @author Steffen Becker */ header('Content-type: application/javascript'); $offset = 60 * 60 * 24 * 365; // set offset to 365 days = 1 year Modified: trunk/src/moosique.net/js/moosique.js =================================================================== --- trunk/src/moosique.net/js/moosique.js 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/js/moosique.js 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,8 +1,11 @@ /** * moosique-Player-Class * + * TODO * * + * @package moosique.net + * @author Steffen Becker */ var Moosique = new Class({ Implements: Options, @@ -76,7 +79,6 @@ * for the YMP-Events and initializes the Player. Events are: * onProgress, onPlaylistUpdate, onTrackPause, onTrackStart, onTrackComplete * where onProgress is the most important event-handler, because this is where the learning-process is fired - * */ applyYahooMediaPlayerConfig: function() { var that = this; @@ -252,7 +254,6 @@ /** * Send an ajax-request to generate the recommendations and passes the * result to the corresponding html-container - * */ generateRecommendations: function() { var that = this; @@ -294,7 +295,6 @@ /** * Updates the recently-Listened-To UL-List Element with the contents * from the recentlyListened-Cookie and makes them re-addable to the playlist - * */ updateRecently: function() { var that = this; @@ -378,7 +378,6 @@ /** * This function stops the player and displays the default * status-message "Player stopped", also refreshes the playlist - * */ stopPlaying: function() { var that = this; @@ -411,7 +410,6 @@ /** * Adds click-Events to the Interface for Tabs and invokes * addEventsToButtons() - * */ initInterface: function() { var that = this; @@ -448,7 +446,7 @@ this.addEventsToButtons(); }, - + /** * Make the search-Form an ajax-Search form, displaying the results * on the homepage if successful @@ -499,7 +497,6 @@ }, - /** * For Recommendations and Search-Results * This function searches for all links with the class addToPlaylist @@ -520,11 +517,11 @@ // determine if the link is to an album or a single track var href = a.get('href'); var rel = a.get('rel'); - + var type = ''; if (href.match(/jamendo\.com\/get\/track\/id\//gi)) { type = 'playlist'; } if (href.match(/\.mp3/)) { type = 'mp3File'; } - + // if the addable item is a playlist, we have to get the playlistitems if (type == 'playlist') { var getPlaylist = new Request({method: 'get', url: 'moosique/index.php', @@ -586,7 +583,6 @@ /** * This function adds a random song from a random record from the * recommendations results to the playlist (enqueue at the end) - * */ addRandomToPlaylist: function() { var that = this; Modified: trunk/src/moosique.net/js/start.js =================================================================== --- trunk/src/moosique.net/js/start.js 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/js/start.js 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,4 +1,4 @@ -// Default Player Config for moosique.net +// Default Yahoo Media Player Config for moosique.net var YMPParams = { autoplay: false, parse: false, // do not parse initial content Modified: trunk/src/moosique.net/moosique/classes/Config.php =================================================================== --- trunk/src/moosique.net/moosique/classes/Config.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/Config.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,8 +1,11 @@ <?php /** - * A General Config-Class for retrieving values from config.ini - * and initializing the Debugger + * The basic Config class, stores all configuration in itself and + * initializes a debugger if debugging is active + * + * @package moosique.net + * @author Steffen Becker */ class Config { @@ -12,6 +15,7 @@ /** * On Class initialization, read the ini file to get * the config values and hand them to $this->config + * and create a new debugger-class if debugging is activated */ function __construct() { $this->config = parse_ini_file(dirname(__FILE__) . '/../config.ini', true); @@ -41,8 +45,8 @@ /** * Returns the value of a last-fm config-entry from config.ini * - * @return String The wanted Configvalue - * @param String Value for the wanted Configvalue + * @return string The wanted LastFM-Configvalue + * @param string Value for the wanted Configvalue */ public function getConfigLastFM($value) { return $this->config['lastFM'][$value]; @@ -52,13 +56,15 @@ /** * Returns the value of an URL defined in config.ini * - * @return String The wanted Url - * @param String Value for the wanted Url + * @return string The wanted Url + * @param string Value for the wanted Url */ public function getConfigUrl($value) { - if ($value == 'wsdlLocal' || $value == 'allTags' || $value == 'allRecords') { + // prepend base-url for wsdl and allRecords + if ($value == 'wsdlLocal' || $value == 'allRecords') { return $this->config['url']['base'] . $this->config['url'][$value]; } + // prepend absPath (file:/) for ontology if ($value == 'tagOntology') { return 'file:' . $this->config['url']['absPath'] . $this->config['url'][$value]; } @@ -67,10 +73,10 @@ /** - * This funtion returns one (if specified) or all learning-Config entries from config.ini + * This funtion returns one (if specified) or all learning-Config values from config.ini * - * @param String Value for a single learning-Configuration - * @return Mixed The wanted value as a string, or - if not specified - complete learingConfig as an array + * @param string Value for a single learning-Configuration, optional + * @return mixed The wanted value as a string, or - if not specified - complete learingConfig as an array */ public function getConfigLearning($prefix = false) { @@ -89,8 +95,8 @@ /** * This funtion returns one (if specified) or all prefixes from the config.ini * - * @param String String-Value for a single prefix - * @return Mixed The wanted prefix as a string, or - if not specified - all Prefixes as an array + * @param string String-Value for a single prefix, optional + * @return mixed The wanted prefix as a string, or - if not specified - all Prefixes as an array */ public function getConfigPrefixes($prefix = false) { if ($prefix !== false) { @@ -106,5 +112,4 @@ } - ?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/DataHelper.php =================================================================== --- trunk/src/moosique.net/moosique/classes/DataHelper.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/DataHelper.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,13 +1,19 @@ <?php - +/** + * This class provides functions to get Data from the SPARQL-Endpoints + * and to prepare and use this data with different array/object methods + * + * @package moosique.net + * @author Steffen Becker + */ class DataHelper extends Config { - public $connection; + public $connection; // here we save the dl-learnerconnection for public access /** - * - * - * + * Get config (parent) and establish a connection to the dl-learner webservice + * + * @author Steffen Becker */ function __construct() { parent::__construct(); // init config @@ -16,8 +22,12 @@ /** + * Get Data from a search using a SPARQL-Requst over the DL-Learner * - * + * @param mixed $search String/Array with the search-Value, array for more than one value + * @param string $type the type of search performed (tagSearch, albumSearch etc.) + * @return array The resulting Data, prepared and ready for use + * @author Steffen Becker */ public function getData($search, $type) { $sparql = new SparqlQueryBuilder($search, $type); @@ -38,10 +48,12 @@ * Cleans up objects or retrieves them from a XML-File (for playlists) * and converts them into arrays for use in the view class * - * @param Mixed $data The Data-Object (from a Sparql-Query or a playlist-array) - * @param String $type To define what kind of data to prepare - * @return Array A multidimensional Array ready for processing for HTML-output - */ + * @param mixed $data The Data-Object (from a Sparql-Query or a playlist-array) + * @param string $type the type of search performed (tagSearch, albumSearch etc.) + * @param mixed $search String/Array with the search-Value, array for more than one value + * @return array A multidimensional Array ready for processing for HTML-output + * @author Steffen Becker + */ public function prepareData($data, $type, $search) { $mergedArray = array(); @@ -78,11 +90,12 @@ /** * This function merges the result-Object to a nice array * we can process easily. The array is created by type, - * returning the data sorted for artist, tag or song + * returning the data sorted for artist, tag or song etc. * - * @param Object $data - * @param String $type This can be 'artist', 'tag' or 'song' - * @return Array A Multidimensional array sorted by type for output-use + * @param object $data + * @param string $type This can be 'artist', 'tag' or 'song' etc. without 'Search' + * @return array a Multidimensional array sorted by type for output-use (or false) + * @author Steffen Becker */ private function mergeArray($data, $type) { // convert the $data-response object to an array @@ -105,11 +118,13 @@ } else return false; } + /** * Like the php-function array_unique, but for multidimensional arrays, calls itself recursively * - * @return Array (Multidimensional) array without double entries - * @param Array $array The Array to clean up + * @param array $array The Array to clean up + * @return array (Multidimensional) array without double entries + * @author Steffen Becker */ private function arrayUnique($array) { $newArray = array(); @@ -134,34 +149,32 @@ /** - * Converts a simple Object to an array + * Converts an object to an array recursively * - * @return Array the Array created from the Object - * @param object $obj The Object to convert + * @param object $object The object to convert + * @return the corresponding array created from the object + * @author Steffen Becker */ - private function object2array($obj) { - $arr = array(); - $_arr = is_object($obj) ? get_object_vars($obj) : $obj; - foreach ($_arr as $key => $val) { - $val = (is_array($val) || is_object($val)) ? $this->object2array($val) : $val; - $arr[$key] = $val; + private function object2array($object) { + $array = array(); + $_array = is_object($object) ? get_object_vars($object) : $object; + foreach ($_array as $key => $value) { + $value = (is_array($value) || is_object($value)) ? $this->object2array($value) : $value; + $array[$key] = $value; } - return $arr; + return $array; } /** - * Establishes a new Dl-Learner Connection and saves it in - * private $connection for class-wide use. + * Establishes a new Dl-Learner Connection * - * @return + * @author Steffen Becker */ private function establishConnection() { $this->connection = new DllearnerConnection(); } - } - ?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/Debugger.php =================================================================== --- trunk/src/moosique.net/moosique/classes/Debugger.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/Debugger.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -4,34 +4,38 @@ * General Debugger-Class, implementing a FirePHP-Debugger, * for usage see http://www.firephp.org/HQ/Use.htm * - * Usage for Classees implementing Config.php + * Usage for Classees implementing Config.php: * if ($this->debugger) $this->debugger->log($data, "Label"); * + * @package moosique.net + * @author Steffen Becker */ class Debugger { - // instance of the FirePHP-Class - private $fb; + private $fb; // instance of the FirePHP-Class /** * Initializes the Debugger by inlcuding and instanciating FirePHP + * + * @author Steffen Becker */ function __construct() { require_once('FirePHP.class.php'); $this->fb = FirePHP::getInstance(true); } + /** * Logs an Object using FirePHP * - * @param Object $var Any Object, Array, String to log - * @param String $label The Label for the Object to log + * @param mixed $var Any object, array, string etc. to log + * @param string $label The label for the object to log + * @author Steffen Becker */ public function log($var, $label) { $this->fb->log($var, $label); } - } ?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/DllearnerConnection.php =================================================================== --- trunk/src/moosique.net/moosique/classes/DllearnerConnection.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/DllearnerConnection.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,50 +1,52 @@ <?php - /** - * + * This Class handles the connection to the DL-Learner WebService + * and sends/receives all request (Sparql/Learning) to it + * + * @package moosique.net + * @author Steffen Becker */ -class DllearnerConnection extends Config { - - private $knowledgeSourceID; +class DllearnerConnection extends Config { + + private $knowledgeSourceID; // the id for the knowledge-source private $client; // here we store the soap-client private $endpoint; // the currently used endpoint - // use getEndpoint and setEndpoint to change /** - * Object initializing: retrieve ini-values, set the endpoint + * Object initializing: retrieve ini-values (parent::__constuct), set the endpoint * and include the neccessary wsdl-utilities and try to establish * a connection to the dl-learner webservice * + * @author Steffen Becker */ - function __construct() { - parent::__construct(); // init config + function __construct() { + parent::__construct(); // init config // we use jamendo as the default sparql-endpoint $this->setEndpoint($this->getConfigUrl('jamendo')); - // load WSDL files (has to be done due to a Java web service bug) ini_set('soap.wsdl_cache_enabled', '0'); include('Utilities.php'); Utilities::loadWSDLfiles($this->getConfigUrl('wsdl')); $this->connect(); - } + } + /** * Tries to connect to the DL-Learner Webservice using the Tools - * from Utilities.php. Sets private var client. + * from Utilities.php. Sets private var client if successful * + * @author Steffen Becker */ private function connect() { - // connect to DL-Learner-Web-Service - try { - $this->client = new SoapClient($this->getConfigUrl('wsdlLocal')); + try { + $this->client = new SoapClient($this->getConfigUrl('wsdlLocal')); } catch (Exception $e) { if ($this->debugger) $this->debugger->log($e, "Error connecting to the DL-Learner Webservice."); echo '<h2>Could not connect to the DL-Learner Webservice.</h2>'; exit; } - // After establishing the SoapClient we create a Session ID - // and add the default knowledgeSource (see config.ini) + // and add the default knowledgeSource if (isset($_SESSION['sessionID'])) { // if there is a current session running, we don't need to // register a new client at the dl-learner webservice @@ -70,34 +72,37 @@ $_SESSION['sessionID'] = $this->client->generateID(); $this->knowledgeSourceID = $this->client->addKnowledgeSource($_SESSION['sessionID'], 'sparql', $this->endpoint); } - - } - + } + + /** * Sets the SPARQL-endpoint, the DL-Learner Webservice is connecting to - * - * @param String $endpoint The URI of the SPARQL-Endpoint to set + * + * @param string $endpoint The URI of the SPARQL-Endpoint to set + * @author Steffen Becker */ public function setEndpoint($endpoint) { $this->endpoint = $endpoint; } + /** * Returns a String with the URI for the SPARQL-Endpoint currently used * - * @return String The Endpoint URI currently used + * @return string The Endpoint URI currently used + * @author Steffen Becker */ public function getEndpoint() { return $this->endpoint; } + /** - * This method tries to create a connectionID from the DL-Learner - * Webservice and returns a JSON-object with the results from the - * Sparql-Query sent to the current endpoint + * Uses the Webservice to get results from a SPARQL-Query from the current endpoint * - * @return String A JSON-Object with the containing result-set - * @param String $query The SPARQL-Querystring to send + * @param string $query The SPARQL-Querystring to send + * @return string A JSON-Object with the containing results + * @author Steffen Becker */ public function sparqlQuery($query) { $result = $this->client->sparqlQuery($_SESSION['sessionID'], $this->knowledgeSourceID, $query); @@ -107,14 +112,13 @@ /** * Bulid the exclusion-String-Array from config.ini for faster - * recommendation-generation + * recommendation-generation. The Exclusions are the fragments/nodes + * that will not be extracted * - * @param Array $conf The Learning-Conf Array - * @return Array The Array of String with predicates to exclude + * @param array $conf The Learning-Conf Array + * @return array The Array of Strings with predicates to exclude */ private function getExclusions($conf) { - // exclude from node expansion that are not relevant for any learning processes - // this speeds up the general node-extraction $exclusionsArray = array(); $exclude = explode(',', $conf['exclude']); foreach($exclude as $exclusion) { @@ -125,10 +129,14 @@ return $exclusionsArray; } + /** + * Creates a learning request with the given instances an positive Examples * - * - * + * @param array $instances An Array of strings with the URLs to the instances + * @param array $positiveExamples An Array of strings with positive Example URLS + * @return string A JSON Object with the results + * @author Steffen Becker */ public function learn($instances, $positiveExamples) { $result = false; @@ -168,16 +176,19 @@ // after we have set all conf-values, we initialize the learning process $this->client->initAll($id); - $result = $this->client->learnDescriptionsEvaluated($id); return $result; - } + /** * Converts a natural Description in a SPARQL-Query for recommendation retrieval - * - */ + * and adds the global limit set in maxResults + * + * @param string $kb Result-String in KB-Syntax + * @return string A SPARQL-Query String for the KB-Syntax + * @author Steffen Becker + */ public function kbToSqarql($kb) { return $this->client->SparqlRetrieval($kb, $this->getConfig('maxResults')); } Modified: trunk/src/moosique.net/moosique/classes/LastFM.php =================================================================== --- trunk/src/moosique.net/moosique/classes/LastFM.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/LastFM.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,19 +1,35 @@ <?php - +/** + * This class handles all connections to the last.fm-API for retrieving + * tags for a given username. If the user has no tags, the topTags for + * topArtists are used as tags + * + * @package moosique.net + * @author Steffen Becker + */ class LastFM extends Config { - private $topTags; + private $topTags; // save tags here + /** + * Initializing class requires the last.fm username + * + * @param string $user The last.fm Username + * @author Steffen Becker + */ function __construct($user) { parent::__construct(); // init config - $this->getLastFMTags($user); } + /** + * Gets the Top-Tags for a last.fm user. The number of Tags to retrieve + * is set in config.ini * - * - * + * @param string $user The last.fm username + * @return array An array with the top tags for $user + * @author Steffen Becker */ private function getLastFMTags($user) { $allTags = array(); @@ -44,10 +60,15 @@ $this->topTags = $allTags; } + /** + * This is called if the user has no Tags. This function tries to get the + * topArtists from the user and then tries to get the topTags for the + * artists -- the most listened to artists are a good base for useful tags * - * - * + * @param string $user The last.fm Username + * @return array An array with the topTags for the Topartists from $user + * @author Steffen Becker */ private function getTagsFromTopArtists($user) { $allArtists = array(); @@ -69,7 +90,6 @@ $allArtists = array_slice($allArtists, 0, $this->getConfigLastFM('topArtists')); // get the topTags for every artist - foreach($allArtists as $artistName) { $requestUrl = $this->getConfigLastFM('artistsTopTagsUrl') . '&artist=' . urlencode($artistName) @@ -91,16 +111,17 @@ return $finalTags; } + /** + * Returns the topTags * - * - * + * @return array An Array of strings ('rock', 'doom metal' etc.) with the Top-Tags + * @author Steffen Becker */ public function getTopTags() { return $this->topTags; } - } ?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/Recommendations.php =================================================================== --- trunk/src/moosique.net/moosique/classes/Recommendations.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/Recommendations.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,19 +1,35 @@ <?php - +/** + * This class provides methods for recommendations-creation, + * setting and getting positive examples and instances and + * creating and retrieving recommendations using a connection + * to the DL-Learner + * + * @package moosique.net + * @author Steffen Becker + */ class Recommendations extends Config { private $posExamples; private $instances; + /** + * Only used for getting the global config in this class + * + * @author Steffen Becker + */ function __construct() { parent::__construct(); // init config } + /** * Returns an array of prepared serach-statements to feed the sparql= * query-bulider with, converted from the natural description of the results * - * + * @param object $connection a reference to a DllearnerConnection Class + * @return mixed A multidimensional array with a SPARQL-Query, the KBsyntax and the score for all results or an error string + * @author Steffen Becker */ public function getQueries($connection) { $queries = array(); @@ -47,7 +63,6 @@ } } } - if ($match) { $sparql = $connection->kbToSqarql($solution->descriptionKBSyntax); // extract the subtring we use for the final sparql-query @@ -58,7 +73,6 @@ $queries[] = $sparql; $scores[] = $score; $kbSyntaxes[] = $solution->descriptionKBSyntax; - } } } @@ -80,11 +94,14 @@ } - /** + * This function sets the positive examples in private $posExamples + * if no array is given, it tries to get the positiveExamples from + * the cookie moosique (set by moosique.js) * - * - * + * @param array $posExamples an Array of url-strings of positive examples + * @return boolean returns false if sth. goes wrong + * @author Steffen Becker */ public function setPosExamples($posExamples = false) { if ($posExamples === false) { @@ -98,7 +115,7 @@ $posExamples = array_unique($posExamples); $this->posExamples = $posExamples; } - } + } } else { if (is_array($posExamples)) { $this->posExamples = $posExamples; @@ -108,20 +125,23 @@ } } + + /** + * This function sets the instances in private $instances + * if no array is given, it tries to create instances from + * posExamples and a random list of records from allRecords.txt + * + * TODO more testing, what is the optimum posExamples/neutral ratio, 50/50? + * for now we assume 50/50, use $totalInstances = $this->getConfigLearning('instances'); * - * - * + * @param array $instances An array of url-strings for records of instances (should contain posExamples) + * @author Steffen Becker */ public function setInstances($instances = false) { - - // TODO more testing, what is the optimum posExamples/neutral ratio, 50/50? - // for now we assume 50/50 - // $totalInstances = $this->getConfigLearning('instances'); - if ($instances === false) { $instances = array(); - // and then add some random Records _not_ in this list + // and then add some random Records _not_ already in this list $allRecords = file($this->getConfigUrl('allRecords')); $countPos = count($this->posExamples); @@ -140,14 +160,14 @@ $this->instances = $instances; } } - - } + /** - * - * - * + * Returns the positive Examples + * + * @return array Array of positive examples + * @author Steffen Becker */ public function getPosExamples() { return $this->posExamples; @@ -155,17 +175,15 @@ /** - * - * - * + * Returns the instances + * + * @return array Array of instances (containing positive Examples) + * @author Steffen Becker */ public function getInstances() { return $this->instances; } - } -?> - - +?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/RequestHandler.php =================================================================== --- trunk/src/moosique.net/moosique/classes/RequestHandler.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/RequestHandler.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,32 +1,37 @@ <?php - /** - * + * General Request handler - all requests made from the frontend + * are handled here. Calls the different methods and classes for + * seraching, learning and playlist/info requests. + * only accepts ajax-requests + * + * @package moosique.net + * @author Steffen Becker */ class RequestHandler extends Config { private $response; private $dataHelper; - /* This inits requestHandling, a request is - only processed, if it was called by an - xmlHTTPrequest and the get-method */ + /** + * This inits requestHandling, a request is only processed, if it was + * called by an xmlHTTPrequest and the get-method - we don't use POST at all + * + * @author Steffen Becker + */ function __construct() { parent::__construct(); // init config - $this->dataHelper = new DataHelper(); + $this->dataHelper = new DataHelper(); // we only accept ajax-get requests if ($this->isAjax() && $this->isGet()) { $this->response = $this->processRequest(); - + // and return the response if it is not empty if (!empty($this->response)) { return $this->response; } else { if (isset($_GET['searchType'])) { return "<h2>Sorry, nothing found.</h2>"; - if ($_GET['searchType'] == 'lastFM') { - return '<h2>Nothing found for the last.fm-user »' . $_GET['searchValue'] . '«.'; - } } return "<h2>The repsonse from the server was empty.</h2>"; } @@ -34,23 +39,24 @@ header('Location: ' . $this->getConfigUrl('base')); } } - + + /** - * Processes the request made through ajax, handles - * the different searches and other related requests - * - * @return + * Processes the requests made to the server in the webapplication moosique.net + * This is where the different requests are handled and data is fetched + * + * @return string The response/results as ready-to-use HTML + * @author Steffen Becker */ private function processRequest() { $response = ''; - // ========== SEARCH REQUEST ================================= + // ========== SEARCH REQUEST ============= if (isset($_GET['searchType']) && isset($_GET['searchValue'])) { $type = $_GET['searchType']; - // clean up the search value + // clean up the search value, remove unwanted chars etc. $search = $this->cleanString($_GET['searchValue'], $type); - // a search for "everything" causes 4 searches for artist, tags, album and songs // concatenating the response from all 4 searches if ($type == 'allSearch') { @@ -59,48 +65,52 @@ $response .= $this->createSearch($search, 'albumSearch'); $response .= $this->createSearch($search, 'songSearch'); } - // normal search for artist, tag or song + // normal search for artist, tag, album or song if ($type == 'artistSearch' || $type == 'tagSearch' || $type == 'songSearch' || $type == 'albumSearch') { $response = $this->createSearch($search, $type); } - // last.fm search, initiate the lastFM-Class and get the tags for the user - // then make an exakt-tag search with the result + // last.fm search, initiate the lastFM-Class and get the tags for + // the user ($search) - then make tagSearches for every result if ($type == 'lastFM') { $lastFM = new LastFM($search); $tags = $lastFM->getTopTags(); // no we have the topTags, do a search for related albums if (!empty($tags)) { foreach($tags as $tag) { - // FIXME when using last.fm-Tags for tagSearch, we want exakt results, meaning - // no "darkmetalbeermusic" as result when the lastfm tag is "metal" - // what we do here is nothing but a tag search for each tag + // ALWAYS limit the results for last-FM search $response .= $this->createSearch($this->cleanString($tag, $type), 'tagSearch', $this->getConfig('maxResults')); } - } else { // let the view handle it, displays error + } else { // let the view handle it: <h2>-Error-Message $response .= $this->createSearch($tags, $type, $this->getConfig('maxResults')); } } } - // ========== LEARNING REQUEST ================================= + + // ========== LEARNING REQUEST =========== if (isset($_GET['get']) && $_GET['get'] == 'recommendations') { - $r = new Recommendations(); // init/reset recommendations + // create a new recommendations-class and set the instances/posExamples + $r = new Recommendations(); $r->setPosExamples(); $r->setInstances(); + // get all queries/kbSyntaxes $recommendations = $r->getQueries($this->dataHelper->connection); $results = array(); + // if we have some recommendations and queries for them if (is_array($recommendations) && !empty($recommendations)) { if (!empty($recommendations['queries'])) { foreach($recommendations['queries'] as $query) { - // $data = $this->getData($query, 'recommendations', $this->getConfig('maxResults')); - // TODO no limiting, else it is not really random... + // get the results for each query created $data = $this->dataHelper->getData($query, 'recommendations'); $results[] = $data; } } + // add them to the multi-dimensional recommendations-Array, it now + // contains results, scores, syntaxes and queries $recommendations['results'] = $results; + // finally create the view for the recommendations $response .= $this->createView($recommendations, 'recommendations', '', $this->getConfig('maxResults')); } else { // an error occured during recommendation-retrieval @@ -110,7 +120,8 @@ } - // ========== ARTIST INFORMATION REQUEST ================================= + // ========== ARTIST INFORMATION REQUEST ============= + // TODO artist info, not yet implemented if (isset($_GET['info']) && !(empty($_GET['info']))) { $currentAlbum = $_GET['info']; $response .= '<p>Artist Information coming soon...</p>'; @@ -119,7 +130,7 @@ // ========== PLAYLIST REQUEST ================================= // Due to a bug in YMP we don't directly deliver the .xspf-file, we return a prepared - // list of <li> including the links to the mp3-files, and this is build in the view of course. + // list of <li> including the links to the mp3-files - and this is build in the view of course. if (isset($_GET['get']) && isset($_GET['playlist'])) { $data = array('playlist' => $_GET['playlist'], 'albumID' => $_GET['rel']); $type = $_GET['get']; @@ -128,15 +139,19 @@ $response = $this->createView($preparedData, $type, $search); } - // Finally returning the response + // matched all possible cases, in other cases response is empty return $response; } /** - * - * - * + * Creates a search request for the given SearchValue + * + * @param mixed $search The value to search for, can be a string or and array for tagSeach/lastFM + * @param string $type The type of search: tagSearch, albumSearch, songSearch etc. + * @param int $maxResults Limit for maximum shown results, optional + * @return void + * @author Steffen Becker */ private function createSearch($search, $type, $maxResults = false) { $data = $this->dataHelper->getData($search, $type); @@ -146,9 +161,14 @@ /** - * - * - * + * Creates a view for given data and searchvalue/types + * + * @param array $data The Data-Array to create the view from + * @param string $type The type of search made + * @param mixed $search The search string or array of strings (for tag/lastfm-serach) + * @param int $maxResults A limit for showing results, optional + * @return string The final HTML-Code, ready to use + * @author Steffen Becker */ private function createView($data, $type, $search, $maxResults = false) { $v = new View($data, $type, $search, $maxResults); @@ -163,7 +183,12 @@ * If the search string contains a %20-Space-Char somewhere in the middle * of the string, it returns an array of search-values, divided by " " * Doing this we later can perform more searches for values like "stoner doom metal" - * resulting in an array with [0] => stoner [1] => doom [2] => metal + * resulting in an array with [0] => stoner [1] => doom [2] => metal for better results + * + * @param string $string The searchValue the user entered + * @param string $type The type of search: artistSearch, tagSearch etc. + * @return mixed A cleaned string or an array of cleaned strings + * @author Steffen Becker */ private function cleanString($string, $type) { $remove = array('/', '?', '+', "=", '$', ',', '.', ':', ';', '\'', "\\", "\\\\"); @@ -175,7 +200,6 @@ // if lastFM-Search or exakt search, we split "death metal" into an array // containing "death" and "metal", for better search results - // TODO implement for tagSearch too if ((strpos($string, " ") > 0) && ($type == 'lastFM' || $type == 'tagSearch')) { $string = explode(" ", $string); } @@ -185,9 +209,10 @@ /** - * Returns the HTML stored in the private $response - * - * @return String HTML-Code generated + * Returns the private $response == the final HTML + * + * @return string The final HTML produced by this class + * @author Steffen Becker */ public function getResponse() { return $this->response; @@ -195,10 +220,11 @@ /** - * Checks if the request made is an AJAX-Request and returns true if so - * - * @return Boolean - */ + * Checks for an ajax-request + * + * @return boolean True if the request was made via ajax, false if not + * @author Steffen Becker + */ private function isAjax() { if ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') ) { @@ -210,9 +236,10 @@ /** - * Checks if the request made is a GET-Request and returns true if so + * Checks for a GET-Request * - * @return Boolean + * @return boolean True if the request is a GET-Request, false if not + * @author Steffen Becker */ private function isGet() { if (isset($_GET) && !empty($_GET)) { @@ -221,20 +248,6 @@ return false; } } - - - /** - * Checks if the request made is a POST-Request and returns true if so - * - * @return Boolean - */ - private function isPost() { - if (isset($_POST) && !empty($_POST)) { - return true; - } else { - return false; - } - } } Modified: trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php =================================================================== --- trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,9 +1,10 @@ <?php - /** - * - * - * + * This class provides functions to build the sepcial SPARQL-Queries + * used in moosique.net + * + * @package moosique.net + * @author Steffen Becker */ class SparqlQueryBuilder extends Config { @@ -13,14 +14,13 @@ * Class-Constructor, automatically calls buildQuery with * the given variables when initalizing this class * - * @return - * @param object $search - * @param object $typeOfSearch - * @param object $limit[optional] + * @param mixed $search The clean search-Value, can be an array of values + * @param string $searchType The type of search + * @author Steffen Becker */ - function __construct($search, $searchType, $limit = 0) { + function __construct($search, $searchType) { parent::__construct(); // init config - $this->buildQuery($search, $searchType, $limit); + $this->buildQuery($search, $searchType); } @@ -28,20 +28,18 @@ * Builds the complete Sparql-Query depending on the type of search * and saves it in the private $queryString. * - * @param object $search - * @param object $typeOfSearch - * @param object $limit + * @param mixed $search The clean search-Value, can be an array of values + * @param string $searchType The type of search + * @author Steffen Becker */ private function buildQuery($search, $searchType) { - /* Build up the Prefixes */ $prefixes = ''; foreach($this->getConfigPrefixes() as $prefix => $resource) { $prefixes .= 'PREFIX ' . $prefix . ': <' . $resource . '>' . "\n"; } - // if a global limit is set, we use it - // else we use the optional limit given to the parent class when constructing it + // if the globalLimit-config-value is set, we use maxResults as LIMIT if ($this->getConfig('globalLimit') == 1) { $limit = "\n" . 'LIMIT ' . $this->getConfig('maxResults'); } else { @@ -69,10 +67,6 @@ case 'albumSearch' : $query = $this->queryAlbumSearch($search); break; case 'songSearch' : $query = $this->querySongSearch($search); break; case 'recommendations' : $query = $this->queryRecommendations($search); break; - - /* TODO build functions for other queries - case 'currentInfo' : $query = $this->queryCurrentInfo($search); break; - */ } // save the query $this->queryString = $prefixes . $beginStatement . $baseQuery . $query . $endStatement; @@ -80,10 +74,11 @@ /** - * Returns the Sparql-Query part for an artist-search + * Creates the SPARQL-Query-Part for an artist search * - * @param Mixed - * @return String Sparql-Query part for artist-search + * @param string $search The search value, sth. like "Slayer" or "Jimi Hendrix" + * @return string The SPARQL-query part for an artist search + * @author Steffen Becker */ private function queryArtistSearch($search) { $queryString = ' { @@ -102,13 +97,14 @@ /** * For a Tag-Search we display the playable records, therefore we need record and * artist information too, AlbumCover is optional - * Returns the Sparql-Query part for tag-search + * if $search is an array, this performs an exact-tagSerach instead * - * @return String Sparql-Query part for tag-search + * @param mixed $search The search value, sth. like "metal" or "breakcore", String or Array + * @return string Sparql-Query part for tag-search */ private function queryTagSearch($search) { if (is_array($search)) { - // special case again: if array, we do the exakt tagSearch + // special case: if array, we do the exakt tagSearch, we have sth. like "stoner" and "rock" $queryString = $this->queryExactTagSearch($search); } else { $queryString = ' { @@ -125,17 +121,20 @@ return $queryString; } - + /** - * - * - * - * + * This function returns the SPARQL-Query part for an exact-Tag-Search from + * a search array containing string like "stoner" "doom" "metal" + * Performs an AND-Search, a result has to have all tags from the array + * + * @param mixed $search The search array, containing strings like "stoner", "rock" etc, single string also allowed + * @return string Sparql-Query part for exact-tag-search + * @author Steffen Becker */ private function queryExactTagSearch($search) { $queryString = ' { ?record tags:taggedWithTag ?tag ; '; - + // extra check if no array, we use $search as string if (is_array($search)) { foreach($search as $tag) { $queryString .= ' tags:taggedWithTag <http://dbtune.org/jamendo/tag/' . $tag . '> ; '; @@ -150,15 +149,16 @@ FILTER (regex(str(?image), "1.100.jpg", "i")) . } } '; - return $queryString; } /** - * Returns the Sparql-Query part for album-search - * - * @return String Sparql-Query part for album-search + * Creates the SPARQL-Query part for an album-Search + * + * @param string $search The search-string, a string like "dark side of the moon", "ladyland" etc. + * @return string Sparql-Query part for an album-search + * @author Steffen Becker */ private function queryAlbumSearch($search) { $queryString = ' { @@ -177,9 +177,11 @@ /** - * Returns the Sparql-Query part for song-search - * - * @return String Sparql-Query part for song-search + * Creates the SPARQL-Query part for a song-Search + * + * @param string $search The search-string, a string like "souljacker", "purple haze" etc. + * @return string Sparql-Query part for an album-search + * @author Steffen Becker */ private function querySongSearch($search) { $queryString = ' { @@ -197,11 +199,13 @@ /** + * Creates the SPARQL-Query part for a recommendations search, this + * is much like album/tagSearch, but with additional info * - * - * - * - */ + * @param string $search The SPARQL-String retrieved from the recommendations-learn result + * @return string Sparql-Query part for a recommendation search + * @author Steffen Becker + */ private function queryRecommendations($search) { $queryString = ' { ?record mo:available_as ?playlist ; @@ -215,24 +219,22 @@ } '; // TODO ?record tags:taggedWithTag ?tag makes the queries blow up high - - // and finally we append the sparql-string from kb-Description + // and finally we append the sparql-string from kb-Description-Conversion $queryString .= $search; return $queryString; } /** - * Returns the build Query-String + * Returns the final Query-String * - * @return String Complete SPARQL-Query stored in SparqlQueryBuilder + * @return string The final Complete SPARQL-Query + * @author Steffen Becker */ public function getQuery() { return $this->queryString; } - } - ?> \ No newline at end of file Modified: trunk/src/moosique.net/moosique/classes/View.php =================================================================== --- trunk/src/moosique.net/moosique/classes/View.php 2009-10-28 11:05:25 UTC (rev 1898) +++ trunk/src/moosique.net/moosique/classes/View.php 2009-10-28 23:45:32 UTC (rev 1899) @@ -1,30 +1,46 @@ <?php /** - * This class handles all HTML-Output for all different kinds of - * requests. No Templating system is used. + * This class handles all HTML-Output for all different kinds of requests. + * It also creates error messages shown in the frontend * - * + * @package moosique.net + * @author Steffen Becker */ class View extends Config { - private $html = ''; - private $limit = 0; + private $html = ''; // the final HTML-Output is stored + private $limit = 0; // limit for showing results - // view modes are debug or both, default is html view + /** + * Creating a View automatically creates the HTML + * + * @param array $data The result-Data-array + * @param string $type the type of search performed + * @param mixed $search A string or array with the searchValues + * @param int $limit The maximum number of results to show/create HTML for, optional + * @author Steffen Becker + */ function __construct($data, $type, $search, $limit = false) { parent::__construct(); // init config - if ($limit === false) { // no special limit set, we use the maxResultsLimit + if ($limit === false) { // if no special limit set, we use maxResults $this->limit = $this->getConfig('maxResults'); } else { $this->limit = $limit; } $this->createOutput($data, $type, $search); } - - + + /** - * + * Starts creating the HTML output. First checks if the data is fine, + * and gets sub-HTML-parts afterwards, if the data is not fine, an + * error-message will be created + * + * @param array $data The result-Data-array + * @param string $type the type of search performed + * @param mixed $search A string or array with the searchValues + * @author Steffen Becker */ private function createOutput($data, $type, $search) { // if we have an array for $search (Tag or lastFM-Search) we implode the searchString @@ -85,11 +101,12 @@ /** - * - * - * - * - * + * This lmits the result-data, to a given number of results stored + * in the private $limit + * + * @param array $data The result-Data-Array + * @return array The limited array + * @author Steffen Becker */ private function limitData($data) { $count = count($data); @@ -114,8 +131,13 @@ /** - * - * @param object $data + * Returns the HTML for an artist serach, containing special stuff + * like homepage-links, album-list etc. + * + * @param array $data The result-Array to create HTML from + * @param string $type type of search to get the template + * @return string HTML for a artistSearch + * @author Steffen Becker */ private function artistSearchHTML($data, $type) { $this->html .= '<div class="artistSearch"><ul class="clearfix">'; @@ -167,8 +189,14 @@ /** - * - * @param object $array + * Returns the HTML for tagSearch results + * This is somewhat special, we first create a list of found tags, + * and then we list the albums found for those tags + * + * @param array $data The result-Array to create HTML from + * @param string $type type of search to get the template + * @return string HTML for a tagSearch + * @author Steffen Becker */ private function tagSearchHTML($data, $type) { $this->html .= '<div class="tagSearch">'; @@ -202,7 +230,7 @@ $j = $i; // default -- non random, no limit // if there is limit set, and randomize is active, we use the random numbers if ($numberOfAlbums > $this->limit && $this->getConfig('randomize') == 1) { - $j = $random[$i]; + $j = $random[$i]; // randomizing the results for the tag } $template = $this->getTemplate($type); @@ -212,9 +240,8 @@ $albumTitle = $this->getValue($tag['albumTitle'], $j); $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getValue($tag['playlist'], $j)); - $addToPlaylist = '<li><a class="addToPlaylist" href="' . $playlist . '" ' - . 'title="' . $artistName . ' - ' . $albumTitle . '" ' - . 'rel="' . $record . '">Click here to add this album to your playlist.</a></li>'; + $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' + . $artistName . ' - ' . $albumTitle . '">Click here to add this album to your playlist</a></li>'; $image = $this->getImage($tag, $artistName. ' - ' . $albumTitle, $j); @@ -229,8 +256,12 @@ /** + * Returns the HTML for albumSearch results * - * + * @param array $data The result-Array to create HTML from + * @param string $type type of search to get the template + * @return string HTML for a albumSearch + * @author Steffen Becker */ private function albumSearchHTML($data, $type) { $this->html .= '<div class="albumSearch"><ul class="clearfix">'; @@ -240,7 +271,7 @@ if (($i % 2) == 0) { $class = 'odd'; } else { $class = ''; } $template = $this->getTemplate($type); - + // $index = 0, we always want a single value and no array here $record = $this->getValue($album['record'], 0); $albumTitle = $this->getValue($album['albumTitle'], 0); $artistName = $this->getValue($album['artistName'], 0); @@ -249,7 +280,6 @@ $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' . $artistName . ' - ' . $albumTitle . '">Click here to add this album to your playlist</a></li>'; - // Artist-Image is optional $image = $this->getImage($album, $artistName . ' - ' . $albumTitle); $tags = $this->getTagList($album['tag']); @@ -264,12 +294,12 @@ /** - * - * - * - * - * - * + * Returns the HTML for songSearch results + * + * @param array $data The result-Array to create HTML from + * @param string $type type of search to get the template + * @return string HTML for a songSearch + * @author Steffen Becker */ private function songSearchHTML($data, $type) { $this->html .= '<div class="songSearch"><ul class="clearfix">'; @@ -303,12 +333,12 @@ /** - * - * - * - * - * - * + * Returns the HTML for recommendations + * + * @param array $data The result-Array to create HTML from + * @param string $type type of search to get the template + * @return string HTML for recommendations + * @author Steffen Becker */ private function recommendationsHTML($data, $type) { $count = count($data['scores']); // doesnt matter if scores or results... @@ -330,15 +360,14 @@ foreach ($resultSet as $record => $result) { // alternating classes for li-elements if (($j % 2) == 0) { $class = 'odd'; } else { $class = ''; } - $template = $this->getTemplate($type); $artistName = $this->getValue($result['artistName']); $albumTitle = $this->getValue($result['albumTitle']); $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getValue($result['playlist'])); - $addToPlaylist = '<li><a class="addToPlaylist" href="' . $playlist . '" ' - . 'title="' . $artistName . ' - ' . $albumTitle . '" ' - . 'rel="' . $record . '">Click here to add this album to your playlist.</a></li>'; + + $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' + . $artistName . ' - ' . $albumTitle . '">Click here to add this album to your playlist</a></li>'; $image = $this->getImage($result, $artistName . ' - ' . $albumTitle); @@ -357,9 +386,11 @@ /** + * Returns a list... [truncated message content] |
From: <hee...@us...> - 2009-10-28 11:05:37
|
Revision: 1898 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1898&view=rev Author: heeroyuy Date: 2009-10-28 11:05:25 +0000 (Wed, 28 Oct 2009) Log Message: ----------- -removed IndividualObject because it isn't necessary anymore Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-10-28 11:03:23 UTC (rev 1897) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-10-28 11:05:25 UTC (rev 1898) @@ -1,76 +0,0 @@ -/** - * Copyright (C) 2007-2009, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.tools.protege; - - -/** - * This Class handles the manchester String, the normal string and if the Individual is a positive Individual. - * @author Christian Koetteritzsch - * - */ -public class IndividualObject { - - private final String normalIndividual; - private boolean isPos; - private String additionalInformation; - - /** - * Constructor for the IndividualObject. - * @param normal String - * @param pos boolean - */ - public IndividualObject(String normal, boolean pos) { - normalIndividual = normal; - isPos = pos; - } - - /** - * This method returns the String of the Individual. - * @return String normalIndividual - */ - public String getIndividualString() { - return normalIndividual; - } - - /** - * This method returns if the Example is a positive Example. - * @return boolean isPos - */ - public boolean isPositiveExample() { - return isPos; - } - - /** - * This method sets the example positive or negative if changed to the other list. - * @param pos boolean - */ - public void setExamplePositive(boolean pos) { - isPos = pos; - } - - public void setAdditionalInformation(String additional) { - this.additionalInformation = additional; - } - - public String getAdditionalInformation() { - return additionalInformation; - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-28 11:03:33
|
Revision: 1897 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1897&view=rev Author: heeroyuy Date: 2009-10-28 11:03:23 +0000 (Wed, 28 Oct 2009) Log Message: ----------- -code cleanup -add javadoc Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -22,7 +22,6 @@ import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; import java.util.List; import java.util.Set; import java.util.Timer; @@ -34,7 +33,6 @@ import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; -import javax.swing.event.ListSelectionEvent; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.EvaluatedDescription; @@ -165,34 +163,6 @@ } /** - * select/deselect the Check boxes. - * - * @param i - * ItemEvent - */ - public void itemStateChanged(ItemEvent i) { - - } - - /** - * Nothing happens here. - * - * @param e - * ListSelectionEvent - */ - public void valueChanged(ListSelectionEvent e) { - - } - - - /** - * Destroys the Thread after the Pluigin is closed. - */ - public void destroyDLLearnerThread() { - // dlLearner = null; - } - - /** * Resets the toggled Button after the plugin is closed. */ public void resetToggled() { @@ -258,7 +228,6 @@ try { dlLearner.join(); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } List<? extends EvaluatedDescription> result = la @@ -284,7 +253,6 @@ } setProgress(0); view.stopStatusBar(); - //view.algorithmTerminated(); updateList(result); view.algorithmTerminated(); @@ -297,23 +265,8 @@ for (List<? extends EvaluatedDescription> list : resultLists) { updateList(list); - this.checkSelectedItem(list); } } - /* - * TODO: ueberlegen wegen umsetzung. - */ - private void checkSelectedItem(List<? extends EvaluatedDescription> result) { - if(!view.getSuggestClassPanel().getSuggestList().isSelectionEmpty()) { - SuggestListItem item = (SuggestListItem) view.getSuggestClassPanel().getSuggestList().getSelectedValue(); - String itemString = item.getValue(); - for(EvaluatedDescription desc: result) { - if(desc.getDescription().toString().equals(itemString)) { - - } - } - } - } private void updateList( final List<? extends EvaluatedDescription> result) { @@ -329,12 +282,6 @@ for (String ontology : ont) { if (eval.getDescription().toString().contains( ontology)) { - // dm.add(i, new SuggestListItem(colorGreen, - // eval - // .getDescription().toManchesterSyntaxString - // (ontology, null), - // ((EvaluatedDescriptionClass) - // eval).getAccuracy()*100)); if (((EvaluatedDescriptionClass) eval) .isConsistent()) { dm.add(i, new SuggestListItem(colorGreen, Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -234,7 +234,6 @@ isReasonerSet = true; }catch (ComponentInitException e) { view.setIsInconsistent(true); - //e.printStackTrace(); } catch (InconsistentOntologyException incon) { view.setIsInconsistent(true); } @@ -266,7 +265,6 @@ try { currentConceptURL = new URL(currentConcept.toString()); } catch (MalformedURLException e1) { - // TODO Auto-generated catch block String error = "Cannot convert to URL."; view.renderErrorMessage(error); e1.printStackTrace(); @@ -297,25 +295,30 @@ this.la = cm.learningAlgorithm(CELOE.class, lp, reasoner); } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } + + //Config options set in the gui. + //config option if all is used for suggestions cm.applyConfigEntry(la, "useAllConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getAllBox()); + //config option if exists is used for suggestions cm.applyConfigEntry(la, "useExistsConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getSomeBox()); + //config option if hasValue is used for suggestions cm.applyConfigEntry(la, "useHasValueConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getValueBox()); + //config option if negation is used for suggestions cm.applyConfigEntry(la, "useNegation", view.getPosAndNegSelectPanel().getOptionPanel().getNotBox()); + //config option if cardinalitylimits is used for suggestions cm.applyConfigEntry(la, "useCardinalityRestrictions", view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox()); if(view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox()) { + //config option to set the cardinalityrestrictions cm.applyConfigEntry(la, "cardinalityLimit", view.getPosAndNegSelectPanel().getOptionPanel().getCountMoreBox()); } - + //config option to set the noise cm.applyConfigEntry(la, "noisePercentage", view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy()); + //config option to set the maximum execution time cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); - view.setLearningDuration(view - .getPosAndNegSelectPanel().getOptionPanel() - .getMaxExecutionTime()); try { // initializes the learning algorithm la.init(); @@ -545,18 +548,22 @@ return evalDescriptions.get(index); } + /** + * This methode sets if the knowledge source is updated or not. + * @param isUpdated boolean if knowledge sourec is updated + */ public void setKnowledgeSourceIsUpdated(boolean isUpdated) { knowledgeSourceIsUpdated = isUpdated; } + /** + * This methode returns a boolean if the knowledge + * source is updated. + * @return boolean if knowledge source is updated + */ public boolean getIsKnowledgeSourceIsUpdated() { return knowledgeSourceIsUpdated; } - - public OWLEditorKit getOWLEditorKit() { - return editor; - } - } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -340,6 +340,10 @@ learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); } } + /** + * This methode returns the help button. + * @return help button + */ public JButton getHelpButton() { return helpButton; } @@ -402,7 +406,6 @@ */ public void setExamplePanelVisible(boolean visible) { posPanel.setVisible(visible); - //detail.repaint(); } /** @@ -448,7 +451,6 @@ public void unsetEverything() { run.setEnabled(true); model.getNewOWLDescription().clear(); - action.destroyDLLearnerThread(); errorMessage.setText(""); learner.removeAll(); } @@ -485,6 +487,10 @@ this.isInconsistent = isIncon; } + /** + * This methode returns if the ontology is inconsistent. + * @return boolean if ontology is inconsistent + */ public boolean getIsInconsistent() { return isInconsistent; } @@ -517,7 +523,6 @@ * This method sets the run button enable after learning. */ public void algorithmTerminated() { - this.stopStatusBar(); CELOE celoe = (CELOE) model.getLearningAlgorithm(); String error = "Learning successful. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " + celoe.getMaximumHorizontalExpansion() + "."; hint.setForeground(Color.RED); @@ -541,6 +546,10 @@ return learnerScroll; } + /** + * This methode sets the help button visible. + * @param isVisible boolean if help button is visible + */ public void setHelpButtonVisible(boolean isVisible) { helpButton.setVisible(isVisible); } @@ -561,18 +570,24 @@ return readThread; } - public void setLearningDuration(int time) { - stat.setMaximumValue(time); - } - + /** + * This Methode starts the status bar. + */ public void startStatusBar() { stat.showProgress(true); } + /** + * This methode stops the status bar. + */ public void stopStatusBar() { stat.showProgress(false); } + /** + * This methode returns the statusbar. + * @return statusbar + */ public StatusBar getStatusBar() { return stat; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -40,7 +40,8 @@ /** * This class takes care of all events happening in the GraphicalCoveragePanel. - * + * It renders the Informations for the individual points and sets the + * individuals for the popup component. * @author Christian Koetteritzsch * */ @@ -74,12 +75,18 @@ } @Override + /** + * Nothing happens here. + */ public void mouseDragged(MouseEvent arg0) { - // TODO Auto-generated method stub } @Override + /** + * This methode renders the tool tip message when the mouse goes over + * the plus symbole. It also renders the the informations for the individual point. + */ public void mouseMoved(MouseEvent m) { if (m.getX() >= panel.getX1() + panel.getShiftCovered() && m.getX() <= panel.getX2() + panel.getShiftCovered() @@ -132,10 +139,17 @@ } @Override + /** + * Nothing happens here. + */ public void propertyChange(PropertyChangeEvent arg0) { } @Override + /** + * This methode renders the popup box and + * computes which individuals must be shown. + */ public void mouseClicked(MouseEvent arg0) { if (panel.getEvaluateddescription() != null) { if (arg0.getX() >= panel.getX1() + panel.getShiftCovered() @@ -229,26 +243,34 @@ } @Override + /** + * Nothing happens here. + */ public void mouseEntered(MouseEvent arg0) { - // TODO Auto-generated method stub } @Override + /** + * Nothing happens here. + */ public void mouseExited(MouseEvent arg0) { - // TODO Auto-generated method stub } @Override + /** + * Nothing happens here. + */ public void mousePressed(MouseEvent arg0) { - // TODO Auto-generated method stub } @Override + /** + * Nothing happens here. + */ public void mouseReleased(MouseEvent arg0) { - // TODO Auto-generated method stub } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -139,10 +139,18 @@ return circlePoint; } + /** + * This method returns the DLLearner Individual. + * @return DLLearner Individual + */ public Individual getDLLearnerIndividual() { return individualDLLearner; } + /** + * This method returns the base uri of the Individual. + * @return base uri of the individual + */ public String getBaseUri() { return baseUri; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -38,6 +38,10 @@ panel = m; } @Override + /** + * This methode sets the Informations on the panel where the + * graphic is shown. + */ public void propertyChange(PropertyChangeEvent arg0) { panel.setInformation(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -192,96 +192,81 @@ } /** - * - * @return + * This methode returns the OWLRadioButton. + * @return OWLRAdioButton */ public JRadioButton getOwlRadioButton() { return owlRadioButton; } /** - * - * @return + * This methode returns the ELProfileButton. + * @return ELProfileButton */ public JRadioButton getElProfileButton() { return elProfileButton; } /** - * - * @return + * This methode returns if the allquantor box is selected. + * @return boolean if allquantor box is selected */ public boolean getAllBox() { return allBox.isSelected(); } /** - * - * @return + * This methode returns if the some box is selected. + * @return boolean if some box is selected */ public boolean getSomeBox() { return someBox.isSelected(); } /** - * - * @return + * This methode returns if the not box is selected. + * @return boolean if not box is selected */ public boolean getNotBox() { return notBox.isSelected(); } /** - * - * @return + * This methode returns if the value box is selected. + * @return boolean if value box is selected */ public boolean getValueBox() { return valueBox.isSelected(); } /** - * - * @return + * This methode returns the ProfilePanel. + * @return Profile Panel */ public JPanel getProfilePanel() { return profilePanel; } /** - * - * @return + * This methode returns the int of the cardinality restriction. + * @return cardinality restriction int */ public int getCountMoreBox() { return Integer.parseInt(countMoreBox.getSelectedItem().toString()); } /** - * - * @return + * This methode returns if the cardinality restiction box is selected. + * @return boolean if cardinality restiction box is selected */ public boolean getMoreBox() { return moreBox.isSelected(); } /** - * - * @return + * This methode sets the the checkboxes enable that are needed for + * the OWL 2 Profile. */ - public JPanel getRadioBoxPanel() { - return radioBoxPanel; - } - - /** - * - * @return - */ - public JPanel getCheckBoxPanel() { - return checkBoxPanel; - } - - /** - * - */ public void setToOWLProfile() { allBox.setSelected(true); someBox.setSelected(true); @@ -292,7 +277,8 @@ } /** - * + * This methode sets the the checkboxes enable that are needed for + * the EL Profile. */ public void setToELProfile() { allBox.setSelected(false); @@ -304,7 +290,8 @@ } /** - * + * This methode sets the combo box for the cardinality restriction + * enabled/disabled. * @param isEnabled */ public void setCountMoreBoxEnabled(boolean isEnabled) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -29,7 +29,6 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.reasoning.FastInstanceChecker; import org.protege.editor.owl.OWLEditorKit; -import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLOntology; @@ -62,18 +61,6 @@ this.editor = editorKit; this.view = v; this.model = m; - - //TODO: mehr informationen fuer grafische anzeige herraussuchen. - //editor.getOWLModelManager().getActiveOntology().getDataPropertyAssertionAxioms(null); - //editor.getOWLModelManager().getActiveOntology().getObjectPropertyAssertionAxioms(null); - //editor.getOWLModelManager().getActiveOntology().getSameIndividualAxioms(null); - //editor.getOWLModelManager().getActiveOntology().getDifferentIndividualAxioms(null); - /*Set<OWLAxiom> test = editor.getOWLModelManager().getActiveOntology().getAxioms(); - for(OWLAxiom t : test) { - System.out.println("hier: " + t); - //System.out.println("da: " + t); - }*/ - //System.out.println(); } /** @@ -97,7 +84,6 @@ */ private void setPositiveConcept() { current = editor.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass(); - //editor.getOWLWorkspace().getOWLIndividualSelectorPanel().getSelectedObjects(); if(current != null) { SortedSet<Individual> individuals = null; hasIndividuals = false; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2009-10-28 10:07:09 UTC (rev 1896) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2009-10-28 11:03:23 UTC (rev 1897) @@ -51,7 +51,8 @@ @Override /** - * + * This methode sets the graphical coverage panel enable when a + * suggested class expression is selected. */ public void mouseClicked(MouseEvent e) { if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { @@ -72,7 +73,6 @@ } } } - view.getSuggestClassPanel().getSuggestModel().indexOf(item); view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel(evaluatedDescription); view.setGraphicalPanel(); } @@ -96,7 +96,8 @@ @Override /** - * + * This methode sets the add button enable when + * a suggested class expression is selected. */ public void mousePressed(MouseEvent e) { if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { @@ -116,13 +117,11 @@ @Override - /* - * TODO: Ueberlegen wie ich das mit dem selektierten Objekt umsetze + /** + * Nothing happens here. */ public void valueChanged(ListSelectionEvent e) { - Object selectedObject = view.getSuggestClassPanel().getSuggestList().getSelectedValue(); - - view.getSuggestClassPanel().getSuggestList().setSelectedValue(selectedObject, true); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-28 10:07:17
|
Revision: 1896 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1896&view=rev Author: heeroyuy Date: 2009-10-28 10:07:09 +0000 (Wed, 28 Oct 2009) Log Message: ----------- -added more Information for individuals when mouse goes over an individual point -deprecated constructor in IndividualPoint and write a new one because showing more details on the graphical panel needs it -fixed a bug that after learning the graphical panel isn't showning Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -553,10 +553,9 @@ return knowledgeSourceIsUpdated; } - /* - * TODO Add methods to get additional informations about a individual. - * Informations needed are the ones in the Individuals tab in protege. - */ + public OWLEditorKit getOWLEditorKit() { + return editor; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -357,7 +357,7 @@ c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.LINE_START; c.gridx = 0; - c.gridy = 3; + c.gridy = 4; c.weightx = 0.0; c.weighty = 0.0; learner.add(detail, c); @@ -367,13 +367,13 @@ c.anchor = GridBagConstraints.LINE_START; c.gridwidth = GridBagConstraints.REMAINDER; c.gridx = 0; - c.gridy = 4; + c.gridy = 5; learner.add(advancedPanel, c); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.gridx = 0; - c.gridy = 5; + c.gridy = 6; c.gridwidth = GridBagConstraints.REMAINDER; learner.add(posPanel, c); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -499,7 +499,7 @@ for(String uri : uriString) { if(ind.toString().contains(uri)) { posCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null), ind, uri)); } } i++; @@ -547,7 +547,7 @@ for(String uri : uriString) { if(ind.toString().contains(uri)) { posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null), ind, uri)); } } } else { @@ -555,7 +555,7 @@ for(String uri : uriString) { if(ind.toString().contains(uri)) { additionalIndividuals.add(new IndividualPoint("*", - (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null), ind, uri)); } } } @@ -596,7 +596,7 @@ for(String uri : uriString) { if(ind.toString().contains(uri)) { posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null), ind, uri)); } } k++; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -24,6 +24,7 @@ import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Map; import java.util.Set; import java.util.Vector; @@ -32,7 +33,10 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; import org.dllearner.learningproblems.EvaluatedDescriptionClass; +import org.dllearner.reasoning.FastInstanceChecker; /** * This class takes care of all events happening in the GraphicalCoveragePanel. @@ -93,15 +97,36 @@ panel.getGraphicalCoveragePanel().setToolTipText( "To view all Individuals please click on the plus"); } - + Vector<IndividualPoint> v = panel.getIndividualVector(); + FastInstanceChecker reasoner = model.getReasoner(); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 && v.get(i).getXAxis() <= m.getX() + 5 && v.get(i).getYAxis() >= m.getY() - 5 && v.get(i).getYAxis() <= m.getY() + 5) { - panel.getGraphicalCoveragePanel().setToolTipText( - v.get(i).getIndividualName()); + String individualInformation = "<html><body>" + v.get(i).getIndividualName().toString(); + Set<NamedClass> types = reasoner.getTypes(v.get(i).getDLLearnerIndividual()); + individualInformation += "<br><b>Types:</b><br>"; + for(NamedClass dlLearnerClass : types) { + individualInformation += dlLearnerClass.toManchesterSyntaxString(v.get(i).getBaseUri(), null) + "<br>"; + } + Map<ObjectProperty,Set<Individual>> objectProperties = reasoner.getObjectPropertyRelationships(v.get(i).getDLLearnerIndividual()); + Set<ObjectProperty> key = objectProperties.keySet(); + individualInformation += "<br><b>Objectproperties:</b><br>"; + for(ObjectProperty objectProperty: key) { + Set<Individual> indiSet = objectProperties.get(objectProperty); + individualInformation = individualInformation + objectProperty.toManchesterSyntaxString(v.get(i).getBaseUri(), null) + " "; + for(Individual indi: indiSet) { + individualInformation += indi.toManchesterSyntaxString(v.get(i).getBaseUri(), null); + if(indiSet.size() > 1) { + individualInformation += ", "; + } + } + individualInformation += "<br>"; + } + individualInformation += "</body></htlm>"; + panel.getGraphicalCoveragePanel().setToolTipText(individualInformation); } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -18,6 +18,8 @@ * */ package org.dllearner.tools.protege; + + /** * This Class handles the manchester String, the normal string and if the Individual is a positive Individual. * @author Christian Koetteritzsch Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -21,6 +21,8 @@ import java.awt.geom.Ellipse2D; +import org.dllearner.core.owl.Individual; + /** * This class is a datastructure for one individual shown in * the GraphicalCoveragePanel. @@ -34,6 +36,8 @@ private int yAxis; private final String individual; private final Ellipse2D circlePoint; + private Individual individualDLLearner; + private String baseUri; /** * Constructor of the class. @@ -42,6 +46,7 @@ * @param y coordinate on the y axis * @param ind Name of the Individual */ + @Deprecated public IndividualPoint(String p, int x, int y, String ind) { this.point = p; this.xAxis = x; @@ -49,6 +54,26 @@ this.circlePoint = new Ellipse2D.Double(x - 1, y - 1, 4, 4); this.individual = ind; } + + /** + * This is the second Construktor of the class. This should be used if more + * details for the shown Individuals should be displayed. + * @param p display String + * @param x coordinate on the x axis + * @param y coordinate on the y axis + * @param ind Name of the Individual + * @param indi DLLearner Indivudal + * @param base base uri of the individual. + */ + public IndividualPoint(String p, int x, int y, String ind, Individual indi, String base) { + this.point = p; + this.xAxis = x; + this.yAxis = y; + this.circlePoint = new Ellipse2D.Double(x - 1, y - 1, 4, 4); + this.individual = ind; + this.individualDLLearner = indi; + this.baseUri = base; + } /** * This method sets the display string of the individual. @@ -113,4 +138,12 @@ public Ellipse2D getIndividualPoint() { return circlePoint; } + + public Individual getDLLearnerIndividual() { + return individualDLLearner; + } + + public String getBaseUri() { + return baseUri; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-10-27 23:02:54 UTC (rev 1895) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-10-28 10:07:09 UTC (rev 1896) @@ -29,6 +29,7 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.reasoning.FastInstanceChecker; import org.protege.editor.owl.OWLEditorKit; +import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLOntology; @@ -61,8 +62,18 @@ this.editor = editorKit; this.view = v; this.model = m; + //TODO: mehr informationen fuer grafische anzeige herraussuchen. - //editor.getOWLModelManager().getActiveOntology().getIndividualAxioms(); + //editor.getOWLModelManager().getActiveOntology().getDataPropertyAssertionAxioms(null); + //editor.getOWLModelManager().getActiveOntology().getObjectPropertyAssertionAxioms(null); + //editor.getOWLModelManager().getActiveOntology().getSameIndividualAxioms(null); + //editor.getOWLModelManager().getActiveOntology().getDifferentIndividualAxioms(null); + /*Set<OWLAxiom> test = editor.getOWLModelManager().getActiveOntology().getAxioms(); + for(OWLAxiom t : test) { + System.out.println("hier: " + t); + //System.out.println("da: " + t); + }*/ + //System.out.println(); } /** @@ -86,9 +97,11 @@ */ private void setPositiveConcept() { current = editor.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass(); + //editor.getOWLWorkspace().getOWLIndividualSelectorPanel().getSelectedObjects(); if(current != null) { SortedSet<Individual> individuals = null; hasIndividuals = false; + System.out.println("hier: " + editor.getOWLModelManager().getActiveOntology().getAxioms(current)); // checks if selected concept is thing when yes then it selects all // individuals if (!(current.toString().equals("Thing"))) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <neb...@us...> - 2009-10-27 23:03:09
|
Revision: 1895 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1895&view=rev Author: nebelschwade Date: 2009-10-27 23:02:54 +0000 (Tue, 27 Oct 2009) Log Message: ----------- Tag and LastFM-Search now use "exakt search" when searching for more than one word - better results, this is used for the recommendations too implemented albumSearch Random/Limit for results working mootools upgrade, usage of mootools log/spinner/Elements.From, better js new DataHelper class (cleaner RequestHandler) refactored view and sparqlBuilder compressed images css-updates deleted unused data/testing Modified Paths: -------------- trunk/src/moosique.net/css/reset.css trunk/src/moosique.net/css/style.css trunk/src/moosique.net/img/bg.png trunk/src/moosique.net/img/controls.png trunk/src/moosique.net/img/noimage.png trunk/src/moosique.net/index.php trunk/src/moosique.net/js/debug.js trunk/src/moosique.net/js/index.php trunk/src/moosique.net/js/moosique.js trunk/src/moosique.net/js/start.js trunk/src/moosique.net/moosique/classes/Config.php trunk/src/moosique.net/moosique/classes/DllearnerConnection.php trunk/src/moosique.net/moosique/classes/LastFM.php trunk/src/moosique.net/moosique/classes/Recommendations.php trunk/src/moosique.net/moosique/classes/RequestHandler.php trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php trunk/src/moosique.net/moosique/classes/View.php trunk/src/moosique.net/moosique/config.ini trunk/src/moosique.net/moosique/index.php trunk/src/moosique.net/moosique/testing/learnTest.php Added Paths: ----------- trunk/src/moosique.net/img/spinner.gif trunk/src/moosique.net/js/mootools-1.2.4-core-nc.js trunk/src/moosique.net/js/mootools-1.2.4-core-yc.js trunk/src/moosique.net/js/mootools-1.2.4.2-more-nc.js trunk/src/moosique.net/js/mootools-1.2.4.2-more-yc.js trunk/src/moosique.net/moosique/classes/DataHelper.php trunk/src/moosique.net/moosique/data/moosique.owl trunk/src/moosique.net/moosique/testing/nodeExtractionBug_2.conf Removed Paths: ------------- trunk/src/moosique.net/img/loading.gif trunk/src/moosique.net/js/mootools-1.2.3-core-nc.js trunk/src/moosique.net/js/mootools-1.2.3-core-yc.js trunk/src/moosique.net/moosique/data/allRecords.txt trunk/src/moosique.net/moosique/data/allTags.txt trunk/src/moosique.net/moosique/data/dontUse.txt trunk/src/moosique.net/moosique/data/tagsWeUse.txt Modified: trunk/src/moosique.net/css/reset.css =================================================================== --- trunk/src/moosique.net/css/reset.css 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/css/reset.css 2009-10-27 23:02:54 UTC (rev 1895) @@ -1,4 +1,4 @@ -/* basic reset */ +/* default minimal basic css reset */ /* =================================================================== */ @media all { html, body, div, h1, h2, h3, @@ -17,7 +17,6 @@ select, option { font: inherit; color: inherit; } a { color: inherit; font: inherit; text-decoration: none; } a:hover { text-decoration: underline; } -a:active { position: relative; top: 1px; } .hidden { position: absolute; left: -9999px; top: -9999px; } .clearfix:after { clear: both; content: ' '; display: block; font-size: 0; line-height: 0; visibility: hidden; width: 0; height: 0; } Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/css/style.css 2009-10-27 23:02:54 UTC (rev 1895) @@ -2,11 +2,12 @@ /*=============== Default Styling ===============*/ body { font: normal 12px/18px Verdana, Arial, sans-serif; color: #f1f7e4; background: url('../img/bg.png') top left repeat #3a3a3a; border-top: 5px solid #1fd611; } -input, textarea, select { background: #292929; border: 1px solid #5a5a5a; outline: none; padding: 5px; } +input, select { background: #292929; border: 1px solid #5a5a5a; outline: none; padding: 5px; } input[type=submit] { padding: 5px 10px; } -textarea:focus, input:focus, -select:focus { border: 1px solid #1fd611; } +input:focus, select:focus { border: 1px solid #1fd611; } a:hover { color: #1fd611; } +a.button { background: #4a4a4a; color: #f1f7e4; padding: 5px 10px; text-decoration: none; } +a.button:hover { border: 1px solid #1fd611; padding: 4px 9px; } h1 { font: 32px/32px Georgia, Times, serif; } h2 { font: 28px/28px Georgia, Times, serif; } h3 { font: 20px/20px Georgia, Times, serif; } @@ -15,110 +16,93 @@ h6 { font: 10px/10px Georgia, Times, serif; } pre { font: normal 10px/14px Monaco, Courier, monospace; } p, h1, h2, h3, h4, h5, h6, -table, ul, ol, blockquote, -pre, form { margin-bottom: 18px; } +ul, ol, pre, form { margin-bottom: 18px; } /* Initial hiding */ -#recommendations, #player, -#information, #help, -#loadingImg, #header h1 { display: none; } +#recommendations, #information, +#header h1, #player, #help { display: none; } /* Rounded Corners */ -input, textarea, select, -a.button { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } +input, select, a.button { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } #content, #status, #playing, #playerControls, .results li { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } -#mainMenu a { -moz-border-radius-bottomleft: 10px; -moz-border-radius-bottomright: 10px; +#nav a { -moz-border-radius-bottomleft: 10px; -moz-border-radius-bottomright: 10px; -webkit-border-bottom-left-radius: 10px; -webkit-border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; border-top-left-radius: 10px; } -/* button-click-feeling for links, by offsetting top position */ -#playerControls a:active { position: relative; top: 2px; } -#playlist .delete:active, -#playlist .moveUp:active, -#playlist .moveDown:active { top: 6px; } - - /*=============== Default Containers ===============*/ #container, #header, -#headerContainer, -#mainContainer, #content, -#playlist li { position: relative; } +#content, #playlist li { position: relative; } #container { width: 760px; margin: 0 auto; } #header { height: 150px; padding-top: 20px; } #content { background: #292929; padding: 20px; } #footer { font: normal 10px/14px Verdana, Arial, sans-serif; padding: 20px; text-align: center; } -/*=============== header Area, Player Controls, Status, Playing and Search Form ===============*/ +/*=============== Player Controls, Status, Playing ===============*/ #status, #playing { position: absolute; top: 70px; left: 0; width: 490px; height: 60px; background: #292929; padding: 10px 20px; } #playerControls { position: absolute; top: 70px; right: 0; width: 170px; height: 60px; padding: 10px 20px; background: #292929; } +#playerControls a:active { position: relative; top: 2px; } #status { background: #393939; height: 60px; line-height: 60px; text-align: center; font-weight: bold; border: 1px solid #1fd611; z-index: 1000; } #playing span { display: block; margin-bottom: 0; font-size: 10px; } #playing .track { font: bold 12px/32px Verdana, Arial, sans-serif; } #playing .time { position: absolute; bottom: 10px; right: 20px; } - #prev, #next, #stop, #playPause, #mute { display: block; width: 20px; height: 40px; text-indent: -10000px; float: left; margin: 10px 0 0 10px; } -/* Sprites */ #prev { background: url(../img/controls.png) 0px -160px no-repeat; } #next { background: url(../img/controls.png) 0px -120px no-repeat; } #stop { background: url(../img/controls.png) 0px -80px no-repeat; } #mute { background: url(../img/controls.png) 0px -280px no-repeat; margin-right: 0; width: 23px; } #playPause { background: url(../img/controls.png) 0px 0px no-repeat; width: 26px; } -/* Search form */ + +/*=============== Search Form ===============*/ #searchValue { margin: 0 5px; width: 100px; } -#loadingImg { cursor: wait; } -a.button { background: #4a4a4a; color: #f1f7e4; padding: 5px 10px; text-decoration: none; } -a.button:hover { border: 1px solid #1fd611; padding: 4px 9px; } +.spinner { position: absolute; z-index: 10; background: url('../img/bg.png') top left repeat #3a3a3a; } +.spinner-img { background: url('../img/spinner.gif') top left no-repeat; width: 24px; height: 24px; margin: 0 auto; } + + +/*=============== Content & General ===============*/ #addRandom { text-decoration: underline; } +#footer a { padding: 0 10px; } -/*=============== Menu & Footer ===============*/ -#mainMenu ul { position: absolute; top: 0; right: 0; } -#mainMenu li { float: left; } -#mainMenu a { display: block; margin-left: 10px; line-height: 30px; height: 30px; + +/*=============== Menu ===============*/ +#nav ul { position: absolute; top: 0; right: 0; } +#nav li { float: left; } +#nav a { display: block; margin-left: 10px; line-height: 30px; height: 30px; padding: 10px 12px; color: #f1f7e4; background: #4a4a4a; } -#mainMenu .active a, -#mainMenu .active a:hover { background: #1fd611; } -#mainMenu a:hover { text-decoration: none; background: #5a5a5a; } +#nav .active a, +#nav .active a:hover { background: #1fd611; } +#nav a:hover { text-decoration: none; background: #5a5a5a; } -#footer a { padding: 0 10px; } -/*=============== Search Results ===============*/ -.results li h3 a { font-weight: normal; } -.results li img { border: 2px solid #545454; } +/*=============== Search Results, Recommendations & Playlist ===============*/ +.results h3 a { font-weight: normal; } +.results img { border: 2px solid #545454; max-width: 308px; max-height: 308px; } .results li { float: left; width: 312px; border: 1px solid #545454; padding: 18px; margin-bottom: 18px; } .results li.odd { margin-right: 18px; clear: both; } .results ul ul { list-style: disc; } - -/* This is for the list of found albums etc */ .results li li, .artistSearch li li, .tagSearch li li { border: none; display: list-item; padding: 0; margin: 0 0 0 36px; width: auto; height: auto; float: none; } + +.results h4 { display: inline; } #recommendationResults ul ul, .tagSearch ul ul { clear: both; } -.results .artistImage { text-align: center; margin-bottom: 18px;} -.results .cover { margin: 0 18px 18px 0; width: 104px; height: 104px; float: left; } -#recommendationResults h4, -.tagSearch h4 { display: inline; } - - -/*=============== Recommendations and playlist ===============*/ +.results .image { text-align: center; margin-bottom: 18px; } +#recommendationResults.results .image, +.results .tagSearch .image { margin: 0 18px 18px 0; width: 104px; height: 104px; float: left; } #autoAdd { float: right; } -#recommended a:hover { cursor: pointer; text-decoration: none; font-weight: bold; color: #131313; } -#playlist, #recommended, -#recently { margin-left: 36px; list-style: decimal; } -#playlist li, #recently li, -#recommended li { line-height: 24px; } -#playlist .ymp-btn-page-pause { font-weight: bold; } -/* Playlist buttons */ +#playlist, #recently { margin-left: 36px; list-style: decimal; } +#playlist li, #recently li { line-height: 24px; } +#playlist .ymp-btn-page-pause { font-weight: bold; } #playlist .delete, #playlist .moveUp, #playlist .moveDown { position: absolute; display: block; top: 5px; right: 20px; width: 14px; height: 14px; @@ -126,11 +110,13 @@ background: url(../img/controls.png) 0px -200px no-repeat;} #playlist .moveUp { background: url(../img/controls.png) 0px -360px no-repeat; right: 40px; } #playlist .moveDown { background: url(../img/controls.png) 0px -320px no-repeat; right: 60px; } +#playlist .delete:active, +#playlist .moveUp:active, +#playlist .moveDown:active { top: 6px; } -/*=============== Information / Help ===============*/ +/*=============== Information & Help ===============*/ - } /* end @media screen */ \ No newline at end of file Modified: trunk/src/moosique.net/img/bg.png =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/img/controls.png =================================================================== (Binary files differ) Deleted: trunk/src/moosique.net/img/loading.gif =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/img/noimage.png =================================================================== (Binary files differ) Added: trunk/src/moosique.net/img/spinner.gif =================================================================== (Binary files differ) Property changes on: trunk/src/moosique.net/img/spinner.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/index.php 2009-10-27 23:02:54 UTC (rev 1895) @@ -1,18 +1,17 @@ <?php session_start(); ?> -<!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"> +<!DOCTYPE html> +<html lang="en"> <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <link href="css/" rel="stylesheet" type="text/css" /> + <meta charset="utf-8" /> + <link rel="stylesheet" href="css/" /> <title>moosique.net</title> </head> <body> <div id="container"> <div id="header"> <h1>moosique.net</h1> - <div id="mainMenu"> + + <div id="nav"> <ul class="clearfix"> <li class="active"><a href="#" class="home">Search</a></li> <li><a href="#" class="player">Playlist</a></li> @@ -21,20 +20,22 @@ <li><a href="#" class="help">?</a></li> </ul> </div> + <form id="searchForm" method="get" action="moosique/"> <div> <select name="searchType" id="searchType"> <option value="allSearch">All</option> <option value="artistSearch">Artist</option> <option value="tagSearch">Tag</option> + <option value="albumSearch">Album</option> <option value="songSearch">Song</option> <option value="lastFM">last.fm</option> </select> <input id="searchValue" name="searchValue" type="text" /> <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" /> - <img id="loadingImg" src="img/loading.gif" alt="Loading..." /> </div> </form> + <div id="playerControls"> <a href="#" id="playPause" title="Play/Pause">Play / Pause</a> <a href="#" id="stop" title="Stop playing">Stop</a> @@ -42,6 +43,7 @@ <a href="#" id="next" title="Play next Track in Playlist">Next Track</a> <a href="#" id="mute" title="Sound on/off">Mute</a> </div> + <div id="status"> </div> <div id="playing"> <span class="info">Player stopped</span> @@ -87,18 +89,18 @@ <h2>Recommendations</h2> <p> These recommendations are generated every time you listen to a song - for at least half it's length, assuming that you liked it. You click on a + for at least half it's length, assuming that you liked it. You can click on a recommended album to add it to the playlist, or you can <a href="#" id="addRandom">click here to just add a random song from your recommendations</a>.<br /> </p> + <p> + <a href="#" id="generateRecommendations" class="button" title="If there is nothing showing up here, you can generate your list of recommendations by clicking here.">Reload recommendations</a> + </p> <div id="recommendationResults" class="results"> </div> - <p> - <a href="#" id="generateRecommendations" class="button" title="If there is nothing showing up here, you can generate your list of recommendations by clicking here.">Reload recommendations</a> - </p> </div> <div id="information"> @@ -138,9 +140,7 @@ <a href="http://jamendo.com">Jamendo</a> | <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> </div> - <div id="temp" class="hidden"> - - </div> + </div> <!-- end container --> <?php @@ -148,15 +148,15 @@ $c = new Config(); if ($c->getConfig('debug') == 1) /* debugging active */ { ?> -<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> -<script type="text/javascript" src="js/mootools-1.2.3-core-nc.js"></script> -<script type="text/javascript" src="js/moosique.js"></script> -<script type="text/javascript" src="js/debug.js"></script> -<script type="text/javascript" src="js/start.js"></script> - +<script src="http://mediaplayer.yahoo.com/js"></script> +<script src="js/mootools-1.2.4-core-nc.js"></script> +<script src="js/mootools-1.2.4.2-more-nc.js"></script> +<script src="js/moosique.js"></script> +<script src="js/debug.js"></script> +<script src="js/start.js"></script> <?php } else /* compress for production and dont include debugger */ { ?> -<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> -<script type="text/javascript" src="js/"></script> +<script src="http://mediaplayer.yahoo.com/js"></script> +<script src="js/"></script> <?php } ?> </body> </html> \ No newline at end of file Modified: trunk/src/moosique.net/js/debug.js =================================================================== --- trunk/src/moosique.net/js/debug.js 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/js/debug.js 2009-10-27 23:02:54 UTC (rev 1895) @@ -1,6 +1,9 @@ -/* activate debugging if firebug is avaiable */ -if (typeof(console) !== 'undefined') { - debug = console; - debug.log("Firebug-Console for moosique.net activated."); -} - +// New Debugger-Class using the mootools-log +var Debugger = new Class({ + Implements: Log, + initialize: function(){ + this.enableLog().log('Log-Console for moosique.net activated.'); + } +}); +// global debugger-instance +var debug = new Debugger; Modified: trunk/src/moosique.net/js/index.php =================================================================== --- trunk/src/moosique.net/js/index.php 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/js/index.php 2009-10-27 23:02:54 UTC (rev 1895) @@ -17,7 +17,8 @@ } /* the javascript-files to include and compress */ -include('mootools-1.2.3-core-yc.js'); +include('mootools-1.2.4-core-yc.js'); +include('mootools-1.2.4.2-more-yc-min.js'); include('moosique.js'); include('start.js'); Modified: trunk/src/moosique.net/js/moosique.js =================================================================== --- trunk/src/moosique.net/js/moosique.js 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/js/moosique.js 2009-10-27 23:02:54 UTC (rev 1895) @@ -1,9 +1,3 @@ -// initialize an empty debugger, will be activated if firefox/firebug enabled -var debug = {}; -debug.log = function(msg) { - return false; -}; - /** * moosique-Player-Class * @@ -41,36 +35,40 @@ * changed, just change the references here and everything will work fine. */ initVars: function() { - this.main = document.id('content'); - this.menu = document.id('mainMenu'); + // buttons this.playPause = document.id('playPause'); this.prev = document.id('prev'); this.next = document.id('next'); this.stop = document.id('stop'); this.mute = document.id('mute'); - this.status = document.id('status'); - this.playlist = document.id('playlist'); - this.recently = document.id('recently'); + // player info & status display this.nowPlayingInfo = $$('#playing .info'); this.nowPlayingTrack = $$('#playing .track'); this.nowPlayingTime = $$('#playing .time'); + this.status = document.id('status'); + // searchForm elements this.searchForm = document.id('searchForm'); this.searchSubmit = document.id('searchSubmit'); this.searchValue = document.id('searchValue'); this.searchType = document.id('searchType'); this.results = document.id('results'); - this.loading = document.id('loadingImg'); - this.welcome = document.id('welcome'); - this.help = document.id('help'); + // playlist and recently + this.playlist = document.id('playlist'); + this.recently = document.id('recently'); + this.resetPlaylist = document.id('resetPlaylist'); + this.resetRecently = document.id('resetRecently'); + // recommendations this.recommendations = document.id('recommendations'); this.generate = document.id('generateRecommendations'); this.recResults = document.id('recommendationResults'); - this.resetPlaylist = document.id('resetPlaylist'); - this.resetRecently = document.id('resetRecently'); - this.moreInfo = document.id('moreInfo'); - this.temp = document.id('temp'); - this.autoAddCheckbox = document.id('autoAddCheckbox'); this.addRandom = document.id('addRandom'); + this.autoAddCheckbox = document.id('autoAddCheckbox'); + // other + this.content = document.id('content'); + this.nav = document.id('nav'); + this.welcome = document.id('welcome'); + this.help = document.id('help'); + this.moreInfo = document.id('moreInfo'); }, /** @@ -82,11 +80,9 @@ */ applyYahooMediaPlayerConfig: function() { var that = this; - var playerConfig = function() { // display ready-status message that.displayStatusMessage('Player ready.'); - /** * progress: Change the track position and duration displayed every time, as usual in players * @@ -121,7 +117,6 @@ // get the current cookie var recentlyListenedCookie = Cookie.read('moosique'); var recentlyListened = []; - if (recentlyListenedCookie) { // does the cookie exist? recentlyListened = JSON.decode(recentlyListenedCookie).recentlyListened; if (recentlyListened) { // if the cookie is not totally empty @@ -133,15 +128,13 @@ } } } - // add the last played to the array - recentlyListened.push(last); + recentlyListened.push(last); // add the last played to the array // update the cookie recentlyListenedObject = { 'recentlyListened' : recentlyListened }; recentlyListenedCookie = Cookie.write( /* save for one year */ 'moosique', JSON.encode(recentlyListenedObject), { duration: 365 } ); - // update the recently played list that.updateRecently(); that.displayStatusMessage('Added this song to your recently listened to songs.'); @@ -155,44 +148,49 @@ */ var playlistUpdate = function() { // delete button - $$('#playlist .delete').each(function(del) { + that.playlist.getElements('.delete').each(function(del) { del.removeEvents(); del.addEvent('click', function(e) { - e.stop(); - // TODO: if playlist empty or deleted currently playing track: STOP! + e.stop(); // don't folow link + // if current or the last song from the playlist stop playing + if (YAHOO.MediaPlayer.getMetaData().anchor.getParent() == this.getParent()) { + that.stopPlaying(); + } this.getParent().destroy(); // deletes the li-element - // and refresh the playlist if clicked - YAHOO.MediaPlayer.addTracks(that.playlist, '', true); - // TODO: if playlist empty or deleted currently playing track: STOP! + that.refreshPlaylist(); }); }); // up-button - $$('#playlist .moveUp').each(function(up) { + that.playlist.getElements('.moveUp').each(function(up) { up.removeEvents(); up.addEvent('click', function(e) { - e.stop(); // don't folow link + e.stop(); + if (YAHOO.MediaPlayer.getMetaData().anchor.getParent() == this.getParent()) { + that.stopPlaying(); + } var li = up.getParent(); var before = li.getPrevious(); if (before) { // it's not the first one li.inject(before, 'before'); - // and refresh the playlist if clicked - YAHOO.MediaPlayer.addTracks(that.playlist, '', true); + that.refreshPlaylist(); } }); }); // down button - $$('#playlist .moveDown').each(function(down) { + that.playlist.getElements('.moveDown').each(function(down) { down.removeEvents(); down.addEvent('click', function(e) { - e.stop(); // don't folow link + e.stop(); + if (YAHOO.MediaPlayer.getMetaData().anchor.getParent() == this.getParent()) { + that.stopPlaying(); + } var li = down.getParent(); var after = li.getNext(); if (after) { // it's not the first one li.inject(after, 'after'); - // and refresh the playlist if clicked - YAHOO.MediaPlayer.addTracks(that.playlist, '', true); + that.refreshPlaylist(); } }); }); @@ -216,7 +214,7 @@ var trackStart = function() { that.nowPlayingInfo.set('text', 'Currently playing:'); that.nowPlayingTrack.set('text', YAHOO.MediaPlayer.getMetaData().title); - that.playPause.setStyle('background-position', '0px -40px'); + that.playPause.setStyle('background-position', '0px -40px'); // sprite offset // send a request to gather additional artist-information var nowPlayingAlbum = YAHOO.MediaPlayer.getMetaData().anchor.get('rel'); @@ -227,7 +225,6 @@ that.moreInfo.set('html', response); } }).send('info=' + nowPlayingAlbum); - }; /** @@ -271,6 +268,7 @@ onFailure: function() { that.recResults.set('html', '<h2>Unable to get recommendations. Please reset and try again.</h2>'); }, + onSuccess: function(response) { response = response.trim(); if (response != '') { @@ -288,8 +286,6 @@ debug.log('Response from server empty.'); that.recResults.set('html', '<h2>There is nothing in your recently list.</h2><p>You have to listen to some music first, before you can get any recommendations.</p>'); } - - } }).send('get=recommendations'); }, @@ -380,9 +376,9 @@ /** + * This function stops the player and displays the default + * status-message "Player stopped", also refreshes the playlist * - * - * */ stopPlaying: function() { var that = this; @@ -419,38 +415,36 @@ */ initInterface: function() { var that = this; - - that.menu.getElements('a').each(function(tab) { + // tabbed nav + that.nav.getElements('a').each(function(tab) { tab.addEvent('click', function(e) { e.stop(); // dont follow link that.showTab(tab.get('class').toString()); }); }); - // generating recommendations clickable that.generate.addEvent('click', function(e) { e.stop(); that.generateRecommendations(); }); - + // enable resetting recently list that.resetRecently.addEvent('click', function(e) { e.stop(); Cookie.dispose('moosique'); that.updateRecently(); }); - + // enable resetting the playlist that.resetPlaylist.addEvent('click', function(e) { e.stop(); that.playlist.empty(); that.stopPlaying(); }); - + // enable the manual add random to playlist that.addRandom.addEvent('click', function(e) { e.stop(); that.addRandomToPlaylist(); }); - - // make buttons functional + // make player-buttons functional this.addEventsToButtons(); }, @@ -458,22 +452,19 @@ /** * Make the search-Form an ajax-Search form, displaying the results * on the homepage if successful - * - * TODO: sanitize client-side too using regex and displayStatus */ activateSearch: function() { var that = this; - + var spinner = new Spinner(that.searchSubmit); + that.searchForm.addEvent('submit', function(e) { e.stop(); // prevent form submitting the non-ajax way this.set('send', { onRequest: function() { + spinner.show(); that.searchSubmit.set('disabled', 'disabled'); - that.searchSubmit.setStyle('display', 'none'); - // show homescreen for resultdisplaying that.showTab('home'); - // if the welcome-text ist present, cut & paste it to help if (that.welcome) { if (that.welcome.get('html').length > 100) { @@ -481,19 +472,17 @@ that.welcome.destroy(); } } - that.loading.setStyle('display', 'inline'); that.results.set('html', '<h2>Searching...</h2><p>Please be patient, this may take up to a minute...</p>'); }, onFailure: function() { + spinner.hide(); that.results.set('html', '<h2>Unable to process your search. Try again.</h2>'); }, onSuccess: function(response) { + spinner.hide(); that.searchSubmit.erase('disabled'); // reenable submitbutton - that.searchSubmit.setStyle('display', 'inline'); - that.loading.setStyle('display', 'none'); - // display results that.results.set('html', response); // addEvents to result-links that.makeAddable($$('a.addToPlaylist')); @@ -501,7 +490,7 @@ }); // only send form if value is at least 3 chars long - if (that.searchValue.get('value').length > 2) { + if (that.searchValue.get('value').length >= 3) { this.send(); } else { that.displayStatusMessage('Please enter at least 3 chars for searching...'); @@ -577,7 +566,6 @@ // add the delete, moveUp, moveDown Buttons that.playlist.getChildren().each(function(li) { var children = li.getChildren(); - // only add the buttons if they are not there yet if (children.length == 1) { var track = li.getFirst(); @@ -590,68 +578,58 @@ delButton.inject(downButton, 'after'); } }); - // refresh the playlist and show the player-tab that.refreshPlaylist(); }, /** + * This function adds a random song from a random record from the + * recommendations results to the playlist (enqueue at the end) * - * - * */ addRandomToPlaylist: function() { var that = this; var addableAlbums = that.recResults.getElements('.addToPlaylist'); // pick a random album var randomAlbum = addableAlbums.getRandom(); - + // if there is at least one album to add items from if (randomAlbum) { var href = randomAlbum.get('href'); var rel = randomAlbum.get('rel'); - if (href.match(/jamendo\.com\/get\/track\/id\//gi)) { type = 'playlist'; } - if (href.match(/\.mp3/)) { type = 'mp3File'; } - - // if the addable item is a playlist, we have to get the playlistitems var getPlaylist = new Request({method: 'get', url: 'moosique/index.php', onSuccess: function(response) { // yay, we have the playlist, choose a random song and add it // therefore save it as Element in temp and extract a random song - // TODO a better way would be to just get on <li> from the response - // with a regexp and just use this, without creating new dom nodes etc. - that.temp.set('html', '<ul>' + response + '</ul>'); - var songs = that.temp.getElements('li'); + var songs = Elements.from(response); var randomSong = songs.getRandom(); that.insertIntoPlaylist('<li>' + randomSong.get('html') + '</li>'); - that.temp.empty(); } }).send('get=playlist&playlist=' + href + '&rel=' + rel); } else { debug.log('You currently have no recommendations, adding a random one will not work.'); } - }, /** - * Shows the given tab in the menu, and hides all others + * Shows the given tab in the nav, and hides all others * * @param {String} tabID ID of the Tab to show */ showTab: function(tabID) { var that = this; - that.menu.getElements('li').removeClass('active'); - that.menu.getElements('a.' + tabID).getParent().toggleClass('active'); - that.main.getChildren().setStyle('display', 'none'); + that.nav.getElements('li').removeClass('active'); + that.nav.getElements('a.' + tabID).getParent().toggleClass('active'); + that.content.getChildren().setStyle('display', 'none'); document.id(tabID).setStyle('display', 'block'); }, /** * Converts seconds into a string formatted minutes:seconds - * with leading zeros for seconds + * with leading zeros for seconds for a nicer display * * @param {Float} seconds * @return {String} minsec minutes:seconds Deleted: trunk/src/moosique.net/js/mootools-1.2.3-core-nc.js =================================================================== --- trunk/src/moosique.net/js/mootools-1.2.3-core-nc.js 2009-10-27 08:48:54 UTC (rev 1894) +++ trunk/src/moosique.net/js/mootools-1.2.3-core-nc.js 2009-10-27 23:02:54 UTC (rev 1895) @@ -1,4036 +0,0 @@ -/* -Script: Core.js - MooTools - My Object Oriented JavaScript Tools. - -License: - MIT-style license. - -Copyright: - Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/). - -Code & Documentation: - [The MooTools production team](http://mootools.net/developers/). - -Inspiration: - - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) - - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) -*/ - -var MooTools = { - 'version': '1.2.3', - 'build': '4980aa0fb74d2f6eb80bcd9f5b8e1fd6fbb8f607' -}; - -var Native = function(options){ - options = options || {}; - var name = options.name; - var legacy = options.legacy; - var protect = options.protect; - var methods = options.implement; - var generics = options.generics; - var initialize = options.initialize; - var afterImplement = options.afterImplement || function(){}; - var object = initialize || legacy; - generics = generics !== false; - - object.constructor = Native; - object.$family = {name: 'native'}; - if (legacy && initialize) object.prototype = legacy.prototype; - object.prototype.constructor = object; - - if (name){ - var family = name.toLowerCase(); - object.prototype.$family = {name: family}; - Native.typize(object, family); - } - - var add = function(obj, name, method, force){ - if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method; - if (generics) Native.genericize(obj, name, protect); - afterImplement.call(obj, name, method); - return obj; - }; - - object.alias = function(a1, a2, a3){ - if (typeof a1 == 'string'){ - var pa1 = this.prototype[a1]; - if ((a1 = pa1)) return add(this, a2, a1, a3); - } - for (var a in a1) this.alias(a, a1[a], a2); - return this; - }; - - object.implement = function(a1, a2, a3){ - if (typeof a1 == 'string') return add(this, a1, a2, a3); - for (var p in a1) add(this, p, a1[p], a2); - return this; - }; - - if (methods) object.implement(methods); - - return object; -}; - -Native.genericize = function(object, property, check){ - if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){ - var args = Array.prototype.slice.call(arguments); - return object.prototype[property].apply(args.shift(), args); - }; -}; - -Native.implement = function(objects, properties){ - for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties); -}; - -Native.typize = function(object, family){ - if (!object.type) object.type = function(item){ - return ($type(item) === family); - }; -}; - -(function(){ - var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String}; - for (var n in natives) new Native({name: n, initialize: natives[n], protect: true}); - - var types = {'boolean': Boolean, 'native': Native, 'object': Object}; - for (var t in types) Native.typize(types[t], t); - - var generics = { - 'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"], - 'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"] - }; - for (var g in generics){ - for (var i = generics[g].length; i--;) Native.genericize(natives[g], generics[g][i], true); - } -})(); - -var Hash = new Native({ - - name: 'Hash', - - initialize: function(object){ - if ($type(object) == 'hash') object = $unlink(object.getClean()); - for (var key in object) this[key] = object[key]; - return this; - } - -}); - -Hash.implement({ - - forEach: function(fn, bind){ - for (var key in this){ - if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this); - } - }, - - getClean: function(){ - var clean = {}; - for (var key in this){ - if (this.hasOwnProperty(key)) clean[key] = this[key]; - } - return clean; - }, - - getLength: function(){ - var length = 0; - for (var key in this){ - if (this.hasOwnProperty(key)) length++; - } - return length; - } - -}); - -Hash.alias('forEach', 'each'); - -Array.implement({ - - forEach: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this); - } - -}); - -Array.alias('forEach', 'each'); - -function $A(iterable){ - if (iterable.item){ - var l = iterable.length, array = new Array(l); - while (l--) array[l] = iterable[l]; - return array; - } - return Array.prototype.slice.call(iterable); -}; - -function $arguments(i){ - return function(){ - return arguments[i]; - }; -}; - -function $chk(obj){ - return !!(obj || obj === 0); -}; - -function $clear(timer){ - clearTimeout(timer); - clearInterval(timer); - return null; -}; - -function $defined(obj){ - return (obj != undefined); -}; - -function $each(iterable, fn, bind){ - var type = $type(iterable); - ((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind); -}; - -function $empty(){}; - -function $extend(original, extended){ - for (var key in (extended || {})) original[key] = extended[key]; - return original; -}; - -function $H(object){ - return new Hash(object); -}; - -function $lambda(value){ - return ($type(value) == 'function') ? value : function(){ - return value; - }; -}; - -function $merge(){ - var args = Array.slice(arguments); - args.unshift({}); - return $mixin.apply(null, args); -}; - -function $mixin(mix){ - for (var i = 1, l = arguments.length; i < l; i++){ - var object = arguments[i]; - if ($type(object) != 'object') continue; - for (var key in object){ - var op = object[key], mp = mix[key]; - mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $mixin(mp, op) : $unlink(op); - } - } - return mix; -}; - -function $pick(){ - for (var i = 0, l = arguments.length; i < l; i++){ - if (arguments[i] != undefined) return arguments[i]; - } - return null; -}; - -function $random(min, max){ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -function $splat(obj){ - var type = $type(obj); - return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : []; -}; - -var $time = Date.now || function(){ - return +new Date; -}; - -function $try(){ - for (var i = 0, l = arguments.length; i < l; i++){ - try { - return arguments[i](); - } catch(e){} - } - return null; -}; - -function $type(obj){ - if (obj == undefined) return false; - if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name; - if (obj.nodeName){ - switch (obj.nodeType){ - case 1: return 'element'; - case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace'; - } - } else if (typeof obj.length == 'number'){ - if (obj.callee) return 'arguments'; - else if (obj.item) return 'collection'; - } - return typeof obj; -}; - -function $unlink(object){ - var unlinked; - switch ($type(object)){ - case 'object': - unlinked = {}; - for (var p in object) unlinked[p] = $unlink(object[p]); - break; - case 'hash': - unlinked = new Hash(object); - break; - case 'array': - unlinked = []; - for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]); - break; - default: return object; - } - return unlinked; -}; - - -/* -Script: Browser.js - The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash. - -License: - MIT-style license. -*/ - -var Browser = $merge({ - - Engine: {name: 'unknown', version: 0}, - - Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()}, - - Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)}, - - Plugins: {}, - - Engines: { - - presto: function(){ - return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925)); - }, - - trident: function(){ - return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? 5 : 4); - }, - - webkit: function(){ - return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419); - }, - - gecko: function(){ - return (document.getBoxObjectFor == undefined) ? false : ((document.getElementsByClassName) ? 19 : 18); - } - - } - -}, Browser || {}); - -Browser.Platform[Browser.Platform.name] = true; - -Browser.detect = function(){ - - for (var engine in this.Engines){ - var version = this.Engines[engine](); - if (version){ - this.Engine = {name: engine, version: version}; - this.Engine[engine] = this.Engine[engine + version] = true; - break; - } - } - - return {name: engine, version: version}; - -}; - -Browser.detect(); - -Browser.Request = function(){ - return $try(function(){ - return new XMLHttpRequest(); - }, function(){ - return new ActiveXObject('MSXML2.XMLHTTP'); - }); -}; - -Browser.Features.xhr = !!(Browser.Request()); - -Browser.Plugins.Flash = (function(){ - var version = ($try(function(){ - return navigator.plugins['Shockwave Flash'].description; - }, function(){ - return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version'); - }) || '0 r0').match(/\d+/g); - return {version: parseInt(version[0] || 0 + '.' + version[1], 10) || 0, build: parseInt(version[2], 10) || 0}; -})(); - -function $exec(text){ - if (!text) return text; - if (window.execScript){ - window.execScript(text); - } else { - var script = document.createElement('script'); - script.setAttribute('type', 'text/javascript'); - script[(Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerText' : 'text'] = text; - document.head.appendChild(script); - document.head.removeChild(script); - } - return text; -}; - -Native.UID = 1; - -var $uid = (Browser.Engine.trident) ? function(item){ - return (item.uid || (item.uid = [Native.UID++]))[0]; -} : function(item){ - return item.uid || (item.uid = Native.UID++); -}; - -var Window = new Native({ - - name: 'Window', - - legacy: (Browser.Engine.trident) ? null: window.Window, - - initialize: function(win){ - $uid(win); - if (!win.Element){ - win.Element = $empty; - if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2 - win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {}; - } - win.document.window = win; - return $extend(win, Window.Prototype); - }, - - afterImplement: function(property, value){ - window[property] = Window.Prototype[property] = value; - } - -}); - -Window.Prototype = {$family: {name: 'window'}}; - -new Window(window); - -var Document = new Native({ - - name: 'Document', - - legacy: (Browser.Engine.trident) ? null: window.Document, - - initialize: function(doc){ - $uid(doc); - doc.head = doc.getElementsByTagName('head')[0]; - doc.html = doc.getElementsByTagName('html')[0]; - if (Browser.Engine.trident && Browser.Engine.version <= 4) $try(function(){ - doc.execCommand("BackgroundImageCache", false, true); - }); - if (Browser.Engine.trident) doc.window.attachEvent('onunload', function() { - doc.window.detachEvent('onunload', arguments.callee); - doc.head = doc.html = doc.window = null; - }); - return $extend(doc, Document.Prototype); - }, - - afterImplement: function(property, value){ - document[property] = Document.Prototype[property] = value; - } - -}); - -Document.Prototype = {$family: {name: 'document'}}; - -new Document(document); - - -/* -Script: Array.js - Contains Array Prototypes like each, contains, and erase. - -License: - MIT-style license. -*/ - -Array.implement({ - - every: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++){ - if (!fn.call(bind, this[i], i, this)) return false; - } - return true; - }, - - filter: function(fn, bind){ - var results = []; - for (var i = 0, l = this.length; i < l; i++){ - if (fn.call(bind, this[i], i, this)) results.push(this[i]); - } - return results; - }, - - clean: function() { - return this.filter($defined); - }, - - indexOf: function(item, from){ - var len = this.length; - for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){ - if (this[i] === item) return i; - } - return -1; - }, - - map: function(fn, bind){ - var results = []; - for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this); - return results; - }, - - some: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++){ - if (fn.call(bind, this[i], i, this)) return true; - } - return false; - }, - - associate: function(keys){ - var obj = {}, length = Math.min(this.length, keys.length); - for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; - return obj; - }, - - link: function(object){ - var result = {}; - for (var i = 0, l = this.length; i < l; i++){ - for (var key in object){ - if (object[key](this[i])){ - result[key] = this[i]; - delete object[key]; - break; - } - } - } - return result; - }, - - contains: function(item, from){ - return this.indexOf(item, from) != -1; - }, - - extend: function(array){ - for (var i = 0, j = array.length; i < j; i++) this.push(array[i]); - return this; - }, - - getLast: function(){ - return (this.length) ? this[this.length - 1] : null; - }, - - getRandom: function(){ - return (this.length) ? this[$random(0, this.length - 1)] : null; - }, - - include: function(item){ - if (!this.contains(item)) this.push(item); - return this; - }, - - combine: function(array){ - for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); - return this; - }, - - erase: function(item){ - for (var i = this.length; i--; i){ - if (this[i] === item) this.splice(i, 1); - } - return this; - }, - - empty: function(){ - this.length = 0; - return this; - }, - - flatten: function(){ - var array = []; - for (var i = 0, l = this.length; i < l; i++){ - var type = $type(this[i]); - if (!type) continue; - array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]); - } - return array; - }, - - hexToRgb: function(array){ - if (this.length != 3) return null; - var rgb = this.map(function(value){ - if (value.length == 1) value += value; - return value.toInt(16); - }); - return (array) ? rgb : 'rgb(' + rgb + ')'; - }, - - rgbToHex: function(array){ - if (this.length < 3) return null; - if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; - var hex = []; - for (var i = 0; i < 3; i++){ - var bit = (this[i] - 0).toString(16); - hex.push((bit.length == 1) ? '0' + bit : bit); - } - return (array) ? hex : '#' + hex.join(''); - } - -}); - - -/* -Script: Function.js - Contains Function Prototypes like create, bind, pass, and delay. - -License: - MIT-style license. -*/ - -Function.implement({ - - extend: function(properties){ - for (var property in properties) this[property] = properties[property]; - return this; - }, - - create: function(options){ - var self = this; - options = options || {}; - return function(event){ - var args = options.arguments; - args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0); - if (options.event) args = [event || window.event].extend(args); - var returns = function(){ - return self.apply(options.bind || null, args); - }; - if (options.delay) return setTimeout(returns, options.delay); - if (options.periodical) return setInterval(returns, options.periodical); - if (options.attempt) return $try(returns); - return returns(); - }; - }, - - run: function(args, bind){ - return this.apply(bind, $splat(args)); - }, - - pass: function(args, bind){ - return this.create({bind: bind, arguments: args}); - }, - - bind: function(bind, args){ - return this.create({bind: bind, arguments: args}); - }, - - bindWithEvent: function(bind, args){ - return this.create({bind: bind, arguments: args, event: true}); - }, - - attempt: function(args, bind){ - return this.create({bind: bind, arguments: args, attempt: true})(); - }, - - delay: function(delay, bind, args){ - return this.create({bind: bind, arguments: args, delay: delay})(); - }, - - periodical: function(periodical, bind, args){ - return this.create({bind: bind, arguments: args, periodical: periodical})(); - } - -}); - - -/* -Script: Number.js - Contains Number Prototypes like limit, round, times, and ceil. - -License: - MIT-style license. -*/ - -Number.implement({ - - limit: function(min, max){ - return Math.min(max, Math.max(min, this)); - }, - - round: function(precision){ - precision = Math.pow(10, precision || 0); - return Math.round(this * precision) / precision; - }, - - times: function(fn, bind){ - for (var i = 0; i < this; i++) fn.call(bind, i, this); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - } - -}); - -Number.alias('times', 'each'); - -(function(math){ - var methods = {}; - math.each(function(name){ - if (!Number[name]) methods[name] = function(){ - return Math[name].apply(null, [this].concat($A(arguments))); - }; - }); - Number.implement(methods); -})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); - - -/* -Script: String.js - Contains String Prototypes like camelCase, capitalize, test, and toInt. - -License: - MIT-style license. -*/ - -String.implement({ - - test: function(regex, params){ - return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this); - }, - - contains: function(string, separator){ - return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1; - }, - - trim: function(){ - return this.replace(/^\s+|\s+$/g, ''); - }, - - clean: function(){ - return this.replace(/\s+/g, ' ').trim(); - }, - - camelCase: function(){ - return this.replace(/-\D/g, function(match){ - return match.charAt(1).toUpperCase(); - }); - }, - - hyphenate: function(){ - return this.replace(/[A-Z]/g, function(match){ - return ('-' + match.charAt(0).toLowerCase()); - }); - }, - - capitalize: function(){ - return this.replace(/\b[a-z]/g, function(match){ - return match.toUpperCase(); - }); - }, - - escapeRegExp: function(){ - return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - hexToRgb: function(array){ - var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); - return (hex) ? hex.slice(1).hexToRgb(array) : null; - }, - - rgbToHex: function(array){ - var rgb = this.match(/\d{1,3}/g); - return (rgb) ? rgb.rgbToHex(array) : null; - }, - - stripScripts: function(option){ - var scripts = ''; - var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){ - scripts += arguments[1] + '\n'; - return ''; - }); - if (option === true) $exec(scripts); - else if ($type(option) == 'function') option(scripts, text); - return text; - }, - - substitute: function(object, regexp){ - return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ - if (match.charAt(0) == '\\') return match.slice(1); - return (object[name] != undefined) ? object[name] : ''; - }); - } - -}); - - -/* -Script: Hash.js - Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects. - -License: - MIT-style license. -*/ - -Hash.implement({ - - has: Object.prototype.hasOwnProperty, - - keyOf: function(value){ - for (var key in this){ - if (this.hasOwnProperty(key) && this[key] === value) return key; - } - return null; - }, - - hasValue: function(value){ - return (Hash.keyOf(this, value) !== null); - }, - - extend: function(properties){ - Hash.each(properties || {}, function(value, key){ - Hash.set(this, key, value); - }, this); - return this; - }, - - combine: function(properties){ - Hash.each(properties || {}, function(value, key){ - Hash.include(this, key, value); - }, this); - return this; - }, - - erase: function(key){ - if (this.hasOwnProperty(key)) delete this[key]; - return this; - }, - - get: function(key){ - return (this.hasOwnProperty(key)) ? this[key] : null; - }, - - set: function(key, value){ - if (!this[key] || this.hasOwnProperty(key)) this[key] = value; - return this; - }, - - empty: function(){ - Hash.each(this, function(value, key){ - delete this[key]; - }, this); - return this; - }, - - include: function(key, value){ - if (this[key] == undefined) this[key] = value; - return this; - }, - - map: function(fn, bind){ - var results = new Hash; - Hash.each(this, function(value, key){ - results.set(key, fn.call(bind, value, key, this)); - }, this); - return results; - }, - - filter: function(fn, bind){ - var results = new Hash; - Hash.each(this, function(value, key){ - if (fn.call(bind, value, key, this)) results.set(key, value); - }, this); - return results; - }, - - every: function(fn, bind){ - for (var key in this){ - if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false; - } - return true; - }, - - some: function(fn, bind){ - for (var key in this){ - if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true; - } - return false; - }, - - getKeys: function(){ - var keys = []; - Hash.each(this, function(value, key){ - keys.push(key); - }); - return keys; - }, - - getValues: function(){ - var values = []; - Hash.each(this, function(value){ - values.push(value); - }); - return values; - }, - - toQueryString: function(base){ - var queryString = []; - Hash.each(this, function(value, key){ - if (base) key = base + '[' + key + ']'; - var result; - switch ($type(value)){ - case 'object': result = Hash.toQueryString(value, key); break; - case 'array': - var qs = {}; - value.each(function(val, i){ - qs[i] = val; - }); - result = Hash.toQueryString(qs, key); - break; - default: result = key + '=' + encodeURIComponent(value); - } - if (value != undefined) queryString.push(result); - }); - - return queryString.join('&'); - } - -}); - -Hash.alias({keyOf: 'indexOf', hasValue: 'contains'}); - - -/* -Script: Event.js - Contains the Event Native, to make the event object completely crossbrowser. - -License: - MIT-style license. -*/ - -var Event = new Native({ - - name: 'Event', - - initialize: function(event, win){ - win = win || window; - var doc = win.document; - event = event || win.event; - if (event.$extended) return event; - this.$extended = true; - var type = event.type; - var target = event.target || event.srcElement; - while (target && target.nodeType == 3) target = target.parentNode; - - if (type.test(/key/)){ - var code = event.which || event.keyCode; - var key = Event.Keys.keyOf(code); - if (type == 'keydown'){ - var fKey = code - 111; - if (fKey > 0 && fKey < 13) key = 'f' + fKey; - } - key = key || String.fromCharCode(code).toLowerCase(); - } else if (type.match(/(click|mouse|menu)/i)){ - doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; - var page = { - x: event.pageX || event.clientX + doc.scrollLeft, - y: event.pageY || event.clientY + doc.scrollTop - }; - var client = { - x: (event.pageX) ? event.pageX - win.pageXOffset : event.clientX, - y: (event.pageY) ? event.pageY - win.pageYOffset : event.clientY - }; - if (type.match(/DOMMouseScroll|mousewheel/)){ - var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; - } - var rightClick = (event.which == 3) || (event.button == 2); - var related = null; - if (type.match(/over|out/)){ - switch (type){ - case 'mouseover': related = event.relatedTarget || event.fromElement; break; - case 'mouseout': related = event.relatedTarget || event.toElement; - } - if (!(function(){ - while (related && related.nodeType == 3) related = related.parentNode; - return true; - }).create({attempt: Browser.Engine.gecko})()) related = false; - } - } - - return $extend(this, { - event: event, - type: type, - - page: page, - client: client, - rightClick: rightClick, - - wheel: wheel, - - relatedTarget: related, - target: target, - - code: code, - key: key, - - shift: event.shiftKey, - control: event.ctrlKey, - alt: event.altKey, - meta: event.metaKey - }); - } - -}); - -Event.Keys = new Hash({ - 'enter': 13, - 'up': 38, - 'down': 40, - 'left': 37, - 'right': 39, - 'esc': 27, - 'space': 32, - 'backspace': 8, - 'tab': 9, - 'dele... [truncated message content] |
From: <hee...@us...> - 2009-10-27 08:49:02
|
Revision: 1894 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1894&view=rev Author: heeroyuy Date: 2009-10-27 08:48:54 +0000 (Tue, 27 Oct 2009) Log Message: ----------- -finished implementing a status bar Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-26 10:59:25 UTC (rev 1893) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-27 08:48:54 UTC (rev 1894) @@ -114,6 +114,7 @@ view.setHelpButtonVisible(true); view.setHintMessage(moreInformationsMessage); retriever = new SuggestionRetriever(); + retriever.addPropertyChangeListener(view.getStatusBar()); retriever.execute(); } @@ -215,13 +216,15 @@ @Override protected List<? extends EvaluatedDescription> doInBackground() throws Exception { + setProgress(0); la = model.getLearningAlgorithm(); - view.startStatusBar(); + view.getStatusBar().setMaximumValue(view.getPosAndNegSelectPanel().getOptionPanel().getMaxExecutionTime()); timer = new Timer(); timer.schedule(new TimerTask() { - + int progress = 0; @Override public void run() { + progress += 1;setProgress(progress); if (la != null) { publish(la.getCurrentlyBestEvaluatedDescriptions(view .getPosAndNegSelectPanel().getOptionPanel() @@ -236,7 +239,7 @@ } } - }, 0, 500); + }, 1000, 1000); dlLearner = new Thread(new Runnable() { @@ -270,6 +273,7 @@ public void done() { timer.cancel(); + List<? extends EvaluatedDescription> result = null; try { result = get(); @@ -278,9 +282,13 @@ } catch (ExecutionException e) { e.printStackTrace(); } - view.algorithmTerminated(); + setProgress(0); + view.stopStatusBar(); + //view.algorithmTerminated(); updateList(result); view.algorithmTerminated(); + + } @Override Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-26 10:59:25 UTC (rev 1893) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-27 08:48:54 UTC (rev 1894) @@ -572,4 +572,8 @@ public void stopStatusBar() { stat.showProgress(false); } + + public StatusBar getStatusBar() { + return stat; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-10-26 10:59:25 UTC (rev 1893) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-10-27 08:48:54 UTC (rev 1894) @@ -61,6 +61,8 @@ this.editor = editorKit; this.view = v; this.model = m; + //TODO: mehr informationen fuer grafische anzeige herraussuchen. + //editor.getOWLModelManager().getActiveOntology().getIndividualAxioms(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-26 10:59:34
|
Revision: 1893 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1893&view=rev Author: heeroyuy Date: 2009-10-26 10:59:25 +0000 (Mon, 26 Oct 2009) Log Message: ----------- -start to add a progress bar in the main panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-22 07:21:21 UTC (rev 1892) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-26 10:59:25 UTC (rev 1893) @@ -216,6 +216,7 @@ protected List<? extends EvaluatedDescription> doInBackground() throws Exception { la = model.getLearningAlgorithm(); + view.startStatusBar(); timer = new Timer(); timer.schedule(new TimerTask() { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-22 07:21:21 UTC (rev 1892) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-26 10:59:25 UTC (rev 1893) @@ -313,6 +313,9 @@ cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); + view.setLearningDuration(view + .getPosAndNegSelectPanel().getOptionPanel() + .getMaxExecutionTime()); try { // initializes the learning algorithm la.init(); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-22 07:21:21 UTC (rev 1892) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-26 10:59:25 UTC (rev 1893) @@ -40,7 +40,7 @@ import javax.swing.JToggleButton; import org.dllearner.algorithms.celoe.CELOE; -//import org.dllearner.tools.ore.ui.StatusBar; +import org.dllearner.tools.ore.ui.StatusBar; import org.protege.editor.owl.OWLEditorKit; import org.semanticweb.owl.model.OWLDescription; /** @@ -128,7 +128,7 @@ private String labels; private int individualSize; private SuggestClassPanelHandler sugPanelHandler; - //private StatusBar stat; + private StatusBar stat; /** * The constructor for the DL-Learner tab in the class description @@ -166,7 +166,7 @@ runPanel = new JPanel(new FlowLayout()); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); - + stat = new StatusBar(); errorMessage = new JTextArea(); errorMessage.setEditable(false); hint = new JTextArea(); @@ -213,7 +213,7 @@ */ public void makeView(String label) { run.setEnabled(false); - //stat = new StatusBar(); + helpButton.setVisible(false); hint.setForeground(Color.BLACK); hint.setText("To get suggestions for class expression, please click the button above."); @@ -269,11 +269,18 @@ addButtonPanel.add("North", accept); learner.add(addButtonPanel, c); + c.fill = GridBagConstraints.WEST; + c.weightx = 0.0; + c.weighty = 0.0; + c.gridx = 0; + c.gridy = 2; + learner.add(stat, c); + c.fill = GridBagConstraints.BOTH; c.weightx = 0.0; c.weighty = 0.0; c.gridx = 0; - c.gridy = 2; + c.gridy = 3; hint.setPreferredSize(new Dimension(450, 60)); helpButton.setPreferredSize(new Dimension(30, 30)); hintPanel.add(BorderLayout.CENTER, hint); @@ -288,13 +295,13 @@ c.gridx = 0; c.weightx = 0.0; c.weighty = 0.0; - c.gridy = 3; + c.gridy = 4; learner.add(advancedPanel, c); posPanel.setVisible(false); c.fill = GridBagConstraints.BOTH; c.gridx = 0; - c.gridy = 4; + c.gridy = 5; c.weightx = 0.0; c.weighty = 0.0; c.gridwidth = 3; @@ -510,6 +517,7 @@ * This method sets the run button enable after learning. */ public void algorithmTerminated() { + this.stopStatusBar(); CELOE celoe = (CELOE) model.getLearningAlgorithm(); String error = "Learning successful. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " + celoe.getMaximumHorizontalExpansion() + "."; hint.setForeground(Color.RED); @@ -552,4 +560,16 @@ public ReadingOntologyThread getReadingOntologyThread() { return readThread; } + + public void setLearningDuration(int time) { + stat.setMaximumValue(time); + } + + public void startStatusBar() { + stat.showProgress(true); + } + + public void stopStatusBar() { + stat.showProgress(false); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-22 07:21:29
|
Revision: 1892 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1892&view=rev Author: heeroyuy Date: 2009-10-22 07:21:21 +0000 (Thu, 22 Oct 2009) Log Message: ----------- -code cleanup -fixed bug Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -23,9 +23,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.util.List; import java.util.Set; import java.util.Timer; @@ -37,10 +34,7 @@ import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; -import javax.swing.event.ListDataEvent; -import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.EvaluatedDescription; @@ -54,8 +48,7 @@ * @author Christian Koetteritzsch * */ -public class ActionHandler implements ActionListener, ItemListener, - MouseListener, ListSelectionListener, ListDataListener { +public class ActionHandler implements ActionListener { // This is the DLLearnerModel. @@ -122,8 +115,6 @@ view.setHintMessage(moreInformationsMessage); retriever = new SuggestionRetriever(); retriever.execute(); - // model.setCurrentConcept(null); - } if (z.getActionCommand().equals("ADD")) { @@ -154,19 +145,21 @@ } if (z.toString().contains(HELP_BUTTON_STRING)) { String helpText = "What does a sentence like 'Learning started. Currently searching class expressions with length between 4 and 7.' mean?\n" - + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words\n needed to write down the class expression." - + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general\n expression owl:Thing and then further specializes it. Those class expressions, which fit the existing instances of a given class ($currentClass in this case)\n get a high accuracy and are displayed as suggestions. The learning algorithm prefers short expressions.\n 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3\n or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7.\n If you want to search for longer expressions, then you have to increase the maximum runtime setting (it is set to $defaultRuntime seconds by default)\n." - + "See $wikiPage for more details. "; - + + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words needed to write down the class expression.\n\n" + + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general expression owl:Thing and then further specializes it.\n" + + "Those class expressions, which fit the existing instances of a given class ($currentClass in this case) get a high accuracy and are displayed as suggestions.\n" + + "The learning algorithm prefers short expressions. 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3\n" + + "or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7. If you want to search for longer expressions, then you have to increase\n" + + "the maximum runtime setting (it is set to $defaultRuntime seconds by default).\n\n" + + "See http://dl-learner.org/wiki/ProtegePlugin for more details. "; + help = new JTextArea(); help.setEditable(false); help.setForeground(Color.black); help.setText(helpText); - JOptionPane.showMessageDialog(null, - help, - "Help", - JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, help, "Help", + JOptionPane.INFORMATION_MESSAGE); } } @@ -190,84 +183,8 @@ } - /** - * Nothing happens here. - * - * @param m - * MouseEvent - */ - public void mouseReleased(MouseEvent m) { - } - /** - * Nothing happens here. - * - * @param m - * MouseEvent - */ - public void mouseEntered(MouseEvent m) { - - } - - /** - * Choses the right EvaluatedDescription object after a concept is chosen in - * the list. - * - * @param m - * MouseEvent - */ - public void mouseClicked(MouseEvent m) { - if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { - SuggestListItem item = (SuggestListItem) view - .getSuggestClassPanel().getSuggestList().getSelectedValue(); - String desc = item.getValue(); - if (model.getEvaluatedDescriptionList() != null) { - List<? extends EvaluatedDescription> evalList = model - .getEvaluatedDescriptionList(); - Set<String> onto = model.getOntologyURIString(); - for (EvaluatedDescription eDescription : evalList) { - for (String ont : onto) { - if (desc.equals(eDescription.getDescription() - .toManchesterSyntaxString(ont, null))) { - evaluatedDescription = eDescription; - break; - } - } - } - } - view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( - evaluatedDescription); - view.setGraphicalPanel(); - view.getMoreDetailForSuggestedConceptsPanel().repaint(); - } - } - - /** - * Nothing happens here. - * - * @param m - * MouseEvent - */ - public void mouseExited(MouseEvent m) { - - } - - /** - * Sets the ADD button enable after a concept is chosen. - * - * @param m - * MouseEvent - */ - public void mousePressed(MouseEvent m) { - if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { - if (!view.getAddButton().isEnabled()) { - view.getAddButton().setEnabled(true); - } - } - } - - /** * Destroys the Thread after the Pluigin is closed. */ public void destroyDLLearnerThread() { @@ -281,24 +198,6 @@ toggled = false; } - @Override - public void contentsChanged(ListDataEvent listEvent) { - System.out.println(listEvent); - - } - - @Override - public void intervalAdded(ListDataEvent listEvent) { - // TODO Auto-generated method stub - - } - - @Override - public void intervalRemoved(ListDataEvent listEvent) { - // TODO Auto-generated method stub - - } - /** * Inner Class that retrieves the concepts given by the DL-Learner. * @@ -389,9 +288,24 @@ for (List<? extends EvaluatedDescription> list : resultLists) { updateList(list); + this.checkSelectedItem(list); } } - + /* + * TODO: ueberlegen wegen umsetzung. + */ + private void checkSelectedItem(List<? extends EvaluatedDescription> result) { + if(!view.getSuggestClassPanel().getSuggestList().isSelectionEmpty()) { + SuggestListItem item = (SuggestListItem) view.getSuggestClassPanel().getSuggestList().getSelectedValue(); + String itemString = item.getValue(); + for(EvaluatedDescription desc: result) { + if(desc.getDescription().toString().equals(itemString)) { + + } + } + } + } + private void updateList( final List<? extends EvaluatedDescription> result) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -549,6 +549,12 @@ public boolean getIsKnowledgeSourceIsUpdated() { return knowledgeSourceIsUpdated; } + + /* + * TODO Add methods to get additional informations about a individual. + * Informations needed are the ones in the Individuals tab in protege. + */ + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -40,6 +40,7 @@ import javax.swing.JToggleButton; import org.dllearner.algorithms.celoe.CELOE; +//import org.dllearner.tools.ore.ui.StatusBar; import org.protege.editor.owl.OWLEditorKit; import org.semanticweb.owl.model.OWLDescription; /** @@ -126,6 +127,8 @@ private boolean toogled = false; private String labels; private int individualSize; + private SuggestClassPanelHandler sugPanelHandler; + //private StatusBar stat; /** * The constructor for the DL-Learner tab in the class description @@ -140,7 +143,7 @@ model = new DLLearnerModel(editorKit, this); sugPanel = new SuggestClassPanel(model, this); learnerPanel = new JPanel(); - hintPanel = new JPanel(new BorderLayout()); + hintPanel = new JPanel(new FlowLayout()); learnerPanel.setLayout(new BorderLayout()); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); action = new ActionHandler(model, this); @@ -160,11 +163,10 @@ helpButton.setPreferredSize(new Dimension(20, 20)); helpButton.setName("help"); helpButton.addActionListener(action); - helpButton.setVisible(false); runPanel = new JPanel(new FlowLayout()); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); - sugPanel.addSuggestPanelMouseListener(action); + errorMessage = new JTextArea(); errorMessage.setEditable(false); hint = new JTextArea(); @@ -181,6 +183,9 @@ learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPEED); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); + sugPanelHandler = new SuggestClassPanelHandler(this, model); + sugPanel.addSuggestPanelMouseListener(sugPanelHandler); + sugPanel.getSuggestList().addListSelectionListener(sugPanelHandler); this.addAcceptButtonListener(this.action); this.addRunButtonListener(this.action); this.addAdvancedButtonListener(this.action); @@ -208,6 +213,10 @@ */ public void makeView(String label) { run.setEnabled(false); + //stat = new StatusBar(); + helpButton.setVisible(false); + hint.setForeground(Color.BLACK); + hint.setText("To get suggestions for class expression, please click the button above."); String currentConcept = editorKit.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass().toString(); if(!labels.equals(currentConcept) || individualSize != editorKit.getModelManager().getActiveOntology().getIndividualAxioms().size()) { if(individualSize != editorKit.getModelManager().getActiveOntology().getIndividualAxioms().size()) { @@ -304,7 +313,6 @@ learnerScroll.setViewportView(learner); this.renderErrorMessage(""); this.getSuggestClassPanel().getSuggestModel().clear(); - this.getSuggestClassPanel().repaint(); } @@ -336,7 +344,6 @@ GridBagConstraints c = new GridBagConstraints(); learner.remove(posPanel); learner.remove(advancedPanel); - //learner.removeAll(); detail.setVisible(true); c.fill = GridBagConstraints.NONE; @@ -365,7 +372,6 @@ learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); learnerScroll.setViewportView(learner); - learnerScroll.repaint(); } /** * This Method changes the hint message. @@ -389,7 +395,7 @@ */ public void setExamplePanelVisible(boolean visible) { posPanel.setVisible(visible); - detail.repaint(); + //detail.repaint(); } /** @@ -515,12 +521,8 @@ message ="\nTo view details about why a class expression was suggested, please click on it."; } run.setEnabled(true); - // start the algorithm and print the best concept found - //renderErrorMessage(error); - //hint.setForeground(Color.BLACK); + // start the algorithm and print the best concept found; hint.append(message); - hint.repaint(); - //setHintMessage(message); } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -110,7 +110,6 @@ eval = desc; model = m; panel = p; - this.repaint(); id = model.getID(); darkGreen = new Color(0, 100, 0); darkRed = new Color(205, 0, 0); @@ -373,14 +372,12 @@ g2D.drawString("cover the same instances.", 95, 220); } this.setVisible(true); - panel.repaint(); } } private void computeGraphics() { if (eval != null) { this.setVisible(true); - panel.repaint(); additionalIndividualSize = ((EvaluatedDescriptionClass) eval) .getAdditionalInstances().size(); distortionOld = 0; @@ -733,4 +730,5 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -77,7 +77,6 @@ @Override public void mouseMoved(MouseEvent m) { - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); if (m.getX() >= panel.getX1() + panel.getShiftCovered() && m.getX() <= panel.getX2() + panel.getShiftCovered() && m.getY() >= panel.getY1() && m.getY() <= panel.getY2() @@ -109,8 +108,6 @@ @Override public void propertyChange(PropertyChangeEvent arg0) { - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); - panel.repaint(); } @Override @@ -121,7 +118,6 @@ && arg0.getY() >= panel.getY1() && arg0.getY() <= panel.getY2()) { - // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); individualComboBox.clear(); Set<Individual> covInd = ((EvaluatedDescriptionClass) description) @@ -140,7 +136,6 @@ scrollPopup = new BasicComboPopup(indiBox); scrollPopup.setAutoscrolls(true); scrollPopup.show(panel, arg0.getX(), arg0.getY()); - // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -158,7 +153,6 @@ && arg0.getY() <= panel.getY2() + panel.getShiftNewConcept()) { - // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); individualComboBox.clear(); Set<Individual> addInd = ((EvaluatedDescriptionClass) description) .getAdditionalInstances(); @@ -176,7 +170,6 @@ scrollPopup = new BasicComboPopup(indiBox); scrollPopup.setAutoscrolls(true); scrollPopup.show(panel, arg0.getX(), arg0.getY()); - // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -186,7 +179,6 @@ && arg0.getY() >= panel.getY1() && arg0.getY() <= panel.getY2()) { - // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); individualComboBox.clear(); Set<Individual> notCovInd = model.getReasoner().getIndividuals( model.getCurrentConcept()); @@ -206,7 +198,6 @@ scrollPopup = new BasicComboPopup(indiBox); scrollPopup.setAutoscrolls(true); scrollPopup.show(panel, arg0.getX(), arg0.getY()); - // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -27,6 +27,7 @@ private final String normalIndividual; private boolean isPos; + private String additionalInformation; /** * Constructor for the IndividualObject. @@ -61,5 +62,13 @@ public void setExamplePositive(boolean pos) { isPos = pos; } + + public void setAdditionalInformation(String additional) { + this.additionalInformation = additional; + } + + public String getAdditionalInformation() { + return additionalInformation; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -121,11 +121,8 @@ conceptPanel.add(conceptText); conceptPanel.add(accuracyText); conceptPanel.setVisible(true); - //this.add(conceptPanel); this.add(p); this.addPropertyChangeListener(handler); - //conceptPanel.addPropertyChangeListener(handler); - this.repaint(); } private void unsetEverything() { @@ -191,7 +188,5 @@ conceptPanel.add(accuracyText); conceptPanel.setVisible(false); this.add(conceptPanel); - - repaint(); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -40,7 +40,6 @@ @Override public void propertyChange(PropertyChangeEvent arg0) { panel.setInformation(); - panel.repaint(); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -191,51 +191,97 @@ return nrOfConcepts.getValue(); } + /** + * + * @return + */ public JRadioButton getOwlRadioButton() { return owlRadioButton; } + /** + * + * @return + */ public JRadioButton getElProfileButton() { return elProfileButton; } + /** + * + * @return + */ public boolean getAllBox() { return allBox.isSelected(); } + /** + * + * @return + */ public boolean getSomeBox() { return someBox.isSelected(); } + /** + * + * @return + */ public boolean getNotBox() { return notBox.isSelected(); } + /** + * + * @return + */ public boolean getValueBox() { return valueBox.isSelected(); } + /** + * + * @return + */ public JPanel getProfilePanel() { return profilePanel; } - + /** + * + * @return + */ public int getCountMoreBox() { return Integer.parseInt(countMoreBox.getSelectedItem().toString()); } + /** + * + * @return + */ public boolean getMoreBox() { return moreBox.isSelected(); } + /** + * + * @return + */ public JPanel getRadioBoxPanel() { return radioBoxPanel; } + /** + * + * @return + */ public JPanel getCheckBoxPanel() { return checkBoxPanel; } + /** + * + */ public void setToOWLProfile() { allBox.setSelected(true); someBox.setSelected(true); @@ -245,6 +291,9 @@ this.setCountMoreBoxEnabled(true); } + /** + * + */ public void setToELProfile() { allBox.setSelected(false); someBox.setSelected(true); @@ -254,6 +303,10 @@ this.setCountMoreBoxEnabled(false); } + /** + * + * @param isEnabled + */ public void setCountMoreBoxEnabled(boolean isEnabled) { countMoreBox.setEnabled(isEnabled); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.tools.protege; import java.awt.event.ItemEvent; @@ -3,4 +22,9 @@ import java.awt.event.ItemListener; +/** + * This class handles the all actions in the option panel. + * @author Christian Koetteritzsch + * + */ public class OptionPanelHandler implements ItemListener { @@ -11,12 +35,20 @@ private OptionPanel option; + /** + * This is the Constructor of the class. + * @param o Option Panel + */ public OptionPanelHandler(OptionPanel o) { this.option = o; } @Override + /** + * This method handles the actions to be taken if a + * radio button is selected/deselected. + */ public void itemStateChanged(ItemEvent e) { if (e.toString().contains(OWL_RADIO_STRING)) { if (option.getOwlRadioButton().isSelected()) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -60,7 +60,7 @@ @Override public boolean isValidInput() { view.getSuggestClassPanel().getSuggestModel().clear(); - view.getSuggestClassPanel().repaint(); + //view.getSuggestClassPanel().repaint(); if(this.getAxiomType().toString().equals(EQUIVALENT_CLASS_STRING)) { view.makeView("equivalent class"); } else if(this.getAxiomType().toString().equals(SUPERCLASS_STRING)) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-10-20 10:23:23 UTC (rev 1891) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -118,8 +118,6 @@ model .getCurrentlySelectedClassDescription(i)); view.setGraphicalPanel(); - view.getMoreDetailForSuggestedConceptsPanel() - .repaint(); } } @@ -129,8 +127,6 @@ } } } - descriptions.repaint(); - repaint(); } /** @@ -148,9 +144,8 @@ * @param action * ActionHandler */ - public void addSuggestPanelMouseListener(ActionHandler action) { - descriptions.addMouseListener(action); - + public void addSuggestPanelMouseListener(SuggestClassPanelHandler handle) { + descriptions.addMouseListener(handle); } /** Added: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2009-10-22 07:21:21 UTC (rev 1892) @@ -0,0 +1,128 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.tools.protege; + +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.List; +import java.util.Set; + +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.dllearner.core.EvaluatedDescription; +/** + * This is the MouseListener for the Suggest Panel. + * @author Christian Koetteritzsch + * + */ +public class SuggestClassPanelHandler implements MouseListener, ListSelectionListener{ + private DLLearnerView view; + private DLLearnerModel model; + private EvaluatedDescription evaluatedDescription; + + /** + * This is the constructor for the SuggestClassPanelHandler. + * @param v DLLearnerView + * @param m DLLearnerModel + */ + public SuggestClassPanelHandler(DLLearnerView v, DLLearnerModel m) { + this.view = v; + this.model = m; + } + + + @Override + /** + * + */ + public void mouseClicked(MouseEvent e) { + if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { + SuggestListItem item = (SuggestListItem) view + .getSuggestClassPanel().getSuggestList().getSelectedValue(); + String desc = item.getValue(); + if (model.getEvaluatedDescriptionList() != null) { + List<? extends EvaluatedDescription> evalList = model + .getEvaluatedDescriptionList(); + Set<String> onto = model.getOntologyURIString(); + for (EvaluatedDescription eDescription : evalList) { + for (String ont : onto) { + if (desc.equals(eDescription.getDescription() + .toManchesterSyntaxString(ont, null))) { + evaluatedDescription = eDescription; + break; + } + } + } + } + view.getSuggestClassPanel().getSuggestModel().indexOf(item); + view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel(evaluatedDescription); + view.setGraphicalPanel(); + } + } + + @Override + /** + * Nothing happens here. + */ + public void mouseEntered(MouseEvent e) { + + } + + @Override + /** + * Nothing happens here. + */ + public void mouseExited(MouseEvent e) { + + } + + @Override + /** + * + */ + public void mousePressed(MouseEvent e) { + if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { + if (!view.getAddButton().isEnabled()) { + view.getAddButton().setEnabled(true); + } + } + } + + @Override + /** + * Nothing happens here. + */ + public void mouseReleased(MouseEvent e) { + + } + + + @Override + /* + * TODO: Ueberlegen wie ich das mit dem selektierten Objekt umsetze + */ + public void valueChanged(ListSelectionEvent e) { + Object selectedObject = view.getSuggestClassPanel().getSuggestList().getSelectedValue(); + + view.getSuggestClassPanel().getSuggestList().setSelectedValue(selectedObject, true); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <neb...@us...> - 2009-10-20 10:23:32
|
Revision: 1891 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1891&view=rev Author: nebelschwade Date: 2009-10-20 10:23:23 +0000 (Tue, 20 Oct 2009) Log Message: ----------- + readme.txt + recommendations are now working + auto-adding recommendations + modified owl + better code in view + minor style fixes Modified Paths: -------------- trunk/src/moosique.net/css/style.css trunk/src/moosique.net/index.php trunk/src/moosique.net/js/moosique.js trunk/src/moosique.net/moosique/classes/DllearnerConnection.php trunk/src/moosique.net/moosique/classes/RequestHandler.php trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php trunk/src/moosique.net/moosique/classes/View.php trunk/src/moosique.net/moosique/config.ini trunk/src/moosique.net/moosique/data/allTagsByPopularity.txt trunk/src/moosique.net/moosique/index.php trunk/src/moosique.net/moosique/testing/moreThan80.owl Added Paths: ----------- trunk/src/moosique.net/README.txt trunk/src/moosique.net/moosique/classes/Recommendations.php Added: trunk/src/moosique.net/README.txt =================================================================== --- trunk/src/moosique.net/README.txt (rev 0) +++ trunk/src/moosique.net/README.txt 2009-10-20 10:23:23 UTC (rev 1891) @@ -0,0 +1,40 @@ +Installation-Requirements: +========================== + +See /moosique/config.ini + +- PHP 5.2.x + - output_buffering has to be enabled to use debugging features (if enabled in config.ini) + (FirePHP is included in this package) + - installed PEAR-Packages HTTP and HTTP_Request (used by Utilities.php from DL-Learner) + - + +- A running DL-Learner Webservice Instance + - Set paths in config.ini + + +Notes: +====== +- This is a modern piece of websoftware, use a modern browser! + - Tested and working in: + - Firefox 3.5.x + - Safari 4.x and Webkit nightly build r49764 + - Google Chrome 4.0.x + - Opera 10.x + - Untested: + - Internet Explorer and other platform-unindependent browsers + +- JavaScript has to be enabled, this is an AJAX-Application and uses the + Yahoo Media Player-Script! + +- + +- Debugging makes use of Firebug/FirePHP, thus only working in Firefox + +- + + +Known Bugs: +=========== + +- \ No newline at end of file Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/css/style.css 2009-10-20 10:23:23 UTC (rev 1891) @@ -24,9 +24,10 @@ #loadingImg, #header h1 { display: none; } /* Rounded Corners */ -input, textarea, select { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } +input, textarea, select, +a.button { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } #content, #status, #playing, -#playerControls, #results li { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } +#playerControls, .results li { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } #mainMenu a { -moz-border-radius-bottomleft: 10px; -moz-border-radius-bottomright: 10px; -webkit-border-bottom-left-radius: 10px; -webkit-border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; border-top-left-radius: 10px; } @@ -73,13 +74,15 @@ /* Search form */ #searchValue { margin: 0 5px; width: 100px; } #loadingImg { cursor: wait; } +a.button { background: #4a4a4a; color: #f1f7e4; padding: 5px 10px; text-decoration: none; } +a.button:hover { border: 1px solid #1fd611; padding: 4px 9px; } +#addRandom { text-decoration: underline; } - /*=============== Menu & Footer ===============*/ #mainMenu ul { position: absolute; top: 0; right: 0; } #mainMenu li { float: left; } #mainMenu a { display: block; margin-left: 10px; line-height: 30px; height: 30px; - padding: 10px 12px; color: #fafafa; background: #4a4a4a; } + padding: 10px 12px; color: #f1f7e4; background: #4a4a4a; } #mainMenu .active a, #mainMenu .active a:hover { background: #1fd611; } #mainMenu a:hover { text-decoration: none; background: #5a5a5a; } @@ -87,24 +90,27 @@ #footer a { padding: 0 10px; } /*=============== Search Results ===============*/ -#results li h3 a { font-weight: normal; } -#results li img { border: 2px solid #545454; } -#results li { float: left; width: 312px; border: 1px solid #545454; padding: 18px; margin-bottom: 18px; } -#results li.odd { margin-right: 18px; clear: both; } -#results ul ul { list-style: disc; } +.results li h3 a { font-weight: normal; } +.results li img { border: 2px solid #545454; } +.results li { float: left; width: 312px; border: 1px solid #545454; padding: 18px; margin-bottom: 18px; } +.results li.odd { margin-right: 18px; clear: both; } +.results ul ul { list-style: disc; } /* This is for the list of found albums etc */ -#results li li, -#results .artistSearch li li, -#results .tagSearch li li { border: none; display: list-item; padding: 0; margin: 0 0 0 36px; +.results li li, +.artistSearch li li, +.tagSearch li li { border: none; display: list-item; padding: 0; margin: 0 0 0 36px; width: auto; height: auto; float: none; } -#results .tagSearch ul ul { clear: both; } -#results .artistImage { text-align: center; margin-bottom: 18px;} -#results .cover { margin: 0 18px 18px 0; width: 104px; height: 104px; float: left; } -#results .tagSearch h4 { display: inline; } +#recommendationResults ul ul, +.tagSearch ul ul { clear: both; } +.results .artistImage { text-align: center; margin-bottom: 18px;} +.results .cover { margin: 0 18px 18px 0; width: 104px; height: 104px; float: left; } +#recommendationResults h4, +.tagSearch h4 { display: inline; } /*=============== Recommendations and playlist ===============*/ +#autoAdd { float: right; } #recommended a:hover { cursor: pointer; text-decoration: none; font-weight: bold; color: #131313; } #playlist, #recommended, #recently { margin-left: 36px; list-style: decimal; } @@ -121,7 +127,6 @@ #playlist .moveUp { background: url(../img/controls.png) 0px -360px no-repeat; right: 40px; } #playlist .moveDown { background: url(../img/controls.png) 0px -320px no-repeat; right: 60px; } - /*=============== Information / Help ===============*/ Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/index.php 2009-10-20 10:23:23 UTC (rev 1891) @@ -72,29 +72,37 @@ Now get started and add something to the Playlist! </p> </div> - <div id="results"> + <div id="results" class="results"> </div> </div> <div id="recommendations"> - <h2>Recommended Songs</h2> + <form id="autoAdd" method="get" action=""> + <div> + <label for="autoAddCheckbox" title="Check this to automatically add a random song from your recommendations to your playlist everytime your recommendations are updated.">Autoadd recommendations</label> + <input type="checkbox" id="autoAddCheckbox" checked="checked" /> + </div> + </form> + <h2>Recommendations</h2> <p> These recommendations are generated every time you listen to a song - for at least half it's length, assuming that you liked it. + for at least half it's length, assuming that you liked it. You click on a + recommended album to add it to the playlist, or you can <a href="#" id="addRandom">click + here to just add a random song from your recommendations</a>.<br /> + </p> + <div id="recommendationResults" class="results"> - <div id="recommendationResults"> - </div> <p> - <a href="#" id="generateRecommendations">Nothing showing up here? You can also - generate your list of recommendations by clicking here.</a> + <a href="#" id="generateRecommendations" class="button" title="If there is nothing showing up here, you can generate your list of recommendations by clicking here.">Reload recommendations</a> </p> </div> <div id="information"> + <h2>About the artist...</h2> <div id="moreInfo"> </div> @@ -109,13 +117,14 @@ <ol id="playlist"> <li></li> </ol> + <p><a href="#" id="resetPlaylist" class="button" title="Click here to delete all tracks from your playlist.">Delete all</a></p> <h2>Recently Listened to</h2> <p>These are the songs you recently listened to. Click on a song to re-enqueue it to your current playlist.</p> <ol id="recently"> <li></li> </ol> - <p><a href="#" id="reset">Click here to reset your »recently listened to«-list.</a></p> + <p><a href="#" id="resetRecently" class="button" title="Click here to reset your »recently listened to«-list.">Reset</a></p> </div> <div id="help"> @@ -129,6 +138,9 @@ <a href="http://jamendo.com">Jamendo</a> | <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> </div> + <div id="temp" class="hidden"> + + </div> </div> <!-- end container --> <?php Modified: trunk/src/moosique.net/js/moosique.js =================================================================== --- trunk/src/moosique.net/js/moosique.js 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/js/moosique.js 2009-10-20 10:23:23 UTC (rev 1891) @@ -65,7 +65,12 @@ this.recommendations = document.id('recommendations'); this.generate = document.id('generateRecommendations'); this.recResults = document.id('recommendationResults'); - this.reset = document.id('reset'); + this.resetPlaylist = document.id('resetPlaylist'); + this.resetRecently = document.id('resetRecently'); + this.moreInfo = document.id('moreInfo'); + this.temp = document.id('temp'); + this.autoAddCheckbox = document.id('autoAddCheckbox'); + this.addRandom = document.id('addRandom'); }, /** @@ -154,9 +159,11 @@ del.removeEvents(); del.addEvent('click', function(e) { e.stop(); + // TODO: if playlist empty or deleted currently playing track: STOP! this.getParent().destroy(); // deletes the li-element // and refresh the playlist if clicked YAHOO.MediaPlayer.addTracks(that.playlist, '', true); + // TODO: if playlist empty or deleted currently playing track: STOP! }); }); @@ -210,14 +217,26 @@ that.nowPlayingInfo.set('text', 'Currently playing:'); that.nowPlayingTrack.set('text', YAHOO.MediaPlayer.getMetaData().title); that.playPause.setStyle('background-position', '0px -40px'); + + // send a request to gather additional artist-information + var nowPlayingAlbum = YAHOO.MediaPlayer.getMetaData().anchor.get('rel'); + var getInfo = new Request({ + method: 'get', + url: 'moosique/index.php', + onSuccess: function(response) { + that.moreInfo.set('html', response); + } + }).send('info=' + nowPlayingAlbum); + }; /** * trackComplete: we change the Pause-Button to a Play-Button - * TODO: if this was the last track, add another track from the recommendations and start playing + * and execute the autoAdd-Function for adding recommendations */ var trackComplete = function() { that.playPause.setStyle('background-position', '0px 0px'); + that.autoAddToPlaylist(); }; // add the configuration to the events by subscribing @@ -240,19 +259,39 @@ */ generateRecommendations: function() { var that = this; - - // TODO // send ajax request and save the scrobbled song // and retrieve and update the recommendations var getRecommendations = new Request({ method: 'get', url: 'moosique/index.php', + onRequest: function() { + that.recResults.set('html', '<h2>Generating new recommendations...</h2><p>Please be patient, this may take up to a minute...</p>'); + }, + + onFailure: function() { + that.recResults.set('html', '<h2>Unable to get recommendations. Please reset and try again.</h2>'); + }, onSuccess: function(response) { - that.recResults.set('html', response); - that.showTab('recommendations'); - that.displayStatusMessage('You have new recommendations!'); + response = response.trim(); + if (response != '') { + that.recResults.set('html', response); + that.makeAddable($$('a.addToPlaylist')); + that.showTab('recommendations'); + that.displayStatusMessage('You have new recommendations!'); + + if (that.autoAddCheckbox.checked) { + that.addRandomToPlaylist(); + } else { + debug.log('Autoadding songs from recommendations is disabled.'); + } + } else { + debug.log('Response from server empty.'); + that.recResults.set('html', '<h2>There is nothing in your recently list.</h2><p>You have to listen to some music first, before you can get any recommendations.</p>'); + } + + } - }).send('learn=now'); + }).send('get=recommendations'); }, @@ -311,13 +350,7 @@ // the Stop-Playing Button that.stop.addEvent('click', function() { - that.playPause.setStyle('background-position', '0px 0px'); - that.nowPlayingInfo.set('text', 'Player stopped.'); - that.nowPlayingTrack.set('text', '...'); - that.nowPlayingTime.set('text', '0:00 / 0:00'); - YAHOO.MediaPlayer.stop(); - // and reload the playlist - that.refreshPlaylist(); + that.stopPlaying(); }); // Mute-Toggle-Switch @@ -347,6 +380,23 @@ /** + * + * + * + */ + stopPlaying: function() { + var that = this; + that.playPause.setStyle('background-position', '0px 0px'); + that.nowPlayingInfo.set('text', 'Player stopped.'); + that.nowPlayingTrack.set('text', '...'); + that.nowPlayingTime.set('text', '0:00 / 0:00'); + YAHOO.MediaPlayer.stop(); + // and reload the playlist + that.refreshPlaylist(); + }, + + + /** * Displays a status message * * @param {String} message @@ -383,12 +433,23 @@ that.generateRecommendations(); }); - that.reset.addEvent('click', function(e) { + that.resetRecently.addEvent('click', function(e) { e.stop(); Cookie.dispose('moosique'); that.updateRecently(); }); + + that.resetPlaylist.addEvent('click', function(e) { + e.stop(); + that.playlist.empty(); + that.stopPlaying(); + }); + that.addRandom.addEvent('click', function(e) { + e.stop(); + that.addRandomToPlaylist(); + }); + // make buttons functional this.addEventsToButtons(); }, @@ -472,21 +533,22 @@ var rel = a.get('rel'); var type = ''; - if (href.match(/jamendo\.com\/get\/track\/id\/album\//gi)) { type = 'albumPlaylist'; } - if (href.match(/jamendo\.com\/get\/track\/id\/track\//gi)) { type = 'trackPlaylist'; } + if (href.match(/jamendo\.com\/get\/track\/id\//gi)) { type = 'playlist'; } if (href.match(/\.mp3/)) { type = 'mp3File'; } // if the addable item is a playlist, we have to get the playlistitems - if (type == 'albumPlaylist' || type == 'trackPlaylist') { + if (type == 'playlist') { var getPlaylist = new Request({method: 'get', url: 'moosique/index.php', onSuccess: function(response) { that.insertIntoPlaylist(response); + that.showTab('player'); } }).send('get=' + type + '&playlist=' + href + '&rel=' + rel); } if (type == 'mp3File') { var itemHTML = '<li>' + a.getParent().get('html') + '</li>'; that.insertIntoPlaylist(itemHTML); + that.showTab('player'); } }); }); @@ -531,11 +593,49 @@ // refresh the playlist and show the player-tab that.refreshPlaylist(); - that.showTab('player'); }, /** + * + * + * + */ + addRandomToPlaylist: function() { + var that = this; + var addableAlbums = that.recResults.getElements('.addToPlaylist'); + // pick a random album + var randomAlbum = addableAlbums.getRandom(); + + if (randomAlbum) { + var href = randomAlbum.get('href'); + var rel = randomAlbum.get('rel'); + + if (href.match(/jamendo\.com\/get\/track\/id\//gi)) { type = 'playlist'; } + if (href.match(/\.mp3/)) { type = 'mp3File'; } + + // if the addable item is a playlist, we have to get the playlistitems + var getPlaylist = new Request({method: 'get', url: 'moosique/index.php', + onSuccess: function(response) { + // yay, we have the playlist, choose a random song and add it + // therefore save it as Element in temp and extract a random song + // TODO a better way would be to just get on <li> from the response + // with a regexp and just use this, without creating new dom nodes etc. + that.temp.set('html', '<ul>' + response + '</ul>'); + var songs = that.temp.getElements('li'); + var randomSong = songs.getRandom(); + that.insertIntoPlaylist('<li>' + randomSong.get('html') + '</li>'); + that.temp.empty(); + } + }).send('get=playlist&playlist=' + href + '&rel=' + rel); + } else { + debug.log('You currently have no recommendations, adding a random one will not work.'); + } + + }, + + + /** * Shows the given tab in the menu, and hides all others * * @param {String} tabID ID of the Tab to show Modified: trunk/src/moosique.net/moosique/classes/DllearnerConnection.php =================================================================== --- trunk/src/moosique.net/moosique/classes/DllearnerConnection.php 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/moosique/classes/DllearnerConnection.php 2009-10-20 10:23:23 UTC (rev 1891) @@ -38,7 +38,7 @@ try { $this->client = new SoapClient($this->getConfigUrl('wsdlLocal')); } catch (Exception $e) { - $this->debugger->log($e, "Error connecting to the DL-Learner Webservice."); + if ($this->debugger) $this->debugger->log($e, "Error connecting to the DL-Learner Webservice."); echo '<h2>Could not connect to the DL-Learner Webservice.</h2>'; exit; } @@ -99,13 +99,12 @@ * @return String A JSON-Object with the containing result-set * @param String $query The SPARQL-Querystring to send */ - public function sparqlQuery($query) { - $result = $this->client->sparqlQuery($_SESSION['sessionID'], $this->knowledgeSourceID, $query); - return $result; - } + public function sparqlQuery($query) { + $result = $this->client->sparqlQuery($_SESSION['sessionID'], $this->knowledgeSourceID, $query); + return $result; + } + - - /** * * @@ -146,21 +145,21 @@ $this->client->applyConfigEntryStringTupleList($id, $kID, 'replacePredicate', array($this->getConfigPrefixes('tags') . 'taggedWithTag'), array($this->getConfigPrefixes('rdf') . 'type') ); - + + // after we have set all conf-values, we initialize the learning process $this->client->initAll($id); $result = $this->client->learnDescriptionsEvaluated($id); - $result = json_decode($result); return $result; } - + /** + * Converts a natural Description in a SPARQL-Query for recommendation retrieval + * + */ public function kbToSqarql($kb) { - return $this->client->SparqlRetrieval($kb, 20); - - - + return $this->client->SparqlRetrieval($kb, $this->getConfig('maxResults')); } } Added: trunk/src/moosique.net/moosique/classes/Recommendations.php =================================================================== --- trunk/src/moosique.net/moosique/classes/Recommendations.php (rev 0) +++ trunk/src/moosique.net/moosique/classes/Recommendations.php 2009-10-20 10:23:23 UTC (rev 1891) @@ -0,0 +1,173 @@ +<?php + +class Recommendations extends Config { + + private $posExamples; + private $instances; + + function __construct() { + parent::__construct(); // init config + } + + /** + * Returns an array of prepared serach-statements to feed the sparql= + * query-bulider with, converted from the natural description of the results + * + * + */ + public function getQueries($connection) { + $queries = array(); + $scores = array(); + $kbSyntaxes = array(); + + // some posExamples and instances set? ready to go... + if (!empty($this->posExamples) && !empty($this->instances)) { + // learn sth! + $res = $connection->learn($this->instances, $this->posExamples); + $solutions = json_decode($res); + + // do we have some solutions? + if ($solutions->solution1) { + foreach ($solutions as $solution) { + // precentage-value, can also be used for display, nicely formatted + $score = round($solution->scoreValue*100, 2); + // scores below threshold are not used for recommendations + if ($score > $this->getConfig('threshold')) { + // check for everything that is quoted + $match = true; + $kbSyntax = $solution->descriptionKBSyntax; + + // everything in quotes is a potential tag + preg_match_all('/\"(\\.|[^\"])*\"/', $kbSyntax, $quoted); + foreach($quoted[0] as $url) { + if (preg_match('/^\"http:\/\//', $url)) { // if a URL, check if URL to Tag + // if only one of the URLS used is not a tag, we don't use it + if (!preg_match('/^\"http:\/\/dbtune\.org\/jamendo\/tag\//', $url)) { + $match = false; + } + } + } + + if ($match) { + $sparql = $connection->kbToSqarql($solution->descriptionKBSyntax); + // extract the subtring we use for the final sparql-query + $sparql = str_replace("SELECT ?subject \nWHERE", '', $sparql); + $sparql = str_replace('LIMIT ' . $this->getConfig('maxResults'), '', $sparql); + $sparql = str_replace('subject a', 'record tags:taggedWithTag', $sparql); + // push it to the queries-array and + $queries[] = $sparql; + $scores[] = $score; + $kbSyntaxes[] = $solution->descriptionKBSyntax; + + } + } + } + } else { + $error = 'There was an error creating recommendations. Please try resetting + your recently-listened-to list, and try again.'; + } + } else { + $error = 'You have to listen to some songs first to fill up your recently-listened-to-list.'; + } + + if (isset($error)) { + return $error; + } else { + // return scores, description and queries + $recommendations = array('scores' => $scores, 'kbSyntaxes' => $kbSyntaxes, 'queries' => $queries); + return $recommendations; + } + } + + + + /** + * + * + * + */ + public function setPosExamples($posExamples = false) { + if ($posExamples === false) { + $posExamples = array(); + if (!empty($_COOKIE['moosique'])) { + $recent = json_decode(stripslashes($_COOKIE['moosique']))->recentlyListened; + foreach($recent as $link) { + // extract relation from the cookie-link + preg_match_all('#<a\s*(?:rel=[\'"]([^\'"]+)[\'"])?.*?>((?:(?!</a>).)*)</a>#i', $link, $record); + $posExamples[] = $record[1][0]; + $posExamples = array_unique($posExamples); + $this->posExamples = $posExamples; + + } + } + + } else { + if (is_array($posExamples)) { + $this->posExamples = $posExamples; + } else { + return false; + } + } + } + + /** + * + * + * + */ + public function setInstances($instances = false) { + + // TODO more testing, what is the optimum posExamples/neutral ratio, 50/50? + // for now we assume 50/50 + // $totalInstances = $this->getConfigLearning('instances'); + + if ($instances === false) { + $instances = array(); + // and then add some random Records _not_ in this list + $allRecords = file($this->getConfigUrl('allRecords')); + $countPos = count($this->posExamples); + + for ($i = 0; $i < $countPos; $i++) { + $randomRecord = trim($allRecords[array_rand($allRecords)]); + // no double entries for the $instances-array + if (!in_array($randomRecord, $posExamples)) { + $instances[] = $randomRecord; + } + } + // merge with posExamples + $instances = array_merge($this->posExamples, $instances); + $this->instances = $instances; + } else { + if (is_array($instances)) { + $this->instances = $instances; + } + } + + + } + + /** + * + * + * + */ + public function getPosExamples() { + return $this->posExamples; + } + + + /** + * + * + * + */ + public function getInstances() { + return $this->instances; + } + + +} + +?> + + Modified: trunk/src/moosique.net/moosique/classes/RequestHandler.php =================================================================== --- trunk/src/moosique.net/moosique/classes/RequestHandler.php 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/moosique/classes/RequestHandler.php 2009-10-20 10:23:23 UTC (rev 1891) @@ -19,8 +19,24 @@ // we only accept ajax-get requests if ($this->isAjax() && $this->isGet()) { $this->response = $this->processRequest(); + + if (!empty($this->response)) { + return $this->response; + } else { + if (isset($_GET['searchType'])) { + return "<h2>Sorry, nothing found.</h2>"; + if ($_GET['searchType'] == 'lastFM') { + return '<h2>Nothing found for the last.fm-user »' . $_GET['searchValue'] . '«.'; + } + } + return "<h2>The repsonse from the server was empty.</h2>"; + } + + + } else { - // we do nothing. This application is based on AJAX. + // we do nothing. This application is based on AJAX - back to home + header('Location: ' . $this->getConfigUrl('base')); } } @@ -58,10 +74,10 @@ } + // normal search for artist, tag or song if ($_GET['searchType'] == 'artistSearch' || $_GET['searchType'] == 'tagSearch' || $_GET['searchType'] == 'songSearch') { - // normal search for artist, tag or song $data = $this->getData($search, $_GET['searchType']); $view = new View($data, $_GET['searchType']); $response = $view->getHTML(); @@ -72,45 +88,56 @@ $lastFM = new LastFM($search); $tags = $lastFM->getTopTags(); // no we have the topTags, do a search for related albums - foreach($tags as $tag) { - // TODO when using last.fm-Tags for tagSearch, we want exakt results, meaning - // no "darkmetalbeermusic" when the lastfm tag is "metal" - - $tag = $this->cleanString($tag, $_GET['searchType']); - // displaying 10 results per tag (=100 results) should be enough - $data = $this->getData($tag, $_GET['searchType'], 20); - $view = new View($data, $_GET['searchType']); + + if (!empty($tags)) { + foreach($tags as $tag) { + // FIXME when using last.fm-Tags for tagSearch, we want exakt results, meaning + // no "darkmetalbeermusic" as result when the lastfm tag is "metal" + + $tag = $this->cleanString($tag, $_GET['searchType']); + // displaying 10 results per tag (=100 results) should be enough + $data = $this->getData($tag, $_GET['searchType'], 20); + $view = new View($data, $_GET['searchType']); + $response .= $view->getHTML(); + } + } else { // let the view handle it, displays error + $view = new View($tags, $_GET['searchType']); $response .= $view->getHTML(); } } } // TODO other requests --- artist Information + // ====================================================================== + if (isset($_GET['info']) && !(empty($_GET['info']))) { + $currentAlbum = $_GET['info']; + $response .= '<p>Artist Information coming soon...</p>'; + } - - - // A Learning-Request // ====================================================================== - if (isset($_GET['learn']) && $_GET['learn'] == 'now') { - $posExamples = $this->getPositiveExamples(); - $instances = $this->getInstances($posExamples); - - $this->debugger->log($instances, "INSTANZEN"); - $this->debugger->log($posExamples, "posExamples"); + if (isset($_GET['get']) && $_GET['get'] == 'recommendations') { + $r = new Recommendations(); + $r->setPosExamples(); + $r->setInstances($r->getPosExamples()); + $recommendations = $r->getQueries($this->connection); - $res = $this->connection->learn($instances, $posExamples); - - // TODO (Yes, BIG one) - // build sparql-query based on learning-results - // build html-view build an sparql-results --- misuse tagSearch-Thingie - foreach ($res as $solution) { - $response .= round($solution->scoreValue*100, 2) . '% --- ' . $solution->descriptionKBSyntax . "\n"; - // $response .= $this->connection->kbToSqarql($solution->descriptionKBSyntax) . "\n"; + $results = array(); + if (is_array($recommendations) && !empty($recommendations)) { + if (!empty($recommendations['queries'])) { + foreach($recommendations['queries'] as $query) { + $data = $this->getData($query, 'recommendations', $this->getConfig('maxResults')); + $results[] = $data; + } + } + $recommendations['results'] = $results; + $view = new View($recommendations, 'recommendations'); + $response .= $view->getHTML(); + + } else { // an error occured during recommendation-retrieval + // give the error message to the view + $view = new View($recommendations, 'recommendations'); } - - $response = '<pre>' . $response . '</pre>'; - } @@ -119,111 +146,21 @@ if (isset($_GET['get']) && isset($_GET['playlist'])) { // Due to a bug in YMP we don't directly deliver the .xspf-file, we return a prepared // list of <li> including the links to the mp3-files, and this is build in the view of course. - $data = $this->prepareData( - array('playlist' => $_GET['playlist'], 'albumID' => $_GET['rel']), - $_GET['get'] - ); + $data = $this->prepareData(array('playlist' => $_GET['playlist'], 'albumID' => $_GET['rel']), $_GET['get']); $view = new View($data, $_GET['get']); $response = $view->getHTML(); } - - // Finally returning the response - if (!empty($response)) { - return $response; - } else { - if ($_GET['searchType'] == 'lastFM') { - return '<h2>Nothing found for the last.fm-user »' . $_GET['searchValue'] . '«.'; - } - return "<h2>The repsonse from the server was empty.</h2>"; - } + return $response; } /** - * - * - * - */ - private function getPositiveExamples() { - $posExamples = array(); - if (!empty($_COOKIE['moosique'])) { - $recent = json_decode(stripslashes($_COOKIE['moosique']))->recentlyListened; - foreach($recent as $link) { - // extract relation from the cookie-link - preg_match_all('#<a\s*(?:rel=[\'"]([^\'"]+)[\'"])?.*?>((?:(?!</a>).)*)</a>#i', $link, $record); - array_push($posExamples, $record[1][0]); - } - } - - $posExamples = array_unique($posExamples); - return $posExamples; - - } - - /** - * - * - * - */ - private function getInstances($posExamples) { - // TODO more testing, what is the optimum posExamples/neutral ratio, 50/50? - // for now we assume 50/50 - // $totalInstances = $this->getConfigLearning('instances'); - $instances = array(); - // and then add some random Records _not_ in this list - $allRecords = file($this->getConfigUrl('allRecords')); - $countPos = count($posExamples); - - for ($i = 0; $i < $countPos; $i++) { - $randomRecord = trim($allRecords[array_rand($allRecords)]); - // no double entries for the $instances-array - if (!in_array($randomRecord, $posExamples)) { - array_push($instances, $randomRecord); - } - } - // merge with posExamples - $instances = array_merge($posExamples, $instances); - shuffle($instances); - - return $instances; - } - - - /** - * - * @param Integer $limit optional Limit for Sparql-Query - */ - private function getData($search, $type, $limit = 0) { - $sparql = new SparqlQueryBuilder($search, $type, $limit); - $query = $sparql->getQuery(); - // sparql-query to dellearner - $json = $this->connection->sparqlQuery($query); - // convert to useable object - $result = json_decode($json); - $resultObject = $result->results->bindings; - - // prepare the data for HTML processing - $data = $this->prepareData($resultObject, $type); - return $data; - } - - - /** - * Establishes a new Dl-Learner Connection and saves it in - * private $connection for class-wide use. - * - * @return - */ - private function establishConnection() { - $this->connection = new DllearnerConnection(); - } - - /** * Removes unwanted chars from a search-string * - * TODO - NOT IMPLEMENTED but prepared + * FIXME - NOT IMPLEMENTED but prepared --- USE AND / OR and stuff and make this an extra function + * * If the search string contains a %20-Space-Char somewhere in the middle * of the string, it returns an array of search-values, divided by " " * Doing this we later can perform more searches for values like "stoner doom metal" @@ -260,46 +197,56 @@ */ private function prepareData($data, $type) { $mergedArray = array(); - switch ($type) { case 'artistSearch' : $mergedArray = $this->mergeArray($data, 'artist'); $mergedArray = $this->arrayUnique($mergedArray); break; - case 'tagSearch' : $mergedArray = $this->mergeArray($data, 'tag'); break; - case 'songSearch' : $mergedArray = $this->mergeArray($data, 'track'); $mergedArray = $this->arrayUnique($mergedArray); break; - case 'lastFM' : $mergedArray = $this->mergeArray($data, 'tag'); break; - - case 'albumPlaylist' : + case 'recommendations' : + $mergedArray = $this->mergeArray($data, 'record'); + $mergedArray = $this->arrayUnique($mergedArray); + break; + case 'playlist' : $playlistObject = simplexml_load_file($data['playlist']); $mergedArray = $this->object2array($playlistObject); // prepend the album stream-information $mergedArray['albumID'] = $data['albumID']; break; - - case 'trackPlaylist' : - $playlistObject = simplexml_load_file($data['playlist']); - $mergedArray = $this->object2array($playlistObject); - $mergedArray['albumID'] = $data['albumID']; - break; } - return $mergedArray; } - - + + /** - * TOOD implement nice merging for multi-tag-search + * + * @param Integer $limit optional Limit for Sparql-Query + */ + private function getData($search, $type, $limit = 0) { + $sparql = new SparqlQueryBuilder($search, $type, $limit); + $query = $sparql->getQuery(); + // sparql-query to dellearner + $json = $this->connection->sparqlQuery($query); + // convert to useable object + $result = json_decode($json); + $resultObject = $result->results->bindings; + + // prepare the data for HTML processing + $data = $this->prepareData($resultObject, $type); + return $data; + } + + + /** * This function merges the result-Object to a nice array * we can process easily. The array is created by type, * returning the data sorted for artist, tag or song @@ -333,7 +280,6 @@ /** * Like the php-function array_unique, but for multidimensional arrays, calls itself recursively * - * * @return Array (Multidimensional) array without double entries * @param Array $array The Array to clean up */ @@ -385,7 +331,17 @@ return $this->response; } + /** + * Establishes a new Dl-Learner Connection and saves it in + * private $connection for class-wide use. + * + * @return + */ + private function establishConnection() { + $this->connection = new DllearnerConnection(); + } + /** * Checks if the request made is an AJAX-Request and returns true if so * Modified: trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php =================================================================== --- trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php 2009-10-20 10:23:23 UTC (rev 1891) @@ -1,9 +1,9 @@ <?php /** - * TODO, create a universal SparqlQueryBuilder for the different requests - * that can be made by a user or are made by the system for additional data - * like geodates, images, stuff... + * + * + * */ class SparqlQueryBuilder extends Config { @@ -50,25 +50,41 @@ } } + /** + * since there is no ORDER BY RAND() in Sparql and we are limiting + * the number of results for performance, we have to do sth. to + * at least randomize the results a bit..., the idea is to ORDER BY + * the different variables ASC/DESC randomly always used variables are + *?artist, ?artistName, ?record and ?playlist (record or track) + */ + $orderBy = ''; + /* BUG: Nice idea, but the jamendo-sparql-endpoint just ignores limit + when using order-by, thus useless approach */ + /* + $randomVariables = array('?artist', '?artistName', '?record', '?playlist'); + $randomOrder = array('ASC', 'DESC'); + if ($searchType != 'currentInfo') { + $orderBy = ' ORDER BY ' . $randomOrder[array_rand($randomOrder)] + . '(' . $randomVariables[array_rand($randomVariables)] . ')' . "\n"; + } + */ + // we need all information we can get, everytime, thus * - $beginStatement = 'SELECT * WHERE { ' . "\n"; - $endStatement = ' }' . $limit; - + $beginStatement = 'SELECT DISTINCT * WHERE { ' . "\n"; + $endStatement = ' }' . $orderBy . $limit; + $query = ''; - - switch($searchType) { - case 'artistSearch' : $query = $this->queryArtistSearch($search); break; - case 'tagSearch' : $query = $this->queryTagSearch($search); break; - case 'songSearch' : $query = $this->querySongSearch($search); break; - case 'lastFM' : $query = $this->queryTagSearch($search); break; + case 'artistSearch' : $query = $this->queryArtistSearch($search); break; + case 'tagSearch' : $query = $this->queryTagSearch($search); break; + case 'songSearch' : $query = $this->querySongSearch($search); break; + case 'lastFM' : $query = $this->queryTagSearch($search); break; + case 'recommendations' : $query = $this->queryRecommendations($search); break; /* TODO build functions for other queries - case 'albumInfo' : $query = $this->queryAlbumInfo($search); break; - case 'songInfo' : $query = $this->querySongInfo($search); break; + case 'currentInfo' : $query = $this->queryCurrentInfo($search); break; */ } - // save the query $this->queryString = $prefixes . $beginStatement . $query . $endStatement; } @@ -102,9 +118,8 @@ /** - * For a Tag-Search we display the playable records - * Therefore we need record and artist information too. - * AlbumCover is optional + * For a Tag-Search we display the playable records, therefore we need record and + * artist information too, AlbumCover is optional * Returns the Sparql-Query part for tag-search * * @return String Sparql-Query part for tag-search @@ -167,6 +182,9 @@ return $queryString; } + + + /** * Returns the Sparql-Query part for tag-search * @@ -193,7 +211,49 @@ return $queryString; } + + + + + /** + * + * + * + * + */ + private function queryRecommendations($search) { + $queryString = ' { + ?artist rdf:type mo:MusicArtist ; + foaf:name ?artistName ; + foaf:made ?record . + ?record mo:available_as ?playlist ; + dc:title ?albumTitle . + + OPTIONAL { ?artist foaf:img ?artistImage . } + OPTIONAL { ?artist foaf:homepage ?artistHomepage . } + OPTIONAL { + ?record mo:image ?cover . + FILTER (regex(str(?cover), "1.100.jpg", "i")) . + } + } '; + + /* ?record tags:taggedWithTag ?tag + makes the queries blow up high */ + + $queryString .= 'FILTER (regex(str(?playlist), "xspf", "i")) . '; + // and finally we append the sparql-string from kb-Description + $queryString .= $search; + + return $queryString; + } + + + + + + + /** * Returns the build Query-String * * @return String Complete SPARQL-Query stored in SparqlQueryBuilder Modified: trunk/src/moosique.net/moosique/classes/View.php =================================================================== --- trunk/src/moosique.net/moosique/classes/View.php 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/moosique/classes/View.php 2009-10-20 10:23:23 UTC (rev 1891) @@ -6,7 +6,6 @@ * */ class View extends Config { - private $html = '<h2>Nothing found.</h2>'; // view modes are debug or both, default is html view @@ -15,16 +14,18 @@ $this->createOutput($data, $type); } + /** * */ private function createOutput($data, $type) { - if (empty($data)) { + if (!is_array($data) || empty($data)) { switch($type) { case 'artistSearch' : $this->html = '<h2>No Artists found for »' . $_GET['searchValue'] . '«</h2>'; break; case 'tagSearch' : $this->html = '<h2>No Tags found for »' . $_GET['searchValue'] . '«</h2>'; break; case 'songSearch' : $this->html = '<h2>No Songs found for »' . $_GET['searchValue'] . '«.</h2>'; break; - case 'lastFM' : $this->html = ''; break; + case 'lastFM' : $this->html = '<h2>The last.fm-user »' . $_GET['searchValue'] . '« does not exist.</h2>'; break; + case 'recommendations' : $this->html = '<h2>' . $data . '</h2>'; break; } } else { // finally we are producing html, depending on the type of request @@ -45,9 +46,12 @@ case 'lastFM' : $this->html .= $this->tagSearchHTML($data); break; - - case 'albumPlaylist' : $this->html = $this->albumPlaylistHTML($data); break; - case 'trackPlaylist' : $this->html = $this->trackPlaylistHTML($data); break; + case 'recommendations' : + $this->html .= $this->recommendationsHTML($data); + break; + case 'playlist' : + $this->html = $this->playlistHTML($data); + break; } } } @@ -62,8 +66,6 @@ $output = '<div class="artistSearch"><ul class="clearfix">'; $i = 0; // counter variable for alternating li-elements foreach($data as $artist) { - // TODO Template-Usage - // alternating classes for li-elements if (($i % 2) == 0) { $class = 'odd'; } else { $class = ''; } @@ -115,17 +117,17 @@ if (!empty($artist['artistHomepage'])) { $homepage = '<a href="' . $this->getValue($artist['artistHomepage']) . '">(Homepage)</a>'; } - // tags if avaiable + $tags = ''; - if (!empty($artist['tag'])) { - if (is_array($this->getValue($artist['tag']))) { - $tags = implode(', ', $this->getValue($artist['tag'])); - } else { - $tags = $this->getValue($artist['tag']); - } - // remove the uri, we only want to have the tag-name - $tags = str_replace('http://dbtune.org/jamendo/tag/', '', $tags); + $tempTag = $this->getValue($artist['tag']); + if (is_array($tempTag)) { + $tags = implode(', ', $tempTag); + } else { + $tags = $tempTag; } + // remove the uri, we only want to have the tag-name + $tags = str_replace('http://dbtune.org/jamendo/tag/', '', $tags); + $output .= sprintf($template, $class, $this->getValue($artist['artistName']), $homepage, $image, $tags, $records ); @@ -171,25 +173,11 @@ '; // we have to do the if/else because if there is only one // result, the returned response wont contain a subarray - $records = $this->getValue($tag['record']); - if (is_array($records)) { $record = $records[$i]; } - else { $record = $records; } + $record = $this->getSingleValue($this->getValue($tag['record']), $i); + $artistName = $this->getSingleValue($this->getValue($tag['artistName']), $i); + $albumTitle = $this->getSingleValue($this->getValue($tag['albumTitle']), $i); + $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getSingleValue($this->getValue($tag['playlist']), $i)); - $artistNames = $this->getValue($tag['artistName']); - if (is_array($artistNames)) { $artistName = $artistNames[$i]; } - else { $artistName = $artistNames; } - - $albumTitles = $this->getValue($tag['albumTitle']); - if (is_array($albumTitles)) { $albumTitle = $albumTitles[$i]; } - else { $albumTitle = $albumTitles; } - - $playlists = $this->getValue($tag['playlist']); - if (is_array($playlists)) { - $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $playlists[$i]); - } else { - $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $playlists); - } - $addToPlaylist = '<li><a class="addToPlaylist" href="' . $playlist . '" ' . 'title="' . $artistName . ' - ' . $albumTitle . '" ' . 'rel="' . $record . '">Click here to add this album to your playlist.</a></li>'; @@ -197,20 +185,11 @@ /* The album cover is optional, so it could be empty */ $image = '<img src="img/noimage.png" alt="No image found..." />'; if (!empty($tag['cover'])) { - $covers = $this->getValue($tag['cover']); - if (is_array($covers)) { - $image = '<img src="' . $covers[$i] . '" alt="' . $artistName. ' - ' . $albumTitle. '" />'; - } else { - $image = '<img src="' . $covers . '" alt="' . $artistName. ' - ' . $albumTitle. '" />'; - } + $image = '<img src="' . $this->getSingleValue($this->getValue($tag['cover']), $i) . '" alt="' . $artistName. ' - ' . $albumTitle. '" />'; } $output .= sprintf($template, - $class, - $image, - $artistName, - $albumTitle, - $addToPlaylist + $class, $image, $artistName, $albumTitle, $addToPlaylist ); } $output .= '</ul>'; @@ -219,6 +198,7 @@ return $output; } + /** * * @@ -241,55 +221,31 @@ <ul>%s</ul> </li> '; - // we have to do the if/else because if there is only one - // result, the returned response wont contain a subarray - $tracks = $this->getValue($song['track']); - if (is_array($tracks)) { $track = $tracks[$i]; } - else { $track = $tracks; } - - $records = $this->getValue($song['record']); - if (is_array($records)) { $record = $records[$i]; } - else { $record = $records; } + + $track = $this->getSingleValue($this->getValue($song['track']), $i); + $record = $this->getSingleValue($this->getValue($song['record']), $i); + $songTitle = $this->getSingleValue($this->getValue($song['songTitle']), $i); + $artistName = $this->getSingleValue($this->getValue($song['artistName']), $i); + $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getSingleValue($this->getValue($song['playlist']), $i)); - $songTitles = $this->getValue($song['songTitle']); - if (is_array($songTitles)) { $songTitle = $songTitles[$i]; } - else { $songTitle = $songTitles; } - - $artistNames = $this->getValue($song['artistName']); - if (is_array($artistNames)) { $artistName = $artistNames[$i]; } - else { $artistName = $artistNames; } - - $playlists = $this->getValue($song['playlist']); - if (is_array($playlists)) { - $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $playlists[$i]); - } else { - $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $playlists); - } - $addToPlaylist = '<li><a rel="' . $record . '" class="addToPlaylist" href="' . $playlist . '" title="' . $artistName . ' - ' . $songTitle . '">Click here to add this song to your playlist</a></li>'; // Artist-Image is optional $image = '<img src="img/noimage.png" alt="No image found..." />'; if (!empty($song['artistImage'])) { - $images = $this->getValue($song['artistImage']); - if (is_array($images)) { - $image = '<img src="' . $images[$i] . '" alt="' . $artistName. '" />'; - } else { - $image = '<img src="' . $images . '" alt="' . $artistName. '" />'; - } + $image = '<img src="' . $this->getSingleValue($this->getValue($song['artistImage']), $i) + . '" alt="' . $artistName. '" />'; } $tags = ''; - if (!empty($song['tag'])) { - if (is_array($this->getValue($song['tag']))) { - $tags = implode(', ', $this->getValue($song['tag'])); - } else { - $tags = $this->getValue($song['tag']); - } - // remove the uri, we only want to have the tag-name - $tags = str_replace('http://dbtune.org/jamendo/tag/', '', $tags); - } + $tempTag = $this->getValue($song['tag']); + if (is_array($tempTag)) { + $tags = implode(', ', $tempTag); + } else { + $tags = $tempTag; + } + $tags = str_replace('http://dbtune.org/jamendo/tag/', '', $tags); $output .= sprintf($template, $class, $artistName . ' - ' . $songTitle, $image, $tags, $addToPlaylist @@ -301,37 +257,105 @@ /** - * - * - * + * + * + * + * + * + * */ - private function albumPlaylistHTML($data) { - $albumID = $data['albumID']; + private function recommendationsHTML($data) { $output = ''; - foreach($data['trackList'] as $tracks) { - foreach($tracks as $track) { - $output .= '<li><a rel="' . $albumID . '" href="' . $track['location'] - . '" class="htrack">' - . $track['creator'] . ' - ' . $track['title'] - . '</a></li>'; + $count = count($data['scores']); // doesnt matter if scores or results... + + if ($count > 0) { // we have at least one usable result + $scores = $data['scores']; + $syntaxes = $data['kbSyntaxes']; + $results = $data['results']; + + for ($i = 0; $i < $count; $i++) { + $syntax = str_replace('http://dbtune.org/jamendo/tag/', '', $syntaxes[$i]); + $syntax = str_replace('"', '', $syntax); + $output .= '<h3>»' . $syntax . '« (accuracy: ' . $scores[$i] . '%)</h3>'; + $output .= '<ul class="clearfix">'; + + $j = 0; + // cycle through all albums and fill the list + foreach ($results[$i] as $record => $result) { + // alternating classes for li-elements + if (($j % 2) == 0) { $class = 'odd'; } + else { $class = ''; } + $j++; + + $template = ' + <li class="clearfix %s"> + <div class="cover">%s</div> + <h4>%s - %s</h4> + <ul>%s</ul> + </li> + '; + $artistName = $this->getSingleValue($this->getValue($result['artistName'])); + $albumTitle = $this->getSingleValue($this->getValue($result['albumTitle'])); + $playlist = str_replace('?item_o=track_no_asc&aue=ogg2&n=all', '', $this->getSingleValue($this->getValue($result['playlist']))); + $addToPlaylist = '<li><a class="addToPlaylist" href="' . $playlist . '" ' + . 'title="' . $artistName . ' - ' . $albumTitle . '" ' + . 'rel="' . $record . '">Click here to add this album to your playlist.</a></li>'; + /* The album cover is optional, so it could be empty */ + $image = '<img src="img/noimage.png" alt="No image found..." />'; + if (!empty($result['cover'])) { + $image = '<img src="' . $this->getSingleValue($this->getValue($result['cover'])) + . '" alt="' . $artistName. ' - ' . $albumTitle. '" />'; + } + + $output .= sprintf($template, + $class, $image, $artistName, $albumTitle, $addToPlaylist + ); + } + $output .= '</ul>'; } + } else { + $output = '<h2>Could not create any recommendations...</h2>'; + $output .= '<p>Listen to some more music or reset your recently listened to list.</p>'; } return $output; } - + + + + + + + + + + + + + /** * * * */ - private function trackPlaylistHTML($data) { + private function playlistHTML($data) { $albumID = $data['albumID']; $output = ''; - foreach($data['trackList'] as $track) { - $output .= '<li><a rel="' . $albumID . '" href="' . $track['location'] - . '" class="htrack">' - . $track['creator'] . ' - ' . $track['title'] - . '</a></li>'; + foreach($data['trackList'] as $tracks) { + // if the tracks-list contains only one song, there are no sub-arrays + if (isset($tracks[0]) && is_array($tracks[0])) { + foreach($tracks as $track) { + $output .= '<li><a rel="' . $albumID . '" href="' . $track['location'] + . '" class="htrack">' + . $track['creator'] . ' - ' . $track['title'] + . '</a></li>'; + } + } else { // only one track, no sub-array, no foreach, same data + $track = $tracks; + $output .= '<li><a rel="' . $albumID . '" href="' . $track['location'] + . '" class="htrack">' + . $track['creator'] . ' - ' . $track['title'] + . '</a></li>'; + } } return $output; } @@ -362,7 +386,22 @@ } } + /** + * + * + * + * + * + */ + private function getSingleValue($data, $index = 0) { + if (is_array($data)) { + return $data[$index]; + } else { + return $data; + } + } + /** * Returns the HTML * Modified: trunk/src/moosique.net/moosique/config.ini =================================================================== --- trunk/src/moosique.net/moosique/config.ini 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/moosique/config.ini 2009-10-20 10:23:23 UTC (rev 1891) @@ -1,36 +1,35 @@ ; Config file for moosique.net + [general] ; Activates global debugging, using FirePHP and Firebug debug = 1 -; If globalLimit = 1 maxResults is used for -; a global SPARQL-Query LIMIT, set to 0 maxResults -; will only be used for viewing results -maxResults = 20 -globalLimit = 0 +; If globalLimit = 1 maxResults is used for a global SPARQL-Query LIMIT, +; set to 0 maxResults will only be used for viewing results +maxResults = 10 +globalLimit = 1 +; %-score a recommendation needs to have to be recommended +threshold = 80 [url] +base = "http://localhost/moosique.net/" local = "http://127.0.0.1/" wsdl = "http://localhost:8181/services?wsdl" wsdlLocal = "http://localhost/moosique.net/moosique/main.wsdl" -; The Default-Jamendo-Endpoint jamendo = "http://dbtune.org/jamendo/sparql/" -; musicbrainz-Endpoint musicbrainz = "http://dbtune.org/musicbrainz/sparql/" -; Last-Fm-Api -; lastfm = "http://dbtune.org/last-fm/" +zitgistdata = "http://dataviewer.zitgist.com/?uri=" tagOntology = "file:/Users/nebelschwade/Sites/moosique.net/moosique/testing/moreThan80.owl" allTags = "http://localhost/moosique.net/moosique/data/allTagsByPopularity.txt" allRecords = "http://localhost/moosique.net/moosique/data/allRecordsWithTags.txt" [lastFM] -; user-top-tags api-url +; change the api-key if you have your own +apiKey = "b9877a7391416d0846ad5f240a1838f9" topTagsUrl = "http://ws.audioscrobbler.com/2.0/?method=user.gettoptags" topArtistsUrl = "http://ws.audioscrobbler.com/2.0/?method=user.gettopartists" artistsTopTagsUrl = "http://ws.audioscrobbler.com/2.0/?method=artist.gettoptags" -; change the api-key if you have your own -apiKey = "b9877a7391416d0846ad5f240a1838f9" ; you don't have to change [learning]-config-vars in most cases @@ -39,7 +38,7 @@ ; set the start class to the correct type (Record in this case) - not supported yet ; celoe.startClass = "http://purl.org/ontology/mo/Record"; ; let it run for a short amount of time (we only want simple expressions) -maxExecutionTimeInSeconds = 2 +maxExecutionTimeInSeconds = 4 ; use owl:hasValue if appropriate ; see: http://www.w3.org/TR/2008/WD-owl2-syntax-20081202/#Individual_Value_Restriction ; not sure whether this greatly influences the results Modified: trunk/src/moosique.net/moosique/data/allTagsByPopularity.txt =================================================================== --- trunk/src/moosique.net/moosique/data/allTagsByPopularity.txt 2009-10-14 14:24:30 UTC (rev 1890) +++ trunk/src/moosique.net/moosique/data/allTagsByPopularity.txt 2009-10-20 10:23:23 UTC (rev 1891) @@ -1,3 +1,7 @@ +Used tags are commented with # +Unused tags are indented (8 spcs) and commented with # +"Not yet in the owl"-tags are neither commented or indented + #http://dbtune.org/jamendo/tag/electro : 2102 #http://dbtune.org/jamendo/tag/rock : 1703 #http://dbtune.org/jamendo/tag/ambient : 1007 @@ -5,22 +9,22 @@ #http://dbtune.org/jamendo/tag/experimental : 810 #http://dbtune.org/jamendo/tag/instrumental : 701 #http://dbtune.org/jamendo/tag/techno : 682 -http://dbtune.org/jamendo/tag/guitare : 583 +# http://dbtune.org/jamendo/tag/guitare : 583 #http://dbtune.org/jamendo/tag/chanson : 442 #http://dbtune.org/jamendo/tag/jazz : 421 #http://dbtune.org/jamendo/tag/poprock : 414 #http://dbtune.org/jamendo/tag/metal : 397 #http://dbtune.org/jamendo/tag/acoustique : 396 #http://dbtune.org/jamendo/tag/alternatif : 389 -http://dbtune.org/jamendo/tag/melodique : 387 +#... [truncated message content] |
From: <jen...@us...> - 2009-10-14 14:24:42
|
Revision: 1890 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1890&view=rev Author: jenslehmann Date: 2009-10-14 14:24:30 +0000 (Wed, 14 Oct 2009) Log Message: ----------- continued work on mutation problem Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java Modified: trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java 2009-10-09 08:38:19 UTC (rev 1889) +++ trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java 2009-10-14 14:24:30 UTC (rev 1890) @@ -59,6 +59,11 @@ private static File owlFile = new File("examples/mutation/mutation.owl"); private static File confFile = new File("examples/mutation/mutation.conf"); + // whether to generate a class containing the positive examples + private static boolean generatePosExampleClass = true; + // set to true if accessing PostreSQL and false for MySQL + private static boolean pgSQL = false; + public static void main(String[] args) throws ClassNotFoundException, BackingStoreException, SQLException { // reading values for db connection from ini file @@ -71,8 +76,14 @@ String table = prefs.node("database").get("table", null); // connect to database - Class.forName("com.mysql.jdbc.Driver"); - String url = "jdbc:mysql://"+dbServer+":3306/"+dbName; + String url = "jdbc:"; + if(pgSQL) { + Class.forName("org.postgresql.Driver"); + url += "postgresql://"+dbServer+":5432/"+dbName; + } else { + Class.forName("com.mysql.jdbc.Driver"); + url += "mysql://"+dbServer+":3306/"+dbName; + } Connection conn = DriverManager.getConnection(url, dbUser, dbPass); System.out.println("Successfully connected to database."); @@ -81,6 +92,8 @@ KB kb = new KB(); NamedClass mutationClass = new NamedClass(getURI("Mutation")); + NamedClass deleteriousMutationClass = new NamedClass(getURI("DeletoriousMutation")); + // size change NamedClass protSizeIncClass = new NamedClass(getURI("ProteinSizeIncreasingMutation")); NamedClass protSizeUnchangedClass = new NamedClass(getURI("ProteinSizeUnchangedMutation")); @@ -340,7 +353,16 @@ // reliability_deltag double reliabilityDeltag = rs.getDouble("reliability_deltag"); kb.addAxiom(new DoubleDatatypePropertyAssertion(reliabilityDeltagProp, mutationInd, reliabilityDeltag)); - + + // generate a class with all positive examples (optional) + if(generatePosExampleClass) { + String phenotype = rs.getString("phenotype"); + if(phenotype.toLowerCase().contains("polymorphism")) { + kb.addAxiom(new ClassAssertionAxiom(deleteriousMutationClass, mutationInd)); + } + } + + count++; } @@ -371,15 +393,21 @@ Files.clearFile(confFile); String confHeader = "import(\"" + owlFile.getName() + "\");\n\n"; confHeader += "reasoner = fastInstanceChecker;\n"; - confHeader += "algorithm = refexamples;\n"; - confHeader += "refexamples.noisePercentage = 15;\n"; - confHeader += "refexamples.startClass = \"" + getURI("Mutation") + "\";\n"; - confHeader += "refexamples.writeSearchTree = false;\n"; - confHeader += "refexamples.searchTreeFile = \"log/mutation/searchTree.log\";\n"; + confHeader += "problem = classLearning;\n"; + confHeader += "classLearning.classToDescribe = \"" + deleteriousMutationClass + "\";\n"; + confHeader += "algorithm = celoe;\n"; + confHeader += "celoe.maxExecutionTimeInSeconds = 100;\n"; + confHeader += "celoe.noisePercentage = 25;\n"; +// confHeader += "refexamples.noisePercentage = 15;\n"; +// confHeader += "refexamples.startClass = \"" + getURI("Mutation") + "\";\n"; +// confHeader += "refexamples.writeSearchTree = false;\n"; +// confHeader += "refexamples.searchTreeFile = \"log/mutation/searchTree.log\";\n"; confHeader += "\n"; Files.appendFile(confFile, confHeader); - Carcinogenesis.appendPosExamples(confFile, posExamples); - Carcinogenesis.appendNegExamples(confFile, negExamples); + if(!generatePosExampleClass) { + Carcinogenesis.appendPosExamples(confFile, posExamples); + Carcinogenesis.appendNegExamples(confFile, negExamples); + } long runTime = System.nanoTime() - startTime; System.out.println("Database successfully converted in " + Helper.prettyPrintNanoSeconds(runTime) + "."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-10-09 08:38:32
|
Revision: 1889 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1889&view=rev Author: lorenz_b Date: 2009-10-09 08:38:19 +0000 (Fri, 09 Oct 2009) Log Message: ----------- added third explanation type fixed some rendering stuff moved rendering stuff in separate package added simple impact cache Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LostEntailmentsChecker.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ChangesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MarkableClassExpressionsTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MarkableClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RemainingAxiomsTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/SelectableClassExpressionsTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/SimpleExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/SimpleExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatisfiableClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/AddPropertyAssertionMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/AddToClassMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/MoveFromClassToMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/MoveToClassFromMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/RemoveAllPropertyAssertionsNotToMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/RemoveAllPropertyAssertionsToMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/item/RemoveFromClassMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/InconsistencyExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/InconsistencyExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/UnsatisfiableExplanationPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationType.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterSyntaxRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/MultiLineTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ProgressBarTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/TextAreaRenderer.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterSyntaxRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MultiLineTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ProgressBarTableCellRenderer.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -12,6 +12,7 @@ import org.dllearner.tools.ore.explanation.CachedExplanationGenerator; import org.dllearner.tools.ore.explanation.Explanation; import org.dllearner.tools.ore.explanation.ExplanationException; +import org.dllearner.tools.ore.explanation.ExplanationType; import org.dllearner.tools.ore.explanation.RootFinder; import org.dllearner.tools.ore.explanation.laconic.LaconicExplanationGenerator; import org.mindswap.pellet.owlapi.PelletReasonerFactory; @@ -230,6 +231,15 @@ } + public void setExplanationType(ExplanationType type){ + gen.setExplanationType(type); + fireExplanationTypeChanged(); + } + + public ExplanationType getExplanationType(){ + return gen.getExplanationType(); + } + public boolean isLaconicMode(){ return gen.isLaconicMode(); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -1,8 +1,10 @@ package org.dllearner.tools.ore; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.dllearner.tools.ore.explanation.LostEntailmentsChecker; @@ -24,7 +26,11 @@ private OREManager oreMan; private Set<OWLAxiom> lostEntailments; - private Set<OWLAxiom> addedEntailments; + private Set<OWLAxiom> retainedEntailments; + + private Map<List<OWLOntologyChange>, Set<OWLAxiom>> lostEntailmentsCache; + private Map<List<OWLOntologyChange>, Set<OWLAxiom>> retainedEntailmentsCache; + private ImpactManager(OREManager oreMan) { this.oreMan = oreMan; @@ -33,8 +39,11 @@ this.manager = reasoner.getManager(); lostEntailments = new HashSet<OWLAxiom>(); - addedEntailments = new HashSet<OWLAxiom>(); + retainedEntailments = new HashSet<OWLAxiom>(); + lostEntailmentsCache = new HashMap<List<OWLOntologyChange>, Set<OWLAxiom>>(); + retainedEntailmentsCache = new HashMap<List<OWLOntologyChange>, Set<OWLAxiom>>(); + selectedAxioms = new ArrayList<OWLAxiom>(); listeners = new ArrayList<ImpactManagerListener>(); @@ -69,18 +78,29 @@ } public Set<OWLAxiom> getAddedEntailments(){ - return addedEntailments; + return retainedEntailments; } public void computeImpactForAxiomsInRepairPlan(){ - lostEntailments.clear(); - addedEntailments.clear(); + +// lostEntailments.clear(); +// retainedEntailments.clear(); List<OWLOntologyChange> repairPlan = RepairManager.getInstance(oreMan).getRepairPlan(); - List<Set<OWLAxiom>> classificationImpact = lostEntailmentsChecker.computeClassificationImpact(repairPlan); - lostEntailments.addAll(classificationImpact.get(0)); - addedEntailments.addAll(classificationImpact.get(1)); - Set<OWLAxiom> structuralImpact = lostEntailmentsChecker.computeStructuralImpact(repairPlan); - lostEntailments.addAll(structuralImpact); + lostEntailments = lostEntailmentsCache.get(repairPlan); + retainedEntailments = retainedEntailmentsCache.get(repairPlan); + if(lostEntailments == null){ + lostEntailments = new HashSet<OWLAxiom>(); + retainedEntailments = new HashSet<OWLAxiom>(); + List<Set<OWLAxiom>> classificationImpact = lostEntailmentsChecker.computeClassificationImpact(repairPlan); + lostEntailments.addAll(classificationImpact.get(0)); + retainedEntailments.addAll(classificationImpact.get(1)); + Set<OWLAxiom> structuralImpact = lostEntailmentsChecker.computeStructuralImpact(repairPlan); + lostEntailments.addAll(structuralImpact); + + lostEntailmentsCache.put(repairPlan, lostEntailments); + retainedEntailmentsCache.put(repairPlan, retainedEntailments); + } + } public void addSelection(OWLAxiom ax){ @@ -118,7 +138,7 @@ public void repairPlanExecuted(List<OWLOntologyChange> changes) { selectedAxioms.clear(); lostEntailments.clear(); - addedEntailments.clear(); + retainedEntailments.clear(); fireImpactListChanged(); } @@ -131,7 +151,7 @@ lostEntailmentsChecker = new LostEntailmentsChecker(ontology, oreMan.getReasoner().getClassifier(), manager); selectedAxioms.clear(); lostEntailments.clear(); - addedEntailments.clear(); + retainedEntailments.clear(); fireImpactListChanged(); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -31,14 +31,21 @@ public class CachedExplanationGenerator implements ExplanationGenerator, RepairManagerListener{ private Map<OWLAxiom, OWLOntology> axiom2Module; + private Map<OWLAxiom, Set<Explanation>> regularExplanationCache; private Map<OWLAxiom, Set<Explanation>> laconicExplanationCache; + private Map<OWLAxiom, Set<Explanation>> preciseExplanationCache; + private Map<OWLAxiom, Integer> lastRequestedRegularSize; private Map<OWLAxiom, Integer> lastRequestedLaconicSize; + private boolean laconicMode = false; + private PelletExplanationGenerator regularExpGen; private LaconicExplanationGenerator laconicExpGen; + private ExplanationType explanationType = ExplanationType.REGULAR; + private OWLOntology ontology; private OWLOntologyManager manager; @@ -47,10 +54,14 @@ this.manager = OWLManager.createOWLOntologyManager(); axiom2Module = new HashMap<OWLAxiom, OWLOntology>(); + regularExplanationCache = new HashMap<OWLAxiom, Set<Explanation>>(); laconicExplanationCache = new HashMap<OWLAxiom, Set<Explanation>>(); + preciseExplanationCache = new HashMap<OWLAxiom, Set<Explanation>>(); + lastRequestedRegularSize = new HashMap<OWLAxiom, Integer>(); lastRequestedLaconicSize = new HashMap<OWLAxiom, Integer>(); + RepairManager.getInstance(OREManager.getInstance()).addListener(this); } @@ -58,6 +69,14 @@ laconicMode = laconic; } + public void setExplanationType(ExplanationType type){ + explanationType = type; + } + + public ExplanationType getExplanationType(){ + return explanationType; + } + public boolean isLaconicMode(){ return laconicMode; } @@ -75,10 +94,22 @@ public int getArity(OWLAxiom axiom){ int arity = 0; Map<OWLAxiom, Set<Explanation>> cache; - if(laconicMode == true){ - cache = laconicExplanationCache; - } else { - cache = regularExplanationCache; + switch(explanationType){ + case REGULAR : { + cache = regularExplanationCache; + break; + } + case LACONIC : { + cache = laconicExplanationCache; + break; + } + case PRECISE : { + cache = preciseExplanationCache; + break; + } + default: + throw new UnsupportedOperationException( "Unrecognized module type: " + explanationType ); + } for(Set<Explanation> explanations : cache.values()){ for(Explanation exp : explanations){ @@ -93,10 +124,22 @@ public double getInconsistencyValue(OWLAxiom ax){ double value = 0; Map<OWLAxiom, Set<Explanation>> cache; - if(laconicMode == true){ - cache = laconicExplanationCache; - } else { - cache = regularExplanationCache; + switch(explanationType){ + case REGULAR : { + cache = regularExplanationCache; + break; + } + case LACONIC : { + cache = laconicExplanationCache; + break; + } + case PRECISE : { + cache = preciseExplanationCache; + break; + } + default: + throw new UnsupportedOperationException( "Unrecognized module type: " + explanationType ); + } SortedSet<Explanation> sorted = new TreeSet<Explanation>(); for(Set<Explanation> explanations : cache.values()){ @@ -122,10 +165,22 @@ Set<Explanation> explanations = new HashSet<Explanation>(); try { - if(!laconicMode){ - explanations = computeRegularExplanations(entailment, limit); - } else { - explanations = computeLaconicExplanations(entailment, limit); + switch(explanationType){ + case REGULAR : { + explanations = computeRegularExplanations(entailment, limit); + break; + } + case LACONIC : { + explanations = computeLaconicExplanations(entailment, limit); + break; + } + case PRECISE : { + explanations = computePreciseExplanations(entailment, limit); + break; + } + default: + throw new UnsupportedOperationException( "Unrecognized module type: " + explanationType ); + } } catch (ExplanationException e) { // TODO Auto-generated catch block @@ -154,12 +209,27 @@ } else { explanations = laconicExpGen.getExplanations(entailment, limit); } - laconicExplanationCache.put(entailment, explanations); + laconicExplanationCache.put(entailment, laconicExpGen.retrieveAxioms(explanations)); + preciseExplanationCache.put(entailment, explanations); lastRequestedLaconicSize.put(entailment, Integer.valueOf(limit)); } return explanations; } + private Set<Explanation> computePreciseExplanations(OWLAxiom entailment, int limit) throws ExplanationException{ + + Set<Explanation> explanations = preciseExplanationCache.get(entailment); + Integer lastRequestedSize = lastRequestedLaconicSize.get(entailment); + if(lastRequestedSize == null){ + lastRequestedSize = Integer.valueOf(0); + } + if(explanations == null || lastRequestedSize.intValue() != -1 && lastRequestedSize.intValue() < limit){ + computeLaconicExplanations(entailment, limit); + explanations = preciseExplanationCache.get(entailment); + } + return explanations; + } + private Set<Explanation> computeRegularExplanations(OWLAxiom entailment, int limit) throws ExplanationException{ Set<Explanation> explanations = regularExplanationCache.get(entailment); Integer lastRequestedSize = lastRequestedRegularSize.get(entailment); @@ -217,6 +287,7 @@ // } regularExplanationCache.clear(); laconicExplanationCache.clear(); + preciseExplanationCache.clear(); axiom2Module.clear(); lastRequestedRegularSize.clear(); Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationType.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationType.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationType.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -0,0 +1,9 @@ +package org.dllearner.tools.ore.explanation; + +public enum ExplanationType { + + REGULAR, + LACONIC, + PRECISE + +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LostEntailmentsChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LostEntailmentsChecker.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LostEntailmentsChecker.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -1,8 +1,10 @@ package org.dllearner.tools.ore.explanation; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.mindswap.pellet.owlapi.Reasoner; @@ -115,6 +117,8 @@ } public Set<OWLAxiom> computeStructuralImpact(List<OWLOntologyChange> changes) { + Map<OWLClass, Set<OWLClass>> subsumptionHierarchyUp = new HashMap<OWLClass, Set<OWLClass>>(); + Map<OWLClass, Set<OWLClass>> subsumptionHierarchyDown = new HashMap<OWLClass, Set<OWLClass>>(); System.out.println("Computing structural impact"); System.out.println("Refreshing reasoner"); reasoner.refresh(); @@ -130,10 +134,18 @@ if (subAx.getSubClass() instanceof OWLClass && subAx.getSuperClass() instanceof OWLClass) { OWLClass sub = (OWLClass) subAx.getSubClass(); OWLClass sup = (OWLClass) subAx.getSuperClass(); - - for (OWLClass desc : SetUtils.union(reasoner.getDescendantClasses(sub))) { - - for (OWLClass anc : SetUtils.union(reasoner.getAncestorClasses(sup))) { + Set<OWLClass> descendants = subsumptionHierarchyDown.get(sub); + if(descendants == null){ + descendants = SetUtils.union(reasoner.getDescendantClasses(sub)); + subsumptionHierarchyDown.put(sub, descendants); + } + for (OWLClass desc : descendants) { + Set<OWLClass> ancestors = subsumptionHierarchyUp.get(sub); + if(ancestors == null){ + ancestors = SetUtils.union(reasoner.getAncestorClasses(sup)); + subsumptionHierarchyUp.put(sup, ancestors); + } + for (OWLClass anc : ancestors) { if (!anc.equals(factory.getOWLThing()) && !desc.equals(factory.getOWLNothing())) { OWLSubClassAxiom ax = factory.getOWLSubClassAxiom(desc, anc); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ChangesTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ChangesTable.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ChangesTable.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -13,6 +13,7 @@ import javax.swing.ListSelectionModel; import javax.swing.table.DefaultTableCellRenderer; +import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxTableCellRenderer; import org.jdesktop.swingx.JXTable; import org.semanticweb.owl.model.OWLOntologyChange; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -7,6 +7,7 @@ import javax.swing.ListSelectionModel; import org.dllearner.core.owl.NamedClass; +import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxTableCellRenderer; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.HighlighterFactory; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -29,6 +29,7 @@ import org.dllearner.tools.ore.RepairManager; import org.dllearner.tools.ore.RepairManagerListener; import org.dllearner.tools.ore.explanation.Explanation; +import org.dllearner.tools.ore.ui.rendering.TextAreaRenderer; import org.jdesktop.swingx.JXTable; import org.protege.editor.core.Disposable; import org.semanticweb.owl.model.OWLClass; @@ -67,7 +68,8 @@ column6.setResizable(false); // setRowHeight(getRowHeight() + 4); setRowHeightEnabled(true); - getColumn(0).setCellRenderer(new MultiLineTableCellRenderer()); + + getColumn(0).setCellRenderer(new TextAreaRenderer()); getColumn(1).setMaxWidth(60); getColumn(2).setMaxWidth(60); getColumn(3).setMaxWidth(60); @@ -147,7 +149,7 @@ private static final long serialVersionUID = -3386641672808329591L; public String getToolTipText(MouseEvent e) { - String tip = null; + java.awt.Point p = e.getPoint(); int index = columnModel.getColumnIndexAtX(p.x); int realIndex = @@ -158,6 +160,20 @@ } + @Override + public String getToolTipText(MouseEvent e){ + String tip = null; + java.awt.Point p = e.getPoint(); + int rowIndex = rowAtPoint(p); + if(rowIndex != -1){ + tip = ((ExplanationTableModel)getModel()).getOWLAxiomAtRow(rowIndex).toString(); + + } else { + tip = super.getToolTipText(e); + } + return tip; + } + public void strikeOut(boolean strikeOut){ ((ExplanationTableModel)getModel()).setStriked(strikeOut); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -10,6 +10,7 @@ import org.dllearner.tools.ore.OREManager; import org.dllearner.tools.ore.RepairManager; import org.dllearner.tools.ore.explanation.Explanation; +import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxRenderer; import org.semanticweb.owl.model.AddAxiom; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -37,6 +37,7 @@ import org.dllearner.core.owl.Individual; import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.tools.ore.OREManager; +import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxRenderer; import org.dllearner.tools.protege.IndividualPoint; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -14,12 +14,15 @@ import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; import org.dllearner.tools.ore.ExplanationManager; import org.dllearner.tools.ore.OREManager; import org.dllearner.tools.ore.RepairManager; import org.dllearner.tools.ore.TaskManager; import org.dllearner.tools.ore.explanation.Explanation; +import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxRenderer; +import org.dllearner.tools.ore.ui.rendering.TextAreaRenderer; import org.jdesktop.swingx.JXTable; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLOntologyChange; @@ -42,8 +45,7 @@ setGridColor(Color.LIGHT_GRAY); setTableHeader(null); setRowHeightEnabled(true); - getColumnModel().getColumn(1).setCellRenderer(new MultiLineTableCellRenderer()); - setRowHeight(getRowHeight() + 5); + getColumnModel().getColumn(1).setCellRenderer(new TextAreaRenderer()); getColumn(0).setMaxWidth(60); getColumn(2).setMaxWidth(60); @@ -143,12 +145,13 @@ List<OWLOntologyChange>repairPlan = repMan.getRepairPlan(); StringBuilder sb = new StringBuilder(); + sb.append("["); sb.append(ManchesterSyntaxRenderer.renderSimple(entailment)); if(((ImpactTableModel)getModel()).isLostEntailment(entailment)){ - sb.append(" is lost because"); + sb.append("] is lost because"); new ExplanationDialog(sb.toString(), expMan.getEntailmentExplanations(entailment)); } else { - sb.append(" is added because"); + sb.append("] is added because"); man.applyChanges(repairPlan); new ExplanationDialog(sb.toString(), expMan.getEntailmentExplanations(entailment)); man.applyChanges(repMan.getInverseChanges(repairPlan)); @@ -179,8 +182,9 @@ for(Explanation exp : explanations){ ExplanationTablePanel panel = new ExplanationTablePanel(new SimpleExplanationTable(exp), counter); explanationsPanel.add(panel); + counter++; } - add(explanationsPanel, BorderLayout.NORTH); + add(new JScrollPane(explanationsPanel), BorderLayout.NORTH); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setSize(700, 400); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -7,6 +7,7 @@ import javax.swing.ListSelectionModel; import org.dllearner.core.owl.Individual; +import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxTableCellRenderer; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.HighlighterFactory; Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterRenderer.java 2009-10-08 16:27:27 UTC (rev 1888) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterRenderer.java 2009-10-09 08:38:19 UTC (rev 1889) @@ -1,1268 +0,0 @@ -package org.dllearner.tools.ore.ui; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.log4j.Logger; -import org.protege.editor.owl.model.OWLModelManager; -import org.protege.editor.owl.ui.renderer.OWLEntityRenderer; -import org.protege.editor.owl.ui.renderer.OWLObjectRendererImpl; -import org.protege.editor.owl.ui.renderer.OWLRendererPreferences; -import org.semanticweb.owl.model.OWLAntiSymmetricObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom; -import org.semanticweb.owl.model.OWLClass; -import org.semanticweb.owl.model.OWLClassAssertionAxiom; -import org.semanticweb.owl.model.OWLConstant; -import org.semanticweb.owl.model.OWLConstantAnnotation; -import org.semanticweb.owl.model.OWLDataAllRestriction; -import org.semanticweb.owl.model.OWLDataCardinalityRestriction; -import org.semanticweb.owl.model.OWLDataComplementOf; -import org.semanticweb.owl.model.OWLDataExactCardinalityRestriction; -import org.semanticweb.owl.model.OWLDataMaxCardinalityRestriction; -import org.semanticweb.owl.model.OWLDataMinCardinalityRestriction; -import org.semanticweb.owl.model.OWLDataOneOf; -import org.semanticweb.owl.model.OWLDataProperty; -import org.semanticweb.owl.model.OWLDataPropertyAssertionAxiom; -import org.semanticweb.owl.model.OWLDataPropertyDomainAxiom; -import org.semanticweb.owl.model.OWLDataPropertyExpression; -import org.semanticweb.owl.model.OWLDataPropertyRangeAxiom; -import org.semanticweb.owl.model.OWLDataRange; -import org.semanticweb.owl.model.OWLDataRangeFacetRestriction; -import org.semanticweb.owl.model.OWLDataRangeRestriction; -import org.semanticweb.owl.model.OWLDataSomeRestriction; -import org.semanticweb.owl.model.OWLDataSubPropertyAxiom; -import org.semanticweb.owl.model.OWLDataType; -import org.semanticweb.owl.model.OWLDataValueRestriction; -import org.semanticweb.owl.model.OWLDataVisitor; -import org.semanticweb.owl.model.OWLDeclarationAxiom; -import org.semanticweb.owl.model.OWLDescription; -import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom; -import org.semanticweb.owl.model.OWLDisjointClassesAxiom; -import org.semanticweb.owl.model.OWLDisjointDataPropertiesAxiom; -import org.semanticweb.owl.model.OWLDisjointObjectPropertiesAxiom; -import org.semanticweb.owl.model.OWLDisjointUnionAxiom; -import org.semanticweb.owl.model.OWLEntity; -import org.semanticweb.owl.model.OWLEntityAnnotationAxiom; -import org.semanticweb.owl.model.OWLEquivalentClassesAxiom; -import org.semanticweb.owl.model.OWLEquivalentDataPropertiesAxiom; -import org.semanticweb.owl.model.OWLEquivalentObjectPropertiesAxiom; -import org.semanticweb.owl.model.OWLFunctionalDataPropertyAxiom; -import org.semanticweb.owl.model.OWLFunctionalObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLImportsDeclaration; -import org.semanticweb.owl.model.OWLIndividual; -import org.semanticweb.owl.model.OWLInverseFunctionalObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLInverseObjectPropertiesAxiom; -import org.semanticweb.owl.model.OWLIrreflexiveObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLNegativeDataPropertyAssertionAxiom; -import org.semanticweb.owl.model.OWLNegativeObjectPropertyAssertionAxiom; -import org.semanticweb.owl.model.OWLObject; -import org.semanticweb.owl.model.OWLObjectAllRestriction; -import org.semanticweb.owl.model.OWLObjectAnnotation; -import org.semanticweb.owl.model.OWLObjectCardinalityRestriction; -import org.semanticweb.owl.model.OWLObjectComplementOf; -import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; -import org.semanticweb.owl.model.OWLObjectIntersectionOf; -import org.semanticweb.owl.model.OWLObjectMaxCardinalityRestriction; -import org.semanticweb.owl.model.OWLObjectMinCardinalityRestriction; -import org.semanticweb.owl.model.OWLObjectOneOf; -import org.semanticweb.owl.model.OWLObjectProperty; -import org.semanticweb.owl.model.OWLObjectPropertyAssertionAxiom; -import org.semanticweb.owl.model.OWLObjectPropertyChainSubPropertyAxiom; -import org.semanticweb.owl.model.OWLObjectPropertyDomainAxiom; -import org.semanticweb.owl.model.OWLObjectPropertyExpression; -import org.semanticweb.owl.model.OWLObjectPropertyInverse; -import org.semanticweb.owl.model.OWLObjectPropertyRangeAxiom; -import org.semanticweb.owl.model.OWLObjectSelfRestriction; -import org.semanticweb.owl.model.OWLObjectSomeRestriction; -import org.semanticweb.owl.model.OWLObjectSubPropertyAxiom; -import org.semanticweb.owl.model.OWLObjectUnionOf; -import org.semanticweb.owl.model.OWLObjectValueRestriction; -import org.semanticweb.owl.model.OWLObjectVisitor; -import org.semanticweb.owl.model.OWLOntology; -import org.semanticweb.owl.model.OWLOntologyAnnotationAxiom; -import org.semanticweb.owl.model.OWLOntologyManager; -import org.semanticweb.owl.model.OWLReflexiveObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLRestriction; -import org.semanticweb.owl.model.OWLSameIndividualsAxiom; -import org.semanticweb.owl.model.OWLSubClassAxiom; -import org.semanticweb.owl.model.OWLSymmetricObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLTransitiveObjectPropertyAxiom; -import org.semanticweb.owl.model.OWLTypedConstant; -import org.semanticweb.owl.model.OWLUntypedConstant; -import org.semanticweb.owl.model.SWRLAtom; -import org.semanticweb.owl.model.SWRLAtomConstantObject; -import org.semanticweb.owl.model.SWRLAtomDObject; -import org.semanticweb.owl.model.SWRLAtomDVariable; -import org.semanticweb.owl.model.SWRLAtomIVariable; -import org.semanticweb.owl.model.SWRLAtomIndividualObject; -import org.semanticweb.owl.model.SWRLBuiltInAtom; -import org.semanticweb.owl.model.SWRLClassAtom; -import org.semanticweb.owl.model.SWRLDataRangeAtom; -import org.semanticweb.owl.model.SWRLDataValuedPropertyAtom; -import org.semanticweb.owl.model.SWRLDifferentFromAtom; -import org.semanticweb.owl.model.SWRLObjectPropertyAtom; -import org.semanticweb.owl.model.SWRLRule; -import org.semanticweb.owl.model.SWRLSameAsAtom; -import org.semanticweb.owl.util.OWLDescriptionComparator; -import org.semanticweb.owl.util.OWLDescriptionVisitorAdapter; -import org.semanticweb.owl.util.ShortFormProvider; -import org.semanticweb.owl.util.SimpleShortFormProvider; -import org.semanticweb.owl.vocab.OWLRestrictedDataRangeFacetVocabulary; -import org.semanticweb.owl.vocab.XSDVocabulary; - -public class ManchesterRenderer implements OWLObjectVisitor{ - private static final Logger logger = Logger.getLogger(OWLObjectRendererImpl.class); - - private OWLOntologyManager owlModelManager; - - private StringBuilder buffer; - - private BracketWriter bracketWriter; - - private Map<OWLRestrictedDataRangeFacetVocabulary, String> facetMap; - - private Map<URI, Boolean> simpleRenderDatatypes; - - private OWLObject focusedObject; - - private OWLEntityRenderer entityRenderer; - - private ShortFormProvider shortFomProvider; - - private OWLDescriptionComparator comparator = new OWLDescriptionComparator(shortFomProvider); - - - public ManchesterRenderer(OWLOntologyManager manager) { - this.owlModelManager = manager; - buffer = new StringBuilder(); - bracketWriter = new BracketWriter(); - facetMap = new HashMap<OWLRestrictedDataRangeFacetVocabulary, String>(); - facetMap.put(OWLRestrictedDataRangeFacetVocabulary.MIN_EXCLUSIVE, ">"); - facetMap.put(OWLRestrictedDataRangeFacetVocabulary.MAX_EXCLUSIVE, "<"); - facetMap.put(OWLRestrictedDataRangeFacetVocabulary.MIN_INCLUSIVE, ">="); - facetMap.put(OWLRestrictedDataRangeFacetVocabulary.MAX_INCLUSIVE, "<="); - simpleRenderDatatypes = new HashMap<URI, Boolean>(); - simpleRenderDatatypes.put(XSDVocabulary.INT.getURI(), false); - simpleRenderDatatypes.put(XSDVocabulary.FLOAT.getURI(), false); - simpleRenderDatatypes.put(XSDVocabulary.DOUBLE.getURI(), false); - simpleRenderDatatypes.put(XSDVocabulary.STRING.getURI(), true); - simpleRenderDatatypes.put(XSDVocabulary.BOOLEAN.getURI(), false); - - shortFomProvider = new SimpleShortFormProvider(); - } - - - public void setup(OWLModelManager owlModelManager) { - } - - - public void initialise() { - } - - - public void dispose() { - } - - - public OWLObject getFocusedObject() { - return focusedObject; - } - - -// public void setFocusedObject(OWLObject focusedObject) { -// this.focusedObject = focusedObject; -// if(focusedObject instanceof OWLDescription) { -// comparator.setFocusedDescription((OWLDescription) focusedObject); -// } -// } - - - protected String getAndKeyWord() { - return "and"; - } - - - protected String getOrKeyWord() { - return "or"; - } - - - protected String getNotKeyWord() { - return " not"; - } - - - protected String getSomeKeyWord() { - return "some"; - } - - - protected String getAllKeyWord() { - return "only"; - } - - - protected String getValueKeyWord() { - return "value"; - } - - - protected String getMinKeyWord() { - return "min"; - } - - - protected String getMaxKeyWord() { - return "max"; - } - - - protected String getExactlyKeyWord() { - return "exactly"; - } - - - public String render(OWLObject object, OWLEntityRenderer entityRenderer) { - reset(); - this.entityRenderer = entityRenderer; - try { - object.accept(this); - return buffer.toString(); - } - catch (Exception e) {e.printStackTrace(); - return "<Error! " + e.getMessage() + ">"; - } - } - - - protected String getRendering(OWLEntity entity) { - if (entityRenderer != null){ - return entityRenderer.render(entity); - } - return shortFomProvider.getShortForm(entity); - } - - - int lastNewLineIndex = 0; - - int currentIndex = 0; - - - protected void write(String s) { - int index = s.indexOf('\n'); - if (index != -1) { - lastNewLineIndex = currentIndex + index; - } - currentIndex = currentIndex + s.length(); - buffer.append(s); - } - - - protected int getIndent() { - return currentIndex - lastNewLineIndex; - } - - - protected void insertIndent(int indent) { - for (int i = 0; i < indent; i++) { - write(" "); - } - } - - - protected void writeAndKeyword() { - write(getAndKeyWord()); - write(" "); - } - - - public void reset() { - lastNewLineIndex = 0; - currentIndex = 0; - buffer = new StringBuilder(); - } - - - public String getText() { - return buffer.toString(); - } - - - - - - private List<OWLDescription> sort(Set<OWLDescription> descriptions) { - List<OWLDescription> sortedDescs = new ArrayList<OWLDescription>(descriptions); - Collections.sort(sortedDescs); - return sortedDescs; - } - - - public void visit(OWLObjectIntersectionOf node) { - - int indent = getIndent(); - List<OWLDescription> ops = sort(node.getOperands()); - for (int i = 0; i < ops.size(); i++) { - OWLDescription curOp = ops.get(i); - curOp.accept(this); - if (i < ops.size() - 1) { - write("\n"); - insertIndent(indent); - if (curOp instanceof OWLClass && ops.get(i + 1) instanceof OWLRestriction && OWLRendererPreferences.getInstance().isUseThatKeyword()) { - write("that "); - } - else { - writeAndKeyword(); - } - } - } - } - - - public void visit(OWLTypedConstant node) { - if (simpleRenderDatatypes.containsKey(node.getDataType().getURI())) { - boolean renderQuotes = simpleRenderDatatypes.get(node.getDataType().getURI()); - if (renderQuotes) { - write("\""); - } - write(node.getLiteral()); - if (renderQuotes) { - write("\""); - } - } - else { - write("\""); - write(node.getLiteral()); - write("\"^^"); - node.getDataType().accept(this); - } - } - - - public void visit(OWLUntypedConstant node) { - write("\""); - write(node.getLiteral()); - write("\""); - if (node.hasLang()) { - write("@"); - write(node.getLang()); - } - } - - - public void visit(OWLDataType node) { - write(getRendering(node)); - } - - - public void visit(OWLDataOneOf node) { - write("{"); - for (Iterator<OWLConstant> it = node.getValues().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(", "); - } - } - write("}"); - } - - - public void visit(OWLDataRangeRestriction node) { -// writeOpenBracket(node); - node.getDataRange().accept(this); - write("["); - for (Iterator<OWLDataRangeFacetRestriction> it = node.getFacetRestrictions().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(", "); - } - } - write("]"); -// writeCloseBracket(node); - } - - - public void visit(OWLDataComplementOf owlDataComplementOf) { - write("not("); - owlDataComplementOf.getDataRange().accept(this); - write(")"); - } - - - public void visit(OWLDataRangeFacetRestriction node) { - String rendering = facetMap.get(node.getFacet()); - if (rendering == null) { - rendering = node.getFacet().getShortName(); - } - write(rendering); - write(" "); - node.getFacetValue().accept(this); - } - - - public void visit(OWLObjectSelfRestriction desc) { - desc.getProperty().accept(this); - write(" "); - write(getSomeKeyWord()); - write(" Self"); - } - - - public void visit(OWLDataAllRestriction node) { - node.getProperty().accept(this); - write(" "); - write(getAllKeyWord()); - write(" "); - node.getFiller().accept(this); - } - - - public void visit(OWLDataProperty node) { - write(getRendering(node)); - } - - - public void visit(OWLDataSomeRestriction node) { - node.getProperty().accept(this); - write(" "); - write(getSomeKeyWord()); - write(" "); - node.getFiller().accept(this); - } - - - public void visit(OWLDataValueRestriction node) { - node.getProperty().accept(this); - write(" "); - write(getValueKeyWord()); - write(" "); - node.getValue().accept(this); - } - - - public void visit(OWLIndividual node) { - if (node.isAnonymous()) { - write("Anonymous : ["); - for (OWLOntology ont : owlModelManager.getOntologies()) { - for (OWLDescription desc : node.getTypes(ont)) { - write(" "); - desc.accept(this); - } - } - write(" ]"); - } - else { - write(getRendering(node)); - } - } - - - public void visit(OWLObjectAllRestriction node) { - node.getProperty().accept(this); - write(" "); - write(getAllKeyWord()); - write(" "); - writeOpenBracket(node.getFiller()); - node.getFiller().accept(this); - writeCloseBracket(node.getFiller()); - } - - - public void visit(OWLObjectMinCardinalityRestriction desc) { - writeCardinality(desc, getMinKeyWord()); - } - - - public void visit(OWLObjectExactCardinalityRestriction desc) { - writeCardinality(desc, getExactlyKeyWord()); - } - - - public void visit(OWLObjectMaxCardinalityRestriction desc) { - writeCardinality(desc, getMaxKeyWord()); - } - - - private void writeCardinality(OWLObjectCardinalityRestriction desc, String keyword) { - desc.getProperty().accept(this); - write(" "); - write(keyword); - write(" "); - write(Integer.toString(desc.getCardinality())); - write(" "); - writeOpenBracket(desc.getFiller()); - desc.getFiller().accept(this); - writeCloseBracket(desc.getFiller()); - } - - - public void visit(OWLDataMinCardinalityRestriction desc) { - writeCardinality(desc, getMinKeyWord()); - } - - - public void visit(OWLDataExactCardinalityRestriction desc) { - writeCardinality(desc, getExactlyKeyWord()); - } - - - public void visit(OWLDataMaxCardinalityRestriction desc) { - writeCardinality(desc, getMaxKeyWord()); - } - - - private void writeCardinality(OWLDataCardinalityRestriction desc, String keyword) { - desc.getProperty().accept(this); - write(" "); - write(keyword); - write(" "); - write(Integer.toString(desc.getCardinality())); - write(" "); - writeOpenBracket(desc.getFiller()); - desc.getFiller().accept(this); - writeCloseBracket(desc.getFiller()); - } - - - public void visit(OWLObjectProperty node) { - write(getRendering(node)); - } - - - public void visit(OWLObjectSomeRestriction node) { - node.getProperty().accept(this); - write(" "); - write(getSomeKeyWord()); - write(" "); - writeOpenBracket(node.getFiller()); - node.getFiller().accept(this); - writeCloseBracket(node.getFiller()); - } - - - public void visit(OWLObjectValueRestriction node) { - node.getProperty().accept(this); - write(" "); - write(getValueKeyWord()); - write(" "); - node.getValue().accept(this); - } - - - public void visit(OWLObjectComplementOf node) { - writeNotKeyword(); - write(" "); - writeOpenBracket(node.getOperand()); - node.getOperand().accept(this); - writeCloseBracket(node.getOperand()); - } - - - protected void writeNotKeyword() { - write(getNotKeyWord()); - } - - - public void visit(OWLObjectUnionOf node) { - int indent = getIndent(); - for (Iterator<OWLDescription> it = sort(node.getOperands()).iterator(); it.hasNext();) { - OWLDescription curOp = it.next(); - writeOpenBracket(curOp); - curOp.accept(this); - writeCloseBracket(curOp); - if (it.hasNext()) { - write("\n"); - insertIndent(indent); - writeOrKeyword(); - } - } - } - - - private void writeOrKeyword() { - write(getOrKeyWord()); - write(" "); - } - - - public void visit(OWLClass node) { - write(getRendering(node)); - } - - - public void visit(OWLObjectPropertyInverse property) { - write("inv("); - property.getInverse().accept(this); - write(")"); - } - - - public void visit(OWLObjectOneOf node) { - write("{"); - for (Iterator<OWLIndividual> it = node.getIndividuals().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(", "); - } - } - write("}"); - } - - - public void visit(OWLDisjointClassesAxiom node) { - for (Iterator<OWLDescription> it = sort(node.getDescriptions()).iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" disjointWith "); - } - } - } - - - public void visit(OWLEquivalentClassesAxiom node) { - List<OWLDescription> orderedDescs = sort(node.getDescriptions()); - for(Iterator<OWLDescription> it = orderedDescs.iterator(); it.hasNext(); ) { - OWLDescription desc = it.next(); - if(orderedDescs.get(0).isOWLNothing()) { - it.remove(); - orderedDescs.add(desc); - break; - } - } - - for (Iterator<OWLDescription> it = orderedDescs.iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" equivalentTo "); - } - } - } - - - public void visit(OWLSubClassAxiom node) { - node.getSubClass().accept(this); - write(" subClassOf "); - node.getSuperClass().accept(this); - } - - - public void visit(OWLFunctionalObjectPropertyAxiom axiom) { - write("Functional: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLInverseFunctionalObjectPropertyAxiom axiom) { - write("InverseFunctional: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLIrreflexiveObjectPropertyAxiom axiom) { - write("Irreflexive: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLDataSubPropertyAxiom axiom) { - axiom.getSubProperty().accept(this); - write(" subPropertyOf "); - axiom.getSuperProperty().accept(this); - } - - - public void visit(OWLReflexiveObjectPropertyAxiom axiom) { - write("Reflexive: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLSymmetricObjectPropertyAxiom axiom) { - write("Symmetric: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLTransitiveObjectPropertyAxiom axiom) { - write("Transitive: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLObjectPropertyDomainAxiom axiom) { - if (!OWLRendererPreferences.getInstance().isRenderDomainAxiomsAsGCIs()) { - axiom.getProperty().accept(this); - write(" domain "); - axiom.getDomain().accept(this); - } - else { - axiom.getProperty().accept(this); - write(" some "); - owlModelManager.getOWLDataFactory().getOWLThing().accept(this); - write(" subClassOf "); - axiom.getDomain().accept(this); - } - } - - - public void visit(OWLEquivalentObjectPropertiesAxiom node) { - for (Iterator<OWLObjectPropertyExpression> it = node.getProperties().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" equivalentTo "); - } - } - } - - - public void visit(OWLObjectPropertyRangeAxiom axiom) { - axiom.getProperty().accept(this); - write(" range "); - axiom.getRange().accept(this); - } - - - public void visit(OWLClassAssertionAxiom axiom) { - axiom.getIndividual().accept(this); - write(" types "); - axiom.getDescription().accept(this); - } - - - public void visit(OWLFunctionalDataPropertyAxiom axiom) { - write("Functional: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLEquivalentDataPropertiesAxiom node) { - for (Iterator<OWLDataPropertyExpression> it = node.getProperties().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" equivalentTo "); - } - } - } - - - public void visit(OWLSameIndividualsAxiom axiom) { - write("SameIndividuals: ["); - for (Iterator<OWLIndividual> it = axiom.getIndividuals().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(", "); - } - } - write("]"); - } - - - public void visit(OWLDifferentIndividualsAxiom axiom) { - write("DifferentIndividuals: ["); - for (Iterator<OWLIndividual> it = axiom.getIndividuals().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(", "); - } - } - write("]"); - } - - - public void visit(OWLDisjointDataPropertiesAxiom axiom) { - for (Iterator<OWLDataPropertyExpression> it = axiom.getProperties().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" disjointWith "); - } - } - } - - - public void visit(OWLDisjointObjectPropertiesAxiom axiom) { - for (Iterator<OWLObjectPropertyExpression> it = axiom.getProperties().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" disjointWith "); - } - } - } - - - public void visit(OWLObjectPropertyAssertionAxiom axiom) { - axiom.getSubject().accept(this); - write(" "); - axiom.getProperty().accept(this); - write(" "); - axiom.getObject().accept(this); - } - - - public void visit(OWLDataPropertyAssertionAxiom axiom) { - axiom.getSubject().accept(this); - write(" "); - axiom.getProperty().accept(this); - write(" "); - axiom.getObject().accept(this); - } - - - public void visit(OWLNegativeDataPropertyAssertionAxiom axiom) { - write("not("); - axiom.getSubject().accept(this); - write(" "); - axiom.getProperty().accept(this); - write(" "); - axiom.getObject().accept(this); - write(")"); - } - - - public void visit(OWLNegativeObjectPropertyAssertionAxiom axiom) { - write("not("); - axiom.getSubject().accept(this); - write(" "); - axiom.getProperty().accept(this); - write(" "); - axiom.getObject().accept(this); - write(")"); - } - - - public void visit(OWLInverseObjectPropertiesAxiom axiom) { - axiom.getFirstProperty().accept(this); - write(" inverseOf "); - axiom.getSecondProperty().accept(this); - } - - - public void visit(OWLAntiSymmetricObjectPropertyAxiom axiom) { - write("AntiSymmetric: "); - axiom.getProperty().accept(this); - } - - - public void visit(OWLDataPropertyDomainAxiom axiom) { - axiom.getProperty().accept(this); - write(" domain "); - axiom.getDomain().accept(this); - } - - - public void visit(OWLDataPropertyRangeAxiom axiom) { - axiom.getProperty().accept(this); - write(" range "); - axiom.getRange().accept(this); - } - - - public void visit(OWLObjectSubPropertyAxiom axiom) { - axiom.getSubProperty().accept(this); - write(" subPropertyOf "); - axiom.getSuperProperty().accept(this); - } - - - public void visit(OWLDisjointUnionAxiom axiom) { - axiom.getOWLClass().accept(this); - write(" disjointUnionOf "); - write("["); - int indent = getIndent(); - for (Iterator<OWLDescription> it = axiom.getDescriptions().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write("\n"); - insertIndent(indent); - } - } - write("]"); - } - - - public void visit(OWLDeclarationAxiom axiom) { - OWLEntity entity = axiom.getEntity(); - if (entity.isOWLClass()){ - write("Class("); - } - else if (entity.isOWLObjectProperty()){ - write("Object property("); - } - else if (entity.isOWLDataProperty()){ - write("Data property("); - } - else if (entity.isOWLIndividual()){ - write("Individual("); - } - else{ - write("("); - } - entity.accept(this); - write(")"); - } - - - public void visit(OWLImportsDeclaration axiom) { - writeOntologyURI(axiom.getImportedOntologyURI()); - if (owlModelManager.getImportedOntology(axiom) == null) { - write(" (Not Loaded)"); - } - } - - - public void visit(OWLAxiomAnnotationAxiom axiom) { - axiom.getSubject().accept(this); - write(" "); - axiom.getAnnotation().accept(this); - } - - - private void writeOpenBracket(OWLDescription description) { - description.accept(bracketWriter); - if (bracketWriter.writeBrackets()) { - write("("); - } - } - - - private void writeOpenBracket(OWLDataRange dataRange) { - dataRange.accept(bracketWriter); - if (bracketWriter.writeBrackets()) { - write("("); - } - } - - - private void writeCloseBracket(OWLDescription description) { - description.accept(bracketWriter); - if (bracketWriter.writeBrackets()) { - write(")"); - } - } - - - private void writeCloseBracket(OWLDataRange dataRange) { - dataRange.accept(bracketWriter); - if (bracketWriter.writeBrackets()) { - write(")"); - } - } - - - public void visit(OWLOntology ontology) { - writeOntologyURI(ontology.getURI()); - } - - - public void visit(OWLObjectPropertyChainSubPropertyAxiom axiom) { - for (Iterator<OWLObjectPropertyExpression> it = axiom.getPropertyChain().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" o "); - } - } - write(" \u279E "); - axiom.getSuperProperty().accept(this); - } - - - public void visit(OWLConstantAnnotation annotation) { - write(annotation.getAnnotationURI().getFragment()); - write(" "); - write(annotation.getAnnotationValue().toString()); - } - - - public void visit(SWRLRule swrlRule) { - for (Iterator<SWRLAtom> it = swrlRule.getBody().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" , "); - } - } - write(" -> "); - for (Iterator<SWRLAtom> it = swrlRule.getHead().iterator(); it.hasNext();) { - it.next().accept(this); - if (it.hasNext()) { - write(" \u2227 "); - } - } - } - - - public void visit(OWLEntityAnnotationAxiom owlEntityAnnotationAxiom) { - owlEntityAnnotationAxiom.getSubject().accept(this); - write(" "); - owlEntityAnnotationAxiom.getAnnotation().accept(this); - } - - - public void visit(OWLOntologyAnnotationAxiom axiom) { - axiom.getSubject().accept(this); - write(" "); - axiom.getAnnotation().accept(this); - } - - - public void visit(OWLObjectAnnotation owlObjectAnnotation) { - write(owlObjectAnnotation.getAnnotationURI().getFragment()); - write(" "); - owlObjectAnnotation.getAnnotationValue().accept(this); - } - - - public void visit(SWRLClassAtom swrlClassAtom) { - OWLDescription desc = swrlClassAtom.getPredicate(); - if (desc.isAnonymous()) { - write("("); - } - desc.accept(this); - if (desc.isAnonymous()) { - write(")"); - } - write("("); - swrlClassAtom.getArgument().accept(this); - write(")"); - } - - - public void visit(SWRLDataRangeAtom swrlDataRangeAtom) { - swrlDataRangeAtom.getPredicate().accept(this); - write("("); - swrlDataRangeAtom.getArgument().accept(this); - write(")"); - } - - - public void visit(SWRLObjectPropertyAtom swrlObjectPropertyAtom) { - swrlObjectPropertyAtom.getPredicate().accept(this); - write("("); - swrlObjectPropertyAtom.getFirstArgument().accept(this); - write(", "); - swrlObjectPropertyAtom.getSecondArgument().accept(this); - write(")"); - } - - - public void visit(SWRLDataValuedPropertyAtom swrlDataValuedPropertyAtom) { - swrlDataValuedPropertyAtom.getPredicate().accept(this); - write("("); - swrlDataValuedPropertyAtom.getFirstArgument().accept(this); - write(", "); - swrlDataValuedPropertyAtom.getSecondArgument().accept(this); - write(")"); - } - - - public void visit(SWRLBuiltInAtom swrlBuiltInAtom) { - write(swrlBuiltInAtom.getPredicate().getShortName()); - write("("); - Iterator<SWRLAtomDObject> it = swrlBuiltInAtom.getArguments().iterator(); - while (it.hasNext()) { - SWRLAtomDObject argument = it.next(); - argument.accept(this); - if (it.hasNext()) { - write(", "); - } - } - write(")"); - } - - - public void visit(SWRLAtomDVariable swrlAtomDVariable) { - write("?"); - write(swrlAtomDVariable.getURI().getFragment()); - } - - - public void visit(SWRLAtomIVariable swrlAtomIVariable) { - write("?"); - write(swrlAtomIVariable.getURI().getFragment()); - } - - - public void visit(SWRLAtomIndividualObject swrlAtomIndividualObject) { - swrlAtomIndividualObject.getIndividual().accept(this); - } - - - public void visit(SWRLAtomConstantObject swrlAtomConstantObject) { - swrlAtomConstantObject.getConstant().accept(this); - } - - - public void visit(SWRLDifferentFromAtom swrlDifferentFromAtom) { - swrlDifferentFromAtom.getPredicate().accept(this); - write("("); - swrlDifferentFromAtom.getFirstArgument().accept(this); - write(", "); - swrlDifferentFromAtom.getSecondArgument().accept(this); - write(")"); - } - - - public void visit(SWRLSameAsAtom swrlSameAsAtom) { - swrlSameAsAtom.getPredicate().accept(this); - write("("); - swrlSameAsAtom.getFirstArgument().accept(this); - write(", "); - swrlSameAsAtom.getSecondArgument().accept(this); - write(")"); - } - - - private void writeOntologyURI(URI uri) { - String shortName = uri.getFragment();//owlModelManager.getURIRendering(uri); - if (shortName != null) { - write(shortName); - write(" ("); - write(uri.toString()); - write(")"); - } - else { - write(uri.toString()); - } - } - - - private class BracketWriter extends OWLDescriptionVisitorAdapter implements OWLDataVisitor { - - boolean nested = false; - - - public boolean writeBrackets() { - return nested; - } - - - public void visit(OWLO... [truncated message content] |
From: <hee...@us...> - 2009-10-08 16:27:41
|
Revision: 1888 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1888&view=rev Author: heeroyuy Date: 2009-10-08 16:27:27 +0000 (Thu, 08 Oct 2009) Log Message: ----------- -continued help button with message on a seperate panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 13:58:26 UTC (rev 1887) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 16:27:27 UTC (rev 1888) @@ -33,6 +33,8 @@ import java.util.concurrent.ExecutionException; import javax.swing.DefaultListModel; +import javax.swing.JOptionPane; +import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.event.ListDataEvent; @@ -73,6 +75,8 @@ private final Color colorGreen = new Color(0, 139, 0); private final DLLearnerView view; private static final String HELP_BUTTON_STRING = "help"; + private JTextArea help; + private static final String ADVANCED_BUTTON_STRING = "Advanced"; /** * This is the constructor for the action handler. @@ -137,7 +141,7 @@ view.setHintMessage(message); view.setHelpButtonVisible(false); } - if (z.getActionCommand().equals("")) { + if (z.toString().contains(ADVANCED_BUTTON_STRING)) { if (!toggled) { toggled = true; view.setIconToggled(toggled); @@ -148,13 +152,21 @@ view.setExamplePanelVisible(toggled); } } - System.out.println(z.getActionCommand()); - if (z.getActionCommand().equals(HELP_BUTTON_STRING)) { - String helpText = "What does a sentence like 'Learning started. Currently searching class expressions with length between 4 and 7.' mean?" - + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words needed to write down the class expression." - + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general expression owl:Thing and then further specializes it. Those class expressions, which fit the existing instances of a given class ($currentClass in this case) get a high accuracy and are displayed as suggestions. The learning algorithm prefers short expressions. 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3 or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7. If you want to search for longer expressions, then you have to increase the maximum runtime setting (it is set to $defaultRuntime seconds by default)." + if (z.toString().contains(HELP_BUTTON_STRING)) { + String helpText = "What does a sentence like 'Learning started. Currently searching class expressions with length between 4 and 7.' mean?\n" + + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words\n needed to write down the class expression." + + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general\n expression owl:Thing and then further specializes it. Those class expressions, which fit the existing instances of a given class ($currentClass in this case)\n get a high accuracy and are displayed as suggestions. The learning algorithm prefers short expressions.\n 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3\n or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7.\n If you want to search for longer expressions, then you have to increase the maximum runtime setting (it is set to $defaultRuntime seconds by default)\n." + "See $wikiPage for more details. "; - view.getHelpButton().setToolTipText(helpText); + + help = new JTextArea(); + help.setEditable(false); + help.setForeground(Color.black); + help.setText(helpText); + + JOptionPane.showMessageDialog(null, + help, + "Help", + JOptionPane.INFORMATION_MESSAGE); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-08 13:58:26 UTC (rev 1887) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-08 16:27:27 UTC (rev 1888) @@ -158,7 +158,7 @@ helpIcon = new ImageIcon(helpIconUrl); helpButton = new JButton(helpIcon); helpButton.setPreferredSize(new Dimension(20, 20)); - helpButton.setText("help"); + helpButton.setName("help"); helpButton.addActionListener(action); helpButton.setVisible(false); runPanel = new JPanel(new FlowLayout()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-08 13:58:33
|
Revision: 1887 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1887&view=rev Author: heeroyuy Date: 2009-10-08 13:58:26 +0000 (Thu, 08 Oct 2009) Log Message: ----------- -started help button and help text Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/Help-16x16.png Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 13:11:27 UTC (rev 1886) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 13:58:26 UTC (rev 1887) @@ -72,9 +72,11 @@ private final Color colorRed = new Color(139, 0, 0); private final Color colorGreen = new Color(0, 139, 0); private final DLLearnerView view; + private static final String HELP_BUTTON_STRING = "help"; /** * This is the constructor for the action handler. + * * @param m * DLLearnerModel * @param view @@ -96,7 +98,9 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("suggest equivalent class expression") || z.getActionCommand().equals("suggest super class expression")) { + if (z.getActionCommand().equals("suggest equivalent class expression") + || z.getActionCommand() + .equals("suggest super class expression")) { model.setKnowledgeSource(); view.getSuggestClassPanel().getSuggestModel().clear(); view.getSuggestClassPanel().repaint(); @@ -105,8 +109,12 @@ view.getRunButton().setEnabled(false); view.getHintPanel().setForeground(Color.RED); CELOE celoe = (CELOE) model.getLearningAlgorithm(); - - String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and" + celoe.getMaximumHorizontalExpansion() + ". "; + + String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + + celoe.getMinimumHorizontalExpansion() + + " and" + + celoe.getMaximumHorizontalExpansion() + ". "; + view.setHelpButtonVisible(true); view.setHintMessage(moreInformationsMessage); retriever = new SuggestionRetriever(); retriever.execute(); @@ -125,8 +133,9 @@ .getSuggestClassPanel().getSuggestList() .getSelectedValue()); } - String message = "class expression\nadded"; - view.renderErrorMessage(message); + String message = "class expression added"; + view.setHintMessage(message); + view.setHelpButtonVisible(false); } if (z.getActionCommand().equals("")) { if (!toggled) { @@ -139,9 +148,16 @@ view.setExamplePanelVisible(toggled); } } + System.out.println(z.getActionCommand()); + if (z.getActionCommand().equals(HELP_BUTTON_STRING)) { + String helpText = "What does a sentence like 'Learning started. Currently searching class expressions with length between 4 and 7.' mean?" + + "Length: In Manchester OWL Syntax (the syntax used for class expressions in Protege), we define length simply as the number of words needed to write down the class expression." + + "The learning algorithm (called CELOE) for suggesting class expressions starts with the most general expression owl:Thing and then further specializes it. Those class expressions, which fit the existing instances of a given class ($currentClass in this case) get a high accuracy and are displayed as suggestions. The learning algorithm prefers short expressions. 'Currently searching class expressions with length between 4 and 7.' means that it has already evaluated all class expressions of length 1 to 3 or excluded them as possible suggestions. All the expressions currently evaluated have length between 4 and 7. If you want to search for longer expressions, then you have to increase the maximum runtime setting (it is set to $defaultRuntime seconds by default)." + + "See $wikiPage for more details. "; + view.getHelpButton().setToolTipText(helpText); + } } - /** * select/deselect the Check boxes. * @@ -149,7 +165,7 @@ * ItemEvent */ public void itemStateChanged(ItemEvent i) { - + } /** @@ -208,8 +224,8 @@ } } } - view.getMoreDetailForSuggestedConceptsPanel() - .renderDetailPanel(evaluatedDescription); + view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( + evaluatedDescription); view.setGraphicalPanel(); view.getMoreDetailForSuggestedConceptsPanel().repaint(); } @@ -300,7 +316,10 @@ .getNrOfConcepts())); CELOE celoe = (CELOE) model.getLearningAlgorithm(); view.getHintPanel().setForeground(Color.RED); - String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " + celoe.getMaximumHorizontalExpansion() + "."; + String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + + celoe.getMinimumHorizontalExpansion() + + " and " + + celoe.getMaximumHorizontalExpansion() + "."; view.setHintMessage(moreInformationsMessage); } } @@ -381,7 +400,8 @@ // (ontology, null), // ((EvaluatedDescriptionClass) // eval).getAccuracy()*100)); - if (((EvaluatedDescriptionClass) eval).isConsistent()) { + if (((EvaluatedDescriptionClass) eval) + .isConsistent()) { dm.add(i, new SuggestListItem(colorGreen, eval.getDescription() .toManchesterSyntaxString( @@ -404,7 +424,7 @@ } } } - + view.getSuggestClassPanel().setSuggestList(dm); view.getLearnerView().repaint(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-08 13:11:27 UTC (rev 1886) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-08 13:58:26 UTC (rev 1887) @@ -104,9 +104,12 @@ private final JPanel addButtonPanel; private final JLabel wikiPane; private final ImageIcon toggledIcon; + private ImageIcon helpIcon; private final JTextArea hint; + private JButton helpButton; private final JPanel runPanel; private final JPanel advancedPanel; + private JPanel hintPanel; private boolean isInconsistent; // This is the Panel for more details of the suggested concept private final MoreDetailForSuggestedConceptsPanel detail; @@ -137,6 +140,7 @@ model = new DLLearnerModel(editorKit, this); sugPanel = new SuggestClassPanel(model, this); learnerPanel = new JPanel(); + hintPanel = new JPanel(new BorderLayout()); learnerPanel.setLayout(new BorderLayout()); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); action = new ActionHandler(model, this); @@ -150,6 +154,13 @@ advanced.setVisible(true); advancedPanel = new JPanel(); run = new JButton(); + URL helpIconUrl = this.getClass().getResource("Help-16x16.png"); + helpIcon = new ImageIcon(helpIconUrl); + helpButton = new JButton(helpIcon); + helpButton.setPreferredSize(new Dimension(20, 20)); + helpButton.setText("help"); + helpButton.addActionListener(action); + helpButton.setVisible(false); runPanel = new JPanel(new FlowLayout()); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); @@ -254,8 +265,11 @@ c.weighty = 0.0; c.gridx = 0; c.gridy = 2; - hint.setPreferredSize(new Dimension(490, 60)); - learner.add(hint, c); + hint.setPreferredSize(new Dimension(450, 60)); + helpButton.setPreferredSize(new Dimension(30, 30)); + hintPanel.add(BorderLayout.CENTER, hint); + hintPanel.add(BorderLayout.EAST, helpButton); + learner.add(hintPanel, c); advancedPanel.add(advanced); advancedPanel.add(adv); @@ -311,7 +325,9 @@ learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); } } - + public JButton getHelpButton() { + return helpButton; + } /** * This method enables the GraphicalCoveragePanel after a class expression is * selected from the list. @@ -515,6 +531,10 @@ return learnerScroll; } + public void setHelpButtonVisible(boolean isVisible) { + helpButton.setVisible(isVisible); + } + /** * This method returns the model of the DL-Learner plugin. * @return model of the plugin Added: trunk/src/dl-learner/org/dllearner/tools/protege/Help-16x16.png =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/protege/Help-16x16.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-08 13:11:43
|
Revision: 1886 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1886&view=rev Author: heeroyuy Date: 2009-10-08 13:11:27 +0000 (Thu, 08 Oct 2009) Log Message: ----------- -added information from getMinimumHorizontalExpansion() and getMaximumHorizontalExpansion() on main panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 11:51:27 UTC (rev 1885) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 13:11:27 UTC (rev 1886) @@ -40,6 +40,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; @@ -103,7 +104,10 @@ model.setLearningAlgorithm(); view.getRunButton().setEnabled(false); view.getHintPanel().setForeground(Color.RED); - view.setHintMessage("learning started"); + CELOE celoe = (CELOE) model.getLearningAlgorithm(); + + String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and" + celoe.getMaximumHorizontalExpansion() + ". "; + view.setHintMessage(moreInformationsMessage); retriever = new SuggestionRetriever(); retriever.execute(); // model.setCurrentConcept(null); @@ -294,6 +298,10 @@ publish(la.getCurrentlyBestEvaluatedDescriptions(view .getPosAndNegSelectPanel().getOptionPanel() .getNrOfConcepts())); + CELOE celoe = (CELOE) model.getLearningAlgorithm(); + view.getHintPanel().setForeground(Color.RED); + String moreInformationsMessage = "Learning started. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " + celoe.getMaximumHorizontalExpansion() + "."; + view.setHintMessage(moreInformationsMessage); } } @@ -339,9 +347,9 @@ } catch (ExecutionException e) { e.printStackTrace(); } - view.algorithmTerminated(); updateList(result); + view.algorithmTerminated(); } @Override @@ -396,6 +404,7 @@ } } } + view.getSuggestClassPanel().setSuggestList(dm); view.getLearnerView().repaint(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-08 11:51:27 UTC (rev 1885) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-10-08 13:11:27 UTC (rev 1886) @@ -39,6 +39,7 @@ import javax.swing.JTextArea; import javax.swing.JToggleButton; +import org.dllearner.algorithms.celoe.CELOE; import org.protege.editor.owl.OWLEditorKit; import org.semanticweb.owl.model.OWLDescription; /** @@ -487,21 +488,23 @@ * This method sets the run button enable after learning. */ public void algorithmTerminated() { - String error = "learning successful\n"; + CELOE celoe = (CELOE) model.getLearningAlgorithm(); + String error = "Learning successful. Currently searching class expressions with length between " + celoe.getMinimumHorizontalExpansion() + " and " + celoe.getMaximumHorizontalExpansion() + "."; hint.setForeground(Color.RED); - setHintMessage(error); + this.setHintMessage(error); String message = ""; if(isInconsistent) { - message ="Class expressions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; + message ="\nClass expressions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; } else { - message ="To view details about why a class expression was suggested, please click on it."; + message ="\nTo view details about why a class expression was suggested, please click on it."; } run.setEnabled(true); // start the algorithm and print the best concept found //renderErrorMessage(error); - hint.setForeground(Color.BLACK); + //hint.setForeground(Color.BLACK); hint.append(message); - setHintMessage(message); + hint.repaint(); + //setHintMessage(message); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-08 11:51:37
|
Revision: 1885 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1885&view=rev Author: heeroyuy Date: 2009-10-08 11:51:27 +0000 (Thu, 08 Oct 2009) Log Message: ----------- -small change in OptionPanel class Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-08 11:04:20 UTC (rev 1884) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-08 11:51:27 UTC (rev 1885) @@ -300,13 +300,13 @@ // TODO Auto-generated catch block e.printStackTrace(); } - cm.applyConfigEntry(la, "useAllConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getAllBox().isSelected()); - cm.applyConfigEntry(la, "useExistsConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getSomeBox().isSelected()); - cm.applyConfigEntry(la, "useHasValueConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getValueBox().isSelected()); - cm.applyConfigEntry(la, "useNegation", view.getPosAndNegSelectPanel().getOptionPanel().getNotBox().isSelected()); - cm.applyConfigEntry(la, "useCardinalityRestrictions", view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox().isSelected()); - if(view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox().isSelected()) { - cm.applyConfigEntry(la, "cardinalityLimit", view.getPosAndNegSelectPanel().getOptionPanel().getCountMoreBox().getSelectedItem()); + cm.applyConfigEntry(la, "useAllConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getAllBox()); + cm.applyConfigEntry(la, "useExistsConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getSomeBox()); + cm.applyConfigEntry(la, "useHasValueConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getValueBox()); + cm.applyConfigEntry(la, "useNegation", view.getPosAndNegSelectPanel().getOptionPanel().getNotBox()); + cm.applyConfigEntry(la, "useCardinalityRestrictions", view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox()); + if(view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox()) { + cm.applyConfigEntry(la, "cardinalityLimit", view.getPosAndNegSelectPanel().getOptionPanel().getCountMoreBox()); } cm.applyConfigEntry(la, "noisePercentage", view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy()); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-08 11:04:20 UTC (rev 1884) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-08 11:51:27 UTC (rev 1885) @@ -199,20 +199,20 @@ return elProfileButton; } - public JCheckBox getAllBox() { - return allBox; + public boolean getAllBox() { + return allBox.isSelected(); } - public JCheckBox getSomeBox() { - return someBox; + public boolean getSomeBox() { + return someBox.isSelected(); } - public JCheckBox getNotBox() { - return notBox; + public boolean getNotBox() { + return notBox.isSelected(); } - public JCheckBox getValueBox() { - return valueBox; + public boolean getValueBox() { + return valueBox.isSelected(); } public JPanel getProfilePanel() { @@ -220,12 +220,12 @@ } - public JComboBox getCountMoreBox() { - return countMoreBox; + public int getCountMoreBox() { + return Integer.parseInt(countMoreBox.getSelectedItem().toString()); } - public JCheckBox getMoreBox() { - return moreBox; + public boolean getMoreBox() { + return moreBox.isSelected(); } public JPanel getRadioBoxPanel() { @@ -236,4 +236,26 @@ return checkBoxPanel; } + public void setToOWLProfile() { + allBox.setSelected(true); + someBox.setSelected(true); + notBox.setSelected(true); + valueBox.setSelected(true); + moreBox.setSelected(true); + this.setCountMoreBoxEnabled(true); + } + + public void setToELProfile() { + allBox.setSelected(false); + someBox.setSelected(true); + notBox.setSelected(false); + valueBox.setSelected(false); + moreBox.setSelected(false); + this.setCountMoreBoxEnabled(false); + } + + public void setCountMoreBoxEnabled(boolean isEnabled) { + countMoreBox.setEnabled(isEnabled); + } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java 2009-10-08 11:04:20 UTC (rev 1884) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java 2009-10-08 11:51:27 UTC (rev 1885) @@ -33,10 +33,10 @@ } } else if(e.toString().contains(VALUE_STRING)) { - if(option.getMoreBox().isSelected()) { - option.getCountMoreBox().setEnabled(true); + if(option.getMoreBox()) { + option.setCountMoreBoxEnabled(true); } else { - option.getCountMoreBox().setEnabled(false); + option.setCountMoreBoxEnabled(false); } } } @@ -44,23 +44,15 @@ private void setToOWLProfile() { option.getOwlRadioButton().setSelected(true); option.getElProfileButton().setSelected(false); - option.getAllBox().setSelected(true); - option.getSomeBox().setSelected(true); - option.getNotBox().setSelected(true); - option.getValueBox().setSelected(true); - option.getMoreBox().setSelected(true); - option.getCountMoreBox().setEnabled(true); + option.setToOWLProfile(); + } private void setToELProfile() { option.getOwlRadioButton().setSelected(false); option.getElProfileButton().setSelected(true); - option.getAllBox().setSelected(false); - option.getSomeBox().setSelected(true); - option.getNotBox().setSelected(false); - option.getValueBox().setSelected(false); - option.getMoreBox().setSelected(false); - option.getCountMoreBox().setEnabled(false); + option.setToELProfile(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-10-08 11:04:27
|
Revision: 1884 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1884&view=rev Author: heeroyuy Date: 2009-10-08 11:04:20 +0000 (Thu, 08 Oct 2009) Log Message: ----------- -finished adding new options in protege plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 09:48:07 UTC (rev 1883) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-10-08 11:04:20 UTC (rev 1884) @@ -145,7 +145,7 @@ * ItemEvent */ public void itemStateChanged(ItemEvent i) { - + } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-08 09:48:07 UTC (rev 1883) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-10-08 11:04:20 UTC (rev 1884) @@ -300,7 +300,15 @@ // TODO Auto-generated catch block e.printStackTrace(); } - cm.applyConfigEntry(la, "useNegation", false); + cm.applyConfigEntry(la, "useAllConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getAllBox().isSelected()); + cm.applyConfigEntry(la, "useExistsConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getSomeBox().isSelected()); + cm.applyConfigEntry(la, "useHasValueConstructor", view.getPosAndNegSelectPanel().getOptionPanel().getValueBox().isSelected()); + cm.applyConfigEntry(la, "useNegation", view.getPosAndNegSelectPanel().getOptionPanel().getNotBox().isSelected()); + cm.applyConfigEntry(la, "useCardinalityRestrictions", view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox().isSelected()); + if(view.getPosAndNegSelectPanel().getOptionPanel().getMoreBox().isSelected()) { + cm.applyConfigEntry(la, "cardinalityLimit", view.getPosAndNegSelectPanel().getOptionPanel().getCountMoreBox().getSelectedItem()); + } + cm.applyConfigEntry(la, "noisePercentage", view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy()); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-08 09:48:07 UTC (rev 1883) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-10-08 11:04:20 UTC (rev 1884) @@ -53,10 +53,8 @@ private JCheckBox someBox; private JCheckBox notBox; private JCheckBox valueBox; - private JCheckBox lessBox; private JCheckBox moreBox; - private JComboBox countLessBox; private JComboBox countMoreBox; private JPanel profilePanel; @@ -83,7 +81,7 @@ radioBoxPanel = new JPanel(); radioBoxPanel.setLayout(new GridLayout(1, 3)); checkBoxPanel = new JPanel(); - checkBoxPanel.setLayout(new GridLayout(1, 8)); + checkBoxPanel.setLayout(new GridLayout(1, 6)); minAccuracyLabel = new JLabel("noise in %: "); maxExecutionTimeLabel = new JLabel("maximum execution time: "); @@ -123,46 +121,27 @@ notBox.addItemListener(optionHandler); valueBox = new JCheckBox("value", true); valueBox.addItemListener(optionHandler); - lessBox = new JCheckBox("<=x with max.:", true); - lessBox.addItemListener(optionHandler); - moreBox = new JCheckBox(">=x with max.:", true); + moreBox = new JCheckBox("<=x, >=x with max.:", true); moreBox.addItemListener(optionHandler); - countLessBox = new JComboBox(); - countLessBox.addItem("1"); - - countLessBox.addItem("2"); - countLessBox.addItem("3"); - countLessBox.addItem("4"); - countLessBox.addItem("5"); - countLessBox.addItem("6"); - countLessBox.addItem("7"); - countLessBox.addItem("8"); - countLessBox.addItem("9"); - countLessBox.addItem("10"); - countLessBox.setSelectedItem("3"); - countLessBox.setEditable(false); - countMoreBox = new JComboBox(); - countMoreBox.addItem("1"); - countMoreBox.addItem("2"); - countMoreBox.addItem("3"); - countMoreBox.addItem("4"); - countMoreBox.addItem("5"); - countMoreBox.addItem("6"); - countMoreBox.addItem("7"); - countMoreBox.addItem("8"); - countMoreBox.addItem("9"); - countMoreBox.addItem("10"); - countMoreBox.setSelectedItem("3"); + countMoreBox.addItem(1); + countMoreBox.addItem(2); + countMoreBox.addItem(3); + countMoreBox.addItem(4); + countMoreBox.addItem(5); + countMoreBox.addItem(6); + countMoreBox.addItem(7); + countMoreBox.addItem(8); + countMoreBox.addItem(9); + countMoreBox.addItem(10); + countMoreBox.setSelectedItem(5); countMoreBox.setEditable(false); checkBoxPanel.add(allBox); checkBoxPanel.add(someBox); checkBoxPanel.add(notBox); checkBoxPanel.add(valueBox); - checkBoxPanel.add(lessBox); - checkBoxPanel.add(countLessBox); checkBoxPanel.add(moreBox); checkBoxPanel.add(countMoreBox); @@ -236,17 +215,10 @@ return valueBox; } - public JCheckBox getLessBox() { - return lessBox; - } - public JPanel getProfilePanel() { return profilePanel; } - public JComboBox getCountLessBox() { - return countLessBox; - } public JComboBox getCountMoreBox() { return countMoreBox; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java 2009-10-08 09:48:07 UTC (rev 1883) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanelHandler.java 2009-10-08 11:04:20 UTC (rev 1884) @@ -7,6 +7,7 @@ private static final String OWL_RADIO_STRING = "OWL 2"; private static final String EL_RADIO_STRING = "EL Profile"; + private static final String VALUE_STRING = "<=x, >=x with max.:"; private OptionPanel option; @@ -31,6 +32,12 @@ this.setToOWLProfile(); } + } else if(e.toString().contains(VALUE_STRING)) { + if(option.getMoreBox().isSelected()) { + option.getCountMoreBox().setEnabled(true); + } else { + option.getCountMoreBox().setEnabled(false); + } } } @@ -41,8 +48,6 @@ option.getSomeBox().setSelected(true); option.getNotBox().setSelected(true); option.getValueBox().setSelected(true); - option.getLessBox().setSelected(true); - option.getCountLessBox().setEnabled(true); option.getMoreBox().setSelected(true); option.getCountMoreBox().setEnabled(true); } @@ -54,8 +59,6 @@ option.getSomeBox().setSelected(true); option.getNotBox().setSelected(false); option.getValueBox().setSelected(false); - option.getLessBox().setSelected(false); - option.getCountLessBox().setEnabled(false); option.getMoreBox().setSelected(false); option.getCountMoreBox().setEnabled(false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |