You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(18) |
Aug
(33) |
Sep
(30) |
Oct
(27) |
Nov
(59) |
Dec
(30) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(67) |
Feb
(44) |
Mar
(70) |
Apr
(73) |
May
(119) |
Jun
(31) |
Jul
(92) |
Aug
(86) |
Sep
(76) |
Oct
(152) |
Nov
(156) |
Dec
(85) |
2008 |
Jan
(111) |
Feb
(121) |
Mar
(107) |
Apr
(102) |
May
(45) |
Jun
(65) |
Jul
(62) |
Aug
(133) |
Sep
(56) |
Oct
(56) |
Nov
(17) |
Dec
(15) |
2009 |
Jan
(10) |
Feb
(5) |
Mar
(10) |
Apr
(14) |
May
(49) |
Jun
(94) |
Jul
(67) |
Aug
(23) |
Sep
(9) |
Oct
(92) |
Nov
(26) |
Dec
(51) |
2010 |
Jan
(105) |
Feb
(83) |
Mar
(52) |
Apr
(59) |
May
(68) |
Jun
(71) |
Jul
(127) |
Aug
(49) |
Sep
(91) |
Oct
(27) |
Nov
(33) |
Dec
(26) |
2011 |
Jan
(26) |
Feb
(45) |
Mar
(26) |
Apr
(28) |
May
(17) |
Jun
(15) |
Jul
(45) |
Aug
(33) |
Sep
(50) |
Oct
(22) |
Nov
(10) |
Dec
(21) |
2012 |
Jan
(33) |
Feb
(24) |
Mar
(36) |
Apr
(60) |
May
(60) |
Jun
(43) |
Jul
(114) |
Aug
(19) |
Sep
(35) |
Oct
(24) |
Nov
(64) |
Dec
(12) |
2013 |
Jan
(54) |
Feb
(58) |
Mar
(51) |
Apr
(46) |
May
(21) |
Jun
(29) |
Jul
(25) |
Aug
(25) |
Sep
(13) |
Oct
(7) |
Nov
(14) |
Dec
(27) |
2014 |
Jan
(10) |
Feb
(7) |
Mar
(16) |
Apr
(14) |
May
(19) |
Jun
(8) |
Jul
(15) |
Aug
(11) |
Sep
(5) |
Oct
(11) |
Nov
(11) |
Dec
(4) |
2015 |
Jan
(52) |
Feb
(27) |
Mar
(22) |
Apr
(17) |
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(3) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <mg...@us...> - 2007-03-23 20:02:14
|
Revision: 415 http://svn.sourceforge.net/obo/?rev=415&view=rev Author: mgibson Date: 2007-03-23 13:02:12 -0700 (Fri, 23 Mar 2007) Log Message: ----------- if there are more than 12 fields phenote now makes a tabbed panel currently hardwired to 12 - should make configurable my charfieldgui rework laid groundwork for this as field panel now controls layout of fields not vice versa which was quirky also reworked layout of whole main panel - more flexible now - using more of gridbaglayout and setPrefferedSize over setMinimumSize setMinSize really needs to be used sparingly need config to say dont put field in table - as table gets way too jammed worms got a lot of fields Modified Paths: -------------- phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/datamodel/OntologyManager.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/GridBagUtil.java phenote/trunk/src/java/phenote/gui/SelectionHistory.java phenote/trunk/src/java/phenote/gui/TermInfo.java phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java phenote/trunk/src/java/phenote/gui/field/FieldPanel.java phenote/trunk/src/java/phenote/gui/field/FreeTextField.java phenote/trunk/src/java/phenote/gui/field/SearchParamPanel.java phenote/trunk/src/java/phenote/main/Phenote.java Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2007-03-23 20:02:12 UTC (rev 415) @@ -19,6 +19,7 @@ private String name; private boolean postCompAllowed=false; private Ontology postCompRelOntol; + // index? orderNumber? for order in gui/datamodel? public CharField(CharFieldEnum c) { charFieldEnum = c; Modified: phenote/trunk/src/java/phenote/datamodel/OntologyManager.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2007-03-23 20:02:12 UTC (rev 415) @@ -56,6 +56,7 @@ /** This is where the ontologies are in a generic fashion. A char field has one or more ontologies (entity char field often has more than ontology)*/ public List<CharField> getCharFieldList() { return charFieldList; } + public int getNumberOfFields() { return charFieldList.size(); } public List<Ontology> getAllOntologies() { List<Ontology> ontologies = new ArrayList<Ontology>(); @@ -177,20 +178,3 @@ // return null; // this shouldnt happen - err msg? // } -// /** util fn! */ -// private OBOClass makePostCompTerm(OBOClass genus, String relation, OBOClass diff) { -// String nm = pcString(genus.getName(),diff.getName()); -// String id = pcString(genus.getID(),diff.getID()); -// OBOClass postComp = new OBOClassImpl(nm,id); -// OBOProperty ISA = OBOProperty.IS_A; -// OBORestrictionImpl gRel = new OBORestrictionImpl(postComp,ISA,genusTerm); -// return postComp; -// } -// private void addOntologyList(List<Ontology> l) { -// allOntologyList.addAll(l); -// } - -// private void addOntology(Ontology o) { -// allOntologyList.add(o); -// } - Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2007-03-23 20:02:12 UTC (rev 415) @@ -72,8 +72,9 @@ //setBorder(new javax.swing.border.LineBorder(java.awt.Color.RED)); debug //setLayout(new GridLayout(2,1)); // row,col setLayout(new GridBagLayout()); - setPreferredSize(new Dimension(1800,800)); - setMinimumSize(new Dimension(1400,630)); // 630 + //setPreferredSize(new Dimension(1800,800)); + setPreferredSize(new Dimension(1400,500)); + //setMinimumSize(new Dimension(1400,630)); // 630 characterTableModel = new CharacterTableModel(); charJTable = new JTable(characterTableModel); Modified: phenote/trunk/src/java/phenote/gui/GridBagUtil.java =================================================================== --- phenote/trunk/src/java/phenote/gui/GridBagUtil.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/GridBagUtil.java 2007-03-23 20:02:12 UTC (rev 415) @@ -60,4 +60,8 @@ } + public static void padLeft(GridBagConstraints g,int pad) { + g.insets.left = pad; + } + } Modified: phenote/trunk/src/java/phenote/gui/SelectionHistory.java =================================================================== --- phenote/trunk/src/java/phenote/gui/SelectionHistory.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/SelectionHistory.java 2007-03-23 20:02:12 UTC (rev 415) @@ -69,7 +69,7 @@ public JComponent getComponent() { JPanel termHistoryPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap termHistoryPanel.setPreferredSize(new Dimension(200,100)); - termHistoryPanel.setMinimumSize(new Dimension(100,100)); + //termHistoryPanel.setMinimumSize(new Dimension(100,100)); if (DO_HTML) { JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/html"); // sets up HTMLEditorKit Modified: phenote/trunk/src/java/phenote/gui/TermInfo.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermInfo.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/TermInfo.java 2007-03-23 20:02:12 UTC (rev 415) @@ -59,7 +59,7 @@ public JComponent getComponent() { JPanel termInfoPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap termInfoPanel.setPreferredSize(new Dimension(400,100)); - termInfoPanel.setMinimumSize(new Dimension(380,100)); + //termInfoPanel.setMinimumSize(new Dimension(380,100)); //termInfoPanel.setMaximumSize(new Dimension(380,400)); if (DO_HTML) { JEditorPane editorPane = new JEditorPane(); Modified: phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java 2007-03-23 20:02:12 UTC (rev 415) @@ -90,10 +90,10 @@ //charFieldGui = cfg; //setCharField(cf); jComboBox.setPreferredSize(CharFieldGui.inputSize); //new Dimension(390,20)); - jComboBox.setMaximumSize(CharFieldGui.inputSize); //new Dimension(390,20)); + //jComboBox.setMaximumSize(CharFieldGui.inputSize); //new Dimension(390,20)); // this is super critical - fixes bug where layout goes to hell if string are long // in completion - dont ask me why???? - jComboBox.setMinimumSize(CharFieldGui.inputSize); + //jComboBox.setMinimumSize(CharFieldGui.inputSize); AutoTextFieldEditor autoTextFieldEditor = new AutoTextFieldEditor(); jComboBox.setEditor(autoTextFieldEditor); // dont know why by setting fonts this seem to get worse not better in terms of Modified: phenote/trunk/src/java/phenote/gui/field/FieldPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-23 20:02:12 UTC (rev 415) @@ -7,12 +7,14 @@ import java.util.ArrayList; import java.util.List; +import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JTabbedPane; import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; @@ -32,47 +34,74 @@ private SearchParamPanel searchParamPanel; // searchParamManager? private OntologyManager ontologyManager = OntologyManager.inst(); private JPanel fieldPanel; + //private JComponent fieldPanel; private SearchParamsI searchParams; + private JTabbedPane jTabbedPane; + /** eventually configurable (with default 12) - for now hardwire at 12 */ + private static int fieldsPerTab = 12; + public FieldPanel() { this(true,true); } // false for post comp panel public FieldPanel(boolean doAllFields,boolean addSearchPanel) { - initGui(addSearchPanel); + initGui(); if (doAllFields) initCharFieldGuis(); + if (addSearchPanel) + initSearchPanel(); } - private void initGui(boolean addSearchPanel) { + private void initGui() { // should figure y from # of fields really!!! yes!!! // width of ontology labels effects x - this.setMinimumSize(new Dimension(700,490));//690,490)); + this.setPreferredSize(new Dimension(650,350));//690,490)); + //this.setMinimumSize(new Dimension(700,490));//690,490)); //this.setPreferredSize(new Dimension(2000,750)); // irrelevant in box layout //this.setMaximumSize(new Dimension(2000,750)); BoxLayout bl = new BoxLayout(this,BoxLayout.X_AXIS); // grid bag? this.setLayout(bl); - fieldPanel = new JPanel(new GridBagLayout()); - // panel inside of panel - i think is a leftover no reason now - add(fieldPanel); + + } + + private void initSearchPanel() { // search param panel - maybe search panel should be added to main frame? - if (addSearchPanel) - add(getSearchParamPanel().getPanel()); + add(Box.createRigidArea(new Dimension(2,0))); + add(getSearchParamPanel().getPanel()); } private void initCharFieldGuis() { + fieldPanel = new JPanel(new GridBagLayout()); + if (isTabbed()) { + jTabbedPane = new JTabbedPane(); + add(jTabbedPane); + } + else { // no tabs + add(fieldPanel); + } + + int fieldNum = 0; + int tab = 1; for (CharField charField : ontologyManager.getCharFieldList()) { + if (isTabbed() && fieldNum % fieldsPerTab == 0) { + fieldPanel = new JPanel(new GridBagLayout()); + jTabbedPane.addTab("Tab "+tab++,fieldPanel); + } + ++fieldNum; //CharFieldGui gui = new CharFieldGui(charField,this); // adds to panel CharFieldGui gui = CharFieldGui.makeCharFieldGui(charField,getSearchParams()); addCharFieldGuiToPanel(gui); charFieldGuiList.add(gui); } - // search param panel - maybe search panel should be added to main frame? - //add(getSearchParamPanel().getPanel()); --> initGui } + private boolean isTabbed() { + return ontologyManager.getNumberOfFields() > fieldsPerTab; + } + void addCharFieldGuiToPanel(CharFieldGui fieldGui) { addLabel(fieldGui.getLabel(),fieldGui.hasOntologyChooser()); if (fieldGui.hasOntologyChooser()) Modified: phenote/trunk/src/java/phenote/gui/field/FreeTextField.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FreeTextField.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/field/FreeTextField.java 2007-03-23 20:02:12 UTC (rev 415) @@ -37,6 +37,7 @@ //charFieldGui = cfg; textField = new JTextField(35); textField.setMinimumSize(CharFieldGui.inputSize); + //textField.setPreferredSize(CharFieldGui.inputSize); textField.setEditable(true); textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); textField.addFocusListener(new FreeFocusListener()); Modified: phenote/trunk/src/java/phenote/gui/field/SearchParamPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/SearchParamPanel.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/gui/field/SearchParamPanel.java 2007-03-23 20:02:12 UTC (rev 415) @@ -23,7 +23,8 @@ JPanel getPanel() { JPanel panel = new JPanel(); - panel.setMinimumSize(new Dimension(305,150)); + //panel.setMinimumSize(new Dimension(305,150)); + panel.setPreferredSize(new Dimension(60,50)); // panel.setPreferredSize(new Dimension(250,250)); ?? BoxLayout boxLayout = new BoxLayout(panel,BoxLayout.Y_AXIS); panel.setLayout(boxLayout); Modified: phenote/trunk/src/java/phenote/main/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/main/Phenote.java 2007-03-23 14:21:24 UTC (rev 414) +++ phenote/trunk/src/java/phenote/main/Phenote.java 2007-03-23 20:02:12 UTC (rev 415) @@ -33,7 +33,6 @@ public class Phenote { - //private static final String VERSION = "0.8.2 dev"; private static final Logger LOG = Logger.getLogger(Phenote.class); private static boolean standalone = false; // default for servlet @@ -57,7 +56,6 @@ System.out.println("Failed to set to Java/Metal look & feel"); } phenote = getPhenote(); - //phenote.initConfig(args); phenote.doCommandLine(args); // does config // put this is in a phenote.util.Log class? - get file from config - default? try { DOMConfigurator.configure(Config.inst().getLogConfigUrl()); } @@ -73,12 +71,6 @@ /** private constructor -> singleton */ private Phenote() {} -// /** args is most likely null if not called from command line */ -// public void initConfig(String[] args) { -// // gets config file from command line & loads - if no config file -// // loads default. should actually put that logic here. -// doCommandLine(args); // load config file -// } public void initOntologies() { //OntologyDataAdapter oda = new OntologyDataAdapter(); // singleton? @@ -135,7 +127,7 @@ frame = new JFrame("Phenote "+PhenoteVersion.versionString()); frame.getContentPane().add(makeMainPanel()); MenuManager.createMenuManager(frame); - frame.setPreferredSize(new Dimension(1200,700)); //1100,700)); + frame.setPreferredSize(new Dimension(1220,800)); //1100,700)); if (standalone) // if stand alone exit java on window close frame.addWindowListener(new WindowExit()); frame.pack(); @@ -156,18 +148,24 @@ private JPanel makeMainPanel() { JPanel mainPanel = new JPanel(new GridBagLayout()); // ?? - JPanel upperPanel = new JPanel(); - BoxLayout bl = new BoxLayout(upperPanel,BoxLayout.X_AXIS); - upperPanel.setLayout(bl); + JPanel upperPanel = new JPanel(new GridBagLayout()); + //BoxLayout bl=new BoxLayout(upperPanel,BoxLayout.X_AXIS);upperPanel.setLayout(bl); + GridBagConstraints ugbc = GridBagUtil.makeFillingConstraint(0,0); + ugbc.weightx = 1; + fieldPanel = new FieldPanel(); // field panel contains search params - upperPanel.add(fieldPanel); + upperPanel.add(fieldPanel,ugbc); termInfo = new TermInfo(); - upperPanel.add(termInfo.getComponent()); + ugbc.gridx++; + ugbc.weightx = 5; + upperPanel.add(termInfo.getComponent(),ugbc); selectionHistory = new SelectionHistory(); - upperPanel.add(selectionHistory.getComponent()); + ugbc.gridx++; + ugbc.weightx = 3; + upperPanel.add(selectionHistory.getComponent(),ugbc); //++gbc.gridx; // ?? //gbc.anchor = GridBagConstraints.NORTHWEST; // ?? //mainPanel.add(termInfo.getComponent(),gbc); @@ -179,13 +177,13 @@ // int anchor = GridBagConstraints.WEST; // GridBagConstraints gbc = GridBagUtil.makeConstraint(0,0,1,1,weightY,4,4,fill,anchor); GridBagConstraints gbc = GridBagUtil.makeFillingConstraint(0,0); - gbc.weighty = 10; + gbc.weighty = 1; mainPanel.add(upperPanel,gbc); characterTablePanel = new CharacterTablePanel(); //termAndTablePanel.add(characterTablePanel); ++gbc.gridy; // ? - gbc.weighty = 17; + gbc.weighty = 10; mainPanel.add(characterTablePanel,gbc); return mainPanel; @@ -201,4 +199,10 @@ public CharacterTablePanel getCharacterTablePanel() { return characterTablePanel; } } +// /** args is most likely null if not called from command line */ +// public void initConfig(String[] args) { +// // gets config file from command line & loads - if no config file +// // loads default. should actually put that logic here. +// doCommandLine(args); // load config file +// } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-23 14:21:27
|
Revision: 414 http://svn.sourceforge.net/obo/?rev=414&view=rev Author: mgibson Date: 2007-03-23 07:21:24 -0700 (Fri, 23 Mar 2007) Log Message: ----------- There is now a menu option to change your configuration - its a little crude at this point as you then have to restart phenote - eventually will redo the configuration on the fly - but this is at least a start. all it actually does is change the file name in my-phenote.cfg. it took me a while to realize i needed to just set the modal flag on the dialog as i couldnt get the dialog to stay up and i was doing ridiculous tricks with threads til i finally realize - gee whiz its like ive never put up a dialog before Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java phenote/trunk/src/java/phenote/gui/FileMenu.java phenote/trunk/src/java/phenote/main/Phenote.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2007-03-22 16:52:28 UTC (rev 413) +++ phenote/trunk/src/java/phenote/config/Config.java 2007-03-23 14:21:24 UTC (rev 414) @@ -88,7 +88,7 @@ /** if all else fails revert to flybase which should be there */ public void loadDefaultFlybaseConfigFile() throws ConfigException { - setConfigFile(FLYBASE_DEFAULT_CONFIG_FILE,true,false,false); + setConfigFile(FLYBASE_DEFAULT_CONFIG_FILE,true,false,false); // merge true? } /** default file should be in .phenote/conf/my-phenote.cfg. if not set yet then just @@ -186,13 +186,14 @@ //File conf = new File(dotPhenote,"conf");conf.mkdir();return conf; } - private File getMyPhenoteFile() { + private static File getMyPhenoteFile() { return new File(getDotPhenoteConfDir(),"my-phenote.cfg"); } /** Write name of config file loaded out to .phenote/conf/my-phenote.cfg for use - by future startups with no config specified */ - private void writeMyPhenoteDefaultFile(String newDefaultFileString) + by future startups with no config specified + Throws ConfigException if fails to find file */ + public static void writeMyPhenoteDefaultFile(String newDefaultFileString) throws ConfigException { try { File myPhenote = getMyPhenoteFile(); Modified: phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java =================================================================== --- phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java 2007-03-22 16:52:28 UTC (rev 413) +++ phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java 2007-03-23 14:21:24 UTC (rev 414) @@ -39,7 +39,7 @@ import phenote.gui.GridBagUtil; import phenote.util.FileUtil; -class ConfigFileQueryGui { +public class ConfigFileQueryGui { //private String selection; private String selectedFile; @@ -47,20 +47,24 @@ private boolean okPressed = false; private ButtonGroup buttonGroup; - static String queryUserForConfigFile() { + public static String queryUserForConfigFile() { ConfigFileQueryGui c = new ConfigFileQueryGui(); return c.queryUser(); } + private String queryUser() { - dialog = new JDialog(); //"Choose Configuration",true); - //dialog.setPreferredSize(new Dimension(300,400)); - //dialog.setLayout(new BoxLayout(dialog,BoxLayout.Y_AXIS)); - //dialog.setLayout(new GridLayout(0,1)); - //dialog.setLayout(new BorderLayout()); + makeQueryDialog(); + return selectedFile; + } + + + private void makeQueryDialog() { + java.awt.Frame f = phenote.main.Phenote.getPhenote().getFrame(); + // true -> modal -> this is crucial! + dialog = new JDialog(f,true); //"Choose Configuration",true); dialog.setLayout(new GridBagLayout()); dialog.setTitle("Phenote Configuration"); - // set layout? JLabel text = new JLabel("Please pick a configuration for Phenote: "); int center = GridBagConstraints.CENTER; GridBagConstraints gbc = GridBagUtil.makeAnchorConstraint(0,0,center); @@ -89,12 +93,6 @@ dialog.pack(); centerOnScreen(dialog); dialog.setVisible(true); - //return selection; // ???? - while (!okPressed) { - //System.out.println("ok pressed? "+okPressed); - try { Thread.sleep(10); } catch (InterruptedException e) {} - } // sleep?? - return selectedFile; } private class OkActionListener implements ActionListener { @@ -191,19 +189,66 @@ c.setLocation(p); } - private class PhenoteClassLoader extends ClassLoader { +} - private PhenoteClassLoader() { - super(ClassLoader.getSystemClassLoader()); - } - - protected String findLibrary(String lib) { - return super.findLibrary(lib); - //return this.getParent().findLibrary(lib); - } +// silly me - all i needed to do was make the dialog modal! silly silly +// WaitSwingWorkerThread waitSwingWorkerThread; + // doesnt work - still spins + //Thread dt = new DialogThread(); +// try { +// // this says cant do from EventDispatcherThread +// //javax.swing.SwingUtilities.invokeAndWait(new DialogThread()); +// // this literally makes the computer blow up +// //javax.swing.SwingUtilities.invokeLater(new DialogThread()); +// } //catch (InterruptedException e) { System.out.println("interrupted "+e); } +// catch (Exception e) { System.out.println("Exception: "+e); } + //dt.start(); + //DialogSwingWorkerThread dt = new DialogSwingWorkerThread(); + //dt.start(); +// while (!okPressed) { +// System.out.println("ok pressed? "+okPressed+" cur thread "+Thread.currentThread()+" dlg thread "+dt); +// try { Thread.sleep(300); } catch (InterruptedException e) {} +// } // sleep?? +// return selectedFile; //(String) dt.get(); //selectedFile; +// waitSwingWorkerThread = new WaitSwingWorkerThread(); +// waitSwingWorkerThread.start(); +// return (String)waitSwingWorkerThread.get(); +// private class DialogThread extends Thread { +// public void run() { +// makeQueryDialog(); +// } +// } - //protected ClassLoader getParent() { return super.getParent(); } +// private class WaitSwingWorkerThread extends phenote.gui.SwingWorker { +// public Object construct() { +// while (!okPressed) { +// System.out.println("ok pressed? "+okPressed+" cur thread "+Thread.currentThread()+" this "+this+" sel "+selectedFile); +// // try { +// waitSwingWorkerThread.sleep(300);// } catch (InterruptedException e) {} +// } // sleep?? +// return selectedFile; +// } +// } + - } +// private class DialogSwingWorkerThread extends phenote.gui.SwingWorker { +// public Object construct() { +// makeQueryDialog(); +// // while (!okPressed) { +// // System.out.println("ok pressed? "+okPressed+" cur thread "+Thread.currentThread()+" this "+this); +// // try { Thread.sleep(300); } catch (InterruptedException e) {} +// // } // sleep?? +// return selectedFile; +// } +// } -} +// private class PhenoteClassLoader extends ClassLoader { +// private PhenoteClassLoader() { +// super(ClassLoader.getSystemClassLoader()); +// } +// protected String findLibrary(String lib) { +// return super.findLibrary(lib); +// //return this.getParent().findLibrary(lib); +// } +// //protected ClassLoader getParent() { return super.getParent(); } +// } Modified: phenote/trunk/src/java/phenote/gui/FileMenu.java =================================================================== --- phenote/trunk/src/java/phenote/gui/FileMenu.java 2007-03-22 16:52:28 UTC (rev 413) +++ phenote/trunk/src/java/phenote/gui/FileMenu.java 2007-03-23 14:21:24 UTC (rev 414) @@ -4,12 +4,15 @@ import java.awt.event.ActionListener; import javax.swing.JMenu; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import phenote.dataadapter.CharacterListManager; import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.LoadSaveManager; import phenote.config.Config; -//import phenote.gui.prefswindow.PrefsWindowController; +import phenote.config.ConfigFileQueryGui; +import phenote.config.ConfigException; +//import phenote.gui.prefswindow.PrefsWindowController; ??? class FileMenu extends JMenu { @@ -34,12 +37,16 @@ save.setActionCommand("save"); save.addActionListener(actionListener); add(save); + + JMenuItem loadConfig = new JMenuItem("Load Configuration"); + loadConfig.addActionListener(new ConfigActionListener()); + add(loadConfig); } private class LoadSaveActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (!Config.inst().hasDataAdapters()) { - System.out.println("no data adapter to load with"); + System.out.println("no file data adapter to load/save with"); return; } if (e.getActionCommand().equals("load")) @@ -50,6 +57,26 @@ } } + private class ConfigActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + // 1st step just set my-phenote.cfg & user restart phenote + // eventually reconfigure phenote in same session, cfg,obo,gui + String cfg = ConfigFileQueryGui.queryUserForConfigFile(); + try { + if (cfg != null && !cfg.equals("")) + Config.writeMyPhenoteDefaultFile(cfg); + String m = "You must restart phenote for new config to take effect"; + JOptionPane.showMessageDialog(null,m,"Please restart", + JOptionPane.INFORMATION_MESSAGE); + } + catch (ConfigException x) { + String m = "Failed to change configuration "+x.getMessage(); + JOptionPane.showMessageDialog(null,m,"Config error", + JOptionPane.ERROR_MESSAGE); + } + } + } + // for testing public void clickLoad() { loadMenuItem.doClick(); Modified: phenote/trunk/src/java/phenote/main/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/main/Phenote.java 2007-03-22 16:52:28 UTC (rev 413) +++ phenote/trunk/src/java/phenote/main/Phenote.java 2007-03-23 14:21:24 UTC (rev 414) @@ -49,7 +49,7 @@ public static void main(String[] args) { standalone = true; // i think this is ok System.out.println("This is Phenote version "+PhenoteVersion.versionString()); - // default mac lok & feel is "Mac OS X", but the JComboBox is buggy + // default mac look & feel is "Mac OS X", but the JComboBox is buggy try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } @@ -156,16 +156,14 @@ private JPanel makeMainPanel() { JPanel mainPanel = new JPanel(new GridBagLayout()); // ?? - //JPanel termAndTablePanel = new JPanel(); JPanel upperPanel = new JPanel(); - //BoxLayout bl = new BoxLayout(termAndTablePanel,BoxLayout.Y_AXIS); BoxLayout bl = new BoxLayout(upperPanel,BoxLayout.X_AXIS); upperPanel.setLayout(bl); fieldPanel = new FieldPanel(); // field panel contains search params upperPanel.add(fieldPanel); - termInfo = new TermInfo(); //fieldPanel); + termInfo = new TermInfo(); upperPanel.add(termInfo.getComponent()); selectionHistory = new SelectionHistory(); @@ -204,59 +202,3 @@ } -// /** for now just looking for '-c configFile.cfg', use command line package -// if we need to get more sophisticated -// so if user has personal config file should override this - however maybe -// there should be a distinction between initial config file and user made configs -// well really the initials are db/species specific - so could be -// --initialConfig zf|fb|obd - actually da heck with that with entity chooser just -// put all 3 ontologies in one which is then the default (unspecified on cmd line) -// and -c file.cfg will load/overwrite that cfg into .phenote/my-phenote.cfg -// (if it exists) - we can always add --init later if we need it -// -c overwrites, -i doesnt -i is for initial startup of phenote */ -// private void doCommandLineOld(String[] args) { -// String configFile = getConfigFileFromCommandLine(args); -// // if no config file specified then set default initial config file. this will be -// // overridden by a personal config file if it exists -// //if (configFile == null) configFile = Config.DEFAULT_CONFIG_FILE; stored in file -// try { -// if (isOverwriteConfigFile(args)) //causes wipeout move of app file to .phenote -// Config.inst().setOverwriteConfigFile(configFile); -// else if (isInitialConfigFile(args)) -// Config.inst().setInitialConfigFile(configFile); -// //else if update... -// else // no command line config file specified - use last one specified (cache) -// Config.inst().loadDefaultConfigFile(); -// } catch (ConfigException e) { -// //LOG.fatal("EXITING! Fatal error in config file: "+e.getMessage()); -// LOG.error("Error in config file! "+e.getMessage()); -// e.printStackTrace(); // log? -// //System.exit(1); // isnt this a bit extreme? -// System.out.println("Yikes! config exception "+e+" gonna try loading default" -// +" config"); -// try { Config.inst().loadDefaultConfigFile(); } -// catch (ConfigException ce) { -// System.out.println("bummer - even default config fails. we're hosed! "+ce); -// } -// } -// } - -// // change to -m for merge?? - move to CommandLine! -// private boolean isInitialConfigFile(String args[]) { -// if (args == null || args.length < 2) return false; -// return args[0].equals("-i"); -// } -// private boolean isOverwriteConfigFile(String args[]) { -// if (args == null || args.length < 2) return false; -// return args[0].equals("-c"); -// } - -// private String getConfigFileFromCommandLine(String args[]) { -// // need 2 args -// if (args == null || args.length < 2) return null; -// //String firstArg = args[0]; -// if (!isInitialConfigFile(args) && !isOverwriteConfigFile(args)) return null; -// String configFile = args[1]; -// return configFile; -// } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-22 16:52:27
|
Revision: 413 http://svn.sourceforge.net/obo/?rev=413&view=rev Author: mgibson Date: 2007-03-22 09:52:28 -0700 (Thu, 22 Mar 2007) Log Message: ----------- refactored char field gui as it was driving me nuts - basically i went too far with HASA over inheritance - i do think inheritance is generally abused - but in this case it turned out to be really handy to TermCompList & all inheriting from CharFieldGui rather than associating as theres so much shared between them interesting lesson i suppose - its hard to know sometimes when to do isa or hasa - its nice to ask questions of charfieldgui and have its subclasses override the answers Modified Paths: -------------- phenote/trunk/conf/flybase.cfg phenote/trunk/conf/human.cfg phenote/trunk/conf/worm.cfg phenote/trunk/conf/zfin-standalone.cfg phenote/trunk/src/java/phenote/config/FieldConfig.java phenote/trunk/src/java/phenote/config/OntologyConfig.java phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java phenote/trunk/src/java/phenote/gui/field/FieldPanel.java phenote/trunk/src/java/phenote/gui/field/FreeTextField.java phenote/trunk/src/java/phenote/gui/field/PostCompGui.java phenote/trunk/src/java/phenote/gui/field/RelationCompList.java phenote/trunk/src/java/phenote/gui/field/TermCompList.java phenote/trunk/src/java/test/phenote/gui/TestPhenote.java Added Paths: ----------- phenote/trunk/src/java/phenote/gui/field/OboException.java Modified: phenote/trunk/conf/flybase.cfg =================================================================== --- phenote/trunk/conf/flybase.cfg 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/conf/flybase.cfg 2007-03-22 16:52:28 UTC (rev 413) @@ -23,7 +23,7 @@ <field name="Entity" syntax-abbrev="E"> <!-- postcomp relationship-ontology="relationship.obo" repos-subdir="OBO_REL"/ --> - <ontology file="relationship.obo" is-postcomp-rel="true" repos-subdir="OBO_REL"/> + <ontology name="Relationship" file="relationship.obo" is-postcomp-rel="true" repos-subdir="OBO_REL"/> <ontology name="Fly" file="fly_anatomy.obo" repos-subdir="anatomy/gross_anatomy/animal_gross_anatomy/fly"/> <ontology name="Human Anatomy" file="fma_obo.obo"/> Modified: phenote/trunk/conf/human.cfg =================================================================== --- phenote/trunk/conf/human.cfg 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/conf/human.cfg 2007-03-22 16:52:28 UTC (rev 413) @@ -17,7 +17,8 @@ <field name="Genetic Context" file="context.obo" syntax-abbrev="GC"/> <field name="Entity" syntax-abbrev="E"> - <postcomp relationship-ontology="relationship.obo" repos-subdir="OBO_REL"/> + <ontology name="Relationship" file="relationship.obo" + is-postcomp-rel="true" repos-subdir="OBO_REL"/> <ontology name="Human Anatomy" file="fma_obo.obo"/> <ontology name="Gene Ontology" file="gene_ontology.obo" repos-subdir="genomic-proteomic"/> <ontology name="Chemical" file="chebi.obo" repos-subdir="chemical"/> Modified: phenote/trunk/conf/worm.cfg =================================================================== --- phenote/trunk/conf/worm.cfg 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/conf/worm.cfg 2007-03-22 16:52:28 UTC (rev 413) @@ -23,7 +23,8 @@ <field name="Genetic Context" file="context.obo" syntax-abbrev="GC" enable="true"/> <field name="Entity" syntax-abbrev="E" enable="true"> - <postcomp relationship-ontology="relationship.obo" repos-subdir="OBO_REL"/> + <ontology name="Relationship" file="relationship.obo" + is-postcomp-rel="true" repos-subdir="OBO_REL"/> <ontology name="GO" file="gene_ontology.obo" repos-subdir="genomic-proteomic"/> <ontology name="SP" file="spatial.obo"/> </field> Modified: phenote/trunk/conf/zfin-standalone.cfg =================================================================== --- phenote/trunk/conf/zfin-standalone.cfg 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/conf/zfin-standalone.cfg 2007-03-22 16:52:28 UTC (rev 413) @@ -19,7 +19,8 @@ <field name="Genetic Context" file="context.obo" syntax-abbrev="GC" enable="true"/> <field name="Entity" syntax-abbrev="E" enable="true"> - <postcomp relationship-ontology="relationship.obo" repos-subdir="OBO_REL"/> + <ontology name="Relationship" file="relationship.obo" + is-postcomp-rel="true" repos-subdir="OBO_REL"/> <ontology name="ZF" file="zebrafish_anatomy.obo" filter-out="ZFS:" repos-subdir="anatomy/gross_anatomy/animal_gross_anatomy/fish"/> <ontology name="Human Anatomy" file="fma_obo.obo"/> Modified: phenote/trunk/src/java/phenote/config/FieldConfig.java =================================================================== --- phenote/trunk/src/java/phenote/config/FieldConfig.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/config/FieldConfig.java 2007-03-22 16:52:28 UTC (rev 413) @@ -25,24 +25,24 @@ /** construct from xml bean field - READ */ - FieldConfig(Field field) { - this.label = field.getName(); + FieldConfig(Field fieldBean) { + this.label = fieldBean.getName(); // try{//phase this out!charFieldEnum = CharFieldEnum.getCharFieldEnum(label);} // catch (Exception e) {} // no char field enum for name - new generic! //fc = new FieldConfig(name); - if (field.xgetEnable() != null) - enabled = field.getEnable(); + if (fieldBean.xgetEnable() != null) + enabled = fieldBean.getEnable(); - if (field.getSyntaxAbbrev() != null) { - setSyntaxAbbrev(field.getSyntaxAbbrev()); + if (fieldBean.getSyntaxAbbrev() != null) { + setSyntaxAbbrev(fieldBean.getSyntaxAbbrev()); } - // POST COMP, relationship ontol - old way - phase out - now in ont arr below - if (field.getPostcomp() != null) { + // POST COMP, relationship ontol - OLD WAY - PHASING OUT - now in ont arr below + if (fieldBean.getPostcomp() != null) { //setIsPostComp(true); - set in OC read by ODA - String relFile = field.getPostcomp().getRelationshipOntology(); + String relFile = fieldBean.getPostcomp().getRelationshipOntology(); OntologyConfig rel = OntologyConfig.makePostCompRelCfg(relFile); //setPostCompRelOntCfg(rel); dont need anymore - set in OC addOntologyConfig(rel); // new way @@ -50,15 +50,15 @@ // ONTOLOGIES if only one ontology file is an attribute... (convenience) // this is being phased out - no need and a hassle - if (field.getFile() != null) { - addOntologyConfig(new OntologyConfig(field)); + if (fieldBean.getFile() != null) { + addOntologyConfig(new OntologyConfig(fieldBean)); } // otherwise its multiple ontologies listed in ontology elements (entity) // also in new way post comp rel comes in here as well else { - Ontology[] ontologies = field.getOntologyArray(); - for (Ontology o : ontologies) { - addOntologyConfig(new OntologyConfig(o,getLabel())); // label -> default name + Ontology[] ontologies = fieldBean.getOntologyArray(); + for (Ontology ontBean : ontologies) { + addOntologyConfig(new OntologyConfig(ontBean,getLabel())); // label -> default name } } } Modified: phenote/trunk/src/java/phenote/config/OntologyConfig.java =================================================================== --- phenote/trunk/src/java/phenote/config/OntologyConfig.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/config/OntologyConfig.java 2007-03-22 16:52:28 UTC (rev 413) @@ -27,8 +27,10 @@ setOntologyFile(file); } + // phasing out - now just doing rel as another ontology - backward compatible static OntologyConfig makePostCompRelCfg(String file) { OntologyConfig rel = new OntologyConfig("Relationship",file); + System.out.println("OC rel name "+rel.name); rel.isPostCompRel = true; return rel; } @@ -68,6 +70,11 @@ reposSubdir = o.getReposSubdir(); // if xgetIsPostCompRel != null isPostCompRel = o.getIsPostcompRel(); // hmm what will return when not set?? + + // for now ignoring if name set as there was a bug where name was getting set + // to "Entity" in the -u .phenote/conf file - woops + if (isPostCompRel /*&& o.getName()==null*/) // default Relationship name + name = "Relationship"; //if (isPostCompRel) fc.setPostCompRelOntCfg(this); } Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2007-03-22 16:52:28 UTC (rev 413) @@ -39,8 +39,9 @@ public String getName() { if (name == null) { // not explicitly set - if (hasOneOntology()) + if (hasOneOntology()) { name = getOntology().getName(); + } else name = charFieldEnum.toString(); } @@ -76,7 +77,10 @@ if (!hasOntologies()) return null; return getFirstOntology(); } - public Ontology getFirstOntology() { return ontologyList.get(0); } + public Ontology getFirstOntology() { + if (ontologyList.isEmpty()) return null; // ex? + return ontologyList.get(0); + } private int getOntologySize() { if (!hasOntologies()) return 0; @@ -103,7 +107,7 @@ postCompAllowed = pca; } - /** whether this field allows for post composition - from config */ + /** whether this field allows for post composition - from config - allowed? how bout has? */ public boolean postCompAllowed() { return postCompAllowed; } Modified: phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java 2007-03-22 16:52:28 UTC (rev 413) @@ -1,5 +1,6 @@ package phenote.gui.field; +import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; @@ -35,8 +36,11 @@ /** The jcombobox that does auto completion - i had to do some tricks(hacks) to get it working with mouse over which doesnt come naturally to jcombobox */ -public abstract class AbstractAutoCompList extends JComboBox { +public abstract class AbstractAutoCompList extends CharFieldGui { //extends JComboBox { + + private JComboBox jComboBox = new JComboBox(); + //private Ontology ontology; private boolean changingCompletionList = false; //private boolean keyTyped = false; @@ -52,32 +56,46 @@ private boolean inTestMode = false; //private AutoTextFieldEditor autoTextFieldEditor; private AutoTextField autoTextField; - private CharField charField; + //private CharField charField; //private CharFieldGui charFieldGui; // should it be ISA not HASA? ///** Whether differentia of a post composed term */ //private boolean isDifferentia = false; /** if false then model is not edited */ - private boolean editModel; + //private boolean editModel = true; //private CompletionListListener compListListener = new CompletionListListener(); + private SearchParamsI searchParams; private CompListSearcher compListSearcher; private boolean setGuiForMultiSelect = false; + + protected AbstractAutoCompList(CharField cf) { + super(cf); + init(); + } + /** @param editModel if false then ACB doesnt edit model directly (post comp) can abstract classes have constructors - if not init() */ - protected AbstractAutoCompList(CompListSearcher s,boolean editModel,CharField cf) { + //protected AbstractAutoCompList(CompListSearcher s,boolean editModel,CharField cf) { +// protected AbstractAutoCompList(SearchParamsI sp,boolean editModel,CharField cf, +// String label) { +// super(cf,label); +// init(); +// } + + private void init() { // this inner class enables retrieving of JList for mouse over // this will probably throw errors if non metal look & feel is used - setUI(new MetalListComboUI()); - setEditable(true); + jComboBox.setUI(new MetalListComboUI()); + jComboBox.setEditable(true); //charFieldGui = cfg; - setCharField(cf); - setPreferredSize(CharFieldGui.inputSize); //new Dimension(390,20)); - setMaximumSize(CharFieldGui.inputSize); //new Dimension(390,20)); + //setCharField(cf); + jComboBox.setPreferredSize(CharFieldGui.inputSize); //new Dimension(390,20)); + jComboBox.setMaximumSize(CharFieldGui.inputSize); //new Dimension(390,20)); // this is super critical - fixes bug where layout goes to hell if string are long // in completion - dont ask me why???? - setMinimumSize(CharFieldGui.inputSize); + jComboBox.setMinimumSize(CharFieldGui.inputSize); AutoTextFieldEditor autoTextFieldEditor = new AutoTextFieldEditor(); - this.setEditor(autoTextFieldEditor); + jComboBox.setEditor(autoTextFieldEditor); // dont know why by setting fonts this seem to get worse not better in terms of // the wierd layout issue with large terms & list //setFont(new Font("Courier",Font.PLAIN,12)); yuck @@ -86,33 +104,47 @@ //java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); //for (Font f : fonts) System.out.println(f); //setFont(new Font("Lucida Typewriter",Font.PLAIN,10)); - setFont(new Font("Monospaced",Font.PLAIN,10)); + jComboBox.setFont(new Font("Monospaced",Font.PLAIN,10)); //setOntology(ontology); //searchParams = sp; // singleton access? part of ontology? - compListSearcher = s; + //compListSearcher = new CompListSearcher(cf.getFirstOntology(),sp);//s; //enableTermInfoListening(true); // default - hardwired in rel & term subclasses //addCompletionListListener(compList); + // why is this commented out? //if (editModel) // ComboBoxActionListener edits the model - this.editModel = editModel; - addActionListener(new ComboBoxActionListener()); + //this.editModel = editModel; + jComboBox.addActionListener(new ComboBoxActionListener()); } + protected Component getUserInputGui() { return jComboBox; } + + protected boolean isCompList() { return true; } + + protected void setSearchParams(SearchParamsI sp) { + searchParams = sp; + compListSearcher = new CompListSearcher(getCharField().getFirstOntology(),sp); + } + + protected SearchParamsI getSearchParams() { return searchParams; } + protected CompListSearcher getCompListSearcher() { return compListSearcher; } //void setOntology(Ontology o) { ontology = o; } //void setSearchParams(SearchParamsI sp) { searchParams = sp; } - void setCharField(CharField charField) { this.charField = charField; } + //void setCharField(CharField charField) { this.charField = charField; } - protected CharField getCharField() { return charField; } + //protected CharField getCharField() { return charField; } + protected boolean hasOntologyChooser() { return hasMoreThanOneOntology(); } + protected boolean hasMoreThanOneOntology() { - return charField.hasMoreThanOneOntology(); + return getCharField().hasMoreThanOneOntology(); } - protected boolean editModelEnabled() { return editModel; } + //protected boolean editModelEnabled() { return editModel; } /** char in table changed - adjust - not needed for rel(at least not yet) as post comp doesnt listen to table changes (does it? should it?), @@ -135,18 +167,18 @@ public void setText(String text, boolean doCompletion) { this.doCompletion = doCompletion; //this.keyTyped = doCompletion; // key has to be typed for completion - getEditor().setItem(text); + jComboBox.getEditor().setItem(text); //if (charField!=null)log().debug(charField.getName()+" setting text ["+text+"]"); //new Throwable().printStackTrace(); this.doCompletion = true; // set back to default } /** for now just clear out gui without editing model */ - void setGuiForMultiSelect() { + protected void setGuiForMultiSelect() { // flag to prevent AutoTextField.setText from setting to current term // is there a cleaner way to do this?? - this falg may need to be generalized // as may want for user being able to set to "" (non-required field gen-con) - setGuiForMultiSelect = true; + setGuiForMultiSelect = true; // ???? setText("*",false); // false -> no completion, "*"? setGuiForMultiSelect = false; } @@ -154,9 +186,10 @@ /** Return text in text field */ public String getText() { //return (String)getSelectedItem(); - return getEditor().getItem().toString(); // or editor.getText() ? + return jComboBox.getEditor().getItem().toString(); // or editor.getText() ? } + void clear() { setText(""); @@ -254,17 +287,18 @@ /** disable completion for item being selected - otherwise a popup comes up after the selection - probably no harm in keeping this but this may be redundant with the turning off of doCompletion in inner ATF.setText which is more - comprehensive */ - public void setSelectedItem(Object item) { - doCompletion = false; - super.setSelectedItem(item); - doCompletion = true; - } + comprehensive - also we are no longer subclass of JCombo so this doesnt + even get called - if we do need this then we need to subclass JCombo */ +// public void setSelectedItem(Object item) { +// doCompletion = false; +// jComboBox.setSelectedItem(item); +// doCompletion = true; +// } /** If combo box is relationship then the items will be OBOProperties not OBOClasses */ private boolean isRelationshipList() { - return charField.isRelationship(); + return getCharField().isRelationship(); } private boolean isTermList() { return !isRelationshipList(); } @@ -305,10 +339,11 @@ // could just do comboBoxModel.setList(l); ??? compComboBoxModel = new CompComboBoxModel(l); //setModel(defaultComboBoxModel); - setModel(compComboBoxModel); + jComboBox.setModel(compComboBoxModel); changingCompletionList = false; // showPopup can hang during test but not during real run - bizarre - showPopup(); // only show popup on key events - actually only do comp w key + if (!inTestMode) + jComboBox.showPopup(); // only show popup on key events - actually only do comp w key } /** This is cheesy but theres a hanging bug with showPopup that only happens @@ -320,12 +355,14 @@ /** This is cheesy but theres a hanging bug with showPopup that only happens in test mode - dont know why but doesnt actually matter, so if inTestMode - then dont showpopup - if hangs in nontest will investigate */ - public void showPopup() { - if (inTestMode) - return; - super.showPopup(); - } + then dont showpopup - if hangs in nontest will investigate + this actually needs to go in subclass of JCombo if we go there - this class + no longer sublcasses JCombo - for now commenting out */ +// public void showPopup() { +// if (inTestMode) +// return; +// super.showPopup(); +// } // /** returns true if input changed from previously recorded input */ @@ -365,7 +402,7 @@ /** This may return null if not using Metal/Java UI/Look & Feel as JList comes from the UI - need to implement getting JList from each UI I guess */ protected JList getUIJList() { - ComboBoxUI comboBoxUI = getUI(); + ComboBoxUI comboBoxUI = jComboBox.getUI(); if (!(comboBoxUI instanceof MetalListComboUI)) { System.out.println("Cant retrieve JList for look & feel, cant do mouse overs " +comboBoxUI.getClass()); @@ -436,7 +473,7 @@ catch (OboException e) { return; } // if not valid then dont edit model // EDIT MODEL - if (editModel) + if (editModelEnabled()) editModel(); } } @@ -454,13 +491,14 @@ Initializes the editor with the specified item. It seems to be ok as far as i can tell to supress this method entirely - if this ends up being problematic then this should be coulpled with a flag set in setCurrentValidItem - or a related method to supress the syn coming after term set */ - public void configureEditor(ComboBoxEditor anEditor,Object anItem) { - //log().debug("configure editor called"+anItem); - //new Throwable().printStackTrace(); - // it appears to be ok to supress this entirely - super.configureEditor(anEditor,anItem); // ??? supress - } + or a related method to supress the syn coming after term set + this doesnt seem to be supressing anymore so i guess its ok */ +// public void configureEditor(ComboBoxEditor anEditor,Object anItem) { +// //log().debug("configure editor called"+anItem); +// //new Throwable().printStackTrace(); +// // it appears to be ok to supress this entirely +// super.configureEditor(anEditor,anItem); // ??? supress +// } protected abstract void editModel(); @@ -471,19 +509,22 @@ return log; } public void simulateLKeyStroke() { - autoTextField.processKeyEvent(new KeyEvent(this,KeyEvent.KEY_PRESSED,0,0,KeyEvent.VK_L,'l')); - autoTextField.processKeyEvent(new KeyEvent(this,KeyEvent.KEY_TYPED,0,0,KeyEvent.VK_UNDEFINED,'l')); + autoTextField.processKeyEvent(new KeyEvent(jComboBox,KeyEvent.KEY_PRESSED,0,0,KeyEvent.VK_L,'l')); + autoTextField.processKeyEvent(new KeyEvent(jComboBox,KeyEvent.KEY_TYPED,0,0,KeyEvent.VK_UNDEFINED,'l')); } public void simulateKeyStroke(int keyCode, char c) { - KeyEvent k = new KeyEvent(this,KeyEvent.KEY_PRESSED,0,0,keyCode,c); + KeyEvent k = new KeyEvent(jComboBox,KeyEvent.KEY_PRESSED,0,0,keyCode,c); autoTextField.processKeyEvent(k); k.setKeyCode(KeyEvent.KEY_RELEASED); autoTextField.processKeyEvent(k); - k = new KeyEvent(this,KeyEvent.KEY_TYPED,0,0,KeyEvent.VK_UNDEFINED,c); + k = new KeyEvent(jComboBox,KeyEvent.KEY_TYPED,0,0,KeyEvent.VK_UNDEFINED,c); autoTextField.processKeyEvent(k); } + /** For TestPhenote */ + public JComboBox getJComboBox() { return jComboBox; } + private class CompComboBoxModel implements ComboBoxModel { //private List<CompletionTerm> list; cant do - may also be CompletionRelation! private List list; @@ -498,11 +539,6 @@ } } -// its own file? -class OboException extends Exception { - OboException() { super(); } - OboException(String s) { super(s); } -} // GARBAGE // private class AutoKeyListener extends KeyAdapter { Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2007-03-22 16:52:28 UTC (rev 413) @@ -1,5 +1,6 @@ package phenote.gui.field; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Container; @@ -39,60 +40,147 @@ ontology to browse - CharFieldGui does either - with get/setText - hides the details of the gui - just a field that gives text should there be subclasses for free text, term, & relations? hmmmm */ -class CharFieldGui { +abstract class CharFieldGui { //private AutoComboBox comboBox; //private AbstractAutoCompList comboBox; // ??? - private RelationCompList relCompList; - private TermCompList termCompList; - private CompListSearcher compListSearcher; + //private RelationCompList relCompList; + //private TermCompList termCompList; + //private CompListSearcher compListSearcher; //private JTextField textField; - private FreeTextField freeTextField; - private boolean isCompList = false; + //private FreeTextField freeTextField; + //private boolean isCompList = false; private CharField charField; - private FieldPanel fieldPanel; + //private FieldPanel fieldPanel; //private JComboBox ontologyChooserCombo; private String label; - private boolean enableListeners = true; + //private boolean enableListeners = true; private boolean addCompButton = true; /** if true then set gui but not model, for clearing on multi, default false */ private boolean updateGuiOnly = false; + private JButton retrieveButton; static int fieldHeight = 17; static Dimension inputSize = new Dimension(390,fieldHeight); // size of user input box + private boolean editModel = true; - CharFieldGui(CharField charField, FieldPanel tp) {/*Container parent,*/ - init(charField,tp); + /** CharFieldGui for main window not post comp box - factory method */ + static CharFieldGui makeCharFieldGui(CharField charField,SearchParamsI sp) { + if (charField.hasOntologies()) { + //return new TermCompList(charField,sp,true); // enable listeners + TermCompList t = new TermCompList(charField); + t.setSearchParams(sp); + t.enableListeners(true); + t.allowPostCompButton(true); + return t; + //return createCompList(charField,sp); +// if (charField.isRelationship()) { +// return new RelationCompList(searcher,editModel,charField); +// } +// else { +// return new TermCompList(searcher,editModel,charField); +// } + } + else { + FreeTextField f = new FreeTextField(charField); + f.enableListeners(true); + return f; + } } - /** @param enableListeners - a catchall flag for disabling editing model, listening - to model edits, & litening to selection - postcompGui handles these and sets - this false, in main window this is true - rename? more flags? subclass? - postCompGui mode? - @param addCompButton if false override configuration and dont show - post comp button */ - CharFieldGui(CharField cf,FieldPanel tp,String label,boolean enableListeners, - boolean addCompButton) { - this.label = label; - this.enableListeners = enableListeners; - this.addCompButton = addCompButton; // post comp button - init(cf,tp); +// private static CharFieldGui createCompList(CharField charField, SearchParamsI sp) { +// // enableListeners - if false then ACB wont directly edit model (post comp) +// //compListSearcher = new CompListSearcher(charField.getOntologyList(),sp); +// //new CompListSearcher(charField.getFirstOntology(),fieldPanel.getSearchParams()); +// if (charField.isRelationshipList()) { +// return new RelationCompList(sp,enableListeners,charField); +// } +// else { +// return new TermCompList(sp,enableListeners); +// } +// } + + // private static CharFieldGui createFreeTextField() {} ?? + + /** createPostCompRelationList - will relation lists ever be in main window and if + so will they ever have listeners enabled - maybe, probably not */ + static CharFieldGui makeRelationList(CharField cf,SearchParamsI sp) { + RelationCompList r = new RelationCompList(cf); + r.setSearchParams(sp); // does rel really need search params? + return r; } - private void init(CharField cf, FieldPanel tp) { + /** make term completion lists for post comp window (genus & diff), they dont listen + to selection nor edit model - isolated */ + static CharFieldGui makePostCompTermList(CharField cf,SearchParamsI sp, + String label) { + // false - no listeners(dont edit model), false - dont add comp button + // eventually adding comp button come from config for recursive comp + //boolean allowPostCompBut = false; + TermCompList t = new TermCompList(cf); + t.setSearchParams(sp); + // t.isInSeparateWindow(true) or t.isolate(true)?? + t.enableEditModel(false); + t.enableListeners(false); + t.allowPostCompButton(false); // eventually config for recurse/embed + t.setLabel(label); + return t; + } + + + + protected CharFieldGui(CharField charField) { + init(charField); + } +// protected CharFieldGui(CharField charField,String label) { +// init(charField,label); +// } + +// protected CharFieldGui(CharField charField,boolean enableListeners) { +// //this.enableListeners = enableListeners; +// enableListeners(enableListeners); +// init(charField); +// } + + +// CharFieldGui(CharField charField, FieldPanel tp) {/*Container parent,*/ +// init(charField,tp); +// } + +// /** @param enableListeners - a catchall flag for disabling editing model, listening +// to model edits, & litening to selection - postcompGui handles these and sets +// this false, in main window this is true - rename? more flags? subclass? +// postCompGui mode? +// @param addCompButton if false override configuration and dont show +// post comp button */ +// CharFieldGui(CharField cf,FieldPanel tp,String label,boolean enableListeners, +// boolean addCompButton) { +// this.label = label; +// this.enableListeners = enableListeners; +// this.addCompButton = addCompButton; // post comp button +// init(cf,tp); +// } + + + private void init(CharField cf) { //, FieldPanel tp) { charField = cf; - fieldPanel = tp; - if (!charField.hasOntologies()) - initTextField(charField.getName()); - else - initCombo(); - + //fieldPanel = tp; + //if (!charField.hasOntologies()) initTextField(charField.getName()); + //else initCombo(); // check queryableAdapter if charField is queryable addRetrieveButton(); + // enableListeners(true) + } + /** Get the component used for user input - text field or jCombo */ + protected abstract Component getUserInputGui(); + + protected void enableListeners(boolean enable) { + if (!enable) return; + // listens for selection (eg from table) - not for PostCompGui - if (enableListeners) - SelectionManager.inst().addCharSelectionListener(new FieldCharSelectListener()); + //if (enableListeners) + SelectionManager.inst().addCharSelectionListener(new FieldCharSelectListener()); // listen for model changes (eg TermInfo commit) // this needs renaming. if not editing model then its a post comp window, and @@ -100,21 +188,35 @@ // char field guis. either add a new param or rename "enableListeners" - hmmm // or subclass CharFieldGui?? hmmmmm.... oh right this is changes in model // from the main window i think?? - if (enableListeners) - EditManager.inst().addCharChangeListener(new FieldCharChangeListener()); + //if (enableListeners) + EditManager.inst().addCharChangeListener(new FieldCharChangeListener()); } + protected void enableEditModel(boolean em) { editModel = em; } + protected boolean editModelEnabled() { return editModel; } + + // overridden by AbstaractAutoCompList + protected void setSearchParams(SearchParamsI sp) {} + + + /** no-op - overridden by term comp list - set to false for now for terms in comp + window - resursion coming... */ + protected void allowPostCompButton(boolean allow) {} + private void addRetrieveButton() { if (!Config.inst().hasQueryableDataAdapter()) return; QueryableDataAdapterI qa = Config.inst().getQueryableDataAdapter(); // for now just one if (qa.isFieldQueryable(getCharField().getName())) { - JButton b = new JButton("Retrieve"); - b.addActionListener(new RetrieveActionListener(qa)); - fieldPanel.addRetrieveButton(b); + retrieveButton = new JButton("Retrieve"); + retrieveButton.addActionListener(new RetrieveActionListener(qa)); + //fieldPanel.addRetrieveButton(b); } } + boolean hasRetrieveButton() { return retrieveButton != null; } + JButton getRetrieveButton() { return retrieveButton; } + private class RetrieveActionListener implements ActionListener { QueryableDataAdapterI qda; private RetrieveActionListener(QueryableDataAdapterI q) { qda = q; } @@ -135,10 +237,14 @@ } // FreeTextField.updateModel uses this - boolean updateGuiOnly() { return updateGuiOnly; } + protected boolean updateGuiOnly() { return updateGuiOnly; } + protected void setUpdateGuiOnly(boolean u) { updateGuiOnly = u; } + /** edits from post comp come in here i believe (term info used to but now - thats done with UseTermEvent) */ + thats done with UseTermEvent), also edits on the model from EditManager + but they get tossed i think as its either the same source or not for this + char field */ private class FieldCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { // check charField is this char field @@ -154,16 +260,18 @@ //boolean editModel = false; // maybe setModelUpdateMode(false) ?? - updateGuiOnly = true; // disable model editing - a better way to do this??? + // is updateGuiOnly still needed here? dont think so - only for free text + // and this only gets post comp term updates ??? + //updateGuiOnly = true; // disable model editing - a better way to do this??? setValueFromChar(getFirstSelectedChar()); - updateGuiOnly = false; // reenable model editing + //updateGuiOnly = false; // reenable model editing } } } /** for testing and internal use */ AbstractAutoCompList getCompList() { - if (!isCompList) + if (!isCompList()) return null; if (isRelationshipList()) return getRelComp(); @@ -171,20 +279,22 @@ //return comboBox; } - // hasOntology? - boolean isCompList() { return isCompList; } + // hasOntology? overridded by AbstractAutoCompList + boolean isCompList() { return false; }// isCompList; } private boolean isRelationshipList() { return charField.isRelationship(); } - private TermCompList getTermComp() { + protected TermCompList getTermComp() { // throw ex if null? - return termCompList; + //return termCompList; + return null; // overridden by TermCompList } private RelationCompList getRelComp() { - return relCompList; + //return relCompList; + return null; // overridden } // hardwired in term & rel subclasses now @@ -195,27 +305,31 @@ /** Set the gui from the model (selection) */ void setValueFromChar(CharacterI character) { - if (character == null) { - log().error("ERROR: setting to null character"); - return; - } - if (charField == null) return; + // call this check from subclass? no do this check in subclass! +// if (character == null) { +// log().error("ERROR: attempt to set fields from null character"); // ex? +// return; +// } +// if (charField == null) return; // if (charField.getCharFieldEnum() == null) { // log().error("Cant set value for field "+getLabel()+". Gui for character field has not " // +"been associated with a datamodel field. check field names in config"); // return; // } // if its a comp list need to set its model/current term rel (for AACL.setText) - if (isCompList) - getCompList().setValueFromChar(character); - else - getFreeTextField().setValueFromChar(character); + /// overridden in subclass + //if (isCompList()) getCompList().setValueFromChar(character); + //else getFreeTextField().setValueFromChar(character); //String v = charField.getCharFieldEnum().getValue(character).getName(); //setText(v); ?? } + protected void setLabel(String label) { + this.label = label; + } + String getLabel() { if (label == null) { if (charField.hasMoreThanOneOntology() || !charField.hasOntologies()) @@ -226,18 +340,20 @@ return label; } - private void initCombo() { //, Container parent) { - isCompList = true; + //JLabel getLabelGui() { return new JLabel +// private void initCombo() { //, Container parent) { + //isCompList = true; + //String name = charField.getFirstOntology().getName();JLabel label = - fieldPanel.addLabel(getLabel(),charField.hasMoreThanOneOntology()); + //fieldPanel.addLabel(getLabel(),charField.hasMoreThanOneOntology()); // if has more than one ontology(entity) then add ontology choose list // if (charField.hasMoreThanOneOntology()) // initOntologyChooser(charField); - createCompList(); // comp list now makes ontologyChooser (if >1 ont) - fieldPanel.addFieldGui(getCompList()); + //createCompList(); // comp list now makes ontologyChooser (if >1 ont) + //fieldPanel.addFieldGui(getCompList()); //getCompList().setCharField(charField); @@ -245,10 +361,11 @@ // AND addCompButton flag is true - PostCompGui sets to false - no post comp of // post comp yet - and if so probably would do in same window not multiple // windows anyways - if (charField.postCompAllowed() && addCompButton) { - JButton postCompButton = new JButton("Comp"); // ??? - postCompButton.addActionListener(new PostCompListener()); - fieldPanel.addPostCompButton(postCompButton); + // this belongs in TermCompList - free text doesnt use +// if (charField.postCompAllowed() && addCompButton) { +// JButton postCompButton = new JButton("Comp"); // ??? +// postCompButton.addActionListener(new PostCompListener()); +// fieldPanel.addPostCompButton(postCompButton); // keep this here for now - may reinstate - this is inpanel post comp // // todo -> get pc differentia ontologies from config, >1 add chooser // AutoComboBox postCompCombo = @@ -257,28 +374,29 @@ // postCompCombo.setCharField(harField); // postCompCombo.setIsDifferentia(true); // differentia of genus in post comp // fieldPanel.addFieldGui(postCompCombo); - } - } +// } +// } - /** sets up rel or term comp list depending on isRelList(). also set up - compListSearcher */ - private void createCompList() { - //comboBox = new AutoComboBox(charField.getFirstOntology(), - //fieldPanel.getSearchParams(),enableListeners); - // enableListeners - if false then ACB wont directly edit model (post comp) - compListSearcher = - new CompListSearcher(charField.getOntologyList(),fieldPanel.getSearchParams()); - //new CompListSearcher(charField.getFirstOntology(),fieldPanel.getSearchParams()); - if (isRelationshipList()) { - relCompList = new RelationCompList(compListSearcher,enableListeners,charField); - } - else { - termCompList = new TermCompList(compListSearcher,enableListeners,this); - } - } +// /** sets up rel or term comp list depending on isRelList(). also set up +// compListSearcher */ +// private void createCompList() { +// //comboBox = new AutoComboBox(charField.getFirstOntology(), +// //fieldPanel.getSearchParams(),enableListeners); +// // enableListeners - if false then ACB wont directly edit model (post comp) +// compListSearcher = +// new CompListSearcher(charField.getOntologyList(),fieldPanel.getSearchParams()); +// //new CompListSearcher(charField.getFirstOntology(),fieldPanel.getSearchParams()); +// if (isRelationshipList()) { +// relCompList = new RelationCompList(compListSearcher,enableListeners,charField); +// } +// else { +// termCompList = new TermCompList(compListSearcher,enableListeners,this); +// } +// } - void addOntologyChooser(JComboBox oc) { fieldPanel.addOntologyChooser(oc); } +// void addOntologyChooser(JComboBox oc) { fieldPanel.addOntologyChooser(oc); } + // private void initOntologyChooser(CharField charField) { // ontologyChooserCombo = new JComboBox(); // // add listener.... @@ -289,18 +407,18 @@ // fieldPanel.addOntologyChooser(ontologyChooserCombo); // } - private void initTextField(String label) { - isCompList = false; - fieldPanel.addLabel(label); - freeTextField = new FreeTextField(this); -// textField = new JTextField(25); -// textField.setEditable(true); -// textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); -// textField.addKeyListener(new TextKeyListener()); - fieldPanel.addFieldGui(freeTextField.getComponent()); - } +// private void initTextField(String label) { +// //isCompList = false; +// fieldPanel.addLabel(label); +// freeTextField = new FreeTextField(this); +// // textField = new JTextField(25); +// // textField.setEditable(true); +// // textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); +// // textField.addKeyListener(new TextKeyListener()); +// fieldPanel.addFieldGui(freeTextField.getComponent()); +// } - private FreeTextField getFreeTextField() { return freeTextField; } +// private FreeTextField getFreeTextField() { return freeTextField; } // ?? was this moved somewhere else? // /** key listener for free text fields for Cmd-V pasting for macs */ @@ -325,42 +443,37 @@ // } - void setText(String text) { + protected abstract void setText(String text);// { // set/getText interface to combo & text field? - if (isCompList) getCompList().setText(text); - else getFreeTextField().setText(text); - } - String getText() { - if (isCompList) return getCompList().getText(); - else return getFreeTextField().getText(); - } + //if (isCompList()) getCompList().setText(text); + //else getFreeTextField().setText(text);} + protected abstract String getText(); // { + //if (isCompList()) return getCompList().getText(); + //else return getFreeTextField().getText();} /** clears gui not model - for multi select - may want to set to * or something? */ - void setGuiForMultiSelect() { - if (isCompList) { - getCompList().setGuiForMultiSelect(); - } - else { - updateGuiOnly = true; - setText("*"); // or * for multi sel? rename method setGuiForMultiSelect? - updateGuiOnly = false; - } - } + protected abstract void setGuiForMultiSelect(); // { +// if (isCompList()) { getCompList().setGuiForMultiSelect(); } +// else { +// updateGuiOnly = true; +// setText("*"); // or * for multi sel? rename method setGuiForMultiSelect? +// updateGuiOnly = false; } } - void setOboClass(OBOClass term) { - if (!isCompList || isRelationshipList()) return; // throw ex?? - getTermComp().setOboClass(term); + protected void setOboClass(OBOClass term) { + // no-op overridden by TermCompList + //if (!isCompList() || isRelationshipList()) return; // throw ex?? + //getTermComp().setOboClass(term); //else textField.setText(term.getName()); // shouldnt happen } /** for auto combos (ontol) for relationships (post comp rel) */ void setRel(OBOProperty rel) { - if (!isCompList || !isRelationshipList()) return; // ex??? + if (!isCompList() || !isRelationshipList()) return; // ex??? getRelComp().setRel(rel); //else textField.setText(rel.getName()); // shouldnt actually happen } CharFieldEnum getCharFieldEnum() { return charField.getCharFieldEnum(); } - CharField getCharField() { return charField; } + protected CharField getCharField() { return charField; } private CharacterI getFirstSelectedChar() { return SelectionManager.inst().getFirstSelectedCharacter(); @@ -381,88 +494,53 @@ } - /** I think post-comp should only be closeable if its empty (in expand collapse - inframe case - now window) */ - private class PostCompListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - new PostCompGui(charField,fieldPanel.getSearchParams()); - } - } +// /** I think post-comp should only be closeable if its empty (in expand collapse +// inframe case - now window) */ --> TermCompList +// private class PostCompListener implements ActionListener { +// public void actionPerformed(ActionEvent e) { +// new PostCompGui(charField,fieldPanel.getSearchParams()); +// } +// } /** should define a CharFieldGuiEx! */ OBOClass getCurrentOboClass() throws Exception { - //if (!isCompList || isRelationshipList) + //if (!isCompList() || isRelationshipList) if (!isTermCompList()) throw new Exception("Field has no OBO Class"); - return getTermComp().getCurrentOboClass(); // throws Ex + return null; // overridden by term comp list + //return getTermComp().getCurrentOboClass(); // throws Ex } OBOProperty getCurrentRelation() throws Exception { - if (!isCompList || !isRelationshipList()) + if (!isCompList() || !isRelationshipList()) throw new Exception("Field has no Relation"); return getRelComp().getCurrentRelation(); // throws Ex } - private boolean isTermCompList() { - return isCompList && !isRelationshipList() && getTermComp()!=null; + protected boolean isTermCompList() { + return false; // overridden by term comp list + //return isCompList() && !isRelationshipList() && getTermComp()!=null; // && getTermComp != null? } /** for post comp gui to set ontol chooser */ void setOntologyChooserFromTerm(OBOClass term) { - if (!isTermCompList()) return; // shouldnt happen - ex? - getTermComp().setOntologyChooserFromTerm(term); + //if (!isTermCompList()) return; // shouldnt happen - ex? + // overridden by term comp + //getTermComp().setOntologyChooserFromTerm(term); } + protected boolean hasOntologyChooser() { return false; } + protected JComboBox getOntologyChooser() { return null; } + /** Overridden by TermCompList */ + protected boolean hasCompButton() { return false; } + /** Overridden by TermCompList */ + protected JButton getCompButton() { return null; } + private Logger log; private Logger log() { if (log == null) log = Logger.getLogger(getClass()); return log; } } - // -> TermCompList -// private class OntologyChooserListener implements ActionListener { -// public void actionPerformed(ActionEvent e) { -// String s = ontologyChooserCombo.getSelectedItem().toString(); -// try { -// Ontology o = OntologyManager.inst().getOntologyForName(s); -// //getCompList().setOntology(o); // termComp? -// compListSearcher.setOntology(o); -// } -// catch (OntologyException ex) { -// log().error(ex.getMessage()); -// return; -// } -// } -// } - -// List<CharacterI> getSelectedChars() { -// return SelectionManager.inst().getSelectedChars(); -// } - -// // separate char text field class? --> FreeTextField -// /** This is where the model gets updated (for free text fields) */ -// private class TextFieldDocumentListener implements DocumentListener { -// //private String previousVal = null; -// public void changedUpdate(DocumentEvent e) { updateModel(); } -// public void insertUpdate(DocumentEvent e) { updateModel(); } -// public void removeUpdate(DocumentEvent e) { updateModel(); } -// private void updateModel() { -// // if only updating gui (multi select clear) then dont update model -// if (updateGuiOnly) return; -// // on delete last pheno row clearing of text will trigger this -// //if (!characterTablePanel.hasRows()) return; -// //String genotype = lumpField.getText(); -// //characterTablePanel.setSelectedGenotype(genotype); -// List<CharacterI> chars = getSelectedChars(); -// // i believe this isnt using oboClass as we just have string -// // of course it isnt this is free text -// String v = getText(); -// //UpdateTransaction ut = new UpdateTransaction(char,getCharFieldEnum(),v); -// CompoundTransaction ct = new CompoundTransaction(chars,getCharFieldEnum(),v); -// EditManager.inst().updateModel(CharFieldGui.this,ct); -// //previousVal = v; // undo -// } -// } - Modified: phenote/trunk/src/java/phenote/gui/field/FieldPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-22 16:52:28 UTC (rev 413) @@ -1,5 +1,6 @@ package phenote.gui.field; +import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -34,17 +35,16 @@ private SearchParamsI searchParams; public FieldPanel() { - this(true); - //initAllOntologies(); + this(true,true); } // false for post comp panel - public FieldPanel(boolean doAllOntologies) { - initGui(); - if (doAllOntologies) - initAllOntologies(); + public FieldPanel(boolean doAllFields,boolean addSearchPanel) { + initGui(addSearchPanel); + if (doAllFields) + initCharFieldGuis(); } - private void initGui() { + private void initGui(boolean addSearchPanel) { // should figure y from # of fields really!!! yes!!! // width of ontology labels effects x this.setMinimumSize(new Dimension(700,490));//690,490)); @@ -56,31 +56,34 @@ // panel inside of panel - i think is a leftover no reason now add(fieldPanel); // search param panel - maybe search panel should be added to main frame? - add(getSearchParamPanel().getPanel()); - + if (addSearchPanel) + add(getSearchParamPanel().getPanel()); } - /** from selection in plump table - hmmm mvc - get from model change event - - should ACB listen for event and change themselves? - oh wait this is for selection - not editing - no editing in table silly - should do selection event/listener */ - void setFieldsFromCharacter(CharacterI character) { - for (CharFieldGui fieldGui : charFieldGuiList) - fieldGui.setValueFromChar(character); - } + private void initCharFieldGuis() { - private void initAllOntologies() { - for (CharField charField : ontologyManager.getCharFieldList()) { - SearchParamsI s = getSearchParamPanel().getSearchParams(); - CharFieldGui gui = new CharFieldGui(charField,this); // adds to panel + //CharFieldGui gui = new CharFieldGui(charField,this); // adds to panel + CharFieldGui gui = CharFieldGui.makeCharFieldGui(charField,getSearchParams()); + addCharFieldGuiToPanel(gui); charFieldGuiList.add(gui); } - // search param panel - maybe search panel should be added to main frame? //add(getSearchParamPanel().getPanel()); --> initGui } + void addCharFieldGuiToPanel(CharFieldGui fieldGui) { + addLabel(fieldGui.getLabel(),fieldGui.hasOntologyChooser()); + if (fieldGui.hasOntologyChooser()) + addOntologyChooser(fieldGui.getOntologyChooser()); + addFieldGui(fieldGui.getUserInputGui()); + if (fieldGui.hasCompButton()) + addPostCompButton(fieldGui.getCompButton()); + if (fieldGui.hasRetrieveButton()) + addRetrieveButton(fieldGui.getRetrieveButton()); + } + SearchParamsI getSearchParams() { if (searchParams == null) searchParams = getSearchParamPanel().getSearchParams(); @@ -111,7 +114,7 @@ fieldPanel.add(ontologyChooser,makeOntologyChooserConstraint()); } - void addFieldGui(JComponent comp) { + void addFieldGui(Component comp) { fieldPanel.add(comp,makeFieldConstraint()); } @@ -179,6 +182,14 @@ // GARBAGE - DELETE +// /** from selection in plump table - hmmm mvc - get from model change event - +// should ACB listen for event and change themselves? - oh wait this is for selection +// not editing - no editing in table silly - should do selection event/listener */ +// void setFieldsFromCharacter(CharacterI character) { +// for (CharFieldGui fieldGui : charFieldGuiList) +// fieldGui.setValueFromChar(character); +// } + // // for testing - move to test? // private AbstractAutoCompList getComboBox(CharFieldEnum cfe) { // for (CharFieldGui cfg : charFieldGuiList) @@ -395,37 +406,3 @@ // comboBox.setModel(new DefaultComboBoxModel(v)); // } // } - // delete... -// private class AutoDocumentListener implements DocumentListener { -// private String ontology; -// private AutoDocumentListener(String o) { this.ontology = o; } -// public void changedUpdate(DocumentEvent e) { doCompletion(e); } -// public void insertUpdate(DocumentEvent e) { doCompletion(e); } -// public void removeUpdate(DocumentEvent e) { doCompletion(e); } -// private void doCompletion(DocumentEvent e) { -// Document d = e.getDocument(); -// try { -// searchPanel.redoCompletionList(ontology,e.getDocument().getText(0,d.getLength())); -// } -// catch (javax.swing.text.BadLocationException ex) { -// System.out.println("bad location"); -// } -// } -// } - // HasText interface? to cover JTextField as well? - // private String getUserInput(String ontology) { - //if (ontology.equals(ANATOMY)) - //return (String)entityField.getEditor().getItem(); //} -// void setSearchPanel(SearchPanel sp) { -// searchPanel = sp; -// // overlay?? home made jcombo - jcombo mac bug - list on top of jtext -// // mac bug worked around thank goodness -// //searchPanel.setLocation(qualityTextField.getLocation()); -// } - //comboBox.setEditable(true); - //ActionListener a = new AutoActionListener(ontologyString,comboBox); - //comboBox.getEditor().addActionListener(a); - //comboBox.addActionListener(a); - //entityField.getDocument().addDocumentListener(new AutoDocumentListener(ANATOMY)); - //qualityTextField = addField("Quality Term",this,true); - //qualityTextField.getDocument().addDocumentListener(new AutoDocumentListener(QUALITY)); Modified: phenote/trunk/src/java/phenote/gui/field/FreeTextField.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FreeTextField.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/gui/field/FreeTextField.java 2007-03-22 16:52:28 UTC (rev 413) @@ -1,6 +1,7 @@ package phenote.gui.field; import java.util.List; +import java.awt.Component; import java.awt.Toolkit; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; @@ -13,6 +14,8 @@ import javax.swing.event.DocumentListener; import javax.swing.event.DocumentEvent; +import org.apache.log4j.Logger; + import phenote.datamodel.CharacterI; import phenote.datamodel.CharField; //import phenote.datamodel.CharFieldEnum; // phase out @@ -21,15 +24,17 @@ import phenote.gui.selection.SelectionManager; // should this be a subclass of charfieldGui? maybe? -class FreeTextField { +class FreeTextField extends CharFieldGui { private JTextField textField; - private CharFieldGui charFieldGui; + //private CharFieldGui charFieldGui; private boolean guiTextHasChanged = false; + //private boolean updateGuiOnly = false; //private void initTextField(String label) { - FreeTextField(CharFieldGui cfg) { - charFieldGui = cfg; + FreeTextField(CharField charField) { //CharFieldGui cfg) { + super(charField); + //charFieldGui = cfg; textField = new JTextField(35); textField.setMinimumSize(CharFieldGui.inputSize); textField.setEditable(true); @@ -38,16 +43,23 @@ textField.addKeyListener(new TextKeyListener()); } - JTextField getComponent() { return textField; } + - void setText(String text) { + //JTextField getComponent() { return textField; } + protected Component getUserInputGui() { return textField; } + + protected void setText(String text) { textField.setText(text); } - String getText() { return textField.getText(); } + protected String getText() { return textField.getText(); } - private boolean updateGuiOnly() { return charFieldGui.updateGuiOnly(); } + //private boolean updateGuiOnly() { return /*charFieldGui.*/updateGuiOnly(); } protected void setValueFromChar(CharacterI chr) { + if (chr == null) { + log().error("ERROR: attempt to set fields from null character"); // ex? + return; + } //String v = charField.getCharFieldEnum().getValue(chr).getName(); if (!chr.hasValue(getCharField())) return; @@ -55,8 +67,14 @@ setText(v); } + protected void setGuiForMultiSelect() { + setUpdateGuiOnly(true);//updateGuiOnly = true; + setText("*"); + setUpdateGuiOnly(false);//updateGuiOnly = false; + } + // subclass? - private CharField getCharField() { return charFieldGui.getCharField(); } + //private CharField getCharField() { return charFieldGui.getCharField(); } /** key listener for free text fields for Cmd-V pasting for macs */ private class TextKeyListener extends KeyAdapter { @@ -95,7 +113,7 @@ String v = getText(); //CompoundTransaction ct = new CompoundTransaction(chars,getCharFieldEnum(),v); CompoundTransaction ct = CompoundTransaction.makeUpdate(chars,getCharField(),v); - EditManager.inst().updateModel(charFieldGui,ct); // cfg source + EditManager.inst().updateModel(this,ct);//charFieldGui,ct); // cfg source guiTextHasChanged = false; // reset flag } @@ -105,7 +123,9 @@ //private CharFieldEnum getCharFieldEnum() { return charFieldGui.getCharFieldEnum(); } + + /** This is where it is noted that the gui has been edited, only update the model on focus change if the gui has been actually edited */ private class TextFieldDocumentListener implements DocumentListener { @@ -115,4 +135,9 @@ private void setGuiChanged() { guiTextHasChanged = true; } } + private Logger log; + private Logger log() { + if (log == null) log = Logger.getLogger(getClass()); + return log; + } } Added: phenote/trunk/src/java/phenote/gui/field/OboException.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/OboException.java (rev 0) +++ phenote/trunk/src/java/phenote/gui/field/OboException.java 2007-03-22 16:52:28 UTC (rev 413) @@ -0,0 +1,6 @@ +package phenote.gui.field; + +class OboException extends Exception { + OboException() { super(); } + OboException(String s) { super(s); } +} Modified: phenote/trunk/src/java/phenote/gui/field/PostCompGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/PostCompGui.java 2007-03-22 16:35:31 UTC (rev 412) +++ phenote/trunk/src/java/phenote/gui/field/PostCompGui.java 2007-03-22 16:52:28 UTC (rev 413) @@ -58,24 +58,30 @@ // dialog wont be focusable if owner is not showing or something like that Frame owner = Phenote.getPhenote().getFrame(); dialog = new JDialog(owner,charField.getName()+" Post Composition"); - FieldPanel compFieldPanel = new FieldPanel(false); // (searchParams)? + FieldPanel compFieldPanel = new FieldPanel(false,false); // (searchParams)? compFieldPanel.setSearchParams(searchParams); // false - dont edit model, false - no post comp button - genusField = new CharFieldGui(charField,compFieldPanel,"Genus",false,false); + //genusField = new CharFieldGui(charField,compFieldPanel,"Genus",false,false); + genusField = CharFieldGui.makePostCompTermList(charField,searchParams,"Genus"); + compFieldPanel.addCharFieldGuiToPanel(genusField); // Relationship?? stripped down ontology? hmmmmmm... CharField relChar = new CharField(CharFieldEnum.RELATIONSHIP); // Ontology o = OntologyManager.getRelationshipOntology() ?? getRelCharField? Ontology o = charField.getPostCompRelOntol(); relChar.addOntology(o); - relField = new CharFieldGui(relChar,compFieldPanel,"Relationship",false,false); + //relField = new CharFieldGui(relChar,compFieldPanel,"Relationship",false,false); + relField = CharFieldGui.makeRelationList(relChar,searchParams); // "Relationship"? + compFieldPanel.addCharFieldGuiToPanel(relField); //relField.enableTermInfoListening(false); // turn off term info for rels // relField = new RelFieldGui(relChar,compTermPanel,"Relationship"); // relField = new RelationshipFieldGui(compFieldPanel); - diffField = - new CharFieldGui(charField,compFieldPanel,"Differentia",false,false); + // when recurse put... [truncated message content] |
From: <mg...@us...> - 2007-03-22 16:35:37
|
Revision: 412 http://svn.sourceforge.net/obo/?rev=412&view=rev Author: mgibson Date: 2007-03-22 09:35:31 -0700 (Thu, 22 Mar 2007) Log Message: ----------- fixed nicole compile error - nicole please examine - and fixed bug where queryable da\ ta adapter was not getting written out to updated config Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/config/ConfigWriter.java phenote/trunk/src/java/phenote/edit/AddTransaction.java phenote/trunk/src/java/phenote/edit/CharChangeEvent.java phenote/trunk/src/java/phenote/edit/DeleteTransaction.java phenote/trunk/src/java/phenote/edit/TransactionI.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2007-03-21 01:27:17 UTC (rev 411) +++ phenote/trunk/src/java/phenote/config/Config.java 2007-03-22 16:35:31 UTC (rev 412) @@ -503,7 +503,7 @@ return queryAdapConfList != null && getQueryableDataAdapter()!= null; } - /** Just get first one - for now assume theres one */ + /** Just get first one thats enabled - for now assume theres one */ public QueryableDataAdapterI getQueryableDataAdapter() { //if (!hasQueryableDataAdapter()) return null; // ex? if (queryAdapConfList == null) return null; @@ -514,7 +514,8 @@ return null; } - private List<QueryableAdapConfig> getQueryAdapCfgs() { + /** all configs for query adaps - enabled or not */ + List<QueryableAdapConfig> getQueryAdapCfgs() { if (queryAdapConfList == null) queryAdapConfList = new ArrayList<QueryableAdapConfig>(1); return queryAdapConfList; Modified: phenote/trunk/src/java/phenote/config/ConfigWriter.java =================================================================== --- phenote/trunk/src/java/phenote/config/ConfigWriter.java 2007-03-21 01:27:17 UTC (rev 411) +++ phenote/trunk/src/java/phenote/config/ConfigWriter.java 2007-03-22 16:35:31 UTC (rev 412) @@ -5,6 +5,7 @@ import org.apache.xmlbeans.XmlOptions; import phenote.config.xml.DataadapterDocument.Dataadapter; +import phenote.config.xml.QueryableDataadapterDocument.QueryableDataadapter; import phenote.config.xml.LogDocument.Log; import phenote.config.xml.OboRepositoryDocument.OboRepository; import phenote.config.xml.OntologyDocument.Ontology; @@ -29,6 +30,8 @@ addDataAdapters(); + addQueryDataAdapters(); + addLog(); addUvicGraph(); @@ -55,7 +58,19 @@ daBean.setName(daClassString); daBean.setEnable(dac.isEnabled()); } - + + private void addQueryDataAdapters() { + for (QueryableAdapConfig q : config.getQueryAdapCfgs()) { + addQueryAdapter(q); + } + } + + private void addQueryAdapter(QueryableAdapConfig qac) { + String qacClassString = qac.getConfigString(); + QueryableDataadapter qdBean = phenCfg.addNewQueryableDataadapter(); + qdBean.setName(qacClassString); + qdBean.setEnable(qac.isEnabled()); + } private void addLog() { Log log = phenCfg.addNewLog(); log.setConfigFile(config.getLogConfigFile()); Modified: phenote/trunk/src/java/phenote/edit/AddTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/AddTransaction.java 2007-03-21 01:27:17 UTC (rev 411) +++ phenote/trunk/src/java/phenote/edit/AddTransaction.java 2007-03-22 16:35:31 UTC (rev 412) @@ -1,5 +1,7 @@ package phenote.edit; +import org.geneontology.oboedit.datamodel.OBOClass; + import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; // does char list manager belong in edit package? @@ -32,4 +34,6 @@ /** this is for update trans - return false */ public boolean isUpdateForCharField(CharField cf) { return false; } + public OBOClass getNewTerm() { return null; } + } Modified: phenote/trunk/src/java/phenote/edit/CharChangeEvent.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2007-03-21 01:27:17 UTC (rev 411) +++ phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2007-03-22 16:35:31 UTC (rev 412) @@ -19,7 +19,7 @@ public OBOClass getNewTerm() { return transaction.getNewTerm(); } - public String getNewValueString() { return transaction.getNewValueString(); } + //public String getNewValueString() { return transaction.getNewValueString(); } public boolean isUpdate() { return transaction.isUpdate(); } Modified: phenote/trunk/src/java/phenote/edit/DeleteTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2007-03-21 01:27:17 UTC (rev 411) +++ phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2007-03-22 16:35:31 UTC (rev 412) @@ -1,5 +1,7 @@ package phenote.edit; +import org.geneontology.oboedit.datamodel.OBOClass; + import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; import phenote.dataadapter.CharacterListManager; @@ -32,5 +34,6 @@ return CharacterListManager.inst().getCharacterList(); } + public OBOClass getNewTerm() { return null; } } Modified: phenote/trunk/src/java/phenote/edit/TransactionI.java =================================================================== --- phenote/trunk/src/java/phenote/edit/TransactionI.java 2007-03-21 01:27:17 UTC (rev 411) +++ phenote/trunk/src/java/phenote/edit/TransactionI.java 2007-03-22 16:35:31 UTC (rev 412) @@ -13,7 +13,7 @@ public OBOClass getNewTerm(); - public String getNewValueString(); + //public String getNewValueString(); public boolean isUpdate(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nl...@us...> - 2007-03-21 01:27:19
|
Revision: 411 http://svn.sourceforge.net/obo/?rev=411&view=rev Author: nlw Date: 2007-03-20 18:27:17 -0700 (Tue, 20 Mar 2007) Log Message: ----------- added term history window which displays a set of links to recently used ontology terms. these are presented to the user in reverse order (most recently used first). phenote will work just fine if these links aren't followed. note that 'use term' is buggy if the links are followed. Modified Paths: -------------- phenote/trunk/src/java/phenote/edit/CharChangeEvent.java phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/edit/TransactionI.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/TermInfo.java phenote/trunk/src/java/phenote/gui/field/FieldPanel.java phenote/trunk/src/java/phenote/gui/field/TermCompList.java phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java phenote/trunk/src/java/phenote/gui/selection/TermSelectionEvent.java phenote/trunk/src/java/phenote/main/Phenote.java phenote/trunk/src/java/phenote/util/HtmlUtil.java Added Paths: ----------- phenote/trunk/src/java/phenote/gui/SelectionHistory.java Modified: phenote/trunk/src/java/phenote/edit/CharChangeEvent.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2007-03-21 01:27:17 UTC (rev 411) @@ -1,7 +1,7 @@ package phenote.edit; import java.util.EventObject; - +import org.geneontology.oboedit.datamodel.OBOClass; import phenote.datamodel.CharField; /** This actually is for a CharField change - rename this CharFieldChangeEvent? */ @@ -16,10 +16,15 @@ super(source); transaction = t; } + + public OBOClass getNewTerm() { return transaction.getNewTerm(); } + + public String getNewValueString() { return transaction.getNewValueString(); } public boolean isUpdate() { return transaction.isUpdate(); } - + public TransactionI getTransaction() {return transaction;} + public boolean isUpdateForCharField(CharField cf) { //return transaction.getCharFieldEnum() == cf.getCharFieldEnum(); //if (!transaction.isUpdate()) return false; Modified: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2007-03-21 01:27:17 UTC (rev 411) @@ -103,9 +103,24 @@ private boolean hasTransactions() { return !childTransactions.isEmpty(); } + + public OBOClass getNewTerm() { +// System.out.println("trying to get new term for compound transaction"); + if (firstChild().isUpdate()) + return firstChild().getNewTerm(); + else return null; + } private TransactionI firstChild() { if (!hasTransactions()) return null; // ex? return childTransactions.get(0); } + + public String getNewValueString() { return "blah blah blah";} + + + } + + + Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2007-03-21 01:27:17 UTC (rev 411) @@ -22,7 +22,7 @@ private List<CharChangeListener> charListeners = new ArrayList<CharChangeListener>(3); private List<TransactionI> transactionList = new ArrayList<TransactionI>(); - + private EditManager() {} public static EditManager inst() { @@ -50,11 +50,15 @@ return !transactionList.isEmpty(); // for now - no redo } - private TransactionI getCurrentTransaction() { + public TransactionI getCurrentTransaction() { // for now just return last one - eventually with redo do some tracking if (!haveUndoableTransaction()) return null; // ex? return transactionList.get(transactionList.size()-1); } + + public List<TransactionI> getTransactionList() { + return transactionList; + } // public void updateModel(Object source, UpdateTransaction ut) { // addTransaction(ut); Modified: phenote/trunk/src/java/phenote/edit/TransactionI.java =================================================================== --- phenote/trunk/src/java/phenote/edit/TransactionI.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/edit/TransactionI.java 2007-03-21 01:27:17 UTC (rev 411) @@ -1,16 +1,22 @@ package phenote.edit; import phenote.datamodel.CharField; +import org.geneontology.oboedit.datamodel.OBOClass; + // interface? class? public interface TransactionI { public void editModel(); public void undo(); + + public OBOClass getNewTerm(); + + public String getNewValueString(); public boolean isUpdate(); - + ///** this is actually update sepcific - but thats ok i think */ //public CharFieldEnum getCharFieldEnum(); public boolean isUpdateForCharField(CharField cf); Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2007-03-21 01:27:17 UTC (rev 411) @@ -62,7 +62,14 @@ /** return new value for regular trans, old value for undo? */ //String getValue() { // if undo } - does updateTrans know of undo??? not sure - String getNewValueString() { return newValue.getName(); } + public String getNewValueString() { return "blah blah blah";} + + public OBOClass getNewTerm() { +// System.out.println("trying to get new term"); + if (newValue.isTerm()) + return newValue.getTerm(); + else return null; + } // public boolean isUpdateForCharField(CharField cf) { // return getCharFieldEnum() == cf.getCharFieldEnum(); Added: phenote/trunk/src/java/phenote/gui/SelectionHistory.java =================================================================== --- phenote/trunk/src/java/phenote/gui/SelectionHistory.java (rev 0) +++ phenote/trunk/src/java/phenote/gui/SelectionHistory.java 2007-03-21 01:27:17 UTC (rev 411) @@ -0,0 +1,204 @@ +package phenote.gui; + +import java.util.ArrayList; +import java.util.List; +import java.net.URL; +import java.util.Iterator; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JEditorPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.text.JTextComponent; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import edu.stanford.ejalbert.BrowserLauncher; +import edu.stanford.ejalbert.BrowserLauncherRunner; +import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException; +import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException; + +import org.geneontology.oboedit.datamodel.OBOClass; + +import phenote.datamodel.CharacterI; +import phenote.datamodel.CharFieldEnum; +import phenote.datamodel.OntologyManager; +import phenote.datamodel.TermNotFoundException; +import phenote.edit.EditManager; +import phenote.edit.CharChangeEvent; +import phenote.edit.CharChangeListener; +import phenote.edit.UpdateTransaction; +import phenote.edit.TransactionI; +import phenote.util.HtmlUtil; +import phenote.gui.TermInfo; +import phenote.gui.selection.SelectionManager; +import phenote.gui.selection.TermSelectionEvent; +import phenote.gui.selection.TermSelectionListener; +import phenote.gui.selection.UseTermEvent; +import phenote.gui.selection.UseTermListener; + +public class SelectionHistory { + + //private JEditorPane textArea; + private JTextComponent textArea; + private static final boolean DO_HTML = HtmlUtil.DO_HTML; + private TermHyperlinkListener termHyperlinkListener; + // current obo class being navigated + private OBOClass currentOboClass; + private TermInfo termInfo; + + public SelectionHistory() { //TermPanel termPanel) { + EditManager.inst().addCharChangeListener(new HistorySelectionListener()); + } + +// public SelectionHistory() { //TermPanel termPanel) { +// SelectionManager.inst().addTermSelectionListener(new HistorySelectionListener()); +// } + + + public JComponent getComponent() { + JPanel termHistoryPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap + termHistoryPanel.setPreferredSize(new Dimension(200,100)); + termHistoryPanel.setMinimumSize(new Dimension(100,100)); + if (DO_HTML) { + JEditorPane editorPane = new JEditorPane(); + editorPane.setContentType("text/html"); // sets up HTMLEditorKit + termHyperlinkListener = new TermHyperlinkListener(); + editorPane.addHyperlinkListener(termHyperlinkListener); + textArea = editorPane; + } + else { // pase - delete? + JTextArea jTextArea = new JTextArea(17,50); + jTextArea.setLineWrap(true); + jTextArea.setWrapStyleWord(true); + textArea = jTextArea; + } + textArea.setEditable(false); + JScrollPane scrollPane = new JScrollPane(textArea); + scrollPane.setPreferredSize(new Dimension(400,300)); + scrollPane.setMaximumSize(new Dimension(400,300)); + // border - make JPanel for it (there is a disclaimer about non JPanel) + //scrollPane.setBorder(BorderFactory.createTitledBorder("Term Info")); + termHistoryPanel.setBorder(BorderFactory.createTitledBorder("Term History")); + termHistoryPanel.add(scrollPane,BorderLayout.CENTER); + + return termHistoryPanel; + } + + + // for TestPhenote + String getText() { return textArea.getText(); } + + void setOboClass(OBOClass term) { + // actually i think null is valid for non-required fields - undo & blanking field + // right even if required field should still be able to undo back to init/null +// if (term == null) { +// log().error("Attempt to set term to null"); +// return; // debug stack trace? +// } + currentOboClass = term; + String val = term == null ? "" : term.getName(); +// setText(val,false); // no completion + } + + + /* creating a list of links from the transaction history */ + private void setHistoryFromList(List<TransactionI> transList) { + String html = ""; + //will move this into HtmlUtil shortly... + for (int i=transList.size(); i>0; i--) + { + OBOClass term = transList.get(i-1).getNewTerm(); + if (term!=null) + html = html + "<br>"+HtmlUtil.termLink(term); + } + textArea.setText(html); + textArea.setCaretPosition(0); + } + + /** Listen for selection from phenote (mouse over completion list) */ + //need to make sure this is also recording the "use term" events + + private SelectionManager getSelectionManager() { + return SelectionManager.inst(); + } + + private EditManager getEditManager() { + return EditManager.inst(); + } + +private class HistorySelectionListener implements CharChangeListener { + public void charChanged(CharChangeEvent e) { + if (e.isUpdate()) { + EditManager em = getEditManager(); + List<TransactionI> transList = em.getTransactionList(); + String html=""; + setHistoryFromList(transList); + } + } +} + +// private class HistorySelectionListener implements TermSelectionListener { +// public boolean termSelected(TermSelectionEvent e) { +//// System.out.println("link = "+e.isHyperlinkEvent()); +// if (e.isMouseOverEvent() ) return false; +// setHistoryFromList(e.getOboClass()); +// return true; +// } +// } + private UseTermListener useTermListener; + private UseTermListener getUseTermListener() { + if (useTermListener == null) useTermListener = new HistoryUseTermListener(); + return useTermListener; + } + /** Listens for UseTermEvents from term info,if editModel is true then edits model*/ + private class HistoryUseTermListener implements UseTermListener { + public void useTerm(UseTermEvent e) { + currentOboClass = e.getTerm(); +// System.out.println("term = "+currentOboClass.getName()); +// if (editModelEnabled()) editModel(); + } + } + + + + //listens for clicks on the links, and then brings up the term in termInfo + private class TermHyperlinkListener implements HyperlinkListener { + + public void hyperlinkUpdate(HyperlinkEvent e) { + if (!(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)) + return; + + // internal link to term... + if (HtmlUtil.isPhenoteLink(e)) { + bringUpTermInTermInfo(e); + return; + } + } + private void bringUpTermInTermInfo(HyperlinkEvent e) { + // or do through obo session? + String id = HtmlUtil.getIdFromHyperlink(e); +// System.out.println("link to *"+id+"* selected"); + if (id == null) return; + try { + OBOClass term = OntologyManager.inst().getOboClass(id); // ex + currentOboClass = term; + // send out term selection (non mouse over) for DAG view + Object src = SelectionHistory.this; +// getSelectionManager().selectHistoryTerm(src, term, getUseTermListener()); + getSelectionManager().selectMouseOverTerm(src,term,getUseTermListener()); + } + catch (TermNotFoundException ex) { return; } + } + } +} Modified: phenote/trunk/src/java/phenote/gui/TermInfo.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermInfo.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/gui/TermInfo.java 2007-03-21 01:27:17 UTC (rev 411) @@ -58,7 +58,7 @@ public JComponent getComponent() { JPanel termInfoPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap - termInfoPanel.setPreferredSize(new Dimension(700,100)); + termInfoPanel.setPreferredSize(new Dimension(400,100)); termInfoPanel.setMinimumSize(new Dimension(380,100)); //termInfoPanel.setMaximumSize(new Dimension(380,400)); if (DO_HTML) { @@ -119,7 +119,8 @@ /** Listen for selection from phenote (mouse over completion list) */ private class InfoTermSelectionListener implements TermSelectionListener { public boolean termSelected(TermSelectionEvent e) { - if (!e.isMouseOverEvent()) return false; + + if (!e.isMouseOverEvent() ) return false; setTextFromOboClass(e.getOboClass()); // This sets who now listens to use term button clicks (only 1 listener) setUseTermListener(e.getUseTermListener()); @@ -188,7 +189,7 @@ OBOClass term = OntologyManager.inst().getOboClass(id); // ex setTextFromOboClass(term); // send out term selection (non mouse over) for DAG view - SelectionManager.inst().selectTerm(TermInfo.this, term); + SelectionManager.inst().selectTerm(TermInfo.this, term, true); } catch (TermNotFoundException ex) { return; } } Modified: phenote/trunk/src/java/phenote/gui/field/FieldPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-21 01:27:17 UTC (rev 411) @@ -47,7 +47,7 @@ private void initGui() { // should figure y from # of fields really!!! yes!!! // width of ontology labels effects x - this.setMinimumSize(new Dimension(730,490));//690,490)); + this.setMinimumSize(new Dimension(700,490));//690,490)); //this.setPreferredSize(new Dimension(2000,750)); // irrelevant in box layout //this.setMaximumSize(new Dimension(2000,750)); BoxLayout bl = new BoxLayout(this,BoxLayout.X_AXIS); // grid bag? Modified: phenote/trunk/src/java/phenote/gui/field/TermCompList.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/TermCompList.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/gui/field/TermCompList.java 2007-03-21 01:27:17 UTC (rev 411) @@ -84,7 +84,7 @@ protected void setCurrentValidItem() throws OboException { setOboClass(getSelectedOboClass()); //this will set text to oboclass // send out selection event that is NOT a mouse over event (for DAG view) - SelectionManager.inst().selectTerm(this, getSelectedOboClass()); + SelectionManager.inst().selectTerm(this, getSelectedOboClass(), false); } protected String getCurrentTermRelName() { Modified: phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java =================================================================== --- phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java 2007-03-21 01:27:17 UTC (rev 411) @@ -35,16 +35,25 @@ // void addCharacterSelectionListener(CharacterSelectionListener l) {} + public void selectHistoryTerm(Object source, OBOClass oboClass, UseTermListener l) { + boolean isMouseOver = false; + boolean isHyperlink = true; + TermSelectionEvent e = makeTermEvent(source, oboClass, l, isMouseOver, isHyperlink); + fireSelect(e); + } + public void selectMouseOverTerm(Object source, OBOClass oboClass,UseTermListener l) { boolean isMouseOver = true; - TermSelectionEvent e = makeTermEvent(source,oboClass,l,isMouseOver); + boolean isHyperlink = false; + TermSelectionEvent e = makeTermEvent(source,oboClass,l,isMouseOver,isHyperlink); fireSelect(e); } - public void selectTerm(Object source,OBOClass oboClass) { + public void selectTerm(Object source,OBOClass oboClass, boolean isHyperlink) { boolean isMouseOver = false; - TermSelectionEvent e = makeTermEvent(source,oboClass,null,isMouseOver); - fireSelect(e); +// System.out.println("ishyperlink="+isHyperlink); + TermSelectionEvent e = makeTermEvent(source,oboClass,null,isMouseOver, isHyperlink); + if (!isHyperlink) fireSelect(e); } private void fireSelect(TermSelectionEvent e) { @@ -56,8 +65,8 @@ // void selectTerm(String termName) {} ??? - private TermSelectionEvent makeTermEvent(Object src, OBOClass oc,UseTermListener l,boolean mouse) { - return new TermSelectionEvent(src,oc,l,mouse); + private TermSelectionEvent makeTermEvent(Object src, OBOClass oc,UseTermListener l,boolean mouse, boolean link) { + return new TermSelectionEvent(src,oc,l,mouse,link); } public CharacterI getFirstSelectedCharacter() { Modified: phenote/trunk/src/java/phenote/gui/selection/TermSelectionEvent.java =================================================================== --- phenote/trunk/src/java/phenote/gui/selection/TermSelectionEvent.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/gui/selection/TermSelectionEvent.java 2007-03-21 01:27:17 UTC (rev 411) @@ -9,12 +9,15 @@ private OBOClass oboClass; private UseTermListener useTermListener; private boolean isMouseOverEvent; + private boolean isHyperlinkEvent; - TermSelectionEvent(Object source, OBOClass oboClass, UseTermListener utl,boolean isMouse) { + TermSelectionEvent(Object source, OBOClass oboClass, UseTermListener utl, + boolean isMouse, boolean isHyperlink) { super(source); this.oboClass = oboClass; useTermListener = utl; isMouseOverEvent = isMouse; + isHyperlink = isHyperlink; } public OBOClass getOboClass() { return oboClass; } @@ -22,4 +25,6 @@ public UseTermListener getUseTermListener() { return useTermListener; } public boolean isMouseOverEvent() { return isMouseOverEvent; } + + public boolean isHyperlinkEvent() { return isHyperlinkEvent; } } Modified: phenote/trunk/src/java/phenote/main/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/main/Phenote.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/main/Phenote.java 2007-03-21 01:27:17 UTC (rev 411) @@ -28,6 +28,7 @@ import phenote.gui.GridBagUtil; import phenote.gui.MenuManager; import phenote.gui.TermInfo; +import phenote.gui.SelectionHistory; import phenote.gui.field.FieldPanel; public class Phenote { @@ -40,6 +41,7 @@ private FieldPanel fieldPanel; private static Phenote phenote; private TermInfo termInfo; + private SelectionHistory selectionHistory; private CommandLine commandLine = CommandLine.inst(); private JFrame frame; @@ -133,7 +135,7 @@ frame = new JFrame("Phenote "+PhenoteVersion.versionString()); frame.getContentPane().add(makeMainPanel()); MenuManager.createMenuManager(frame); - frame.setPreferredSize(new Dimension(1130,700)); //1100,700)); + frame.setPreferredSize(new Dimension(1200,700)); //1100,700)); if (standalone) // if stand alone exit java on window close frame.addWindowListener(new WindowExit()); frame.pack(); @@ -165,6 +167,9 @@ termInfo = new TermInfo(); //fieldPanel); upperPanel.add(termInfo.getComponent()); + + selectionHistory = new SelectionHistory(); + upperPanel.add(selectionHistory.getComponent()); //++gbc.gridx; // ?? //gbc.anchor = GridBagConstraints.NORTHWEST; // ?? //mainPanel.add(termInfo.getComponent(),gbc); Modified: phenote/trunk/src/java/phenote/util/HtmlUtil.java =================================================================== --- phenote/trunk/src/java/phenote/util/HtmlUtil.java 2007-03-20 19:59:42 UTC (rev 410) +++ phenote/trunk/src/java/phenote/util/HtmlUtil.java 2007-03-21 01:27:17 UTC (rev 411) @@ -245,7 +245,7 @@ //sb.append(makeRightCol(termLink(link.getParent()))); } - private static String termLink(LinkedObject term) { + public static String termLink(LinkedObject term) { String clickString = getClickString(term.getID(),term.getName()); //System.out.println(clickString); return "<a "+clickString+">"+term.getName()+"</a>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nl...@us...> - 2007-03-20 19:59:51
|
Revision: 410 http://svn.sourceforge.net/obo/?rev=410&view=rev Author: nlw Date: 2007-03-20 12:59:42 -0700 (Tue, 20 Mar 2007) Log Message: ----------- fixed bug which affected the read of phenosyntax...has to do with stripping quotes... was affected with changes to remove the extra space. Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2007-03-20 16:41:39 UTC (rev 409) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2007-03-20 19:59:42 UTC (rev 410) @@ -132,7 +132,9 @@ private String stripQuotesFromFreeText(String value,CharField cf) { if (!isFreeText(cf)) return value; if (value.startsWith(q)) value = value.substring(1); - if (value.endsWith(q)) value = value.substring(0,value.length()-2); + // if (value.endsWith(q)) value = value.substring(0,value.length()-2); + // changed this to "-1" because it was messing up the reader + if (value.endsWith(q)) value = value.substring(0,value.length()-1); return value; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nl...@us...> - 2007-03-20 16:44:03
|
Revision: 409 http://svn.sourceforge.net/obo/?rev=409&view=rev Author: nlw Date: 2007-03-20 09:41:39 -0700 (Tue, 20 Mar 2007) Log Message: ----------- added the tab delimited data adapter to these config files Modified Paths: -------------- phenote/trunk/conf/go-function-process.cfg phenote/trunk/conf/mp-xp.cfg phenote/trunk/conf/nicole.cfg phenote/trunk/conf/zfin-standalone.cfg Modified: phenote/trunk/conf/go-function-process.cfg =================================================================== --- phenote/trunk/conf/go-function-process.cfg 2007-03-19 22:25:19 UTC (rev 408) +++ phenote/trunk/conf/go-function-process.cfg 2007-03-20 16:41:39 UTC (rev 409) @@ -3,6 +3,7 @@ <dataadapter name="phenosyntax" enable="true"/> <dataadapter name="phenoxml" enable="true"/> + <dataadapter name="delimited" enable="true"/> <log config-file="conf/log4j-standalone.xml" /> Modified: phenote/trunk/conf/mp-xp.cfg =================================================================== --- phenote/trunk/conf/mp-xp.cfg 2007-03-19 22:25:19 UTC (rev 408) +++ phenote/trunk/conf/mp-xp.cfg 2007-03-20 16:41:39 UTC (rev 409) @@ -3,6 +3,7 @@ <dataadapter name="phenosyntax" enable="true"/> <dataadapter name="phenoxml" enable="true"/> + <dataadapter name="delimited" enable="true"/> <log config-file="conf/log4j-standalone.xml" /> Modified: phenote/trunk/conf/nicole.cfg =================================================================== --- phenote/trunk/conf/nicole.cfg 2007-03-19 22:25:19 UTC (rev 408) +++ phenote/trunk/conf/nicole.cfg 2007-03-20 16:41:39 UTC (rev 409) @@ -3,6 +3,7 @@ <dataadapter name="phenosyntax" enable="true"/> <dataadapter name="phenoxml" enable="true"/> + <dataadapter name="delimited" enable="true"/> <log config-file="conf/log4j-standalone.xml" /> Modified: phenote/trunk/conf/zfin-standalone.cfg =================================================================== --- phenote/trunk/conf/zfin-standalone.cfg 2007-03-19 22:25:19 UTC (rev 408) +++ phenote/trunk/conf/zfin-standalone.cfg 2007-03-20 16:41:39 UTC (rev 409) @@ -4,6 +4,7 @@ enable="true"/> <dataadapter name="phenote.dataadapter.phenoxml.PhenoXmlAdapter" enable="true"/> <dataadapter name="phenote.dataadapter.nexus.NEXUSAdapter" enable="true"/> + <dataadapter name="phenote.dataadapter.delimited.DelimitedFileAdapter" enable="true"/> <log config-file="conf/log4j-standalone.xml"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-20 01:46:20
|
Revision: 408 http://svn.sourceforge.net/obo/?rev=408&view=rev Author: mgibson Date: 2007-03-19 15:25:19 -0700 (Mon, 19 Mar 2007) Log Message: ----------- dveloper docs - should this just go in docs dir ?? Added Paths: ----------- phenote/trunk/doc/phenote-website/developer-docs/developer-docs.html Added: phenote/trunk/doc/phenote-website/developer-docs/developer-docs.html =================================================================== --- phenote/trunk/doc/phenote-website/developer-docs/developer-docs.html (rev 0) +++ phenote/trunk/doc/phenote-website/developer-docs/developer-docs.html 2007-03-19 22:25:19 UTC (rev 408) @@ -0,0 +1,23 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + <title>Developer docs</title> +</head> +<body> +<h3><span style="text-decoration: underline;">Editing the model</span></h3> +So a phenote.edit.CharChangeEvent has a phenote.edit.TransactionI. <br> +so when a gui component like CharFieldGui wants to edit the model +it calls a method on the EditManager. For instance, for updating +multiple fields at once CharFieldGui makes a bunch of +UpdateTransactions adds them to a CompoundTransaction and sends the +CompoundTransaction to EditManager.updateModel(). updateModel calls +editModel() on the CompoundTransaction (which actually edits the +model), +make a CharChangeEvent with the transaction and sends out the +CharChangeEvent out to CharChangeListeners notifying them that the +model has been changed, and adds the transaction to its list of +transactions (for undo).<br> +A phenote.edit.TransactionI knows how to edit and undo its edit to the datamodel. +</body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cmu...@us...> - 2007-03-18 12:04:55
|
Revision: 407 http://svn.sourceforge.net/obo/?rev=407&view=rev Author: cmungall Date: 2007-03-16 22:53:44 -0700 (Fri, 16 Mar 2007) Log Message: ----------- Modified Paths: -------------- obo-database/trunk/bin/obd-load-db-from-obo.pl obo-database/trunk/sql/obd-core-schema.sql obo-database/trunk/sql/obd-core-views.sql Added Paths: ----------- obo-database/trunk/sql/obd-core-util.sql Modified: obo-database/trunk/bin/obd-load-db-from-obo.pl =================================================================== --- obo-database/trunk/bin/obd-load-db-from-obo.pl 2007-03-16 13:52:03 UTC (rev 406) +++ obo-database/trunk/bin/obd-load-db-from-obo.pl 2007-03-17 05:53:44 UTC (rev 407) @@ -92,5 +92,8 @@ print STDERR "SQL: $sql\n"; $dbh->do($sql); } + foreach (qw(node_id predicate_id object_id)) { + $dbh->do("DELETE FROM link WHERE is_inferred='t' AND node_id IN (SELECT node_id FROM node WHERE source_id=$source)") + } } } Modified: obo-database/trunk/sql/obd-core-schema.sql =================================================================== --- obo-database/trunk/sql/obd-core-schema.sql 2007-03-16 13:52:03 UTC (rev 406) +++ obo-database/trunk/sql/obd-core-schema.sql 2007-03-17 05:53:44 UTC (rev 407) @@ -82,6 +82,7 @@ CREATE INDEX link_node_predicate_indx ON link(node_id,predicate_id); CREATE INDEX link_predicate_object_indx ON link(predicate_id,object_id); CREATE INDEX link_reiflink_node_indx ON link(reiflink_node_id); +CREATE INDEX link_is_inferred_reiflink_node_indx ON link(is_inferred,reiflink_node_id); CREATE INDEX link_triple_indx ON link(node_id,predicate_id,object_id); CREATE TABLE link_inference ( Added: obo-database/trunk/sql/obd-core-util.sql =================================================================== --- obo-database/trunk/sql/obd-core-util.sql (rev 0) +++ obo-database/trunk/sql/obd-core-util.sql 2007-03-17 05:53:44 UTC (rev 407) @@ -0,0 +1 @@ +UPDATE link SET predicate_id = $is_a WHERE predicate_id IN (SELECT node_id FROM node WHERE uid='is_a'); Modified: obo-database/trunk/sql/obd-core-views.sql =================================================================== --- obo-database/trunk/sql/obd-core-views.sql 2007-03-16 13:52:03 UTC (rev 406) +++ obo-database/trunk/sql/obd-core-views.sql 2007-03-17 05:53:44 UTC (rev 407) @@ -71,15 +71,41 @@ part_of astrocyte'; CREATE OR REPLACE VIEW union_link AS SELECT * FROM link WHERE combinator='U'; -CREATE OR REPLACE VIEW basic_link AS SELECT * FROM link WHERE combinator=''; +COMMENT ON VIEW union_link IS 'A link that forms part of an +union equivalence declaration. All union_links for a node N are +combined together, and the combination of links defines N. Examples: +the node representing "thymine or guanine" may be formed of a +union_link to guanine and an union_link to thymine'; + +CREATE OR REPLACE VIEW standard_link AS SELECT * FROM link WHERE combinator=''; +COMMENT ON VIEW standard_link IS 'A link without union or intersection conditions'; + +--CREATE OR REPLACE VIEW nc_link AS SELECT * FROM link WHERE combinator=''; +--COMMENT ON VIEW nc_link IS 'A link stating a condition that is +--necessary for the node. These are "normal" DAG links, such as cell +--nucleus part_of cell (which is necessarily true for all cell nuclei)'; + +CREATE OR REPLACE VIEW inheritable_link AS SELECT * FROM link WHERE combinator!='U'; -- AND is_negated='f'; + +CREATE OR REPLACE VIEW reified_link AS SELECT * FROM link WHERE reiflink_node_id IS NOT NULL; +COMMENT ON VIEW reified_link IS 'A link that has a link pointing to it'; + + -- instance_of CREATE OR REPLACE VIEW instance_of_relation AS SELECT * FROM relation_node WHERE uid='OBO_REL:instance_of'; +COMMENT ON VIEW instance_of_relation IS 'A relation node for the OBO_REL relation "instance_of"'; + CREATE OR REPLACE VIEW instantiation_link AS SELECT link.* FROM link INNER JOIN instance_of_relation ON (predicate_id=instance_of_relation.node_id); +COMMENT ON VIEW instantiation_link IS 'A link of type "instance_of" between an instance and a class'; + CREATE OR REPLACE VIEW asserted_instantiation_link AS SELECT * FROM instantiation_link WHERE is_inferred='f'; +COMMENT ON VIEW asserted_instantiation_link IS 'An instantiation link that is asserted (not implied/inferred)'; + CREATE OR REPLACE VIEW implied_instantiation_link AS SELECT * FROM instantiation_link WHERE is_inferred='t'; +COMMENT ON VIEW implied_instantiation_link IS 'An instantiation link that is inferred (not asserted directly)'; -- is_a CREATE OR REPLACE VIEW is_a_relation AS SELECT * FROM relation_node WHERE uid='OBO_REL:is_a'; @@ -104,9 +130,39 @@ CREATE OR REPLACE VIEW differentium_link AS SELECT link.* - FROM link INNER JOIN non_is_a_relation ON (predicate_id=non_is_a_relation.node_id) - WHERE combinator='I'; + FROM link + WHERE combinator='I' + AND predicate_id NOT IN (SELECT node_id FROM is_a_relation); +CREATE OR REPLACE VIEW genus_link_to_node AS + SELECT genus_link.*, + obj.uid AS object_uid, + obj.label AS object_label, + obj.source_id AS object_source_id, + obj.metatype AS object_metatype + FROM genus_link + INNER JOIN node AS obj ON (genus_link.object_id=obj.node_id); + +CREATE OR REPLACE VIEW differentium_link_to_node AS + SELECT differentium_link.*, + obj.uid AS object_uid, + obj.label AS object_label, + obj.source_id AS object_source_id, + obj.metatype AS object_metatype + FROM differentium_link + INNER JOIN node AS obj ON (differentium_link.object_id=obj.node_id); + +CREATE OR REPLACE VIEW differentium_link_to_label AS + SELECT + dl.*, + pred.uid AS pred_uid, + pred.label AS pred_label, + pred.label || ' ' || dl.object_label AS differentium_label + FROM + differentium_link_to_node AS dl + INNER JOIN node AS pred ON (dl.predicate_id=pred.node_id); + + -- ************************************************************ -- JOINS -- ************************************************************ @@ -315,7 +371,7 @@ SELECT source.uid,source.label, pred.uid AS pred_uid, pred.label AS pred_label,count(link.link_id) FROM link LEFT OUTER JOIN node AS source ON (link.source_id=source.node_id) INNER JOIN node AS pred ON (pred.node_id=link.predicate_id) - GROUP BY source.uid,source.label,pred.uid,pred.label + GROUP BY source.uid,source.label,pred.uid,pred.label; CREATE OR REPLACE VIEW linkcount_by_node_source AS SELECT source.uid,source.label, count(link.link_id) @@ -374,3 +430,65 @@ FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) GROUP BY node.metatype,source.uid,source.label; +-- ************************************************************ +-- INFORMATION CONTENT +-- ************************************************************ + +-- reification is not propagated so we use this +-- NOTE: currently propagates over ALL relations.. TODO fix +CREATE OR REPLACE VIEW implied_annotation_link AS + SELECT + alink.node_id, + alink.predicate_id, + ilink.object_id + FROM + reified_link AS alink + INNER JOIN link AS ilink ON (alink.object_id=ilink.node_id) + WHERE + alink.is_inferred='f'; -- asserted annotation + +CREATE OR REPLACE VIEW count_of_annotated_entity AS + SELECT + count(DISTINCT object_id) AS total + FROM + asserted_link + WHERE + reiflink_node_id IS NOT NULL; + +CREATE OR REPLACE VIEW count_of_annotated_entity_by_class_node_and_evidence AS + SELECT + ial.object_id AS node_id, + CAST(NULL AS INT) AS evidence_id, + count(DISTINCT ial.node_id) AS total + FROM + implied_annotation_link AS ial + GROUP BY ial.object_id; + +-- I(Cn) = -log2 p(Cn) +CREATE OR REPLACE VIEW class_node_entropy_by_evidence AS + SELECT + node_id, +-- evidence_id, + - log(cast(tbc.total AS float) / t.total) / log(2) AS shannon_information + FROM + count_of_annotated_entity_by_class_node_and_evidence AS tbc, + count_of_annotated_entity AS t; + + +CREATE OR REPLACE VIEW class_node_entropy_by_evidence_with_auto_label AS + SELECT + *, + node_auto_label(node_id) AS label + FROM + class_node_entropy_by_evidence; + +CREATE OR REPLACE VIEW class_node_entropy_by_evidence_with_node_and_auto_label AS + SELECT + class_node_entropy_by_evidence.*, + node.uid AS uid, + node_auto_label(node_id) AS label + FROM + class_node_entropy_by_evidence + INNER JOIN node USING (node_id); + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-16 13:53:38
|
Revision: 406 http://svn.sourceforge.net/obo/?rev=406&view=rev Author: mgibson Date: 2007-03-16 06:52:03 -0700 (Fri, 16 Mar 2007) Log Message: ----------- docs for new queryableDatAdapterI for worm Modified Paths: -------------- phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html Modified: phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html =================================================================== --- phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html 2007-03-15 20:16:27 UTC (rev 405) +++ phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html 2007-03-16 13:52:03 UTC (rev 406) @@ -3,13 +3,17 @@ <head> + + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + + <title>Creating a phenote data adapter - developer docs</title> </head> @@ -17,80 +21,142 @@ <body> + <h1 style="text-decoration: underline; text-align: center;">Creating a Phenote Data Adapter</h1> + First off if youve just downloaded phenote from sourceforge obo svn, the (latest) source is located in phenote/trunk/src/java. The most important subdirectories under src/java for creating a data adapter are phenote/dataadapter and phenote/datamodel. <br> + <br> + A good example data adapter to check out is phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter<br> + <br> +<h3><span style="text-decoration: underline;">File Adapter</span></h3> +The interface that a phenote file data adapter implements is +phenote.dataadapter.DataAdapterI (which im going to rename +FileDataAdapterI), and here is what it looks like:<br> -The interface that a phenote data adapter implements is phenote.dataadapter.DataAdapterI, and here is what it looks like:<br> - <br> + public interface DataAdapterI {<br> + <br> + public void load();<br> + public CharacterListI load(File f);<br> + <br> + public void commit(CharacterListI charList);<br> + public void commit(CharacterListI charList, File f);<br> + <br> + /** Set value to use for loading or writeback, for a file adapter this would be<br> + the file name */<br> + public void setAdapterValue(String adapterValue);<br> + public List<String> getExtensions();<br> + public String getDescription();<br> + }<br> + <br> -The most important methods are load() and commit(charList). - load() will be called by phenote to load up a -phenote.datamodel.CharacterListI. A CharacterListI is just a list of + +The most important methods are load and commit. + load()/load(File) will be called by phenote to load up a +phenote.datamodel.CharacterListI (see below)<br> +<br> +<h3><span style="text-decoration: underline;">Queryable Data Adapter</span></h3> +The other kind of data adapter is the queryable data adapter. Typically +this is a data adapter hooked into a database. Here is +phenote.dataadapter.QueryableDataadapterI interface:<br> +<br> +public interface QueryableDataAdapterI {<br> + /** return true if data adapter can query for the char field */<br> + public boolean isFieldQueryable(String field);<br> + /** Throws exception if query fails, and no data to return */<br> + public CharacterListI query(String field, String query) throws DataAdapterEx;<br> +}<br> +<br> +isFieldQueryable returns true for strings of fields that are queryable +through this adapter. The paradigm here is that one queries the adapter +with a field name and value. For instance you can query the pub field +with pub id value MED:1234, and ideally the adapter would return a +CharacterList of all the characters (phenotypic statments) for that +publication in the database. Another common example is querying by +genotype or allele.<br> +<br> +The phenote gui actually queries the QueryableDataAdapter and for every +field that is queryable it puts a "Retrieve" button next to the field. + A user will then fill in that field (e.g. MED:1234 in pub field) +and hit the retrieve button. The gui will then call the +QueryableDataAdapters query method with the name of the field ("Pub") +and the query string ("Med:1234"). The QueryableDataAdapterI should +then return a CharacterList using this query, which will then be loaded +into phenote.<br> +(todo: if there is unsaved data, phenote should ask if the user wants to save before loading). +<br> + +<h2><span style="text-decoration: underline;">Reading in data</span></h2> + + + + A CharacterListI is just a list of phenote.datamodel.Characters. A Character is basically a phenotypic statement (relating E,Q,genotype, etc...). So basically what a data adapter needs to produce is a list of characters. <br> + <br> + A Character is just a set of tag-value fields, where the tag is the name of the field (Entity, Quality, Genotype...), and value is the value of the field. The actual names of the fields come from the @@ -105,65 +171,89 @@ addition to making a data adapter you need to make a configuration that fits with it (or make sure it fits with an existing configuration).<br> <br> -<h2><span style="text-decoration: underline;">Reading in data</span></h2> +To set a field in a character use:<br> - To set a field in a character use:<br> - setValue(CharField cf, String valueString) which throws a phenote.datamodel.TermNotFoundException if the valueString is not found in the ontologies associated with the CharField(via configuration)<br> + where phenote.datamodel.CharField is an object that represents a field in a character. To get a char field you can call <br> + getCharFieldForName(String fieldName) which throws a phenote.datamodel.CharFieldException if you give it a string that is not from the configuration. Ok even better I just combined this into one convenience method:<br> + setValue(String fieldString, String valueString) throws TermNotFoundException, CharFieldException.<br> + For fields with ontologies (with term completion) the valueString has to be the id for the term (not the term name)<br> + <br> + So thats basically it for making characters. Some code might look like this:<br> + <br> + try {<br> + Character c = new Character();<br> + c.setValue("Entity","GO:123");<br> + c.setValue("Quality","PATO:345");<br> + c.setValue("Genotype","somegenotypehere");<br> + ....<br> + } <br> + catch (CharFieldException e) {...} // may want to do this per field - error msg?<br> + catch (TermNotFoundException e) {...} // perhaps per field - error message?<br> + <br> + and for CharacterLists just add the characters made above to it:<br> + CharacterList cl = new CharacterList();<br> + cl.add(character1);<br> + cl.add(character2);<br> + ...<br> + <br> + <br> + <h2><span style="text-decoration: underline;">Writing out data</span></h2> + The CharacterList is passed into the commit method. Iterate through the list of CharacterI's. To get at a Characters field data just call character.getValueString(String fieldString). This throws a @@ -174,7 +264,9 @@ you can call getTerm(String fieldName). This returns an org.geneontology.oboedit.datamodel.OBOClass from the obo edit datamodel (I may eventually wrap this in a phenote object - not sure).<br> + <br> + You can also query the OntologyManager for all existing character fields with OntologyManager.inst().getCharFieldList() which returns a List<CharField>. You can then query whether the Character has a @@ -184,57 +276,91 @@ the free text string or the id of the field. You can also query if its a term with charFieldValue.isTerm() and if so get its OBOClass with getTerm().<br> + <br> + And thats about it. As you can see theres several way of getting at this data. Heres what some code may look like:<br> + <br> + for (CharacterI ch : characterList.getList()) {<br> + try {<br> + String genotype = ch.getValueString("Genotype");<br> + OBOClass entityTerm = ch.getTerm("Entity");<br> + OBOClass valueTerm = ch.getTerm("Value");<br> + <br> + // write this data out to data source...<br> + <br> + } catch (CharFieldException ex) { ...error processing... }<br> + <br> + This implies that Genotype, Entity, and Value are all in configuration file, and if not exception will be thrown.<br> + <br> + <br> + <br> + <br> + <br> + <br> + <span style="font-weight: bold;">ToDo/Changes needed to data adapter interface:</span><br> + Ok I just noticed that currently only load(file) and commit(charList,file) are being called via the LoadSaveManager - I will fix this pronto.<br> + So load & save from file menu has been directed to LoadSaveManager which is hardwired to files(Jim Balhoffs work for phenoxml,syntax, & nexus adapters - which are all file based - we havent had non-file yet). This wont work for database adapters and needs a refactoring - I will get on this! <br> + <br> + load() should return a CharacterList not void! <br> + <br> + ##DONE Add method to Character for setting a field with just strings:<br> + setValue(String field, String value)<br> + <br> + refactor? should OBOClass be wrapped in a phenote class to detach phenote from obo edit?<br> + <br> + refactor note: Im wondering if the file stuff in DataAdapterI should be refactored - i could imagine a AdapterParam class or subclasses of DataAdapterI like FileDataAdapterI and DatabaseDatAdapterI and DataAdapterI would have methods like boolean isFileAdapter(), FileDataAdapter getFileDataAdpater() - need to think about this.<br> + <br> + refactor: phenote datamodel is eventually gonna also get hip to obo edits instance datamodel - however i think it will be under the covers and the above interface will remain the same. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nl...@us...> - 2007-03-15 20:16:30
|
Revision: 405 http://svn.sourceforge.net/obo/?rev=405&view=rev Author: nlw Date: 2007-03-15 13:16:27 -0700 (Thu, 15 Mar 2007) Log Message: ----------- *Added delimited writer. Now you can read & write tab-delimited files. *Added the .xls extension to this format. That way the user can directly import their delimited file into excel w/o any hastle. Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2007-03-15 20:11:28 UTC (rev 404) +++ phenote/trunk/src/java/phenote/config/Config.java 2007-03-15 20:16:27 UTC (rev 405) @@ -381,6 +381,18 @@ return fields; } + public List<CharField> getCharFieldsForDelimited(int colNum) throws ConfigException { + // cache in hash?? + List<CharField> fields = new ArrayList<CharField>(2); + for (FieldConfig fc : getFieldConfigList()) { + fields.add(getCharField(colNum)); + //return fc.getCharField(); + } + if (fields.isEmpty()) + throw new ConfigException("No Field configured"); + return fields; + } + public String getLabelForCharField(CharField cf) throws ConfigException { for (FieldConfig fc : getFieldConfigList()) { if (fc.hasCharField(cf)) Modified: phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java 2007-03-15 20:11:28 UTC (rev 404) +++ phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java 2007-03-15 20:16:27 UTC (rev 405) @@ -33,7 +33,7 @@ DelimitedChar(CharacterI ch) { character = ch; - delimiter = "\t"; + delimiter = "\t"; //delimiter is currently set to tab } // WRITE @@ -58,7 +58,7 @@ * 2) insert delimiter (initially "tab") between each field * 3) write each phenotype character on an individual line under headers. one PC for each * hard return - * should i include the config file on the first line? + * should i include the config file on the first line?...maybe in the future * */ private String makeDelimitedHeaderString() throws BadCharException { if (character == null) { // shouldnt happen @@ -72,11 +72,11 @@ for (CharField cf : OntologyManager.inst().getCharFieldList()) { //if its a free text field - only one col necessary. //if its an ontology field - need two cols (one for ID, the other for text) - sb.append(Config.inst().getSyntaxAbbrevForCharField(cf)); + sb.append(Config.inst().getLabelForCharField(cf)); //for now, i'll call on the syntax abbrev, but i'll want to use the acutal name if (!isFreeText(cf)) { sb.append(" ID").append(delimiter); - sb.append(Config.inst().getSyntaxAbbrevForCharField(cf)).append(" Name"); + sb.append(Config.inst().getLabelForCharField(cf)).append(" Name"); } sb.append(delimiter); } @@ -144,48 +144,36 @@ return term.getID() + delimiter + term.getName(); } -//********READ NOT YET IMPLEMENTED!!! // READ /** Parse syntax line into character */ + //try just splitting at tab. void parseLine(String line) throws SyntaxParseException { - character = new Character(); - Pattern p = Pattern.compile("\\S+=");//\\S+="); - Matcher m = p.matcher(line); - boolean found = m.find(); - if (!found) - throw new SyntaxParseException(line); // skips whitespace lines - int tagStart = m.start(); - int tagEnd = m.end(); - while (found) { - String tag = line.substring(tagStart,tagEnd-1); // -1 take off = - int valueStart = tagEnd; - // find next one will give end of value - found = m.find(); // if parsing last tag found will be false - at end - tagStart = found ? m.start() : line.length(); - if (found) tagEnd = m.end(); // dont need if not found (last one) - String value = line.substring(valueStart,tagStart).trim(); - value = stripComments(value).trim(); - //value = stripQuotesFromFreeText(value); // free text gets quoted - //System.out.println("tag ."+tag+". val ."+value+"."); - addTagValToChar(tag,value); - } - } + character = new Character(); +// System.out.println("input line="+line); + Pattern p = Pattern.compile("\t"); + //parse based on tab...will be delimiter in future + String[] items = p.split(line); + boolean found = (items.length>0); //m.find(); +// System.out.println("numcols="+items.length); + if (!found) + throw new SyntaxParseException(line); // skips whitespace lines + int colCount = 0; + int fieldCount = 0; + while (found) { + String value = items[colCount]; + addDelValToChar(fieldCount,value); + CharField c = Config.inst().getCharField(fieldCount); +// System.out.println("col="+colCount+"; fieldCount="+fieldCount+"; val="+value+"; charfieldname ="+c.getName()); + if (isOntology(c)) { + colCount++; //skip over the Name, only keep ID + } + colCount++; + fieldCount++; + found = (colCount<items.length); // if parsing last tag found will be false - at end + } + } - private String stripComments(String value) { - value = value.replaceAll("/\\*.*\\*/",""); - return value; - } - - private static final String q = "\""; - - private String stripQuotesFromFreeText(String value,CharField cf) { - if (!isFreeText(cf)) return value; - if (value.startsWith(q)) value = value.substring(1); - if (value.endsWith(q)) value = value.substring(0,value.length()-2); - return value; - } - class SyntaxParseException extends Exception { private String syntaxLine; SyntaxParseException(String syntaxLine) { @@ -198,58 +186,38 @@ } } - private void addTagValToChar(String tag, String value) { + + + private void addDelValToChar(int fieldNum, String value) { +// it doesn't really matter if there's a blank column in this mode if (value.equals("")) { - log().error("No value given for "+tag); - return; - } - +// log().error("No value given for column"+fieldNum); + return; //don't need to populate a CharField if no value + } OntologyManager om = OntologyManager.inst(); - try { - // so this is funny but there can be more than one char field for an abbrev - for - // instance Tag is for both abormal and absent. with setValue only the proper char - // field will get set, eg abnormal char field will throw exception for "absent" - List<CharField> fields = Config.inst().getCharFieldsForSyntaxAbbrev(tag);//Ex - for (CharField cf : fields) { - - value = stripQuotesFromFreeText(value,cf); + List<CharField> fields = Config.inst().getCharFieldsForDelimited(fieldNum);//Ex + // List<CharField> fields = Config.inst().getCharFieldsForSyntaxAbbrev(tag);//Ex - if (cf.getName().equals("Stage")) { - // todo - a general relationship extracter? - value = extractStageHack(value); // for now - fix for real later - } - try { + for (CharField cf : fields) { + try { + //System.out.println("column="+fieldNum+"; value = "+value); // set String -> for obo class automatically find term + //this assumes that you are loading data the same order you saved it character.setValue(cf,value); // throws TermNotFoundEx - return; // if no ex thrown were done + return; // if no ex thrown were done } catch (TermNotFoundException e) {} // do nothing - try next char field } } catch (ConfigException e) { log().error(e.getMessage()); } // field not found //catch (TermNotFoundException e) { - System.out.println("PhSynCh term not found "+value); + System.out.println("Error1: term not found ("+value+")"); //log().error(e.getMessage()); - log().error("Term not found "+value); // list char field? - //} - - + log().error("Error2: Term not found ("+value+")"); // list char field? + //} } - /** Stages come with rel - eg during(adult) - for now just assuming its during and ripping - off - in future need to read in rel, and store as relationship between Instances - (not OBOClasses!) - big refactor but go for it! - this extracts the "adult" in above example out of "during(adult)" - or alternatively just record relationship in CharFieldValue? */ - private String extractStageHack(String stageWithRel) { - Pattern p = Pattern.compile("during\\(([^\\)]+)\\)"); - Matcher m = p.matcher(stageWithRel); - if (m.matches()) - return m.group(1); - return stageWithRel; - } - CharacterI getCharacter() { return character; } private Logger log; @@ -258,43 +226,3 @@ return log; } } -// try { -// if (tag.equals("PUB")) -// character.setPub(value); -// else if (tag.equals("GT")) -// character.setGenotype(value); -// else if (tag.equals("GC")) -// character.setGeneticContext(om.getOboClassWithExcep(value)); // throws ex -// else if (tag.equals("E")) -// character.setEntity(om.getTermOrPostComp(value)); -// else if (tag.equals("Q")) -// character.setQuality(om.getOboClassWithExcep(value)); -// else // throw exception? or let rest of char go through? -// System.out.println("pheno syntax tag "+tag+" not recognized (value "+value+")"); -// } -// catch (OntologyManager.TermNotFoundException e) { -// log().error("Term not found for tag "+tag+" value "+value+" in loaded " -// +"ontologies - check syntax with ontology files."); -// return; -// } -// if (character.hasValue("Pub")) // hasPub -// sb.append("PUB=").append(character.getValueString("Pub")); //Pub()); -// // Genotype - not strictly part of pheno syntax but lets face it we need it -// // i would say its an omission from syntax -// //sb.append(" GT=").append(character.getGenotype()); -// if (character.hasValue("Genotype")) -// sb.append(" GT=").append(character.getValueString("Genotype")); -// if (character.hasValue("Genetic Context")) -// sb.append(" GC=").append(makeValue(character.getTerm("Genetic Context"))); - -// if (!character.hasValue("Entity")) -// throw new BadCharException("Error: character has no entity, ignoring"); -// //sb.append(" E=").append(makeValue(character.getEntity())); -// sb.append(" E=").append(makeValue(character.getTerm("Entity"))); - -// // if (character.hasValue(CharFieldEnum.STAGE)) - -// //if (character.getQuality() == null) -// if (!character.hasValue("Quality")) -// throw new BadCharException("Error: character has no quality, ignoring"); -// sb.append(" Q=").append(makeValue(character.getTerm("Quality"))); Modified: phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java 2007-03-15 20:11:28 UTC (rev 404) +++ phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java 2007-03-15 20:16:27 UTC (rev 405) @@ -26,7 +26,7 @@ private File previousFile; private File file; - private static String[] extensions = {"tab"}; + private static String[] extensions = {"tab", "xls"}; /** command line setting of file */ public void setAdapterValue(String filename) { @@ -36,50 +36,33 @@ /** this should return CharacterList and caller should load CharListMan or CLM makes the call itself? */ public void load() { - - if (file == null) - file = getFileFromUserForOpen(previousFile); - if (file == null) return; - previousFile = file; - try { - CharacterListI charList = new CharacterList(); - LineNumberReader lnr = new LineNumberReader(new FileReader(file)); - DelimitedChar synChar = new DelimitedChar(); - for (String line=lnr.readLine(); line != null; line = lnr.readLine()) { - try { - synChar.parseLine(line); - CharacterI ch = synChar.getCharacter(); - charList.add(ch); - } catch (DelimitedChar.SyntaxParseException e) { - System.out.println(e.getMessage()); // jut "" for whitespace line - } - } - CharacterListManager.inst().setCharacterList(this,charList); - lnr.close(); - } - catch (IOException e) { - System.out.println("Delimited read failure "+e); - } - file = null; // null it for next load/commit +//this doesn't seem to do anything } public CharacterListI load(File f) { - // this method temporarily duplicates code from load() - soon load() will be removed CharacterListI charList = new CharacterList(); try { - LineNumberReader lnr = new LineNumberReader(new FileReader(f)); - DelimitedChar synChar = new DelimitedChar(); - for (String line=lnr.readLine(); line != null; line = lnr.readLine()) { - try { - synChar.parseLine(line); - CharacterI ch = synChar.getCharacter(); - charList.add(ch); - } catch (DelimitedChar.SyntaxParseException e) { - System.out.println(e.getMessage()); // jut "" for whitespace line - } - } - lnr.close(); - } + LineNumberReader lnr = new LineNumberReader(new FileReader(f)); + DelimitedChar delChar = new DelimitedChar(); + System.out.println("Reading tab-delimited data from file "+f); + try { + String line=lnr.readLine(); //reading header line + System.out.println(line); + } catch (IOException e) { + System.out.println("Tab-delimited read failure "+e); + } + for (String line=lnr.readLine(); line != null; line = lnr.readLine()) { + try { + delChar.parseLine(line); + CharacterI ch = delChar.getCharacter(); + charList.add(ch); + System.out.println(line); + } catch (DelimitedChar.SyntaxParseException e) { + System.out.println(e.getMessage()); // jut "" for whitespace line + } + } + lnr.close(); + } catch (IOException e) { System.out.println("Tab-delimited read failure "+e); } @@ -150,7 +133,7 @@ } public String getDescription() { - return "Tab Delimited [.tab]"; + return "Tab Delimited [.tab, .xls]"; } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2007-03-15 20:11:28 UTC (rev 404) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2007-03-15 20:16:27 UTC (rev 405) @@ -62,7 +62,7 @@ if (isFreeText(cf)) sb.append('"'); // free text gets quoted sb.append(makeValue(character.getValue(cf))); if (isFreeText(cf)) sb.append("\" "); - sb.append("\n"); +// sb.append("\n"); } // check for entity & quality?? } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-15 20:11:27
|
Revision: 404 http://svn.sourceforge.net/obo/?rev=404&view=rev Author: mgibson Date: 2007-03-15 13:11:28 -0700 (Thu, 15 Mar 2007) Log Message: ----------- committing the preliminary worm.cfg using the stub of a data adapter WormAdapter Added Paths: ----------- phenote/trunk/conf/worm.cfg Added: phenote/trunk/conf/worm.cfg =================================================================== --- phenote/trunk/conf/worm.cfg (rev 0) +++ phenote/trunk/conf/worm.cfg 2007-03-15 20:11:28 UTC (rev 404) @@ -0,0 +1,41 @@ +<phenote-configuration version="1.1" xmlns="phenote/config/xml" xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance" schemaLocation="phenote-config.xsd"> + + <dataadapter name="phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter" + enable="true"/> + <dataadapter name="phenote.dataadapter.phenoxml.PhenoXmlAdapter" enable="true"/> + <dataadapter name="phenote.dataadapter.nexus.NEXUSAdapter" enable="false"/> + + <queryable-dataadapter name="phenote.dataadapter.worm.WormAdapter" enable="true"/> + + <log config-file="conf/log4j-standalone.xml"/> + + <uvic-graph enable="false"/> + + <obo-repository url-dir="http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/"/> + + <field name="Allele" syntax-abbrev="Allele" enable="true"/> + + <field name="Pub" syntax-abbrev="PUB" enable="true"/> + + <field name="Curator" syntax-abbrev="Curator" enable="true"/> + + + <field name="Genetic Context" file="context.obo" syntax-abbrev="GC" enable="true"/> + + <field name="Entity" syntax-abbrev="E" enable="true"> + <postcomp relationship-ontology="relationship.obo" repos-subdir="OBO_REL"/> + <ontology name="GO" file="gene_ontology.obo" repos-subdir="genomic-proteomic"/> + <ontology name="SP" file="spatial.obo"/> + </field> + + <field name="Stage" syntax-abbrev="T" enable="true"> + </field> + + <field name="Quality" file="quality.obo" syntax-abbrev="Q" repos-subdir="phenotype" + enable="true"/> + + <field name="Remark" syntax-abbrev="Desc" enable="true"/> + + <field name="Genetic Interaction" syntax-abbrev="GeneticInteraction" enable="true"/> + +</phenote-configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-15 20:08:46
|
Revision: 403 http://svn.sourceforge.net/obo/?rev=403&view=rev Author: mgibson Date: 2007-03-15 13:08:41 -0700 (Thu, 15 Mar 2007) Log Message: ----------- so added new queryable data adapter interface - char field gui queries if there is a queryable data adapter - typically its a database adapter - and if so queries as to if its char field is queryable and if so puts in a retrieve button which when pressed send field name and user input to queryable data adapter for it to query on and return a new CharacterListI. configured with <queryable-dataadapter name... enabled... /> made a stub of a worm adapter - doesnt do any querying yet (juancarlos...) but it says that it can query on Allele and Pub (gets strings from CharFieldEnum. thus the allele field and pub field show retrieve buttons that just bring up at the moment a not yet implemented message. throws DataAdapterEx if fails to retrieve as it does at the moment woops need to also add the preliminary worm.cfg Modified Paths: -------------- phenote/trunk/conf/flybase.cfg phenote/trunk/conf/phenote-config.rnc phenote/trunk/conf/phenote-config.xsd phenote/trunk/jars/phenoteconfigbeans.jar phenote/trunk/jars/shrimp.jar phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/config/DataAdapterConfig.java phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/ShrimpDag.java phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java phenote/trunk/src/java/phenote/gui/field/FieldPanel.java Added Paths: ----------- phenote/trunk/src/java/phenote/config/QueryableAdapConfig.java phenote/trunk/src/java/phenote/dataadapter/DataAdapterEx.java phenote/trunk/src/java/phenote/dataadapter/worm/ phenote/trunk/src/java/phenote/dataadapter/worm/WormAdapter.java Modified: phenote/trunk/conf/flybase.cfg =================================================================== --- phenote/trunk/conf/flybase.cfg 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/conf/flybase.cfg 2007-03-15 20:08:41 UTC (rev 403) @@ -1,8 +1,11 @@ -<phenote-configuration version="1.0" xmlns="phenote/config/xml" noNamespaceSchemaLocation="phenote-config.xsd"> +<phenote-configuration version="1.1.2" xmlns="phenote/config/xml" noNamespaceSchemaLocation="phenote-config.xsd"> - <dataadapter name="phenosyntax" enable="true"/> - <dataadapter name="phenoxml" enable="true"/> + <dataadapter name="phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter" + enable="true"/> + <dataadapter name="phenote.dataadapter.phenoxml.PhenoXmlAdapter" enable="true"/> + <dataadapter name="phenote.dataadapter.delimited.DelimitedFileAdapter" + enable="true"/> <log config-file="conf/log4j-standalone.xml" /> @@ -28,7 +31,7 @@ <ontology name="SP" file="spatial.obo"/> </field> - <field name="Quality" syntax-abbrev="Q" repos-subdir="phenotype"> + <field name="Quality" syntax-abbrev="Q"> <ontology file="quality.obo" repos-subdir="phenotype" /> </field> Modified: phenote/trunk/conf/phenote-config.rnc =================================================================== --- phenote/trunk/conf/phenote-config.rnc 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/conf/phenote-config.rnc 2007-03-15 20:08:41 UTC (rev 403) @@ -6,12 +6,21 @@ element phenote-configuration { attribute version { xsd:string }, log, + queryable-dataadapter*, dataadapter*, uvic-graph, obo-repository, field* } +queryable-dataadapter = element queryable-dataadapter { + ## actual class name, eg phenote.dataadapter.worm.WormAdapter + attribute name { xsd:string }, + attribute enable { xsd:boolean } +} + + +## rename/add file-dataadapter - keep dataadapter for backward compatibility? dataadapter = element dataadapter { ## for now just 2 dataadapters, phenoxml & phenosyntax (and now also nexus) Modified: phenote/trunk/conf/phenote-config.xsd =================================================================== --- phenote/trunk/conf/phenote-config.xsd 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/conf/phenote-config.xsd 2007-03-15 20:08:41 UTC (rev 403) @@ -4,6 +4,7 @@ <xs:complexType> <xs:sequence> <xs:element ref="x:log"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:queryable-dataadapter"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:dataadapter"/> <xs:element ref="x:uvic-graph"/> <xs:element ref="x:obo-repository"/> @@ -12,6 +13,16 @@ <xs:attribute name="version" use="required" type="xs:string"/> </xs:complexType> </xs:element> + <xs:element name="queryable-dataadapter"> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"> + <xs:annotation> + <xs:documentation>actual class name, eg phenote.dataadapter.worm.WormAdapter</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="enable" use="required" type="xs:boolean"/> + </xs:complexType> + </xs:element> <xs:element name="dataadapter"> <xs:complexType> <xs:attribute name="name" use="required" type="xs:string"/> Modified: phenote/trunk/jars/phenoteconfigbeans.jar =================================================================== (Binary files differ) Modified: phenote/trunk/jars/shrimp.jar =================================================================== (Binary files differ) Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/config/Config.java 2007-03-15 20:08:41 UTC (rev 403) @@ -19,12 +19,14 @@ import phenote.main.PhenoteVersion; import phenote.config.xml.PhenoteConfigurationDocument; import phenote.config.xml.DataadapterDocument.Dataadapter; +import phenote.config.xml.QueryableDataadapterDocument.QueryableDataadapter; import phenote.config.xml.FieldDocument.Field; import phenote.config.xml.LogDocument.Log; import phenote.config.xml.OboRepositoryDocument.OboRepository; import phenote.config.xml.PhenoteConfigurationDocument.PhenoteConfiguration; import phenote.config.xml.UvicGraphDocument.UvicGraph; import phenote.dataadapter.DataAdapterI; +import phenote.dataadapter.QueryableDataAdapterI; import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; import phenote.util.FileUtil; @@ -35,6 +37,7 @@ private static Config singleton = new Config(); private String configFile = FLYBASE_DEFAULT_CONFIG_FILE; private List<DataAdapterConfig> dataAdapConfList; + private List<QueryableAdapConfig> queryAdapConfList; /** only enabled fields */ private List<FieldConfig> enabledFields = new ArrayList<FieldConfig>(); /** enabled & disabled */ @@ -266,6 +269,7 @@ return singleton; } + // --> hasFileDataAdapters public boolean hasDataAdapters() { //return dataAdapConfList != null && !dataAdapConfList.isEmpty(); return getDataAdapters() != null && !getDataAdapters().isEmpty(); @@ -440,6 +444,13 @@ //addDataAdapterFromString(name); } + QueryableDataadapter[] queryAdaps = pc.getQueryableDataadapterArray(); + for (QueryableDataadapter da : queryAdaps) { + QueryableAdapConfig qac = new QueryableAdapConfig(da); + addQueryAdapCfg(qac); + } + + // GRAPH UvicGraph gr = pc.getUvicGraph(); if (gr != null) @@ -476,6 +487,32 @@ getAdapConfigs().add(dac); } + public boolean hasQueryableDataAdapter() { + return queryAdapConfList != null && getQueryableDataAdapter()!= null; + } + + /** Just get first one - for now assume theres one */ + public QueryableDataAdapterI getQueryableDataAdapter() { + //if (!hasQueryableDataAdapter()) return null; // ex? + if (queryAdapConfList == null) return null; + //queryAdapConfList.get(0).getQueryableAdapter(); + // return first enabled adap + for (QueryableAdapConfig q : getQueryAdapCfgs()) + if (q.isEnabled()) return q.getQueryableAdapter(); + return null; + } + + private List<QueryableAdapConfig> getQueryAdapCfgs() { + if (queryAdapConfList == null) + queryAdapConfList = new ArrayList<QueryableAdapConfig>(1); + return queryAdapConfList; + } + + private void addQueryAdapCfg(QueryableAdapConfig qac) { + if (qac == null) return; + getQueryAdapCfgs().add(qac); + } + private void makeFieldConfig(Field field) { FieldConfig fc = new FieldConfig(field); addFieldConfig(fc); Modified: phenote/trunk/src/java/phenote/config/DataAdapterConfig.java =================================================================== --- phenote/trunk/src/java/phenote/config/DataAdapterConfig.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/config/DataAdapterConfig.java 2007-03-15 20:08:41 UTC (rev 403) @@ -33,6 +33,8 @@ setDataAdapterFromConfigString(); } + protected DataAdapterConfig() {}; // for subclass hmmm + String getName() { return name; } boolean isEnabled() { return enabled; } Added: phenote/trunk/src/java/phenote/config/QueryableAdapConfig.java =================================================================== --- phenote/trunk/src/java/phenote/config/QueryableAdapConfig.java (rev 0) +++ phenote/trunk/src/java/phenote/config/QueryableAdapConfig.java 2007-03-15 20:08:41 UTC (rev 403) @@ -0,0 +1,47 @@ +package phenote.config; + +import phenote.config.xml.QueryableDataadapterDocument.QueryableDataadapter; + +import phenote.dataadapter.QueryableDataAdapterI; + +class QueryableAdapConfig extends DataAdapterConfig { + + private QueryableDataAdapterI queryableDataAdapter; + + QueryableAdapConfig(QueryableDataadapter xmlBean) { + // silly cut&paste - QueryableDA has same interface as DA but no way to declare?x + name = xmlBean.getName(); + configString = xmlBean.getName(); // must be set for setDAFromCfgStr + + // yes - this is a way of checking if flag actually specified - nice + // if not specified default is true actually not false + if (xmlBean.xgetEnable() != null) + enabled = xmlBean.getEnable(); + + if (enabled) + setDataAdapterFromConfigString(); + } + + /** check if enabled/constructed? */ + QueryableDataAdapterI getQueryableAdapter() { return queryableDataAdapter; } + + private void setDataAdapterFromConfigString() { + + // new way of doing things is class name itself - so 1st try introspect... + try { + Class c = Class.forName(configString); + Object o = c.newInstance(); + if ( ! (o instanceof QueryableDataAdapterI)) + throw new Exception("class not instance of QueryableDataAdapterI"); + QueryableDataAdapterI da = (QueryableDataAdapterI)o; + //addDataAdapter(da); + queryableDataAdapter = da; + configStringIsClassName = true; + } + catch (Exception e) { + System.out.println("Failed to retrieve queryable data adapter "+configString); + enabled = false; + } + } + +} Added: phenote/trunk/src/java/phenote/dataadapter/DataAdapterEx.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/DataAdapterEx.java (rev 0) +++ phenote/trunk/src/java/phenote/dataadapter/DataAdapterEx.java 2007-03-15 20:08:41 UTC (rev 403) @@ -0,0 +1,5 @@ +package phenote.dataadapter; + +public class DataAdapterEx extends Exception { + public DataAdapterEx(String m) { super(m); } +} Modified: phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java 2007-03-15 20:08:41 UTC (rev 403) @@ -5,6 +5,8 @@ public interface QueryableDataAdapterI { /** return true if data adapter can query for the char field */ - public boolean isCharFieldQueryable(CharField cf); - public CharacterListI query(CharField cf, String query); -} \ No newline at end of file + public boolean isFieldQueryable(String field); + /** Throws exception if query fails, and no data to return */ + public CharacterListI query(String field, String query) throws DataAdapterEx; +} + Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2007-03-15 20:08:41 UTC (rev 403) @@ -20,13 +20,18 @@ /** Writes pheno syntax characters to a file. See http://www.fruitfly.org/~cjm/obd/pheno-syntax.html for a full description of pheno syntax. Its basically a human readable version of pheno xml - e.g. E=head Q=large */ + e.g. E=head Q=large + This should be renamed TagValueFileAdapter as thats what it really is + Also DataAdapterI should be renamed FileDataAdapterI to distinguish from + QueryableDataAdapterI +*/ public class PhenoSyntaxFileAdapter implements DataAdapterI { private File previousFile; private File file; - private static String[] extensions = {"psx", "syn"}; + /** psx phenosyntax, syn syntax, tv tag-value, ptv phenotagvalue */ + private static String[] extensions = {"psx", "syn","tv","ptv","tagval"}; /** command line setting of file */ public void setAdapterValue(String filename) { Added: phenote/trunk/src/java/phenote/dataadapter/worm/WormAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/worm/WormAdapter.java (rev 0) +++ phenote/trunk/src/java/phenote/dataadapter/worm/WormAdapter.java 2007-03-15 20:08:41 UTC (rev 403) @@ -0,0 +1,40 @@ +package phenote.dataadapter.worm; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JOptionPane; + +import phenote.datamodel.CharFieldEnum; +import phenote.datamodel.CharacterListI; +import phenote.dataadapter.DataAdapterEx; +import phenote.dataadapter.QueryableDataAdapterI; + +public class WormAdapter implements QueryableDataAdapterI { + + private List<String> queryableFields = new ArrayList<String>(2); + + public WormAdapter() { init(); } + + private void init() { + // dont HAVE to use CharFieldEnum but it does enforce using same strings + // across different data adapters which is good to enforce + // the worm config needs to have "Pub" and "Allele" + queryableFields.add(CharFieldEnum.PUB.getName()); // "Pub" + queryableFields.add(CharFieldEnum.ALLELE.getName()); // "Allele" + // should their be a check that the current char fields have pub & allele? + } + + /** return true if data adapter can query for the char field */ + public boolean isFieldQueryable(String field) { + return queryableFields.contains(field); + } + public CharacterListI query(String field, String query) throws DataAdapterEx { + String m = "Worm adapter query not yet implemented. field: "+field+" query: "+query; + JOptionPane.showMessageDialog(null,m,"Worm stub",JOptionPane.INFORMATION_MESSAGE); + + // if query has failed... + throw new DataAdapterEx("Worm query of "+query+" of field "+field+" failed"); + } + +} Modified: phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java 2007-03-15 20:08:41 UTC (rev 403) @@ -2,6 +2,18 @@ // labels? methods? subclasses? // is this taking enums too far? or a good use of them? +/** so this class has evolved - this was actually doing the setting of field values at one + point - but now that we've gone to a generic datamodel, the datamodel is now determined + by the configuration - and not restricted to CharFieldEnums - you can have a field that is + not in CharFieldEnum - which leads to the question should we get rid of this class? + and the answer at the moment is maybe not - as you can still use this in data adapters + to get at predefined strings for definied fields - to make sure data adapters are using + the same string for the pub of entity field. which is what enums are right? the + queryable data adapter can use these strings from enum to specify the fields it allows + for querying - so for now i guess CharFieldEnum lives on in a much more limited fashion + the setValue & getValue need to be taken out - no longer used - ya just have to + hope that the strings here are the same ones in config - is there some way to enforce + or check this - i dont think there is */ public enum CharFieldEnum { PUB("Pub") { @@ -20,6 +32,7 @@ return new CharFieldValue(c.getGenotype(),c,this); } }, + ALLELE("Allele"), GENETIC_CONTEXT("Genetic Context") { public void setValue(CharacterI c, CharFieldValue v) { c.setGeneticContext(v.getOboClass()); @@ -56,8 +69,9 @@ private CharFieldEnum(String name) { this.name = name; } public String toString() { return getName(); } public String getName() { return name; } - public abstract void setValue(CharacterI c, CharFieldValue v); - public abstract CharFieldValue getValue(CharacterI c); + // no longer used? + //public abstract void setValue(CharacterI c, CharFieldValue v); + //public abstract CharFieldValue getValue(CharacterI c); // unclear if we need this??? need it in generic field config public static CharFieldEnum getCharFieldEnum(String fieldString) throws Exception { Modified: phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2007-03-15 20:08:41 UTC (rev 403) @@ -95,17 +95,18 @@ // System.out.println("ERROR no datamodel associated with configuration, cant set"+ // " value"); //else - if (charFieldEnum != null) { // pase - take out - charFieldEnum.setValue(character,this); - } - else { +// if (charFieldEnum != null) { // pase - take out +// charFieldEnum.setValue(character,this); +// } +// else { //System.out.println("CFV editMod "+getName()); - character.setValue(charField,this); - } + character.setValue(charField,this); +// } } - CharField getCharField() { return charField; } - public CharFieldEnum getCharFieldEnum() { return charFieldEnum; } + public CharField getCharField() { return charField; } + // phase out... + //public CharFieldEnum getCharFieldEnum() { return charFieldEnum; } public String toString() { return getName(); } } Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2007-03-15 20:08:41 UTC (rev 403) @@ -3,7 +3,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; import phenote.datamodel.CharField; -import phenote.datamodel.CharFieldEnum; +//import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharFieldValue; import phenote.datamodel.CharacterI; @@ -32,11 +32,11 @@ // public UpdateTransaction(CharFieldValue new, CharFieldValue old) ? /** actually maybe dont need to pas in old val - just query for it phase out*/ - public UpdateTransaction(CharacterI c,CharFieldEnum e,OBOClass newVal) { - newValue = new CharFieldValue(newVal,c,e); - //oldValue = new CharFieldValue(old,c,e); - oldValue = e.getValue(c); - } +// public UpdateTransaction(CharacterI c,CharFieldEnum e,OBOClass newVal) { +// newValue = new CharFieldValue(newVal,c,e); +// //oldValue = new CharFieldValue(old,c,e); +// oldValue = e.getValue(c); +// } public UpdateTransaction(CharacterI c,CharField cf,OBOClass newVal) { newValue = new CharFieldValue(newVal,c,cf); oldValue = c.getValue(cf); @@ -64,13 +64,18 @@ String getNewValueString() { return newValue.getName(); } +// public boolean isUpdateForCharField(CharField cf) { +// return getCharFieldEnum() == cf.getCharFieldEnum(); +// } public boolean isUpdateForCharField(CharField cf) { - return getCharFieldEnum() == cf.getCharFieldEnum(); + // the char field should be the same shouldnt they? they better be? + // test for null newVal? + return newValue.getCharField().equals(cf); } - private CharFieldEnum getCharFieldEnum() { - return newValue.getCharFieldEnum(); - } +// private CharFieldEnum getCharFieldEnum() { +// return newValue.getCharFieldEnum(); +// } public void undo() { //oldValue.setValue();//charFieldEnum.setValue(character,oldValue); } Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2007-03-15 20:08:41 UTC (rev 403) @@ -42,6 +42,7 @@ CharacterI getCharacter(int i) { // check out of bounds + if (characterList == null) return null; // ex? return characterList.get(i); } @@ -65,6 +66,7 @@ public int getRowCount() { //return rowCount; + if (getCharacterList() == null) return 1; // or 0?? always have 1 blank row? return getCharacterList().size(); } Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2007-03-15 20:08:41 UTC (rev 403) @@ -147,6 +147,7 @@ private void selectRow(int row) { if (charJTable == null) return; if (row < 0) row = 0; // ??? + // is row 0 based and table 1 based? if (row >= charJTable.getRowCount()) row = charJTable.getRowCount() - 1; //if (charJTable != null && row >= 0 && row < charJTable.getRowCount()) charJTable.setRowSelectionInterval(row,row); Modified: phenote/trunk/src/java/phenote/gui/ShrimpDag.java =================================================================== --- phenote/trunk/src/java/phenote/gui/ShrimpDag.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/gui/ShrimpDag.java 2007-03-15 20:08:41 UTC (rev 403) @@ -71,9 +71,11 @@ private OBOSession getOboSession() { // just hard wire to go for now try { - Ontology o = OntologyManager.inst().getOntologyForName("ZF"); + //Ontology o = OntologyManager.inst().getOntologyForName("ZF"); // fly causes an endless loop - oh my - //Ontology o = OntologyManager.inst().getOntologyForName("Fly"); + Ontology o = OntologyManager.inst().getOntologyForName("Fly"); + //Ontology o = OntologyManager.inst().getOntologyForName("Human Anatomy"); + return o.getOboSession(); } catch (phenote.datamodel.OntologyException e) { System.out.println("no ontol for dag"); Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2007-03-15 20:08:41 UTC (rev 403) @@ -1,7 +1,5 @@ package phenote.gui.field; -//import java.util.List; -//import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Container; @@ -9,9 +7,7 @@ import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; -//import javax.swing.JTextField; -//import javax.swing.event.DocumentListener; -//import javax.swing.event.DocumentEvent; +import javax.swing.JOptionPane; import org.apache.log4j.Logger; @@ -26,12 +22,15 @@ import phenote.datamodel.Ontology; import phenote.datamodel.OntologyException; import phenote.datamodel.OntologyManager; +import phenote.dataadapter.DataAdapterEx; import phenote.dataadapter.QueryableDataAdapterI; import phenote.edit.CharChangeEvent; import phenote.edit.CharChangeListener; //import phenote.edit.CompoundTransaction; import phenote.edit.EditManager; //import phenote.edit.UpdateTransaction; +import phenote.dataadapter.QueryableDataAdapterI; +import phenote.config.Config; import phenote.gui.selection.CharSelectionListener; import phenote.gui.selection.CharSelectionEvent; import phenote.gui.selection.SelectionManager; @@ -106,23 +105,32 @@ } private void addRetrieveButton() { - // if (Config.inst().hasQueryableDataAdapter()) { - // QueryableAdapter qa = Config.inst().getQueryableDataAdapter(); // for now just one - // if (qa.isCharFieldQueryable(cf)) { - // Button b = new Button("Retrieve"); - // b.addActionListener(new RetrieveActionListener(qa)); - // fieldPanel.addRetrieveButton(b) - + if (!Config.inst().hasQueryableDataAdapter()) return; + + QueryableDataAdapterI qa = Config.inst().getQueryableDataAdapter(); // for now just one + if (qa.isFieldQueryable(getCharField().getName())) { + JButton b = new JButton("Retrieve"); + b.addActionListener(new RetrieveActionListener(qa)); + fieldPanel.addRetrieveButton(b); + } } private class RetrieveActionListener implements ActionListener { QueryableDataAdapterI qda; private RetrieveActionListener(QueryableDataAdapterI q) { qda = q; } public void actionPerformed(ActionEvent e) { - CharacterListI cl = qda.query(charField,getText()); - //notifyNewCharList(cl); - // check if unsaved data - if so ask user if wants to save/load - CharacterListManager.inst().setCharacterList(this,cl); + try { + CharacterListI cl = qda.query(charField.getName(),getText()); + //if (cl == null) if null shouldve thrown ex - check anyways? + //notifyNewCharList(cl); + // check if unsaved data - if so ask user if wants to save/load + CharacterListManager.inst().setCharacterList(this,cl); + } + catch (DataAdapterEx ex) { + JOptionPane.showMessageDialog(null,ex.getMessage(),"Retrieve Error", + JOptionPane.ERROR_MESSAGE); + + } } } Modified: phenote/trunk/src/java/phenote/gui/field/FieldPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-14 18:55:53 UTC (rev 402) +++ phenote/trunk/src/java/phenote/gui/field/FieldPanel.java 2007-03-15 20:08:41 UTC (rev 403) @@ -20,9 +20,8 @@ import phenote.gui.GridBagUtil; /** - * TermPanel holds all the fields for the terms - Genotype, Entity/Anatomy, QUALITY. + * FieldPanel holds all the fields for the terms - Genotype, Entity/Anatomy, QUALITY. * Can be populated by hand (Genotype), or selection of instance in completion list. - rename FieldPanel or CharFieldPanel? also has SearchParamPanel(?). */ @@ -119,6 +118,11 @@ void addPostCompButton(JButton pc) { fieldPanel.add(pc,makePostCompConstraint()); } + + void addRetrieveButton(JButton rb) { + // for now assume fields dont do both post comp and retrieve - fix this! + fieldPanel.add(rb,makePostCompConstraint()); + } private int gridbagRow = 0; boolean ontologyChooserPresent = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nl...@us...> - 2007-03-14 18:57:00
|
Revision: 402 http://svn.sourceforge.net/obo/?rev=402&view=rev Author: nlw Date: 2007-03-14 11:55:53 -0700 (Wed, 14 Mar 2007) Log Message: ----------- * took out extra space in free-text in phenosyntax; inserted newlines, grouped each phenocharacter * added extensions for file formats (in [.ext, .ext2, ...]) to display in the load/saver window * added tab delimited data adapter - write only. in future to be expanded to include any delimiter. (note that there is copied code from the phenosyntax writer that will do wierd stuff) Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/config/DataAdapterConfig.java phenote/trunk/src/java/phenote/dataadapter/nexus/NEXUSAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java Added Paths: ----------- phenote/trunk/src/java/phenote/dataadapter/delimited/ phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2007-03-14 01:23:54 UTC (rev 401) +++ phenote/trunk/src/java/phenote/config/Config.java 2007-03-14 18:55:53 UTC (rev 402) @@ -377,6 +377,15 @@ return fields; } + public String getLabelForCharField(CharField cf) throws ConfigException { + for (FieldConfig fc : getFieldConfigList()) { + if (fc.hasCharField(cf)) + return fc.getLabel(); + } + // failed to find field config for char field - shouldnt happen + throw new ConfigException("Syn Abbrev for "+cf+" not found"); + } + public String getSyntaxAbbrevForCharField(CharField cf) throws ConfigException { for (FieldConfig fc : getFieldConfigList()) { if (fc.hasCharField(cf)) Modified: phenote/trunk/src/java/phenote/config/DataAdapterConfig.java =================================================================== --- phenote/trunk/src/java/phenote/config/DataAdapterConfig.java 2007-03-14 01:23:54 UTC (rev 401) +++ phenote/trunk/src/java/phenote/config/DataAdapterConfig.java 2007-03-14 18:55:53 UTC (rev 402) @@ -7,6 +7,7 @@ import phenote.dataadapter.nexus.NEXUSAdapter; import phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter; import phenote.dataadapter.phenoxml.PhenoXmlAdapter; +import phenote.dataadapter.delimited.DelimitedFileAdapter; class DataAdapterConfig { @@ -82,6 +83,8 @@ dataAdapter = new FlybaseDataAdapter(); // for now... else if (configString.equalsIgnoreCase("nexus")) dataAdapter = new NEXUSAdapter(); + else if (configString.equalsIgnoreCase("delimited")) + dataAdapter = new DelimitedFileAdapter(); // LOG not set up yet??? else System.out.println("Data adapter not recognized "+configString); Added: phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java (rev 0) +++ phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedChar.java 2007-03-14 18:55:53 UTC (rev 402) @@ -0,0 +1,300 @@ +package phenote.dataadapter.delimited; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.log4j.Logger; +import org.geneontology.oboedit.datamodel.OBOClass; + +import phenote.datamodel.Character; +import phenote.datamodel.CharacterI; +import phenote.datamodel.CharField; +import phenote.datamodel.CharFieldValue; +import phenote.datamodel.OntologyManager; +import phenote.datamodel.TermNotFoundException; +import phenote.config.Config; +import phenote.config.ConfigException; + +/** I stole this from phenosyntaxchar, but modifying for tab delimited. will + * initially hard code in the tab-delimiter, but eventually it should be generic to + * handle any delimiter. + * A phenotype character thats basically a dataadapter object for datamodel CharacterI. +*/ + +public class DelimitedChar { + + private CharacterI character; + private String delimitedString; + private String delimitedHeaderString; + private String delimiter; + + DelimitedChar() {} + + DelimitedChar(CharacterI ch) { + character = ch; + delimiter = "\t"; + } + + // WRITE + String getDelimitedString() throws BadCharException { + if (delimitedString == null) { + delimitedString = makeDelimitedString(); + } + return delimitedString; + } + String getDelimitedHeaderString() throws BadCharException { + if (delimitedHeaderString == null) { + delimitedHeaderString = makeDelimitedHeaderString(); + } + return delimitedHeaderString; + } + +/** the idea for the tab-delimited output writer is to + * 1) identify what the header/column names should be (like they present in the phenote + * window: pub, entity, quality, etc.). Need to include all column headers even if there + * isn't data for them...they'd just have a blank column...in future will get smart to this. + * basically its creating the headers based on the config file. + * 2) insert delimiter (initially "tab") between each field + * 3) write each phenotype character on an individual line under headers. one PC for each + * hard return + * should i include the config file on the first line? + * */ + private String makeDelimitedHeaderString() throws BadCharException { + if (character == null) { // shouldnt happen + System.out.println("Error: could not make tab-delimited header"); + return ""; //?? + } + StringBuffer sb = new StringBuffer(); + try { + // ontology manager should have char fields in order of config which should be + // syntax order - hope this isnt too presumptious + for (CharField cf : OntologyManager.inst().getCharFieldList()) { + //if its a free text field - only one col necessary. + //if its an ontology field - need two cols (one for ID, the other for text) + sb.append(Config.inst().getSyntaxAbbrevForCharField(cf)); + //for now, i'll call on the syntax abbrev, but i'll want to use the acutal name + if (!isFreeText(cf)) { + sb.append(" ID").append(delimiter); + sb.append(Config.inst().getSyntaxAbbrevForCharField(cf)).append(" Name"); + } + sb.append(delimiter); + } + } + catch (ConfigException e) { + throw new BadCharException(e.getMessage()); + } + return sb.toString(); + + } + + private String makeDelimitedString() throws BadCharException { + if (character == null) { // shouldnt happen + System.out.println("Error: no Character to make delimited string with"); + return ""; //?? + } + StringBuffer sb = new StringBuffer(); +//***************** + try { + + // ontology manager should have char fields in order of config which should be + // syntax order - hope this isnt too presumptious + for (CharField cf : OntologyManager.inst().getCharFieldList()) { + if (character.hasValue(cf)) { + Config.inst().getLabelForCharField(cf); + // sb.append(Config.inst().getLabelForCharField(cf)); + sb.append(makeValue(character.getValue(cf))); + } + else if (isOntology(cf)) sb.append(delimiter); + //need to make sure to add extra delimiter for ontology fields + sb.append(delimiter); + } + + } + catch (ConfigException e) { + throw new BadCharException(e.getMessage()); + } + + + return sb.toString(); + } + + /** If a char field has ontologies it is not free text */ + private boolean isFreeText(CharField cf) { + return !cf.hasOntologies(); + } + + private boolean isOntology(CharField cf) { + return cf.hasOntologies(); + } + + // this may be more general than just this class + class BadCharException extends Exception { + BadCharException(String m) { super(m); } + } + + private String makeValue(CharFieldValue v) { + if (v.isTerm()) return makeTermValue(v.getOboClass()); + return v.getName(); + } + + private String makeTermValue(OBOClass term) { + //if the term comes from an ontology, need to include a col for both + //id and name + return term.getID() + delimiter + term.getName(); + } + +//********READ NOT YET IMPLEMENTED!!! + // READ + + /** Parse syntax line into character */ + void parseLine(String line) throws SyntaxParseException { + character = new Character(); + Pattern p = Pattern.compile("\\S+=");//\\S+="); + Matcher m = p.matcher(line); + boolean found = m.find(); + if (!found) + throw new SyntaxParseException(line); // skips whitespace lines + int tagStart = m.start(); + int tagEnd = m.end(); + while (found) { + String tag = line.substring(tagStart,tagEnd-1); // -1 take off = + int valueStart = tagEnd; + // find next one will give end of value + found = m.find(); // if parsing last tag found will be false - at end + tagStart = found ? m.start() : line.length(); + if (found) tagEnd = m.end(); // dont need if not found (last one) + String value = line.substring(valueStart,tagStart).trim(); + value = stripComments(value).trim(); + //value = stripQuotesFromFreeText(value); // free text gets quoted + //System.out.println("tag ."+tag+". val ."+value+"."); + addTagValToChar(tag,value); + } + } + + private String stripComments(String value) { + value = value.replaceAll("/\\*.*\\*/",""); + return value; + } + + private static final String q = "\""; + + private String stripQuotesFromFreeText(String value,CharField cf) { + if (!isFreeText(cf)) return value; + if (value.startsWith(q)) value = value.substring(1); + if (value.endsWith(q)) value = value.substring(0,value.length()-2); + return value; + } + + class SyntaxParseException extends Exception { + private String syntaxLine; + SyntaxParseException(String syntaxLine) { + this.syntaxLine = syntaxLine; + } + public String getMessage() { + if (syntaxLine.trim().equals("")) + return ""; // just whitespace - who cares + return syntaxLine+" failed to parse - ignoring"; + } + } + + private void addTagValToChar(String tag, String value) { + if (value.equals("")) { + log().error("No value given for "+tag); + return; + } + + OntologyManager om = OntologyManager.inst(); + + try { + // so this is funny but there can be more than one char field for an abbrev - for + // instance Tag is for both abormal and absent. with setValue only the proper char + // field will get set, eg abnormal char field will throw exception for "absent" + List<CharField> fields = Config.inst().getCharFieldsForSyntaxAbbrev(tag);//Ex + for (CharField cf : fields) { + + value = stripQuotesFromFreeText(value,cf); + + if (cf.getName().equals("Stage")) { + // todo - a general relationship extracter? + value = extractStageHack(value); // for now - fix for real later + } + try { + // set String -> for obo class automatically find term + character.setValue(cf,value); // throws TermNotFoundEx + return; // if no ex thrown were done + } + catch (TermNotFoundException e) {} // do nothing - try next char field + } + } + catch (ConfigException e) { log().error(e.getMessage()); } // field not found + //catch (TermNotFoundException e) { + System.out.println("PhSynCh term not found "+value); + //log().error(e.getMessage()); + log().error("Term not found "+value); // list char field? + //} + + + } + + /** Stages come with rel - eg during(adult) - for now just assuming its during and ripping + off - in future need to read in rel, and store as relationship between Instances + (not OBOClasses!) - big refactor but go for it! + this extracts the "adult" in above example out of "during(adult)" + or alternatively just record relationship in CharFieldValue? */ + private String extractStageHack(String stageWithRel) { + Pattern p = Pattern.compile("during\\(([^\\)]+)\\)"); + Matcher m = p.matcher(stageWithRel); + if (m.matches()) + return m.group(1); + return stageWithRel; + } + + CharacterI getCharacter() { return character; } + + private Logger log; + private Logger log() { + if (log == null) log = Logger.getLogger(getClass()); + return log; + } +} +// try { +// if (tag.equals("PUB")) +// character.setPub(value); +// else if (tag.equals("GT")) +// character.setGenotype(value); +// else if (tag.equals("GC")) +// character.setGeneticContext(om.getOboClassWithExcep(value)); // throws ex +// else if (tag.equals("E")) +// character.setEntity(om.getTermOrPostComp(value)); +// else if (tag.equals("Q")) +// character.setQuality(om.getOboClassWithExcep(value)); +// else // throw exception? or let rest of char go through? +// System.out.println("pheno syntax tag "+tag+" not recognized (value "+value+")"); +// } +// catch (OntologyManager.TermNotFoundException e) { +// log().error("Term not found for tag "+tag+" value "+value+" in loaded " +// +"ontologies - check syntax with ontology files."); +// return; +// } +// if (character.hasValue("Pub")) // hasPub +// sb.append("PUB=").append(character.getValueString("Pub")); //Pub()); +// // Genotype - not strictly part of pheno syntax but lets face it we need it +// // i would say its an omission from syntax +// //sb.append(" GT=").append(character.getGenotype()); +// if (character.hasValue("Genotype")) +// sb.append(" GT=").append(character.getValueString("Genotype")); +// if (character.hasValue("Genetic Context")) +// sb.append(" GC=").append(makeValue(character.getTerm("Genetic Context"))); + +// if (!character.hasValue("Entity")) +// throw new BadCharException("Error: character has no entity, ignoring"); +// //sb.append(" E=").append(makeValue(character.getEntity())); +// sb.append(" E=").append(makeValue(character.getTerm("Entity"))); + +// // if (character.hasValue(CharFieldEnum.STAGE)) + +// //if (character.getQuality() == null) +// if (!character.hasValue("Quality")) +// throw new BadCharException("Error: character has no quality, ignoring"); +// sb.append(" Q=").append(makeValue(character.getTerm("Quality"))); Added: phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java (rev 0) +++ phenote/trunk/src/java/phenote/dataadapter/delimited/DelimitedFileAdapter.java 2007-03-14 18:55:53 UTC (rev 402) @@ -0,0 +1,156 @@ +package phenote.dataadapter.delimited; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.LineNumberReader; +import java.util.List; +import java.util.Arrays; + +import phenote.datamodel.CharacterI; +import phenote.datamodel.CharacterListI; +import phenote.datamodel.CharacterList; +import phenote.dataadapter.CharacterListManager; +import phenote.dataadapter.DataAdapterI; +import phenote.dataadapter.phenoxml.PhenoXmlAdapter; + +/** Originated with PhenoSyntaxFileAdapter and modified. Writes the basic text to + * a file, with 'tab' delimiters. First line is column headings, only printed + * once. + * e.g. E=head Q=large */ + +public class DelimitedFileAdapter implements DataAdapterI { + + private File previousFile; + private File file; + private static String[] extensions = {"tab"}; + + /** command line setting of file */ + public void setAdapterValue(String filename) { + file = new File(filename); + } + + /** this should return CharacterList and caller should load CharListMan + or CLM makes the call itself? */ + public void load() { + + if (file == null) + file = getFileFromUserForOpen(previousFile); + if (file == null) return; + previousFile = file; + try { + CharacterListI charList = new CharacterList(); + LineNumberReader lnr = new LineNumberReader(new FileReader(file)); + DelimitedChar synChar = new DelimitedChar(); + for (String line=lnr.readLine(); line != null; line = lnr.readLine()) { + try { + synChar.parseLine(line); + CharacterI ch = synChar.getCharacter(); + charList.add(ch); + } catch (DelimitedChar.SyntaxParseException e) { + System.out.println(e.getMessage()); // jut "" for whitespace line + } + } + CharacterListManager.inst().setCharacterList(this,charList); + lnr.close(); + } + catch (IOException e) { + System.out.println("Delimited read failure "+e); + } + file = null; // null it for next load/commit + } + + public CharacterListI load(File f) { + // this method temporarily duplicates code from load() - soon load() will be removed + CharacterListI charList = new CharacterList(); + try { + LineNumberReader lnr = new LineNumberReader(new FileReader(f)); + DelimitedChar synChar = new DelimitedChar(); + for (String line=lnr.readLine(); line != null; line = lnr.readLine()) { + try { + synChar.parseLine(line); + CharacterI ch = synChar.getCharacter(); + charList.add(ch); + } catch (DelimitedChar.SyntaxParseException e) { + System.out.println(e.getMessage()); // jut "" for whitespace line + } + } + lnr.close(); + } + catch (IOException e) { + System.out.println("Tab-delimited read failure "+e); + } + return charList; + } + + /** returns null if user fails to pick a file */ + // private File getFileFromUser(File dir) { + // return PhenoXmlAdapter.getFileFromUser(dir); // perhaps a util class + // } + + private File getFileFromUserForSave(File dir) { + return PhenoXmlAdapter.getFileFromUserForSave(dir); + } + + private File getFileFromUserForOpen(File dir) { + return PhenoXmlAdapter.getFileFromUserForOpen(dir); + } + + public void commit(CharacterListI charList) { + if (file == null) + file = getFileFromUserForSave(previousFile); + if (file == null) return; + previousFile = file; + + PrintWriter pw; + try { + pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); + } catch (IOException e) { + System.out.println("Failed to open file "+file); + return; + } + + System.out.println("Writing tab-delimited output to file "+file); + //first write out header, then write out contents + //header determined from first CharI + try { + CharacterI ch = charList.get(0); + String c = new DelimitedChar(ch).getDelimitedHeaderString(); + System.out.println(c); + pw.println(c); + } + catch (DelimitedChar.BadCharException e) { + System.out.println(e.getMessage()+" Not writing out header"); + } + + for (CharacterI ch : charList.getList()) { + try { + String c2 = new DelimitedChar(ch).getDelimitedString(); + System.out.println(c2); + pw.println(c2); + } + catch (DelimitedChar.BadCharException e) { + System.out.println(e.getMessage()+" Not writing out character"); + } + } + pw.close(); + file = null; + } + + public void commit(CharacterListI charList, File f) { + file = f; + commit(charList); + } + + public List<String> getExtensions() { + return Arrays.asList(extensions); + } + + public String getDescription() { + return "Tab Delimited [.tab]"; + } + +} Modified: phenote/trunk/src/java/phenote/dataadapter/nexus/NEXUSAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/nexus/NEXUSAdapter.java 2007-03-14 01:23:54 UTC (rev 401) +++ phenote/trunk/src/java/phenote/dataadapter/nexus/NEXUSAdapter.java 2007-03-14 18:55:53 UTC (rev 402) @@ -59,7 +59,7 @@ } public String getDescription() { - return "NEXUS files"; + return "NEXUS [.nex, .nxs]"; } public List<String> getExtensions() { Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2007-03-14 01:23:54 UTC (rev 401) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2007-03-14 18:55:53 UTC (rev 402) @@ -60,8 +60,9 @@ if (character.hasValue(cf)) { sb.append(Config.inst().getSyntaxAbbrevForCharField(cf)).append("=");//ex if (isFreeText(cf)) sb.append('"'); // free text gets quoted - sb.append(makeValue(character.getValue(cf))).append(" "); + sb.append(makeValue(character.getValue(cf))); if (isFreeText(cf)) sb.append("\" "); + sb.append("\n"); } // check for entity & quality?? } @@ -90,7 +91,7 @@ private String makeTermValue(OBOClass term) { // id & commented out name for readability - return term.getID() + " /*" + term.getName() + "*/"; + return term.getID() + " /*" + term.getName() + "*/ "; } Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2007-03-14 01:23:54 UTC (rev 401) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2007-03-14 18:55:53 UTC (rev 402) @@ -140,7 +140,7 @@ } public String getDescription() { - return "PhenoSyntax files"; + return "PhenoSyntax [.psx, .syn]"; } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2007-03-14 01:23:54 UTC (rev 401) +++ phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2007-03-14 18:55:53 UTC (rev 402) @@ -337,7 +337,7 @@ } public String getDescription() { - return "PhenoXML files"; + return "PhenoXML [.pxml, .xml]"; } private Logger log; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cmu...@us...> - 2007-03-14 01:24:03
|
Revision: 401 http://svn.sourceforge.net/obo/?rev=401&view=rev Author: cmungall Date: 2007-03-13 18:23:54 -0700 (Tue, 13 Mar 2007) Log Message: ----------- Modified Paths: -------------- obo-database/trunk/sql/obd-core-schema.sql obo-database/trunk/sql/obd-core-views.sql Modified: obo-database/trunk/sql/obd-core-schema.sql =================================================================== --- obo-database/trunk/sql/obd-core-schema.sql 2007-03-13 16:39:53 UTC (rev 400) +++ obo-database/trunk/sql/obd-core-schema.sql 2007-03-14 01:23:54 UTC (rev 401) @@ -45,6 +45,7 @@ FOREIGN KEY (when_id) REFERENCES node(node_id) ON DELETE CASCADE, is_inferred BOOLEAN NOT NULL DEFAULT 'f', is_instantiation BOOLEAN NOT NULL DEFAULT 'f', + is_negated BOOLEAN NOT NULL DEFAULT 'f', combinator CHAR(1) NOT NULL DEFAULT '', source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE, is_obsolete BOOLEAN NOT NULL DEFAULT 'f', @@ -83,7 +84,34 @@ CREATE INDEX link_reiflink_node_indx ON link(reiflink_node_id); CREATE INDEX link_triple_indx ON link(node_id,predicate_id,object_id); +CREATE TABLE link_inference ( + link_inference_id SERIAL PRIMARY KEY, + link_id INTEGER NOT NULL, + FOREIGN KEY (link_id) REFERENCES link(link_id) ON DELETE CASCADE, + inferred_from_link_id INTEGER NOT NULL, + FOREIGN KEY (inferred_from_link_id) REFERENCES link(link_id) ON DELETE CASCADE, + type_id INTEGER, + FOREIGN KEY (type_id) REFERENCES node (node_id) ON DELETE CASCADE +); + +COMMENT ON TABLE link_inference IS 'A dependency relation between an +inferred link and the links it was inferred from'; + +COMMENT ON COLUMN link_inference.link_id IS 'A link that has been +inferred by some deductive process'; + +COMMENT ON COLUMN link_inference.inferred_from_link_id IS 'The link +that was used to support an inferred link. May itself be inferred, or +asserted. Note that cascading deletes do not propagate, unless a +trigger is added such that any inferred link must have a corresponding +link_inference or be deleted.'; + +COMMENT ON COLUMN link_inference.link_id IS 'An optional inference +type; may come from an ontology of deductive operations'; + + CREATE TABLE sameas ( + sameas_id SERIAL PRIMARY KEY, node_id INTEGER NOT NULL, FOREIGN KEY (node_id) REFERENCES node(node_id) ON DELETE CASCADE, object_id INTEGER NOT NULL, Modified: obo-database/trunk/sql/obd-core-views.sql =================================================================== --- obo-database/trunk/sql/obd-core-views.sql 2007-03-13 16:39:53 UTC (rev 400) +++ obo-database/trunk/sql/obd-core-views.sql 2007-03-14 01:23:54 UTC (rev 401) @@ -6,29 +6,70 @@ -- %% node %% +-- basic categories CREATE OR REPLACE VIEW class_node AS SELECT * FROM node WHERE metatype='C'; +COMMENT ON VIEW class_node IS 'A graph node representing a Class. Examples: a GO class; a post-composed phenotype; an internal class'; + CREATE OR REPLACE VIEW relation_node AS SELECT * FROM node WHERE metatype='R'; -CREATE OR REPLACE VIEW instance_node AS SELECT * FROM node WHERE metatype='I'; +COMMENT ON VIEW relation_node IS 'A graph node representing a Relation. Examples: OBO_REL:part_of'; + CREATE OR REPLACE VIEW transitive_relation_node AS SELECT * FROM node WHERE metatype='R' AND is_transitive='t'; +COMMENT ON VIEW transitive_relation_node IS 'A relation node that is transitive. Examples: part_of. Counter-examples: has_participant'; +CREATE OR REPLACE VIEW instance_node AS SELECT * FROM node WHERE metatype='I'; +COMMENT ON VIEW instance_node IS 'A graph node representing a Instance. Examples: an instance of an Annotation; an instance of a Person'; + +CREATE OR REPLACE VIEW reif_node AS SELECT * FROM node WHERE is_reiflink='t'; +COMMENT ON VIEW reif_node IS 'A node that is reified - ie for which a +corresponding link exists. The node acts as proxy-ID for the +link. Join via link.reiflink_node_id. Uses: If additional data is to +be attached to a link - ie metadata, attribution info - then a +reif_node is created, and the metadata is attached to the reif_node'; + +-- obsoletion-related CREATE OR REPLACE VIEW obsolete_node AS SELECT * FROM node WHERE is_obsolete='t'; +COMMENT ON VIEW obsolete_node IS 'A graph node containing obsolete data. Contrast: valid_node. Obsolete nodes may be mapped to valid_nodes using...'; + CREATE OR REPLACE VIEW obsolete_class_node AS SELECT * FROM class_node WHERE is_obsolete='t'; +COMMENT ON VIEW obsolete_class_node IS 'A class node that is obsolete'; + CREATE OR REPLACE VIEW obsolete_instance_node AS SELECT * FROM instance_node WHERE is_obsolete='t'; +COMMENT ON VIEW obsolete_instance_node IS 'An instance node that is obsolete'; + CREATE OR REPLACE VIEW obsolete_relation_node AS SELECT * FROM relation_node WHERE is_obsolete='t'; +COMMENT ON VIEW obsolete_relation_node IS 'A relation node that is obsolete'; CREATE OR REPLACE VIEW valid_node AS SELECT * FROM node WHERE is_obsolete='f'; +COMMENT ON VIEW valid_node IS 'A graph node that contains current data; not obsolete'; + CREATE OR REPLACE VIEW valid_class_node AS SELECT * FROM class_node WHERE is_obsolete='f'; +COMMENT ON VIEW valid_class_node IS 'A class node that is current; not obsolete'; + CREATE OR REPLACE VIEW valid_instance_node AS SELECT * FROM instance_node WHERE is_obsolete='f'; +COMMENT ON VIEW valid_instance_node IS 'An instance node that is current; not obsolete'; + CREATE OR REPLACE VIEW valid_relation_node AS SELECT * FROM relation_node WHERE is_obsolete='f'; +COMMENT ON VIEW valid_relation_node IS 'A relation node that is current; not obsolete'; -CREATE OR REPLACE VIEW reif_node AS SELECT * FROM node WHERE is_reiflink='t'; -- %% link %% CREATE OR REPLACE VIEW implied_link AS SELECT * FROM link WHERE is_inferred='t'; +COMMENT ON VIEW implied_link IS 'A link that has been inferred; +inferred links are created by deductive reasoning. Examples: X part_of +Z because X is_a Y and Y part_of Z'; + CREATE OR REPLACE VIEW asserted_link AS SELECT * FROM link WHERE is_inferred='f'; +COMMENT ON VIEW asserted_link IS 'A link that has been asserted; converse of implied_link'; CREATE OR REPLACE VIEW intersection_link AS SELECT * FROM link WHERE combinator='I'; +COMMENT ON VIEW intersection_link IS 'A link that forms part of an +intersection equivalence declaration. All intersection_links for a +node N are combined together, and the combination of links defines +N. Examples: the node representing "nucleus of astrocyte" may be +formed of an intersection_link to nucleus and an intersection_link to +part_of astrocyte'; + CREATE OR REPLACE VIEW union_link AS SELECT * FROM link WHERE combinator='U'; CREATE OR REPLACE VIEW basic_link AS SELECT * FROM link WHERE combinator=''; @@ -42,6 +83,8 @@ -- is_a CREATE OR REPLACE VIEW is_a_relation AS SELECT * FROM relation_node WHERE uid='OBO_REL:is_a'; +COMMENT ON VIEW is_a_relation IS 'the relation_node for the OBO_REL relation "is_a"'; + CREATE OR REPLACE VIEW non_is_a_relation AS SELECT * FROM relation_node WHERE uid!='OBO_REL:is_a'; CREATE OR REPLACE VIEW is_a_link AS SELECT link.* @@ -268,6 +311,12 @@ FROM link LEFT OUTER JOIN node AS source ON (link.source_id=source.node_id) GROUP BY source.uid,source.label; +CREATE OR REPLACE VIEW linkcount_by_predicate_and_source AS + SELECT source.uid,source.label, pred.uid AS pred_uid, pred.label AS pred_label,count(link.link_id) + FROM link LEFT OUTER JOIN node AS source ON (link.source_id=source.node_id) + INNER JOIN node AS pred ON (pred.node_id=link.predicate_id) + GROUP BY source.uid,source.label,pred.uid,pred.label + CREATE OR REPLACE VIEW linkcount_by_node_source AS SELECT source.uid,source.label, count(link.link_id) FROM link @@ -275,6 +324,43 @@ LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) GROUP BY source.uid,source.label; +CREATE OR REPLACE VIEW linkcount_by_node_and_object_source AS + SELECT node_source.uid AS node_source_uid, + node_source.label AS node_source_label, + obj_source.uid AS obj_source_uid, + obj_source.label AS obj_source_label, + count(link.link_id) + FROM link + INNER JOIN node USING (node_id) + LEFT OUTER JOIN node AS node_source ON (node.source_id=node_source.node_id) + INNER JOIN node AS obj ON (link.object_id=obj.node_id) + LEFT OUTER JOIN node AS obj_source ON (obj.source_id=obj_source.node_id) + GROUP BY node_source_uid, + node_source_label, + obj_source_uid, + obj_source_label; +CREATE OR REPLACE VIEW inter_ontology_linkcount AS + SELECT * FROM linkcount_by_node_and_object_source WHERE node_source_uid!=obj_source_uid; + +CREATE OR REPLACE VIEW linkcount_by_relation_and_node_source AS + SELECT pred.uid AS relation_uid,pred.label AS relation_label,source.uid,source.label, count(link.link_id) + FROM link LEFT OUTER JOIN node AS source ON (link.source_id=source.node_id) + INNER JOIN node AS pred ON (link.predicate_id=pred.node_id) + GROUP BY pred.uid,pred.label,source.uid,source.label; + +CREATE OR REPLACE VIEW linkcount_by_metatype_and_source AS + SELECT source.uid,source.label, is_inferred, combinator, count(link.link_id) + FROM link + LEFT OUTER JOIN node AS source ON (link.source_id=source.node_id) + GROUP BY source.uid,source.label, is_inferred, combinator; + +CREATE OR REPLACE VIEW linkcount_by_metatype_and_node_source AS + SELECT source.uid,source.label, is_inferred, combinator, count(link.link_id) + FROM link + INNER JOIN node USING (node_id) + LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) + GROUP BY source.uid,source.label, is_inferred, combinator; + CREATE OR REPLACE VIEW implied_linkcount_by_node_source AS SELECT source.uid,source.label, count(link.link_id) FROM link @@ -283,7 +369,7 @@ WHERE link.is_inferred='t' GROUP BY source.uid,source.label; -CREATE OR REPLACE VIEW nodecount_by_metatype_and_source AS +CREATE OR REPLACE VIEW nodecount_by_metatype_and_node_source AS SELECT node.metatype,source.uid,source.label, count(node.node_id) FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) GROUP BY node.metatype,source.uid,source.label; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-13 16:39:54
|
Revision: 400 http://svn.sourceforge.net/obo/?rev=400&view=rev Author: mgibson Date: 2007-03-13 09:39:53 -0700 (Tue, 13 Mar 2007) Log Message: ----------- fixed bug where if no local obo file was found it was trying repository as it should revealed by chris' stuff Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java Modified: phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2007-03-12 22:41:22 UTC (rev 399) +++ phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2007-03-13 16:39:53 UTC (rev 400) @@ -172,23 +172,29 @@ /** If repository is configured loads obo from repos if local out of date */ private void loadOboSessionCheckRepos(Ontology o,OntologyConfig oc) - throws OntologyException { + throws OntologyException { + // first get normal/cached/local ontology String filename = oc.getFile(); - URL url = findFile(filename); // throws OntologyEx if file not found + // throws OntologyEx if file not found -- need to catch - should still try url + URL url = null; + try { url = findFile(filename); } + catch (OntologyException oe) { + System.out.println(filename+" not found locally, trying url if configured "); + } // if ontCfg.hasSynchUrl() ? // URL synchUrl = ontCfg.getSynchUrl long mem = Runtime.getRuntime().totalMemory()/1000000; LOG.debug(url+" checking with repos... loading obo session mem "+mem+"\n"); - startTimer(url+" checked against repos... obo session loaded"); // printed at stopTime + startTimer(); if (oc.hasReposUrl()) { try { URL reposUrl = oc.getReposUrl();//new URL("http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/evidence_code.obo"); // if out of synch copies repos to local // url may be jar/obo-files or svn/obo-files but this function may put file // in cache ~/.phenote/obo-files - url = synchWithRepositoryUrl(url,reposUrl,o.getName()); + url = synchWithRepositoryUrl(url,reposUrl,o.getName(),filename); // to do - if from repos need to load repos into local obo cache! @@ -196,13 +202,10 @@ } loadOboSessionFromUrl(o,url,filename); - stopTimer(); + stopTimer(url+" checked against repos... obo session loaded"); mem = Runtime.getRuntime().totalMemory()/1000000; - System.out.println("mem after load "+mem+" max "+Runtime.getRuntime().maxMemory()/1000000); - //System.gc(); - //mem = Runtime.getRuntime().totalMemory()/1000000; - //System.out.println("\n\nmem after garbage collection "+mem+"\n"); - + long max = Runtime.getRuntime().maxMemory()/1000000; + System.out.println("mem after load "+mem+" max "+max); } /** url is either local file or repos url */ @@ -221,12 +224,18 @@ } /** this copies obo file to local cache (~/.phenote/obo-files */ - private URL synchWithRepositoryUrl(URL localUrl, URL reposUrl, String ontol) + private URL synchWithRepositoryUrl(URL localUrl, URL reposUrl, String ontol, + String filename) throws OntologyException { long repos = getOboDate(reposUrl); - long loc = getOboDate(localUrl); // throws ont ex + long loc = 0; boolean useRepos = false; - if (repos > loc) + if (localUrl != null) + loc = getOboDate(localUrl); // throws ont ex + else + useRepos = true; + + if (repos > loc || useRepos) useRepos = queryUserAboutRepos(ontol); if (useRepos) { @@ -239,7 +248,8 @@ // } // download obo to local cache (takes time!) - String file = FileUtil.getNameOfFile(localUrl); + String file = localUrl!=null ? FileUtil.getNameOfFile(localUrl) : filename; + //String file = FileUtil.getNameOfFile(localUrl); try { localUrl = new File(FileUtil.getDotPhenoteOboDir(),file).toURL(); LOG.info("Downloading new ontology from repository "+reposUrl+" to "+localUrl); @@ -364,17 +374,17 @@ // eventually move to util class private Calendar startTime; - private String timerMsg; - private void startTimer(String m) { + //private String timerMsg; + private void startTimer() { startTime = Calendar.getInstance(); - timerMsg = m; + //timerMsg = m; //LOG.debug(timerMsg+" Start clock "+startTime.getTime()); // ?? } - private void stopTimer() { + private void stopTimer(String m) { Calendar endTime = Calendar.getInstance(); long seconds = (endTime.getTimeInMillis() - startTime.getTimeInMillis())/1000; - LOG.debug(timerMsg+" number of seconds: "+seconds); + LOG.debug(m+" number of seconds: "+seconds); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-12 22:41:23
|
Revision: 399 http://svn.sourceforge.net/obo/?rev=399&view=rev Author: mgibson Date: 2007-03-12 15:41:22 -0700 (Mon, 12 Mar 2007) Log Message: ----------- the print debug statement was calling next which was throwing off the iterations - boy did that throw me Modified Paths: -------------- phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java Modified: phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java =================================================================== --- phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java 2007-03-12 22:31:48 UTC (rev 398) +++ phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java 2007-03-12 22:41:22 UTC (rev 399) @@ -144,13 +144,13 @@ JarFile jar = juc.getJarFile();//new JarFile(jf); Enumeration<JarEntry> en = jar.entries(); while (en.hasMoreElements()) { - System.out.println("entry: "+en.nextElement()); String entry = en.nextElement().getName(); + //System.out.println("entry: "+entry); if (entry.endsWith(".cfg")) { // test if jar if running off of jar basically //System.out.println("cfg "+entry +" res? "+ConfigFileQueryGui.class.getResource(entry)+ConfigFileQueryGui.class.getResource("/"+entry)); if (ConfigFileQueryGui.class.getResource("/"+entry) != null) { - System.out.println("cfg that is in webstart phenote.jar "+entry); + //System.out.println("cfg that is in webstart phenote.jar "+entry); names.add(entry); } } @@ -176,7 +176,7 @@ File[] cfgFiles = confDir.listFiles(filter); if (cfgFiles == null) return; // null if nothing found for (File f : cfgFiles) { - System.out.println("adding cfg file "+f.getName()+" from dir "+confDir); + //System.out.println("adding cfg file "+f.getName()+" from dir "+confDir); names.add(f.getName()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-12 22:31:50
|
Revision: 398 http://svn.sourceforge.net/obo/?rev=398&view=rev Author: mgibson Date: 2007-03-12 15:31:48 -0700 (Mon, 12 Mar 2007) Log Message: ----------- beginnings of queryable data adapter - one from a database like wormbase Modified Paths: -------------- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java Added Paths: ----------- phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java Added: phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java (rev 0) +++ phenote/trunk/src/java/phenote/dataadapter/QueryableDataAdapterI.java 2007-03-12 22:31:48 UTC (rev 398) @@ -0,0 +1,10 @@ +package phenote.dataadapter; + +import phenote.datamodel.CharField; +import phenote.datamodel.CharacterListI; + +public interface QueryableDataAdapterI { + /** return true if data adapter can query for the char field */ + public boolean isCharFieldQueryable(CharField cf); + public CharacterListI query(CharField cf, String query); +} \ No newline at end of file Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2007-03-12 22:17:23 UTC (rev 397) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2007-03-12 22:31:48 UTC (rev 398) @@ -21,9 +21,12 @@ import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharacterI; +import phenote.datamodel.CharacterListI; +import phenote.dataadapter.CharacterListManager; import phenote.datamodel.Ontology; import phenote.datamodel.OntologyException; import phenote.datamodel.OntologyManager; +import phenote.dataadapter.QueryableDataAdapterI; import phenote.edit.CharChangeEvent; import phenote.edit.CharChangeListener; //import phenote.edit.CompoundTransaction; @@ -84,6 +87,10 @@ else initCombo(); + // check queryableAdapter if charField is queryable + addRetrieveButton(); + + // listens for selection (eg from table) - not for PostCompGui if (enableListeners) SelectionManager.inst().addCharSelectionListener(new FieldCharSelectListener()); @@ -98,6 +105,27 @@ EditManager.inst().addCharChangeListener(new FieldCharChangeListener()); } + private void addRetrieveButton() { + // if (Config.inst().hasQueryableDataAdapter()) { + // QueryableAdapter qa = Config.inst().getQueryableDataAdapter(); // for now just one + // if (qa.isCharFieldQueryable(cf)) { + // Button b = new Button("Retrieve"); + // b.addActionListener(new RetrieveActionListener(qa)); + // fieldPanel.addRetrieveButton(b) + + } + + private class RetrieveActionListener implements ActionListener { + QueryableDataAdapterI qda; + private RetrieveActionListener(QueryableDataAdapterI q) { qda = q; } + public void actionPerformed(ActionEvent e) { + CharacterListI cl = qda.query(charField,getText()); + //notifyNewCharList(cl); + // check if unsaved data - if so ask user if wants to save/load + CharacterListManager.inst().setCharacterList(this,cl); + } + } + // FreeTextField.updateModel uses this boolean updateGuiOnly() { return updateGuiOnly; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-12 22:17:24
|
Revision: 397 http://svn.sourceforge.net/obo/?rev=397&view=rev Author: mgibson Date: 2007-03-12 15:17:23 -0700 (Mon, 12 Mar 2007) Log Message: ----------- webstart is doing funny things with config files not sure whats going on... Modified Paths: -------------- phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java Modified: phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java =================================================================== --- phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java 2007-03-12 21:50:54 UTC (rev 396) +++ phenote/trunk/src/java/phenote/config/ConfigFileQueryGui.java 2007-03-12 22:17:23 UTC (rev 397) @@ -150,7 +150,7 @@ // test if jar if running off of jar basically //System.out.println("cfg "+entry +" res? "+ConfigFileQueryGui.class.getResource(entry)+ConfigFileQueryGui.class.getResource("/"+entry)); if (ConfigFileQueryGui.class.getResource("/"+entry) != null) { - //System.out.println("cfg that is in jar "+entry); + System.out.println("cfg that is in webstart phenote.jar "+entry); names.add(entry); } } @@ -175,8 +175,10 @@ }; File[] cfgFiles = confDir.listFiles(filter); if (cfgFiles == null) return; // null if nothing found - for (File f : cfgFiles) + for (File f : cfgFiles) { + System.out.println("adding cfg file "+f.getName()+" from dir "+confDir); names.add(f.getName()); + } } /** generic util? */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-12 21:50:57
|
Revision: 396 http://svn.sourceforge.net/obo/?rev=396&view=rev Author: mgibson Date: 2007-03-12 14:50:54 -0700 (Mon, 12 Mar 2007) Log Message: ----------- new webstart with no config command line param as now configs are brought up for user to choose from Added Paths: ----------- phenote/trunk/doc/phenote-website/phenote.jnlp Added: phenote/trunk/doc/phenote-website/phenote.jnlp =================================================================== --- phenote/trunk/doc/phenote-website/phenote.jnlp (rev 0) +++ phenote/trunk/doc/phenote-website/phenote.jnlp 2007-03-12 21:50:54 UTC (rev 396) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jnlp +spec="1.0+" +codebase="http://toy.lbl.gov:9010/phenote/1.1" +href="phenote.jnlp"> +<information> + <title>Phenote 1.1</title> + <vendor>BBOP</vendor> + <description>Phenote standalone app via webstart</description> + <!-- Declares that the application can run without + access to the server it was downloaded from --> + <offline-allowed /> +</information> +<security> + <!-- Request that the application be given full + access to the local (executing) machine, + as if it were a regular Java application. + Requires that all JAR files be signed + by a trusted party --> + <all-permissions /> +</security> +<resources> + <!-- Specify the versions of the Java Runtime Environment + (JRE) that are supported by the application. + Multiple entries of this kind are allowed, in which + case they are considered to be in order of preference --> + <j2se version="1.5+" initial-heap-size="64m" max-heap-size="500m" /> + <jar href="jars/phenote.jar" /> + <jar href="jars/oboedit.jar" /> + <jar href="jars/org.geneontology.jar" /> + <jar href="jars/BrowserLauncher2-10rc4.jar" /> + <jar href="jars/jsr173_1.0_api.jar" /> + <jar href="jars/phenoxmlbeans.jar" /> + <jar href="jars/phenoteconfigbeans.jar" /> + <jar href="jars/xbean.jar" /> + <jar href="jars/tomcat-servlet.jar" /> + <jar href="jars/te-common.jar" /> + <jar href="jars/log4j-1.2.13.jar" /> +</resources> +<!-- no cmd line param will ask user for config at initialization --> +<application-desc main-class="phenote.main.Phenote"> +</application-desc> +</jnlp> + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cmu...@us...> - 2007-03-12 06:26:45
|
Revision: 395 http://svn.sourceforge.net/obo/?rev=395&view=rev Author: cmungall Date: 2007-03-11 23:26:45 -0700 (Sun, 11 Mar 2007) Log Message: ----------- Modified Paths: -------------- obo-database/trunk/bin/obd-load-db-from-obo.pl obo-database/trunk/sql/obd-core-schema.sql obo-database/trunk/sql/obd-core-views.sql Modified: obo-database/trunk/bin/obd-load-db-from-obo.pl =================================================================== --- obo-database/trunk/bin/obd-load-db-from-obo.pl 2007-03-11 14:17:59 UTC (rev 394) +++ obo-database/trunk/bin/obd-load-db-from-obo.pl 2007-03-12 06:26:45 UTC (rev 395) @@ -1,10 +1,13 @@ #!/usr/bin/perl +use DBIx::DBStag; +use strict; + my $d; my $use_reasoner = 1; my $dump; my $split; -my $delete; +my $nodelete; while ($ARGV[0] =~ /^\-/) { my $opt = shift @ARGV; if ($opt eq '-d' || $opt eq '--database') { @@ -16,8 +19,8 @@ elsif ($opt eq '--dump') { $dump = 1; } - elsif ($opt eq '--delete') { - $delete = 1; + elsif ($opt eq '--nodelete') { + $nodelete = 1; } elsif ($opt eq '--split') { $split = shift @ARGV; @@ -33,7 +36,7 @@ print STDERR "Loading\n"; foreach my $file (@files) { - if ($delete) { + unless ($nodelete) { clear_previous($file); } print STDERR "Converting File: $file\n"; @@ -69,6 +72,7 @@ my $f = shift; print STDERR "Clearing: $f\n"; my %ns = (); + my $dbh = DBIx::DBStag->connect($d); open(F,$f); while(<F>) { chomp; @@ -80,7 +84,13 @@ } } close(F); - foreach (keys %ns) { - run('psql `stag-connect-parameters.pl '.$d.'` -c "DELETE FROM node WHERE uid=\''.$_.'\'"'); + foreach my $source (keys %ns) { + my ($source_id) = $dbh->selectrow_array("SELECT node_id FROM node WHERE uid='$source'"); + return unless $source_id; + foreach my $table (qw(link sameas tagval alias description)) { + my $sql = "DELETE FROM $table WHERE source_id=$source_id"; + print STDERR "SQL: $sql\n"; + $dbh->do($sql); + } } } Modified: obo-database/trunk/sql/obd-core-schema.sql =================================================================== --- obo-database/trunk/sql/obd-core-schema.sql 2007-03-11 14:17:59 UTC (rev 394) +++ obo-database/trunk/sql/obd-core-schema.sql 2007-03-12 06:26:45 UTC (rev 395) @@ -1,3 +1,4 @@ +-- $Id -- CREATE SEQUENCE node_node_uid_seq; CREATE TABLE node ( @@ -15,6 +16,7 @@ UNIQUE(uid) ); ALTER TABLE node add source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE; + COMMENT ON TABLE node IS 'An element of a graph. A graph consists of a collection of nodes n1, n2, ... and a collection of edges between nodes. Nodes can represent Instances, Relations, and Types. RDF: typically corresponds to a resource'; COMMENT ON COLUMN node.uid IS 'A unique identifier for this node. Must be EITHER a valid URI OR a valid OBO ID.'; COMMENT ON COLUMN node.uri IS 'See W3 specs for definition of URI'; @@ -39,12 +41,13 @@ FOREIGN KEY (predicate_id) REFERENCES node(node_id) ON DELETE CASCADE, object_id INTEGER NOT NULL, FOREIGN KEY (object_id) REFERENCES node(node_id) ON DELETE CASCADE, - when_id INTEGER NOT NULL, + when_id INTEGER, FOREIGN KEY (when_id) REFERENCES node(node_id) ON DELETE CASCADE, is_inferred BOOLEAN NOT NULL DEFAULT 'f', is_instantiation BOOLEAN NOT NULL DEFAULT 'f', combinator CHAR(1) NOT NULL DEFAULT '', source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE, + is_obsolete BOOLEAN NOT NULL DEFAULT 'f', --- should reiflink_node_id also be part of key? multiple statements. YES CONSTRAINT link_unique_c UNIQUE(reiflink_node_id, predicate_id, object_id) @@ -80,7 +83,6 @@ CREATE INDEX link_reiflink_node_indx ON link(reiflink_node_id); CREATE INDEX link_triple_indx ON link(node_id,predicate_id,object_id); - CREATE TABLE sameas ( node_id INTEGER NOT NULL, FOREIGN KEY (node_id) REFERENCES node(node_id) ON DELETE CASCADE, @@ -89,16 +91,18 @@ is_inferred BOOLEAN NOT NULL DEFAULT 'f', source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE, - CONSTRAINT link_unique_c UNIQUE(node_id, object_id, source_id) + CONSTRAINT sameas_unique_c UNIQUE(node_id, object_id, source_id) ); -COMMENT ON TABLE sameas IS 'STATUS: under discussion'; +COMMENT ON TABLE sameas IS 'STATUS: under discussion. Should we use the generic link table? Currently, no; rationale: sameas is a metamodel relation and not a relation between distinct entities in reality'; CREATE TABLE tagval ( node_id INTEGER NOT NULL, FOREIGN KEY (node_id) REFERENCES node(node_id) ON DELETE CASCADE, tag_id INTEGER NOT NULL, FOREIGN KEY (tag_id) REFERENCES node (node_id) ON DELETE CASCADE, - val TEXT NOT NULL + val TEXT NOT NULL, + source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE + ); COMMENT ON TABLE tagval IS 'Atomic attribute of a node. A pair (T,V) where T is a relation node and V is an atomic piece of data (RDF: literal). Note: as opposed to RDF we do not treat literals as nodes in the graph. This table can be seen to correspond to slots'; CREATE INDEX tagval_nt_index ON tagval(node_id, tag_id); @@ -110,7 +114,8 @@ scope VARCHAR, -- ? type_id INTEGER, FOREIGN KEY (type_id) REFERENCES node(node_id) ON DELETE CASCADE, - label VARCHAR NOT NULL + label VARCHAR NOT NULL, + source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE ); COMMENT ON TABLE alias IS 'Alternate label for node, intended for humans'; CREATE INDEX alias_nt_indx ON alias(node_id, type_id); @@ -123,13 +128,14 @@ scope VARCHAR, --? type_id INTEGER, FOREIGN KEY (type_id) REFERENCES node(node_id) ON DELETE CASCADE, - label VARCHAR NOT NULL + label VARCHAR NOT NULL, + source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE ); COMMENT ON TABLE alias IS 'Narrative text intended for humans describing what entity the node represents'; CREATE INDEX description_nt_indx ON description(node_id,type_id); CREATE INDEX description_label_indx ON description(label); --- ? +-- ?DEPRECATED -- depcrate in favour of seeAlso links? CREATE TABLE node_xref ( node_id INTEGER NOT NULL, @@ -158,7 +164,9 @@ FOREIGN KEY (node_id) REFERENCES node(node_id) ON DELETE CASCADE, infonode_id INTEGER NOT NULL, FOREIGN KEY (infonode_id) REFERENCES node(node_id) ON DELETE CASCADE, - loadtime TIMESTAMP default 'now' + loadtime TIMESTAMP default 'now', + source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE + ); COMMENT ON TABLE node_audit IS 'An load/update operation on a node that happened at some point in human existence'; @@ -167,7 +175,8 @@ FOREIGN KEY (link_id) REFERENCES link(link_id) ON DELETE CASCADE, infonode_id INTEGER NOT NULL, FOREIGN KEY (infonode_id) REFERENCES node(node_id) ON DELETE CASCADE, - loadtime TIMESTAMP default 'now' + loadtime TIMESTAMP default 'now', + source_id INTEGER REFERENCES node(node_id) ON DELETE CASCADE ); COMMENT ON TABLE link_audit IS 'An load/update operation on a node that happened at some point in human existence'; Modified: obo-database/trunk/sql/obd-core-views.sql =================================================================== --- obo-database/trunk/sql/obd-core-views.sql 2007-03-11 14:17:59 UTC (rev 394) +++ obo-database/trunk/sql/obd-core-views.sql 2007-03-12 06:26:45 UTC (rev 395) @@ -1,17 +1,167 @@ +-- ************************************************************ +-- SPECIFICIY VIEWS +-- ************************************************************ +-- obd-core is hyper-normalized / ultra-generic +-- the views below define a more specific schema, layered on the core +-- %% node %% + +CREATE OR REPLACE VIEW class_node AS SELECT * FROM node WHERE metatype='C'; +CREATE OR REPLACE VIEW relation_node AS SELECT * FROM node WHERE metatype='R'; +CREATE OR REPLACE VIEW instance_node AS SELECT * FROM node WHERE metatype='I'; +CREATE OR REPLACE VIEW transitive_relation_node AS SELECT * FROM node WHERE metatype='R' AND is_transitive='t'; + +CREATE OR REPLACE VIEW obsolete_node AS SELECT * FROM node WHERE is_obsolete='t'; +CREATE OR REPLACE VIEW obsolete_class_node AS SELECT * FROM class_node WHERE is_obsolete='t'; +CREATE OR REPLACE VIEW obsolete_instance_node AS SELECT * FROM instance_node WHERE is_obsolete='t'; +CREATE OR REPLACE VIEW obsolete_relation_node AS SELECT * FROM relation_node WHERE is_obsolete='t'; + +CREATE OR REPLACE VIEW valid_node AS SELECT * FROM node WHERE is_obsolete='f'; +CREATE OR REPLACE VIEW valid_class_node AS SELECT * FROM class_node WHERE is_obsolete='f'; +CREATE OR REPLACE VIEW valid_instance_node AS SELECT * FROM instance_node WHERE is_obsolete='f'; +CREATE OR REPLACE VIEW valid_relation_node AS SELECT * FROM relation_node WHERE is_obsolete='f'; + +CREATE OR REPLACE VIEW reif_node AS SELECT * FROM node WHERE is_reiflink='t'; + +-- %% link %% + +CREATE OR REPLACE VIEW implied_link AS SELECT * FROM link WHERE is_inferred='t'; +CREATE OR REPLACE VIEW asserted_link AS SELECT * FROM link WHERE is_inferred='f'; + +CREATE OR REPLACE VIEW intersection_link AS SELECT * FROM link WHERE combinator='I'; +CREATE OR REPLACE VIEW union_link AS SELECT * FROM link WHERE combinator='U'; +CREATE OR REPLACE VIEW basic_link AS SELECT * FROM link WHERE combinator=''; + +-- instance_of +CREATE OR REPLACE VIEW instance_of_relation AS SELECT * FROM relation_node WHERE uid='OBO_REL:instance_of'; +CREATE OR REPLACE VIEW instantiation_link AS + SELECT link.* + FROM link INNER JOIN instance_of_relation ON (predicate_id=instance_of_relation.node_id); +CREATE OR REPLACE VIEW asserted_instantiation_link AS SELECT * FROM instantiation_link WHERE is_inferred='f'; +CREATE OR REPLACE VIEW implied_instantiation_link AS SELECT * FROM instantiation_link WHERE is_inferred='t'; + +-- is_a +CREATE OR REPLACE VIEW is_a_relation AS SELECT * FROM relation_node WHERE uid='OBO_REL:is_a'; +CREATE OR REPLACE VIEW non_is_a_relation AS SELECT * FROM relation_node WHERE uid!='OBO_REL:is_a'; +CREATE OR REPLACE VIEW is_a_link AS + SELECT link.* + FROM link INNER JOIN is_a_relation ON (predicate_id=is_a_relation.node_id) + WHERE combinator=''; +CREATE OR REPLACE VIEW instance_of_link AS + SELECT link.* + FROM link INNER JOIN instance_of_relation ON (predicate_id=instance_of_relation.node_id) + WHERE combinator=''; +CREATE OR REPLACE VIEW asserted_is_a_link AS SELECT * FROM is_a_link WHERE is_inferred='f'; +CREATE OR REPLACE VIEW implied_is_a_link AS SELECT * FROM is_a_link WHERE is_inferred='t'; + +CREATE OR REPLACE VIEW genus_link AS + SELECT link.* + FROM link INNER JOIN is_a_relation ON (predicate_id=is_a_relation.node_id) + WHERE combinator='I'; + +CREATE OR REPLACE VIEW differentium_link AS + SELECT link.* + FROM link INNER JOIN non_is_a_relation ON (predicate_id=non_is_a_relation.node_id) + WHERE combinator='I'; + +-- ************************************************************ +-- JOINS +-- ************************************************************ + + +-- %% node * link %% + +CREATE OR REPLACE VIEW node_link AS + SELECT + link.*, + node.uid AS node_uid, + node.label AS node_label, + node.source_id AS node_source_id, + node.metatype AS node_metatype + FROM link INNER JOIN node USING (node_id); + +CREATE OR REPLACE VIEW instance_link AS + SELECT * FROM node_link WHERE node_metatype='I'; +CREATE OR REPLACE VIEW class_link AS + SELECT * FROM node_link WHERE node_metatype='C'; +CREATE OR REPLACE VIEW relation_link AS + SELECT * FROM node_link WHERE node_metatype='R'; + + +-- %% link * node %% + +CREATE OR REPLACE VIEW link_to_node AS + SELECT + node_link.*, + obj.uid AS object_uid, + obj.label AS object_label, + obj.source_id AS object_source_id, + obj.metatype AS object_metatype + FROM node_link INNER JOIN node AS obj ON (node_link.object_id=obj.node_id); + +CREATE OR REPLACE VIEW link_to_instance AS + SELECT * FROM link_to_node WHERE object_metatype='I'; +CREATE OR REPLACE VIEW link_to_class AS + SELECT * FROM link_to_node WHERE object_metatype='C'; +CREATE OR REPLACE VIEW link_to_relation AS + SELECT * FROM link_to_node WHERE object_metatype='R'; + +-- %% node * link * node (triple) %% + +CREATE OR REPLACE VIEW node_link_node AS + SELECT + node_link.*, + obj.uid AS object_uid, + obj.label AS object_label, + obj.source_id AS object_source_id, + obj.metatype AS object_metatype + FROM node_link INNER JOIN node AS obj ON (node_link.object_id=obj.node_id); + +CREATE OR REPLACE VIEW instance_link_instance AS + SELECT * FROM node_link_node + WHERE node_metatype='I' AND object_metatype='I'; +CREATE OR REPLACE VIEW instance_link_class AS + SELECT * FROM node_link_node + WHERE node_metatype='I' AND object_metatype='C'; +CREATE OR REPLACE VIEW class_link_instance AS + SELECT * FROM node_link_node + WHERE node_metatype='C' AND object_metatype='I'; +CREATE OR REPLACE VIEW class_link_class AS + SELECT * FROM node_link_node + WHERE node_metatype='C' AND object_metatype='C'; + +CREATE OR REPLACE VIEW link_with_pred AS + SELECT link.*, + pred.uid AS pred_uid, + pred.label AS pred_label, + pred.source_id AS pred_source_id, + pred.metatype AS pred_metatype + FROM link INNER JOIN node AS pred ON (predicate_id=pred.node_id); + CREATE OR REPLACE VIEW link_with_pred_uid AS SELECT link.*, pred.uid AS pred_uid FROM link INNER JOIN node AS pred ON (predicate_id=pred.node_id); -CREATE OR REPLACE VIEW instance_of_link AS - SELECT link.* FROM link INNER JOIN node AS pred ON (predicate_id=pred.node_id) WHERE pred.uid='OBO_REL:instance_of'; +-- ************************************************************ +-- ANNOTATION MODEL +-- ************************************************************ + +-- link where relation=posits; from annotation to statement CREATE OR REPLACE VIEW posits_link AS SELECT pl.* FROM link_with_pred_uid AS pl WHERE pred_uid='oban:posits'; +CREATE OR REPLACE VIEW link_to_link AS + SELECT + link_in.node_id AS in_node_id, + link_in.predicate_id AS in_predicate_id, + linked_link.* + FROM link AS link_in INNER JOIN link AS linked_link ON (link_in.object_id = linked_link.reiflink_node_id); + +-- instance of an annotation CREATE OR REPLACE VIEW annotation_node AS SELECT * FROM node WHERE node_id IN @@ -19,6 +169,7 @@ FROM instance_of_link INNER JOIN node AS c ON (c.node_id=instance_of_link.object_id) WHERE c.uid='oban:Annotation'); +-- instance of an annotation and the statement posited in the annotation CREATE OR REPLACE VIEW annotation_node_J_link AS SELECT node.*, @@ -37,8 +188,6 @@ FROM posits_link AS pl INNER JOIN link ON (pl.object_id=link.reiflink_node_id); - - CREATE OR REPLACE VIEW statement_node AS SELECT node.*, @@ -46,88 +195,29 @@ link.predicate_id, link.object_id, link.is_inferred, -wp link.combinator + link.combinator FROM node INNER JOIN link ON (link.reiflink_node_id=node.node_id); -CREATE OR REPLACE VIEW statementcount_by_source AS - SELECT source.uid,source.label, count(sn.node_id) - FROM statement_node AS sn - INNER JOIN node AS source ON (sn.source_id=source.node_id) - GROUP BY source.uid,source.label; - CREATE OR REPLACE VIEW node_j_source AS SELECT node.*,source.label AS source_label, source.uid AS source_uid FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id); -CREATE OR REPLACE VIEW nodecount_by_source AS - SELECT source.uid,source.label, count(node.node_id) - FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) - GROUP BY source.uid,source.label; -CREATE OR REPLACE VIEW linkcount_by_source AS - SELECT source.uid,source.label, count(link.link_id) - FROM link - INNER JOIN node USING (node_id) - LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) - GROUP BY source.uid,source.label; - -CREATE OR REPLACE VIEW implied_linkcount_by_source AS - SELECT source.uid,source.label, count(link.link_id) - FROM link - INNER JOIN node USING (node_id) - LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) - WHERE link.is_inferred='t' - GROUP BY source.uid,source.label; - -CREATE OR REPLACE VIEW nodecount_by_metatype_and_source AS - SELECT node.metatype,source.uid,source.label, count(node.node_id) - FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) - GROUP BY node.metatype,source.uid,source.label; - -CREATE OR REPLACE VIEW implied_link AS SELECT * FROM link WHERE is_inferred='t'; -CREATE OR REPLACE VIEW asserted_link AS SELECT * FROM link WHERE is_inferred='f'; - -CREATE OR REPLACE VIEW class_node AS SELECT * FROM node WHERE metatype='C'; -CREATE OR REPLACE VIEW relation_node AS SELECT * FROM node WHERE metatype='R'; -CREATE OR REPLACE VIEW instance_node AS SELECT * FROM node WHERE metatype='I'; - -CREATE OR REPLACE VIEW transitive_relation_node AS SELECT * FROM node WHERE metatype='R' AND is_transitive='t'; - - -CREATE OR REPLACE VIEW intersection_link AS SELECT * FROM link WHERE combinator='I'; -CREATE OR REPLACE VIEW union_link AS SELECT * FROM link WHERE combinator='U'; - CREATE OR REPLACE VIEW link_J_predicate AS SELECT link.*, node.uid AS node_uid, node.label AS node_label, - node.source AS node_source + node.source_id AS node_source_id FROM link INNER JOIN node ON (predicate_id=node.node_id); -CREATE OR REPLACE VIEW is_a AS SELECT * FROM node WHERE uid='OBO_REL:is_a'; +-- deprecated? -CREATE OR REPLACE VIEW is_a_link AS - SELECT link.* - FROM link INNER JOIN is_a ON (predicate_id=is_a.node_id) - WHERE combinator=''; - -CREATE OR REPLACE VIEW genus_link AS - SELECT link.* - FROM link INNER JOIN is_a ON (predicate_id=is_a.node_id) - WHERE combinator='I'; - -CREATE OR REPLACE VIEW differentium_link AS - SELECT link.* - FROM link INNER JOIN node ON (predicate_id=node.node_id) - WHERE combinator='I' - AND node.uid='is_a'; - ---use plural to avoid our user type defined for function and easy to remember it is a view ---using views write query to get pheno data is much slower (18 sec) compared with using functions (8 sec) ---however, using view we could write where-clause like in template where-element @@ -157,3 +247,44 @@ INNER JOIN node obj ON (obj.node_id=link.object_id) INNER JOIN node objt ON (obj.metatype_id=objt.node_id) INNER JOIN node r ON (r.node_id=link.predicate_id); + +-- ************************************************************ +-- AGGREGATE QUERIES +-- ************************************************************ + +CREATE OR REPLACE VIEW statementcount_by_source AS + SELECT source.uid,source.label, count(sn.node_id) + FROM statement_node AS sn + INNER JOIN node AS source ON (sn.source_id=source.node_id) + GROUP BY source.uid,source.label; + +CREATE OR REPLACE VIEW nodecount_by_source AS + SELECT source.uid,source.label, count(node.node_id) + FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) + GROUP BY source.uid,source.label; + +CREATE OR REPLACE VIEW linkcount_by_source AS + SELECT source.uid,source.label, count(link.link_id) + FROM link LEFT OUTER JOIN node AS source ON (link.source_id=source.node_id) + GROUP BY source.uid,source.label; + +CREATE OR REPLACE VIEW linkcount_by_node_source AS + SELECT source.uid,source.label, count(link.link_id) + FROM link + INNER JOIN node USING (node_id) + LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) + GROUP BY source.uid,source.label; + +CREATE OR REPLACE VIEW implied_linkcount_by_node_source AS + SELECT source.uid,source.label, count(link.link_id) + FROM link + INNER JOIN node USING (node_id) + LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) + WHERE link.is_inferred='t' + GROUP BY source.uid,source.label; + +CREATE OR REPLACE VIEW nodecount_by_metatype_and_source AS + SELECT node.metatype,source.uid,source.label, count(node.node_id) + FROM node LEFT OUTER JOIN node AS source ON (node.source_id=source.node_id) + GROUP BY node.metatype,source.uid,source.label; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-11 14:18:00
|
Revision: 394 http://svn.sourceforge.net/obo/?rev=394&view=rev Author: mgibson Date: 2007-03-11 07:17:59 -0700 (Sun, 11 Mar 2007) Log Message: ----------- just a comment about file adapters Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java Modified: phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java 2007-03-09 23:52:08 UTC (rev 393) +++ phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java 2007-03-11 14:17:59 UTC (rev 394) @@ -35,6 +35,8 @@ /**Loads a new document of characters, prompting the user to choose a file and possibly a data adapter.*/ public void loadData() { + + // should only hop to file dialog if its known that ALL data adapters are File adapters File aFile = runOpenDialog(); if (aFile != null) { FileFilter filter = fileChooser.getFileFilter(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nl...@us...> - 2007-03-09 23:52:25
|
Revision: 393 http://svn.sourceforge.net/obo/?rev=393&view=rev Author: nlw Date: 2007-03-09 15:52:08 -0800 (Fri, 09 Mar 2007) Log Message: ----------- i noticed that if i increased the amount of memory from 400 to 500M, that the autocomplete ran a lot faster when GO+FMA+CHEBI was loaded. So, that's what I changed here in the build.xml file Modified Paths: -------------- phenote/trunk/build.xml Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2007-03-08 16:38:42 UTC (rev 392) +++ phenote/trunk/build.xml 2007-03-09 23:52:08 UTC (rev 393) @@ -76,7 +76,7 @@ <!-- runs off classfiles not jar, todo: run-jar --> <target name="run" depends="compile"> - <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx400M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx500M"> <!-- arg value="-c configfilehereventually"/ --> <classpath> <pathelement path="${classfiles}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-08 17:17:32
|
Revision: 392 http://svn.sourceforge.net/obo/?rev=392&view=rev Author: mgibson Date: 2007-03-08 08:38:42 -0800 (Thu, 08 Mar 2007) Log Message: ----------- link to dataadapter docs Modified Paths: -------------- phenote/trunk/doc/phenote-website/phenote.html Modified: phenote/trunk/doc/phenote-website/phenote.html =================================================================== --- phenote/trunk/doc/phenote-website/phenote.html 2007-03-08 16:32:41 UTC (rev 391) +++ phenote/trunk/doc/phenote-website/phenote.html 2007-03-08 16:38:42 UTC (rev 392) @@ -5,19 +5,23 @@ + + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + + <title>Phenote</title> </head> @@ -27,21 +31,25 @@ + <h1 style="text-align: left;"><span style="font-weight: bold;"></span>Phenote<br> + </h1> + <br> + Phenote is a tool to annotate phenotypes using the Entity Quality paradigm. It takes advantage of ontologies. It uses term completion to allow curators quick access to @@ -50,38 +58,46 @@ + <br> + <a href="1.0/phenote-flybase.jnlp">Phenote 1.0 for fly</a><br> + <br> + <a href="1.0/phenote-zfin.jnlp">Phenote 1.0 for zfin</a><br> + <br> + <a href="1.0/phenote-zfin.jnlp"></a><a href="1.0/phenote-human.jnlp">Phenote 1.0 for human</a><br> + <br> + To be clear the above webstart links for zfin & fly were made via configuration not hard wired code. Thus one could in theory configure phenote for ones own purposes.<br> @@ -89,11 +105,13 @@ + <br> + Recent addditions include the ability to add any field you like, post compose terms, bulk update, undo, spring framework, and synonyms now are shown in the completion list.<br> @@ -101,11 +119,13 @@ + <br> + Zebrafish requires components of phenote(to plug into their non-public website), not a full web app. Here is a proof of concept of some of @@ -115,49 +135,58 @@ + <br> + <a href="http://reaper.lbl.gov/phenote/html/ncbo.html">Webby Phenote(components used by Zfin)</a><br> + <br> + Webby phenote is a collaboration with Sohel Merchant at dictyBase. Here is what they have done:<br> + <br> + <a href="http://165.124.152.194/db/cgi-bin/dictyBase/curation/phenotypeCuration.pl">DictyBase webby phenote</a><br> + <br> + <br> + We are doing these releases to get feedback. Please report any bugs (ideally through the <a href="https://sourceforge.net/tracker/?group_id=76834&atid=887913">bug tracker</a>) and let us know what you @@ -166,82 +195,100 @@ + <br> + In development - the bleeding edge if you will:<br> + <br> + <a href="1.1/phenote.jnlp">Phenote 1.1</a><br> + <h4>Phenote links:<br> + </h4> + <a href="https://lists.sourceforge.net/lists/listinfo/obo-phenote">Phenote email list</a><br> + <a href="https://sourceforge.net/tracker/?group_id=76834&atid=887913">Phenote bug tracker</a><br> + <a href="https://lists.sourceforge.net/lists/listinfo/obo-phenote-bug-tracker">Bug tracker email list</a><br> + <a href="https://sourceforge.net/svn/?group_id=76834">Phenote source code (obo sourceforge svn)</a><br> + <a href="https://lists.sourceforge.net/lists/listinfo/obo-svn-commit">Phenote svn commit email list</a><br> + <a href="http://wiki.dictybase.org/dictywiki/index.php/Phenotype_Curation_Tool_Documentation#Usage">Dicty webby phenote wiki developer docs</a><br> + <a href="http://www.bioontology.org/wiki-internal/index.php/Phenotype_Annotation_Tool">Phenote ncbo internal wiki (ncbo folk only)</a><br> +<a href="developer-docs/dataadapter.html">Phenote dataadapter developer doc</a><br> + <br> + <a href="phenote-release-notes.html">Phenote Release Notes and old webstart releases</a><br> + <br> + If the Phenote webstart link fails to do anything, then there are probably problems with webstart and/or java(has to be jdk 1.5). Take a look at the <a href="webstart-troubleshooting.html">webstart troubleshooting</a><br> @@ -249,150 +296,180 @@ + page.<br> + <br> + Click here for <a href="phenote-java-requirements.html">phenote java requirements</a><br> + <br> + <br> + <br> + Old releases: <br> + <br> + <a href="0.9/phenote-flybase.jnlp">Phenote 0.9 for fly</a><br> + <a href="0.9/phenote-zfin.jnlp">Phenote (standalone) 0.9 for zfin</a><br> + <br> + <a href="0.8/phenote-flybase.jnlp">Phenote 0.8 for fly.</a><br> + <a href="0.8/phenote-zfin.jnlp">Phenote (standalone) 0.8 for zfin</a><br> + <br> + <a href="0.7/phenote-flybase.jnlp">Phenote 0.7 for fly.</a><br> + <a href="0.7/phenote-zfin.jnlp">Phenote (standalone) 0.7 for zfin</a><br> + <br> + <a href="0.6/phenote-flybase.jnlp">Phenote 0.6 with fly anatomy</a><br> + <br> + <a href="0.6/phenote-zfin.jnlp">Phenote 0.6 with zebrafish anatomy</a><br> + <br> + <a href="0.5/phenote-flybase.jnlp">Phenote 0.5 webstart for FlyBase</a><br> + <br> + <a href="0.5/phenote-zfin.jnlp">Phenote 0.5 webstart for ZFIN</a><br> + <br> + <a href="0.4/phenote-flybase.jnlp">Phenote 0.4 webstart for FlyBase</a><br> + <br> + <a href="0.4/phenote-zfin.jnlp">Phenote 0.4 webstart for ZFIN</a><br> + <br> + <a href="0.3.1/phenote-webstart.jnlp">Phenote for CToL group (0.3.1)</a> (a special release for the CToL group that uses fish taxonomy)<br> @@ -400,45 +477,54 @@ + <br> + <a href="0.3/phenote-webstart.jnlp">Phenote 0.3</a><br> + <br> + <a href="0.2/phenote-webstart.jnlp">Phenote 0.2</a><br> + <br> + <a href="0.1/phenote-webstart.jnlp">Phenote 0.1</a><br> + <br> + <br> + </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2007-03-08 16:32:40
|
Revision: 391 http://svn.sourceforge.net/obo/?rev=391&view=rev Author: mgibson Date: 2007-03-08 08:32:41 -0800 (Thu, 08 Mar 2007) Log Message: ----------- wrote up writeback in dataadapter.html dataadapter docs - really its quite simple Modified Paths: -------------- phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html phenote/trunk/src/java/phenote/datamodel/CharacterI.java Modified: phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html =================================================================== --- phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html 2007-03-08 00:17:04 UTC (rev 390) +++ phenote/trunk/doc/phenote-website/developer-docs/dataadapter.html 2007-03-08 16:32:41 UTC (rev 391) @@ -2,66 +2,95 @@ <html> <head> + + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + + <title>Creating a phenote data adapter - developer docs</title> </head> <body> + <h1 style="text-decoration: underline; text-align: center;">Creating a Phenote Data Adapter</h1> + First off if youve just downloaded phenote from sourceforge obo svn, the (latest) source is located in phenote/trunk/src/java. The most important subdirectories under src/java for creating a data adapter are phenote/dataadapter and phenote/datamodel. <br> + <br> + A good example data adapter to check out is phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter<br> + <br> + The interface that a phenote data adapter implements is phenote.dataadapter.DataAdapterI, and here is what it looks like:<br> + <br> + public interface DataAdapterI {<br> + <br> + public void load();<br> + public CharacterListI load(File f);<br> + <br> + public void commit(CharacterListI charList);<br> + public void commit(CharacterListI charList, File f);<br> + <br> + /** Set value to use for loading or writeback, for a file adapter this would be<br> + the file name */<br> + public void setAdapterValue(String adapterValue);<br> + public List<String> getExtensions();<br> + public String getDescription();<br> + }<br> + <br> + The most important methods are load() and commit(charList). load() will be called by phenote to load up a phenote.datamodel.CharacterListI. A CharacterListI is just a list of phenote.datamodel.Characters. A Character is basically a phenotypic statement (relating E,Q,genotype, etc...). So basically what a data adapter needs to produce is a list of characters. <br> + <br> + A Character is just a set of tag-value fields, where the tag is the name of the field (Entity, Quality, Genotype...), and value is the value of the field. The actual names of the fields come from the @@ -76,55 +105,138 @@ addition to making a data adapter you need to make a configuration that fits with it (or make sure it fits with an existing configuration).<br> <br> +<h2><span style="text-decoration: underline;">Reading in data</span></h2> + + To set a field in a character use:<br> + setValue(CharField cf, String valueString) which throws a phenote.datamodel.TermNotFoundException if the valueString is not found in the ontologies associated with the CharField(via configuration)<br> + where phenote.datamodel.CharField is an object that represents a field in a character. To get a char field you can call <br> + getCharFieldForName(String fieldName) which throws a phenote.datamodel.CharFieldException if you give it a string that is not from the configuration. Ok even better I just combined this into one convenience method:<br> + setValue(String fieldString, String valueString) throws TermNotFoundException, CharFieldException.<br> + For fields with ontologies (with term completion) the valueString has to be the id for the term (not the term name)<br> + <br> + So thats basically it for making characters. Some code might look like this:<br> + <br> + try {<br> + Character c = new Character();<br> + c.setValue("Entity","GO:123");<br> + c.setValue("Quality","PATO:345");<br> + c.setValue("Genotype","somegenotypehere");<br> + ....<br> + } <br> + catch (CharFieldException e) {...} // may want to do this per field - error msg?<br> + catch (TermNotFoundException e) {...} // perhaps per field - error message?<br> + <br> + and for CharacterLists just add the characters made above to it:<br> + CharacterList cl = new CharacterList();<br> + cl.add(character1);<br> + cl.add(character2);<br> + ...<br> + <br> -Ok I just noticed that currently only load(file) and -commit(charList,file) are being called via the LoadSaveManager - I will -fix this pronto.<br> <br> +<h2><span style="text-decoration: underline;">Writing out data</span></h2> +The CharacterList is passed into the commit method. Iterate through the +list of CharacterI's. To get at a Characters field data just call +character.getValueString(String fieldString). This throws a +CharFieldException if the fieldString doesnt match a field in your +configuration. This returns a String which is the value of that field, +in the case of fields with ontologies this is a term id (GO:1234). If +you would like more info than just the term id from an ontology field +you can call getTerm(String fieldName). This returns an +org.geneontology.oboedit.datamodel.OBOClass from the obo edit datamodel +(I may eventually wrap this in a phenote object - not sure).<br> <br> +You can also query the OntologyManager for all existing character +fields with OntologyManager.inst().getCharFieldList() which returns a +List<CharField>. You can then query whether the Character has a +value for a char field with character.hasValue(CharField), and can +retrieve a phenote.datamodel.CharFieldValue from the character with +getValue(CharField). You can then call charFieldValue.getName() to get +the free text string or the id of the field. You can also query if its +a term with charFieldValue.isTerm() and if so get its OBOClass with +getTerm().<br> <br> +And thats about it. As you can see theres several way of getting at this data. Heres what some code may look like:<br> <br> + for (CharacterI ch : characterList.getList()) {<br> + try {<br> + String genotype = ch.getValueString("Genotype");<br> + OBOClass entityTerm = ch.getTerm("Entity");<br> + OBOClass valueTerm = ch.getTerm("Value");<br> <br> -ToDo:<br> + // write this data out to data source...<br> +<br> + } catch (CharFieldException ex) { ...error processing... }<br> +<br> +This implies that Genotype, Entity, and Value are all in configuration file, and if not exception will be thrown.<br> +<br> +<br> +<br> + +<br> + +<br> +<br> +<span style="font-weight: bold;">ToDo/Changes needed to data adapter interface:</span><br> + +Ok I just noticed that currently only load(file) and +commit(charList,file) are being called via the LoadSaveManager - I will +fix this pronto.<br> + So load & save from file menu has been directed to LoadSaveManager which is hardwired to files(Jim Balhoffs work for phenoxml,syntax, & nexus adapters - which are all file based - we havent had non-file yet). This wont work for database adapters and needs a refactoring - I will get on this! <br> <br> -Add method to Character for setting a field with just strings:<br> +load() should return a CharacterList not void! <br> + +<br> +##DONE Add method to Character for setting a field with just strings:<br> + setValue(String field, String value)<br> + <br> +refactor? should OBOClass be wrapped in a phenote class to detach phenote from obo edit?<br> + <br> -(dev note: Im wondering if the file stuff in DataAdapterI should be refactored) +refactor note: Im wondering if the file stuff in DataAdapterI should be +refactored - i could imagine a AdapterParam class or subclasses of +DataAdapterI like FileDataAdapterI and DatabaseDatAdapterI and +DataAdapterI would have methods like boolean isFileAdapter(), +FileDataAdapter getFileDataAdpater() - need to think about this.<br> +<br> +refactor: phenote datamodel is eventually gonna also get hip to obo +edits instance datamodel - however i think it will be under the covers +and the above interface will remain the same. </body> </html> Modified: phenote/trunk/src/java/phenote/datamodel/CharacterI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2007-03-08 00:17:04 UTC (rev 390) +++ phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2007-03-08 16:32:41 UTC (rev 391) @@ -19,8 +19,8 @@ public CharField getCharFieldForName(String fieldName) throws CharFieldException; public CharFieldValue getValue(CharField cf); public String getValueString(CharField cf); - // should make an exception for this - public String getValueString(String fieldName) throws CharFieldException; // yuck + + public String getValueString(String fieldName) throws CharFieldException; public OBOClass getTerm(String fieldName) throws CharFieldException; // public void setTerm(String field, OBOClass term); // needed for protege plugin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |