* * See details what a toolkit can provide in - * embl.ebi.soap.SOAPToolkit. + * org.tulsoft.tools.soap.SOAPToolkit. *************************************************************************/ public SOAPToolkit getToolkit() { return toolkit; From senger at pub.open-bio.org Sun Sep 4 09:45:37 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Sep 4 10:33:04 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509041345.j84Djb0L028017@pub.open-bio.org> senger Sun Sep 4 09:45:37 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv27838/src/main/org/biomoby/client Modified Files: BaseClient.java BaseCmdLineClient.java CentralDigestImpl.java CentralImpl.java GraphsServlet.java Log Message: moby-live/Java/src/main/org/biomoby/client BaseClient.java,1.1,1.2 BaseCmdLineClient.java,1.1,1.2 CentralDigestImpl.java,1.3,1.4 CentralImpl.java,1.24,1.25 GraphsServlet.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseClient.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseClient.java 2005/08/26 06:40:53 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseClient.java 2005/09/04 13:45:37 1.2 @@ -15,8 +15,8 @@ import org.biomoby.shared.parser.MobyPackage; import org.biomoby.shared.parser.MobyJob; -import embl.ebi.soap.axis.AxisCall; -import embl.ebi.utils.GException; +import org.tulsoft.tools.soap.axis.AxisCall; +import org.tulsoft.shared.GException; import java.net.URL; import java.net.MalformedURLException; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseCmdLineClient.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseCmdLineClient.java 2005/08/26 06:40:53 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseCmdLineClient.java 2005/09/04 13:45:37 1.2 @@ -17,11 +17,11 @@ import org.biomoby.shared.datatypes.MobyObject; import org.biomoby.shared.datatypes.MapDataTypesIfc; -import embl.ebi.tools.BaseCmdLine; -import embl.ebi.tools.ICreator; -import embl.ebi.utils.GException; -import embl.ebi.utils.FileUtils; -import embl.ebi.utils.DGUtils; +import org.tulsoft.tools.BaseCmdLine; +import org.tulsoft.tools.loaders.ICreator; +import org.tulsoft.shared.GException; +import org.tulsoft.shared.FileUtils; +import org.tulsoft.tools.debug.DGUtils; import java.util.Vector; import java.util.HashMap; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestImpl.java 2005/04/18 23:57:45 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestImpl.java 2005/09/04 13:45:37 1.4 @@ -6,18 +6,17 @@ package org.biomoby.client; -import java.util.Iterator; -import java.util.Map; -import java.util.Vector; - import org.biomoby.shared.CentralDigest; import org.biomoby.shared.MobyDataType; import org.biomoby.shared.MobyException; import org.biomoby.shared.MobyService; import org.biomoby.shared.MobyServiceType; -import embl.ebi.utils.DGUtils; -// import java.net.*; +import org.tulsoft.tools.debug.DGUtils; + +import java.util.Iterator; +import java.util.Map; +import java.util.Vector; /** * A default implementation of {@link =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/08/26 06:27:04 1.24 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/09/04 13:45:37 1.25 @@ -23,7 +23,7 @@ import org.biomoby.shared.Utils; import org.biomoby.shared.MobyResourceRef; -import embl.ebi.soap.axis.AxisUtils; +import org.tulsoft.tools.soap.axis.AxisUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java 2005/05/19 15:57:25 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java 2005/09/04 13:45:37 1.11 @@ -8,6 +8,31 @@ package org.biomoby.client; +import org.biomoby.shared.CentralAll; +import org.biomoby.shared.MobyDataType; +import org.biomoby.shared.MobyException; +import org.biomoby.shared.MobyNamespace; +import org.biomoby.shared.MobyPrimaryDataSimple; +import org.biomoby.shared.MobyService; +import org.biomoby.shared.MobyServiceType; +import org.biomoby.shared.Utils; + +import org.tulsoft.tools.servlets.Html; +import org.tulsoft.tools.servlets.HtmlConstants; +import org.tulsoft.tools.external.CatchOutputDefaultImpl; +import org.tulsoft.tools.external.Executor; +import org.tulsoft.tools.Printf; +import org.tulsoft.tools.Sorter; +import org.tulsoft.shared.GException; +import org.tulsoft.shared.StringUtils; +import org.tulsoft.shared.UUtils; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -23,32 +48,6 @@ import java.util.Properties; import java.util.Vector; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.biomoby.shared.CentralAll; -import org.biomoby.shared.MobyDataType; -import org.biomoby.shared.MobyException; -import org.biomoby.shared.MobyNamespace; -import org.biomoby.shared.MobyPrimaryDataSimple; -import org.biomoby.shared.MobyService; -import org.biomoby.shared.MobyServiceType; -import org.biomoby.shared.Utils; - -import embl.ebi.servlets.Html; -import embl.ebi.servlets.HtmlConstants; -import embl.ebi.tools.CatchOutputDefaultImpl; -import embl.ebi.tools.Executor; -import embl.ebi.tools.Printf; -import embl.ebi.tools.Sorter; -import embl.ebi.utils.GException; -import embl.ebi.utils.StringUtils; -import embl.ebi.utils.UUtils; - - /** * A servlet making graphs of Moby service instances, Moby data types, * and Moby service types.
@@ -1489,7 +1488,7 @@ // where is the 'dot' program String dotProg = "dot"; String dotPath = (String)initParams.get (DOT_PATH); - if (! UUtils.isEmpty (dotPath)) + if ( ! UUtils.isEmpty (dotPath) && ! "\"\"".equals (dotPath) ) dotProg = dotPath + System.getProperty ("file.separator") + dotProg; // depending on the cache implementation we may ask From senger at pub.open-bio.org Sun Sep 4 09:45:38 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Sep 4 10:33:20 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509041345.j84DjcvT028060@pub.open-bio.org> senger Sun Sep 4 09:45:38 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory pub.open-bio.org:/tmp/cvs-serv27838/src/main/org/biomoby/service/dashboard Modified Files: AbstractPanel.java RegistryPanel.java Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard AbstractPanel.java,1.1,1.2 RegistryPanel.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java 2005/09/02 07:38:36 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java 2005/09/04 13:45:38 1.2 @@ -9,11 +9,14 @@ package org.biomoby.service.dashboard; import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.text.html.HTMLDocument; import javax.swing.Icon; import javax.swing.JComponent; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeSupport; /** * WORK IN PROGRESS.
@@ -23,6 +26,7 @@
*/
public abstract class AbstractPanel
+ extends JPanel
implements DashboardPanel {
/**************************************************************************
@@ -39,20 +43,23 @@
return null;
}
- /**************************************************************************
- *
- **************************************************************************/
- public void addPropertyChangeListener (PropertyChangeListener listener) {
+ /*********************************************************************
+ * Property change stuff
+ ********************************************************************/
+ protected PropertyChangeSupport support;
+
+ public void addPropertyChangeListener (PropertyChangeListener l) {
+ if (support != null)
+ support.addPropertyChangeListener(l);
}
- /**************************************************************************
- *
- **************************************************************************/
- public void removePropertyChangeListener(PropertyChangeListener listener) {
+ public void removePropertyChangeListener (PropertyChangeListener l) {
+ if (support != null)
+ support.removePropertyChangeListener(l);
}
/**************************************************************************
- *
+ * Here we get notified when a property chnage happen.
**************************************************************************/
public void propertyChange (PropertyChangeEvent event) {
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/09/02 07:38:36 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/09/04 13:45:38 1.2
@@ -12,7 +12,9 @@
import javax.swing.text.html.HTMLDocument;
import javax.swing.Icon;
import javax.swing.JComponent;
+
import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;
/**
*
@@ -26,6 +28,20 @@
public class RegistryPanel
extends AbstractPanel {
+ /*********************************************************************
+ * propertyChange()
+ ********************************************************************/
+ public void propertyChange (PropertyChangeEvent e) {
+ String prop = e.getPropertyName();
+ String newVal = (String)e.getNewValue();
+ if (newVal == null) return; // no interest in non-defined new values
+ if (prop == null) return; // no interest in non-specific changes
+// else if (prop.equalsIgnoreCase (PROP_MODE)) setMode (checkAndGetOperMode (newVal));
+// else if (prop.equalsIgnoreCase (PROP_BEAN_VISIBLE)) setBeanVisible (BBConfig.getBoolFromString (newVal));
+// else if (prop.equalsIgnoreCase (PROP_LISTEN_TO)) setListenTo (newVal);
+// else if (prop.equalsIgnoreCase (PROP_DATA_IDENTITY)) setDataIdentity (newVal);
+ }
+
/**************************************************************************
*
**************************************************************************/
From senger at pub.open-bio.org Sun Sep 4 09:45:37 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Sun Sep 4 10:50:50 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509041345.j84DjbQf027878@pub.open-bio.org>
senger
Sun Sep 4 09:45:37 EDT 2005
Update of /home/repository/moby/moby-live/Java/docs/images
In directory pub.open-bio.org:/tmp/cvs-serv27838/docs/images
Modified Files:
ant-snapshot.png
Log Message:
moby-live/Java/docs/images ant-snapshot.png,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
Binary files /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png 2005/08/26 06:27:02 1.2 and /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png 2005/09/04 13:45:36 1.3 differ
rcsdiff: /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png: diff failed
From senger at pub.open-bio.org Sun Sep 4 09:45:37 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Sun Sep 4 10:50:50 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509041345.j84DjbNv027977@pub.open-bio.org>
senger
Sun Sep 4 09:45:37 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/Clients/help
In directory pub.open-bio.org:/tmp/cvs-serv27838/src/Clients/help
Modified Files:
BaseCmdLineClient_usage.txt CacheRegistryClient_usage.txt
MobyCmdLineClient_usage.txt MobyDigest_usage.txt
MobyGraphs_usage.txt MosesGenerators_usage.txt
TestingMobyParser_usage.txt
Added Files:
argsfile.example
Log Message:
moby-live/Java/src/Clients/help argsfile.example,NONE,1.1 BaseCmdLineClient_usage.txt,1.1,1.2 CacheRegistryClient_usage.txt,1.2,1.3 MobyCmdLineClient_usage.txt,1.9,1.10 MobyDigest_usage.txt,1.2,1.3 MobyGraphs_usage.txt,1.6,1.7 MosesGenerators_usage.txt,1.1,1.2 TestingMobyParser_usage.txt,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/help/BaseCmdLineClient_usage.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/Clients/help/BaseCmdLineClient_usage.txt 2005/08/26 06:40:53 1.1
+++ /home/repository/moby/moby-live/Java/src/Clients/help/BaseCmdLineClient_usage.txt 2005/09/04 13:45:37 1.2
@@ -52,3 +52,5 @@
-outxml ... show results as XML
-o
* * WORK IN PROGRESS.
* @@ -60,7 +66,7 @@ * **************************************************************************/ public JLabel getTitle() { - return null; + return new JLabel (getName()); } } From senger at pub.open-bio.org Tue Sep 13 02:54:36 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Tue Sep 13 03:36:08 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509130654.j8D6saEL011005@pub.open-bio.org> senger Tue Sep 13 02:54:36 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory pub.open-bio.org:/tmp/cvs-serv10990/src/main/org/biomoby/service/dashboard Added Files: ConsolePanel.java Dashboard.java DashboardProperties.java EventGeneratorPanel.java Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard ConsolePanel.java,NONE,1.1 Dashboard.java,NONE,1.1 DashboardProperties.java,NONE,1.1 EventGeneratorPanel.java,NONE,1.1 From pieter at pub.open-bio.org Mon Sep 12 09:51:03 2005 From: pieter at pub.open-bio.org (Pieter Neerincs) Date: Tue Sep 13 08:08:47 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509121351.j8CDp3Up008568@pub.open-bio.org> pieter Mon Sep 12 09:51:03 EDT 2005 Update of /home/repository/moby/moby-live/Perl/scripts In directory pub.open-bio.org:/tmp/cvs-serv8543/Perl/scripts Modified Files: CloneCentralDatabases.pl Log Message: Fixed small SQL GRANT PRIVILEGES bug in Perl/scripts/CloneCentralDatabases.pl moby-live/Perl/scripts CloneCentralDatabases.pl,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/CloneCentralDatabases.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/scripts/CloneCentralDatabases.pl 2005/07/07 11:39:54 1.1 +++ /home/repository/moby/moby-live/Perl/scripts/CloneCentralDatabases.pl 2005/09/12 13:51:03 1.2 @@ -143,7 +143,7 @@ $data .= "FLUSH PRIVILEGES\;\n"; $data .= "CREATE DATABASE IF NOT EXISTS $dbname\;\n"; $data .= "USE $dbname\;\n"; - $data .= "GRANT ALL PRIVILEGES ON $dbname TO \"$username\"\@\"localhost\" identified by \"$password\"\;\n"; + $data .= "GRANT ALL PRIVILEGES ON $dbname.* TO \"$username\"\@\"localhost\" identified by \"$password\"\;\n"; $data .= "FLUSH PRIVILEGES\;\n"; } From kawas at pub.open-bio.org Tue Sep 13 09:17:58 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue Sep 13 10:08:01 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509131317.j8DDHwUB012224@pub.open-bio.org> kawas Tue Sep 13 09:17:58 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory pub.open-bio.org:/tmp/cvs-serv12199/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: commented out an unused line that was causing grief. The variable that has been removed is unused. moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.72,1.73 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/08/29 22:36:32 1.72 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/09/13 13:17:58 1.73 @@ -1,1430 +1,1430 @@ -package MOBY::Adaptor::moby::queryapi::mysql; - -use strict; -use vars qw($AUTOLOAD @ISA); -use Carp; -use MOBY::Adaptor::moby::queryapi; -use DBI; -use DBD::mysql; - -@ISA = qw{MOBY::Adaptor::moby::queryapi}; # implements the interface - -{ - #Encapsulated class data - - #___________________________________________________________ - #ATTRIBUTES - my %_attr_data = # DEFAULT ACCESSIBILITY - ( - driver => ["DBI:mysql", 'read/write'], - dbh => [undef, 'read/write'], - - ); - - #_____________________________________________________________ - - # METHODS, to operate on encapsulated class data - - # Is a specified object attribute accessible in a given mode - sub _accessible { - my ($self, $attr, $mode) = @_; - $_attr_data{$attr}[1] =~ /$mode/ - } - - # Classwide default value for a specified object attribute - sub _default_for { - my ($self, $attr) = @_; - $_attr_data{$attr}[0]; - } - - # List of names of all specified object attributes - sub _standard_keys { - keys %_attr_data; - } - - sub driver { - my ($self, $arg) = @_; - $self->{driver} = $arg if defined $arg; - return $self->{driver}; - } - sub dbh { - my ($self, $arg) = @_; - $self->{dbh} = $arg if defined $arg; - return $self->{dbh}; - } - -} - -sub _getDBHandle { - my ($ontology) = @_; - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor(source => $ontology); - return $adap->dbh; -} - -sub new { - my ($caller, %args) = @_; - my $self = $caller->SUPER::new(%args); - - my $caller_is_obj = ref($caller); - my $class = $caller_is_obj || $caller; - - foreach my $attrname ( $self->_standard_keys ) { - if (exists $args{$attrname} && defined $args{$attrname}) { - $self->{$attrname} = $args{$attrname} } - elsif ($caller_is_obj) { - $self->{$attrname} = $caller->{$attrname} } - else { - $self->{$attrname} = $self->_default_for($attrname) } - } - - return unless $self->driver; - my $driver = $self->driver; # inherited from the adaptorI (queryapi) - my $username = $self->username; - my $password = $self->password; - my $port = $self->port; - my $url = $self->url; - my $dbname = $self->dbname; - - my ($dsn) = "$driver:$dbname:$url:$port"; - my $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1}) or die "can't connect to database"; - - - ############################################################## - unless ($dbh) { - print STDERR "Couldn't connect to the datasource \n",($self->_dump()),"\n\n"; - return undef; - } - - $self->dbh($dbh); - ############################################################# - - return undef unless $self->dbh; - return $self; - -} - -sub _add_condition{ - my ($statement, @params) = @_; - my @bindvalues = (); - my $condition = "where "; - - foreach my $param (@params ) - { - if (($param eq 'and') || ($param eq 'or')) - { - $condition .= $param . " "; - } - else - { - my %pair = %$param; - - for my $key (keys %pair) - { - if (defined $pair{$key}) - { - $condition .= $key . " = ? "; - push(@bindvalues, $pair{$key}); - } - else - { - $condition .= $key . " IS NULL " - } - } - } - } - $statement .= $condition; - return ($statement, @bindvalues); - } - -# preforms query but returns a reference to an array containing hash references -sub do_query{ - my ($dbh, $statement, @bindvalues) = @_; - my $sth = $dbh -> prepare($statement); - if (@bindvalues < 1) - { - $sth->execute; - } - else - { - $sth->execute(@bindvalues); - } - # returns an array of hash references - my $arrayHashRef = $sth->fetchall_arrayref({}); - return $arrayHashRef; -} - -sub get_value{ - my ($key, @params) = @_; - - foreach my $param (@params ) - { - my %pair = %$param; - for my $tmp (keys %pair) - { - if ($tmp eq $key){ - return $pair{$key}; - } - } - } -} - -sub _getSIIDFromLSID { - my ($self, $lsid) = @_; - my $dbh = $self->dbh; - my $sth = $dbh->prepare("select service_instance_id from service_instance where lsid = ?"); - $sth->execute($lsid); - my ($siid) = $sth->fetchrow_array(); - return $siid; -} - -# this should NOT retun a collection ID... needs more work... -# args passed in: service_lsid -sub query_collection_input{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $serv_lsid = $args{'service_instance_lsid'}; - - my $statement = "select - collection_input_id, - article_name - from collection_input as c, service_instance as si where si.service_instance_id = c.service_instance_id and si.lsid = ?"; - my $result = do_query($dbh, $statement, ($serv_lsid)); - return $result; -} - -# args passed in: service_instance_lsid, article_name -sub insert_collection_input { - my ($self, %args) = @_; - my $article = $args{article_name}; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - - $self->dbh->do("insert into collection_input (service_instance_id, article_name) values (?,?)", - undef, $siid, $article); - my $id=$self->dbh->{mysql_insertid}; - return $id; -} - -# pass in service_instance_lsid -sub delete_collection_input{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - - my $statement = "delete from collection_input where service_instance_id = ?"; - $self->dbh->do( $statement, undef, $siid); - - if ($self->dbh->err){ - return (1, $self->dbh->errstr); - } - else{ - return 0; - } -} - -# pass service_instance_lsid -sub query_collection_output{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - - my $statement = "select - collection_output_id, - article_name, - service_instance_id - from collection_output where service_instance_id = ? "; - my $result = do_query($dbh, $statement, ($siid)); - return $result; -} - -# pass service_instance_lsid, article_name -sub insert_collection_output { - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - $self->dbh->do("insert into collection_output (service_instance_id, article_name) values (?,?)", - undef, $siid,$args{'article_name'}); - my $id=$self->dbh->{mysql_insertid}; - return $id; -} - -# pass argument service_instance_lsid -sub delete_collection_output{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - my $statement = "delete from collection_output where service_instance_id = ?"; - my @bindvalues = (); - $dbh->do( $statement, undef, ($siid)); - - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -# pass service_instance_lsid -sub query_simple_input{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $collid = $args{collection_input_id}; - my $id_to_use = $siid?$siid:$collid; - - my $dbh = $self->dbh; - - my $statement = "select - simple_input_id, - object_type_uri, - namespace_type_uris, - article_name, - service_instance_id, - collection_input_id - from simple_input where "; - - my $condition; - $siid && ($condition = " service_instance_id = ? and collection_input_id IS NULL"); - $collid && ($condition = " collection_input_id = ?"); - $statement .= $condition; - - my $result = do_query($dbh, $statement, ($id_to_use)); - return $result; -} - -# pass service_instance_lsid, object_type_uri, namespace_type_uris, article_name, collection_input_id -sub insert_simple_input { - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - $dbh->do("insert into simple_input - (object_type_uri, - namespace_type_uris, - article_name, - service_instance_id, - collection_input_id) - values (?,?,?,?,?)", - undef, - $args{'object_type_uri'}, - $args{'namespace_type_uris'}, - $args{'article_name'}, - $siid, - $args{'collection_input_id'}); - my $id=$dbh->{mysql_insertid}; - return $id; -} - -# pass service_instance_lsid -sub delete_simple_input{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my ($collid) = $args{collection_input_id}; - my $statement1; my $statement2; - $siid && ($statement1 = "delete from simple_input where service_instance_id = ?"); - $collid && ($statement2 = "delete from simple_input where collection_input_id = ?"); - - $siid && ($dbh->do( $statement1, undef,($siid))); - $collid && ($dbh->do($statement2, undef,($collid))); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -sub delete_inputs { # this should replace all other delete_*_input - my ($self, %args) = @_; - my $dbh = $self->dbh; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $result_ids = $self->query_collection_input(service_instance_lsid => $self->lsid); - - my $statement = "delete from simple_input where service_instance_id = ?"; - - $dbh->do( $statement, undef,($siid)); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } - -} - -sub delete_output { # this should replace all other delete_*_output - -} - -# UGH this has to know too much bout the underlying database structure e.g. that one is null and other is full -# this problem is in MOBY::Central line 3321 3346 and 3374 -#****** FIX -# send service_instance_lsid, collection_input_id -sub query_simple_output{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $collid = $args{collection_output_id}; - my $dbh = $self->dbh; - my $id_to_use = $siid?$siid:$collid; - - my $statement = "select - simple_output_id, - object_type_uri, - namespace_type_uris, - article_name, - service_instance_id, - collection_output_id - from simple_output where "; - my $condition; - $siid && ($condition = " service_instance_id = ? and collection_output_id IS NULL"); - $collid && ($condition = " collection_output_id = ?"); - $statement .= $condition; - - - my $result = do_query($dbh, $statement, ($id_to_use)); - return $result; -} - -# pass args service_instance_id and collection_output_id -sub insert_simple_output { - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - - $dbh->do("insert into simple_output - (object_type_uri, - namespace_type_uris, - article_name, - service_instance_id, - collection_output_id) - values (?,?,?,?,?)", - undef,( - $args{'object_type_uri'}, - $args{'namespace_type_uris'}, - $args{'article_name'}, - $siid, - $args{'collection_output_id'})); - my $id=$dbh->{mysql_insertid}; - return $id; - -} - -# pass service_instance_id or collection_output_id -sub delete_simple_output{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my ($collid) = $args{collection_output_id}; - my $statement1; my $statement2; - $siid && ($statement1 = "delete from simple_output where service_instance_id = ?"); - $collid && ($statement2 = "delete from simple_output where collection_output_id = ?"); - - $siid && ($dbh->do( $statement1, undef,($siid))); - $collid && ($dbh->do($statement2, undef,($collid))); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -# pass service_instance_lsid -sub query_secondary_input{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - - my $statement = "select - secondary_input_id, - default_value, - maximum_value, - minimum_value, - enum_value, - datatype, - article_name, - service_instance_id - from secondary_input where service_instance_id = ?"; - my $result = do_query($dbh, $statement, ($siid)); - return $result; -} - -# pass default_value, maximum_value minimum_value enum_value datatype article_name service_instance_lsid -sub insert_secondary_input{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - $dbh->do(q{insert into secondary_input (default_value,maximum_value,minimum_value,enum_value,datatype,article_name,service_instance_id) values (?,?,?,?,?,?,?)}, - undef, - ( - $args{'default_value'}, $args{'maximum_value'}, - $args{'minimum_value'}, $args{'enum_value'}, - $args{'datatype'}, $args{'article_name'},$siid) - ); - return $dbh->{mysql_insertid}; -} - -# pass service_instance_lsid -sub delete_secondary_input{ - my ($self, %args) = @_; - my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); - my $dbh = $self->dbh; - my $statement = "delete from secondary_input where service_instance_id=?"; - - $dbh->do( $statement, undef, ($siid)); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - - -# receives argument "type", that may be either an LSID or a type term -sub query_object { - my ($self, %args) = @_; - my $type = $args{type}; - my $condition = ""; - if ($type =~ /^urn\:lsid/){ - $condition = "where object_lsid = ?"; - } elsif ($type) { - $condition = "where object_type = ?"; - } - my $statement = "select - object_id, - object_lsid, - object_type, - description, - authority, - contact_email - from object $condition"; - - my $dbh = _getDBHandle("mobyobject"); - my $result; - if ($type){ - $result = do_query($dbh, $statement, ($type)); - } else { - $result = do_query($dbh, $statement); - } - return $result; -} - -# inserts a new tuple into object table -# pass object_type object_lsid description authority contact_email -sub insert_object{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - $dbh->do("insert into object - (object_type, - object_lsid, - description, - authority, - contact_email) - values (?,?,?,?,?)", - undef, - $args{'object_type'}, - $args{'object_lsid'}, - $args{'description'}, - $args{'authority'}, - $args{'contact_email'}); - my $id=$dbh->{mysql_insertid}; - return $id; -} - -# pass 'type' which is either an LSID or a term -sub delete_object{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $term = $args{type}; - return 0 unless $term; - my $result = $self->query_object(type => $term); - my $row = shift(@$result); - my $id = $row->{object_id}; - my $lsid = $row->{object_lsid}; - my $statement = "delete from object where object_lsid = ?"; - $dbh->do( $statement,undef, ($lsid) ); - - $self->_delete_object_term2term(id => $id); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -# pass "type" here, should be an LSID, preferably... -sub query_object_term2term{ - my ($self, %args) = @_; - my $type = $args{type}; - my $result = $self->query_object(type => $type); - my $row = shift(@$result); - my $id = $row->{object_id}; - return [{}] unless $id; - my $dbh = $self->dbh; - - my $statement = "select - assertion_id, - relationship_type, - object1_id, - object2_id, - object2_articlename - from object_term2term where object2_id = ?"; - my $result2 = do_query($dbh, $statement, ($id)); - return $result2; -} - -# pass object1_type, object2_type, object2_articlename, relationship_type -sub insert_object_term2term{ - my ($self, %args) = @_; - my $type1 = $args{object1_type}; - my $result = $self->query_object(type => $type1); - my $row = shift(@$result); - my $id1 = $row->{object_id}; - my $type2 = $args{object2_type}; - $result = $self->query_object(type => $type2); - $row = shift(@$result); - my $id2 = $row->{object_id}; - my $relationship_type = $args{relationship_type}; - my $object2_articlename = $args{object2_articlename}; - - my $dbh = $self->dbh; - $dbh->do( - q{insert into object_term2term (relationship_type, object1_id, object2_id, object2_articlename) values (?,?,?,?)}, - undef, - $relationship_type, - $id1, - $id2, - $object2_articlename - ); - - return $dbh->{mysql_insertid}; -} - -# pass object 'type' as term or lsid -# this should be a private routine, not a public one. -# SHOULD NOT BE DOCUMENTED IN THE API -sub _delete_object_term2term{ - my ($self, %args) = @_; - my $o1id = $args{id}; - return 0 unless defined($o1id); - my $dbh = $self->dbh; - my $statement = "delete from object_term2term where object1_id=?"; - $dbh->do( $statement,undef, ($o1id)); - - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -# pass servicename and authority_uri -sub query_service_existence { - my ($self, %args) = @_; - my $dbh = $self->dbh; - - my $servicename = $args{'servicename'}; - my $authURI = $args{'authority_uri'}; - my $result = $self->_query_authority(authority_uri => $authURI); - return 0 unless @$result[0]; - my $id = @$result[0]->{authority_id}; - return 0 unless $id; - my $statement = "select - service_instance_id, - category, - servicename, - service_type_uri, - authority_id, - url, - contact_email, - authoritative, - description, - signatureURL, - lsid - from service_instance where servicename = ? and authority_id = ?"; - my $final = do_query($dbh, $statement, ($servicename, $id)); - if (@$final[0]){return 1} else {return 0} - -} -# selects all the columns from service_instance table -# PAY ATTENTION to what this returns. Not auth_id but auth_uri!! -# IMPORTANT: must use quotes for the keys of the hash (eg. 'authority.authority_uri' => $value ) -sub query_service_instance { - my ($self, %args) = @_; - my $dbh = $self->dbh; - - my @args; - while (my ($k, $v) = each %args){ - push @args, ({$k => $v}, "and"); # format for the_add_condition subroutine - # but too bad won't be scalable for "or" - } - - if (keys(%args)){ pop @args;} # remove final "and" - - my $statement = "select - service_instance_id, - category, - servicename, - service_type_uri, - authority.authority_uri, - url, - service_instance.contact_email, - authoritative, - description, - signatureURL, - lsid - from service_instance, authority "; - my @bindvalues; - ($statement, @bindvalues) =_add_condition($statement, @args); - if (keys(%args)){ - $statement .= " and authority.authority_id = service_instance.authority_id"; - } else { - $statement .= " where authority.authority_id = service_instance.authority_id"; - } - my $final = do_query($dbh, $statement, @bindvalues); - return $final; -} - -# custom query for Moby::Central.pm->findService() -# hmmmmmmm.... I'm not sure that this routine should exist... -# it is redundant to the routine above, if the routine above were executed -# multiple times. I think that is the more correct (though less efficient) -# way to go, since it is "scalable" to every possible underlying data source -# ********FIX change this later... -sub match_service_type_uri{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $uri_list = $args{'service_type_uri'}; - my $statement = "select service_instance_id,category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid from service_instance where service_type_uri in ($uri_list)"; - my @bindvalues = (); - my $result = do_query($dbh, $statement, @bindvalues); - return $result; -} - -# passs........ blah blah..... -sub insert_service_instance { - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $authority_id; - if ($args{'authority_uri'}){ # need to transform URI to a row ID - my $result = $self->_query_authority(authority_uri => $args{'authority_uri'}); - return undef unless @$result[0]; - $authority_id = @$result[0]->{authority_id}; - return undef unless $authority_id; - } - - $dbh->do(q{insert into service_instance (category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid) values (?,?,?,?,?,?,?,?,?,?)}, - undef,( - $args{'category'}, - $args{'servicename'}, - $args{'service_type_uri'}, - $authority_id, - $args{'url'}, - $args{'contact_email'}, - $args{'authoritative'}, - $args{'description'}, - $args{'signatureURL'}, - $args{'lsid'})); - - my $id = $dbh->{mysql_insertid}; - return $id; -} - -# pass service_instance_lsid -sub delete_service_instance{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $statement = "delete from service_instance where lsid = ?"; - $dbh->do( $statement,undef, ($args{service_instance_lsid}) ); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -# Selects all columns EXCEPT authority_id -# pass authority_uri -sub query_authority { - my ($self, %args) = @_; - my $authURI = $args{authority_uri}; - my $dbh = $self->dbh; - - my $statement = "select - authority_common_name, - authority_uri, - contact_email - from authority where authority_uri = ?"; - my $result = do_query($dbh, $statement, ($authURI)); - return $result; -} - -# Selects all columns including authority_id -# pass authority_uri. NOTE THAT THIS IS A PRIVATE ROUTINE -# SHOULD NOT BE DOCUMENTED IN THE API -sub _query_authority { - my ($self, %args) = @_; - my $authURI = $args{authority_uri}; - my $dbh = $self->dbh; - - my $statement = "select - authority_common_name, - authority_uri, - authority_id, - contact_email - from authority where authority_uri = ?"; - my $result = do_query($dbh, $statement, ($authURI)); - return $result; -} - -# custom query routine used in Moby::Central.pm -> retrieveServiceProviders() -# no args passed -sub get_all_authorities{ - my ($self, @args) = @_; - my $dbh = $self->dbh; - my $statement = "select distinct authority_uri from authority"; - my @bindvalues = (); - my $result = do_query($dbh, $statement, @bindvalues); - return $result; -} - -# pass authority_common_name, authority_uri, contact_email, return ID of some sort -sub insert_authority{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - $dbh->do("insert into authority - (authority_common_name, - authority_uri, - contact_email) - values (?,?,?)", - undef, - ($args{'authority_common_name'}, - $args{'authority_uri'}, - $args{'contact_email'})); - my $id = $dbh->{mysql_insertid}; - return $id; -} - -# pass service_type, as term or LSID -sub query_service{ - my ($self, %args) = @_; - my $type = $args{type}; - my $condition = ""; - if ($type =~ /^urn\:lsid/){ - $condition = "where service_lsid = ?"; - } elsif ($type) { - $condition = "where service_type = ?"; - } else { - $condition = ""; - } - - my $dbh = _getDBHandle("mobyservice"); - - my $statement = "select - service_id, - service_lsid, - service_type, - description, - authority, - contact_email - from service $condition"; - my $result; - if ($type){ - $result = do_query($dbh, $statement, ($type)); - } else { - $result = do_query($dbh, $statement); - } - return $result; -} - -# pass in .... -sub insert_service{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - $dbh->do(q{insert into service (service_type, service_lsid, description, authority, contact_email) values (?,?,?,?,?)}, - undef, - ( - $args{'service_type'}, $args{'service_lsid'}, $args{'description'}, - $args{'authority'}, $args{'contact_email'} - ) - ); - return $dbh->{mysql_insertid}; -} - -# pass in 'type' as a term or lsid -sub delete_service{ - my ($self, %args) = @_; - my $type = $args{type}; - my $result = $self->query_service(type => $type); - my $row = shift(@$result); - my $id = $row->{service_id}; - my $lsid = $row->{service_lsid}; - return 0 unless $lsid; - my $dbh = $self->dbh; - my $statement = "delete from service where service_lsid = ?"; - $dbh->do( $statement, undef, ($lsid)); - $self->_delete_service_term2term(id => $id); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -sub query_service_term2term{ - my ($self, %args) = @_; - my $type = $args{type}; - my $result = $self->query_service(type => $type); - my $row = shift(@$result); - my $id = $row->{service_id}; - return [{}] unless $id; - my $dbh = $self->dbh; - - my $statement = "select - assertion_id, - relationship_type, - service1_id, - service2_id - from service_term2term where service2_id = ?"; - my $result2 = do_query($dbh, $statement, ($id)); - return $result2; -} - -#pass relationshiptype, servce1_type, service2_type -sub insert_service_term2term{ - my ($self, %args) = @_; - my $type1 = $args{service1_type}; - my $result = $self->query_service(type => $type1); - my $row = shift(@$result); - my $id1 = $row->{service_id}; - my $type2 = $args{service2_type}; - $result = $self->query_service(type => $type2); - $row = shift(@$result); - my $id2 = $row->{service_id}; - my $relationship_type = $args{relationship_type}; - - my $dbh = $self->dbh; - $dbh->do(q{insert into service_term2term (relationship_type, service1_id, service2_id) values (?,?,?)}, - undef, - ($relationship_type, - $id1, - $id2) - ); - - return $dbh->{mysql_insertid}; -} - - -# NOTE THAT THIS IS A PRIVATE FUNCTION AND SHOULD -# NOT BE DOCUMENTED IN THE API. -sub _delete_service_term2term{ - my ($self, %args) = @_; - my $id = $args{id}; - return 0 unless (defined($id)); - my $dbh = $self->dbh; - my $statement = "delete from service_term2term where service1_id=?"; - $dbh->do( $statement,undef, ($id)); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - - -sub query_relationship{ - my ($self, %args) = @_; - my $type = $args{type} || ""; -# return [{}] unless $type; - my $condition = ""; - if ($type =~ /^urn\:lsid/){ - $condition = " relationship_lsid = ? and "; - } elsif ($type) { - $condition = " relationship_type = ? and "; - } - my $ont = $args{ontology}; - - my $dbh = $self->dbh; - - my $statement = "select - relationship_id, - relationship_lsid, - relationship_type, - container, - description, - authority, - contact_email, - ontology - from relationship where $condition ontology = ?"; - - if ($type){ - return do_query($dbh, $statement, ($type, $ont)); - } else { - return do_query($dbh, $statement, ($ont)); - } -} - -sub query_namespace{ - my ($self, %args) = @_; - my $type = $args{type}; - my $condition = ""; - if ($type =~ /^urn\:lsid/){ - $condition = " where namespace_lsid = ?"; - } elsif ($type) { - $condition = " where namespace_type = ?"; - } else { - $condition = ""; - } - - my $dbh = _getDBHandle("mobynamespace"); - - my $statement = "select - namespace_id, - namespace_lsid, - namespace_type, - description, - authority, - contact_email - from namespace $condition"; - my $result; - if ($type){ - $result = do_query($dbh, $statement, ($type)); - } else { - $result = do_query($dbh, $statement); - } - return $result; -} - - -sub insert_namespace{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - $dbh->do(q{insert into namespace (namespace_type, namespace_lsid, description, authority,contact_email) values (?,?,?,?,?)}, - undef, - ( - $args{'namespace_type'}, $args{'namespace_lsid'},$args{'description'},$args{'authority'},$args{'contact_email'} - ) - ); - return $dbh->{mysql_insertid}; -} - -# pass namesapce_lsid -sub delete_namespace{ - my ($self, %args) = @_; - my $type = $args{type}; - my $result = $self->query_namespace(type => $type); - my $row = shift(@$result); - my $id = $row->{namespace_id}; - my $lsid = $row->{namespace_lsid}; - return 0 unless $lsid; - my $dbh = $self->dbh; - my $statement = "delete from namespace where namespace_lsid = ?"; - $dbh->do( $statement, undef, ($lsid)); - $self->_delete_namespace_term2term(id => $id); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} - -sub query_namespace_term2term{ - my ($self, %args) = @_; - my $type = $args{type}; - my $result = $self->query_namespace(type => $type); - my $row = shift(@$result); - my $id = $row->{namespace_id}; - return [{}] unless $id; - my $dbh = $self->dbh; - - my $statement = "select - assertion_id, - relationship_type, - namespace1_id, - namespace2_id - from namespace_term2term where namespace2_id = ?"; - my $result2 = do_query($dbh, $statement, ($id)); - return $result2; -} - -# PRIVATE, NOT PART OF API! -sub _delete_namespace_term2term{ - my ($self, %args) = @_; - my $id = $args{id}; - return 0 unless defined($id); - my $dbh = $self->dbh; - my $statement = "delete from namespace_term2term where namespace1_id=?"; - $dbh->do( $statement,undef, ($id)); - if ($dbh->err){ - return (1, $dbh->errstr); - } - else{ - return 0; - } -} -# pass type as LSID or term -sub check_object_usage{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $errorMsg = 1; - my $type = $args{type}; - return 0 unless $type; - my $result = $self->query_object(type => $type); - my $row = shift @$result; - my $lsid = $row->{object_lsid}; - - my ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join simple_input where object_type_uri = ?}, - undef, $lsid - ); - return $errorMsg - if ($id); - - ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join simple_output where object_type_uri = ?}, - undef, $lsid - ); - return $errorMsg - if ($id); - - ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join collection_input natural join simple_input where object_type_uri = ?}, - undef, $lsid - ); - return $errorMsg - if ($id); - - ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join collection_output natural join simple_output where object_type_uri = ?}, - undef, $lsid - ); - return $errorMsg - if ($id); - - return 0; -} - -# custom query routine for Moby::Central.pm -> deregisterNamespace() -sub check_namespace_usage{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $errorMsg = 1; - my $type = $args{type}; - return 0 unless $type; - my $result = $self->query_namespace(type => $type); - my $row = shift @$result; - my $lsid = $row->{namespace_lsid}; - - my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where INSTR(namespace_type_uris,'$lsid')" - ); - $sth->execute; - - while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { - my @nss = split ",", $ns; - foreach (@nss) { - $_ =~ s/\s//g; - my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; - return (1, $errstr) - if ( $_ eq $lsid ); - } - } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where INSTR(namespace_type_uris,'$lsid')" - ); - $sth->execute; - while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { - my @nss = split ",", $ns; - foreach (@nss) { - $_ =~ s/\s//g; - my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; - return (1, $errstr) - if ( $_ eq $lsid ); - } - } - $sth = - $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where INSTR(namespace_type_uris, '$lsid')" - ); - $sth->execute; - while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { - my @nss = split ",", $ns; - foreach (@nss) { - $_ =~ s/\s//g; - my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; - return (1, $errstr) - if ( $_ eq $lsid ); - } - } - $sth = - $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where INSTR(namespace_type_uris, '$lsid')" - ); - $sth->execute; - while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { - my @nss = split ",", $ns; - foreach (@nss) { - $_ =~ s/\s//g; - my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; - return (1, $errstr) - if ( $_ eq $lsid ); - } - } - return (0, ""); -} - -# custom query routine for Moby::Central.pm -> findService() -sub check_keywords{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $param = $args{keywords}; - return ([{}]) unless (ref($param) =~ /ARRAY/); - my @keywords = @$param; - my %findme = %$param; - my $searchstring; - foreach my $kw ( @keywords ) { - $kw =~ s/\*//g; - $kw = $dbh->quote("%$kw%"); - $searchstring .= " OR description like $kw "; - } - $searchstring =~ s/OR//; # remove just the first OR in the longer statement - - my $statement = "select service_instance_id,category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid from service_instance where $searchstring"; - my @bindvalues = (); - - my $ids = do_query($dbh, $statement, @bindvalues); - return ($ids); -} - -# custom query subroutine for Moby::Central.pm->_searchForSimple() -sub find_by_simple{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $inout = $args{'inout'}; - my $ancestor_string = $args{'ancestor_string'}; - my $namespaceURIs = $args{'namespaceURIs'}; - - my $query ="select service_instance_id, namespace_type_uris from simple_$inout where object_type_uri in ($ancestor_string) and service_instance_id IS NOT NULL " - ; # if service_instance_id is null then it must be a collection input. - my $nsquery; - foreach my $ns ( @{$namespaceURIs} ) { # namespaces are already URI's - $nsquery .= " OR INSTR(namespace_type_uris, '$ns') "; - } - if ($nsquery) { - $nsquery =~ s/OR//; # just the first - $nsquery .= " OR namespace_type_uris IS NULL"; - $query .= " AND ($nsquery) "; - } - - my $result = do_query($dbh, $query, ()); - return $result; -} - -# custom query subroutine for Moby::Central.pm->_searchForCollection() -sub find_by_collection{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $inout = $args{'inout'}; - my $objectURI = $args{'objectURI'}; - my $namespaceURIs = $args{'namespaceURIs'}; - - my $query = "select - c.service_instance_id, - s.namespace_type_uris - from - simple_$inout as s, - collection_$inout as c - where - s.collection_${inout}_id IS NOT NULL - AND s.collection_${inout}_id = c.collection_${inout}_id - AND object_type_uri = '$objectURI' "; - my $nsquery; - foreach my $ns ( @{$namespaceURIs} ) { # namespaces are already URI's - $nsquery .= " OR INSTR(namespace_type_uris, '$ns') "; - } - if ($nsquery) { - $nsquery =~ s/^\sOR//; # just the first - $nsquery .= " OR namespace_type_uris IS NULL"; - $query .= " AND ($nsquery) "; # add the AND clause - } - - my $result = do_query($dbh, $query, ()); - return $result; -} - -# custom query subroutine for Moby::Central.pm->RetrieveServiceNames -sub get_service_names{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $statement = "select authority_uri, servicename from authority as a, service_instance as s where s.authority_id = a.authority_id"; - my @bindvalues = (); - - my $result = do_query($dbh, $statement, @bindvalues); - return $result; -} - -# custom query for Moby::Central.pm->_flatten -sub get_parent_terms{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - - my $type_id = $args{'relationship_type_id'}; - my $statement = " - select - OE1.term - from - OntologyEntry as OE1, - OntologyEntry as OE2, - Term2Term as TT - where - ontologyentry2_id = OE2.id - and ontologyentry1_id = OE1.id - and relationship_type_id = $type_id - and OE2.term = ?"; - - my @bindvalues = (); - push(@bindvalues, $args{'term'}); - - my $result = do_query($dbh, $statement, @bindvalues); - return $result; -} - -# custom query subroutine for selecting from object_term2term and object tables -# used in Moby::OntologyServer.pm->retrieveObject() -sub get_object_relationships{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $type = $args{type}; - return 0 unless $type; - my $result = $self->query_object(type => $type); - my $row = shift @$result; - my $id = $row->{object_id}; - - my $statement = "select - relationship_type, - object_type, - object_lsid, - description, - authority, - contact_email, - object2_articlename - from object_term2term, object - where object1_id = ? and object2_id = object_id"; - - my $result2 = do_query($dbh, $statement, ($id)); - return $result2; -} - -# relationship query for any table used in Moby::OntologyServer->_doRelationshipQuery() -# note: returns a reference to an array containing ARRAY references -sub get_relationship{ - my ($self, %args) = @_; - my $dbh = $self->dbh; - my $direction = $args{'direction'}; - my $ontology = $args{'ontology'}; - my $relationship = $args{'relationship'}; # this is assumed to be an LSID - - my $type = $args{'term'}; - return 0 unless $type; - my $lsid; - if ($ontology eq "service"){ - my $result = $self->query_service(type => $type); - my $row = shift @$result; - $lsid = $row->{service_lsid}; - } else { - my $result = $self->query_object(type => $type); - my $row = shift @$result; - $lsid = $row->{object_lsid}; - } - my $defs; - my $extra_columns; - $extra_columns = ", relationship_type "; - if ($ontology eq "object"){$extra_columns .=", object2_articlename ";} - if ( $direction eq 'root' ) { - unless ( defined $relationship ) { - $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from - ${ontology}_term2term as t2t, - $ontology as s1, - $ontology as s2 - where - s1.${ontology}_id = t2t.${ontology}1_id and - s2.${ontology}_id = t2t.${ontology}2_id and - s1.${ontology}_lsid = ?", undef, $lsid ); # ") - } else { - $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from - ${ontology}_term2term as t2t, - $ontology as s1, - $ontology as s2 - where - relationship_type = ? and - s1.${ontology}_id = t2t.${ontology}1_id and - s2.${ontology}_id = t2t.${ontology}2_id and - s1.${ontology}_lsid = ?", undef, $relationship, $lsid ); # ") - } - } else { - unless ( defined $relationship ) { - $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from - ${ontology}_term2term as t2t, - $ontology as s1, - $ontology as s2 - where - s1.${ontology}_id = t2t.${ontology}1_id and - s2.${ontology}_id = t2t.${ontology}2_id and - s2.${ontology}_lsid = ?", undef, $lsid); # ") - } else { - $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from - ${ontology}_term2term as t2t, - $ontology as s1, - $ontology as s2 - where - relationship_type = ? and - s1.${ontology}_id = t2t.${ontology}1_id and - s2.${ontology}_id = t2t.${ontology}2_id and - s2.${ontology}_lsid = ?", undef, $relationship, $lsid ); # ") - } - } - return $defs; -} - -sub _checkURI { - -# my $uri = "http://www.ics.uci.edu/pub/ietf/uri/#Related"; -#print "$1, $2, $3, $4, $5, $6, $7, $8, $9" if -# $uri =~ m{^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?}; -# -#The license for this recipe is available here. -# -#Discussion: -# -#If the match is successful, a URL such as -# -#http://www.ics.uci.edu/pub/ietf/uri/#Related -# -#will be broken down into the following group match variables: -# -#$1 = http: -#$2 = http -#$3 = //www.ics.uci.edu -#$4 = www.ics.uci.edu -#$5 = /pub/ietf/uri/ -#$6 = -#$7 = -#$8 = #Related -#$9 = Related -# -#In general, this regular expression breaks a URI down into the following parts, -#as defined in the RFC: -# -#scheme = $2 -#authority = $4 -#path = $5 -#query = $7 -#fragment = $9 - -} - -sub DESTROY {} - -1; +package MOBY::Adaptor::moby::queryapi::mysql; + +use strict; +use vars qw($AUTOLOAD @ISA); +use Carp; +use MOBY::Adaptor::moby::queryapi; +use DBI; +use DBD::mysql; + +@ISA = qw{MOBY::Adaptor::moby::queryapi}; # implements the interface + +{ + #Encapsulated class data + + #___________________________________________________________ + #ATTRIBUTES + my %_attr_data = # DEFAULT ACCESSIBILITY + ( + driver => ["DBI:mysql", 'read/write'], + dbh => [undef, 'read/write'], + + ); + + #_____________________________________________________________ + + # METHODS, to operate on encapsulated class data + + # Is a specified object attribute accessible in a given mode + sub _accessible { + my ($self, $attr, $mode) = @_; + $_attr_data{$attr}[1] =~ /$mode/ + } + + # Classwide default value for a specified object attribute + sub _default_for { + my ($self, $attr) = @_; + $_attr_data{$attr}[0]; + } + + # List of names of all specified object attributes + sub _standard_keys { + keys %_attr_data; + } + + sub driver { + my ($self, $arg) = @_; + $self->{driver} = $arg if defined $arg; + return $self->{driver}; + } + sub dbh { + my ($self, $arg) = @_; + $self->{dbh} = $arg if defined $arg; + return $self->{dbh}; + } + +} + +sub _getDBHandle { + my ($ontology) = @_; + my $CONF = MOBY::Config->new; + my $adap = $CONF->getDataAdaptor(source => $ontology); + return $adap->dbh; +} + +sub new { + my ($caller, %args) = @_; + my $self = $caller->SUPER::new(%args); + + my $caller_is_obj = ref($caller); + my $class = $caller_is_obj || $caller; + + foreach my $attrname ( $self->_standard_keys ) { + if (exists $args{$attrname} && defined $args{$attrname}) { + $self->{$attrname} = $args{$attrname} } + elsif ($caller_is_obj) { + $self->{$attrname} = $caller->{$attrname} } + else { + $self->{$attrname} = $self->_default_for($attrname) } + } + + return unless $self->driver; + my $driver = $self->driver; # inherited from the adaptorI (queryapi) + my $username = $self->username; + my $password = $self->password; + my $port = $self->port; + my $url = $self->url; + my $dbname = $self->dbname; + + my ($dsn) = "$driver:$dbname:$url:$port"; + my $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1}) or die "can't connect to database"; + + + ############################################################## + unless ($dbh) { + print STDERR "Couldn't connect to the datasource \n",($self->_dump()),"\n\n"; + return undef; + } + + $self->dbh($dbh); + ############################################################# + + return undef unless $self->dbh; + return $self; + +} + +sub _add_condition{ + my ($statement, @params) = @_; + my @bindvalues = (); + my $condition = "where "; + + foreach my $param (@params ) + { + if (($param eq 'and') || ($param eq 'or')) + { + $condition .= $param . " "; + } + else + { + my %pair = %$param; + + for my $key (keys %pair) + { + if (defined $pair{$key}) + { + $condition .= $key . " = ? "; + push(@bindvalues, $pair{$key}); + } + else + { + $condition .= $key . " IS NULL " + } + } + } + } + $statement .= $condition; + return ($statement, @bindvalues); + } + +# preforms query but returns a reference to an array containing hash references +sub do_query{ + my ($dbh, $statement, @bindvalues) = @_; + my $sth = $dbh -> prepare($statement); + if (@bindvalues < 1) + { + $sth->execute; + } + else + { + $sth->execute(@bindvalues); + } + # returns an array of hash references + my $arrayHashRef = $sth->fetchall_arrayref({}); + return $arrayHashRef; +} + +sub get_value{ + my ($key, @params) = @_; + + foreach my $param (@params ) + { + my %pair = %$param; + for my $tmp (keys %pair) + { + if ($tmp eq $key){ + return $pair{$key}; + } + } + } +} + +sub _getSIIDFromLSID { + my ($self, $lsid) = @_; + my $dbh = $self->dbh; + my $sth = $dbh->prepare("select service_instance_id from service_instance where lsid = ?"); + $sth->execute($lsid); + my ($siid) = $sth->fetchrow_array(); + return $siid; +} + +# this should NOT retun a collection ID... needs more work... +# args passed in: service_lsid +sub query_collection_input{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $serv_lsid = $args{'service_instance_lsid'}; + + my $statement = "select + collection_input_id, + article_name + from collection_input as c, service_instance as si where si.service_instance_id = c.service_instance_id and si.lsid = ?"; + my $result = do_query($dbh, $statement, ($serv_lsid)); + return $result; +} + +# args passed in: service_instance_lsid, article_name +sub insert_collection_input { + my ($self, %args) = @_; + my $article = $args{article_name}; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + + $self->dbh->do("insert into collection_input (service_instance_id, article_name) values (?,?)", + undef, $siid, $article); + my $id=$self->dbh->{mysql_insertid}; + return $id; +} + +# pass in service_instance_lsid +sub delete_collection_input{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + + my $statement = "delete from collection_input where service_instance_id = ?"; + $self->dbh->do( $statement, undef, $siid); + + if ($self->dbh->err){ + return (1, $self->dbh->errstr); + } + else{ + return 0; + } +} + +# pass service_instance_lsid +sub query_collection_output{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + + my $statement = "select + collection_output_id, + article_name, + service_instance_id + from collection_output where service_instance_id = ? "; + my $result = do_query($dbh, $statement, ($siid)); + return $result; +} + +# pass service_instance_lsid, article_name +sub insert_collection_output { + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + $self->dbh->do("insert into collection_output (service_instance_id, article_name) values (?,?)", + undef, $siid,$args{'article_name'}); + my $id=$self->dbh->{mysql_insertid}; + return $id; +} + +# pass argument service_instance_lsid +sub delete_collection_output{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + my $statement = "delete from collection_output where service_instance_id = ?"; + my @bindvalues = (); + $dbh->do( $statement, undef, ($siid)); + + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +# pass service_instance_lsid +sub query_simple_input{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $collid = $args{collection_input_id}; + my $id_to_use = $siid?$siid:$collid; + + my $dbh = $self->dbh; + + my $statement = "select + simple_input_id, + object_type_uri, + namespace_type_uris, + article_name, + service_instance_id, + collection_input_id + from simple_input where "; + + my $condition; + $siid && ($condition = " service_instance_id = ? and collection_input_id IS NULL"); + $collid && ($condition = " collection_input_id = ?"); + $statement .= $condition; + + my $result = do_query($dbh, $statement, ($id_to_use)); + return $result; +} + +# pass service_instance_lsid, object_type_uri, namespace_type_uris, article_name, collection_input_id +sub insert_simple_input { + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + $dbh->do("insert into simple_input + (object_type_uri, + namespace_type_uris, + article_name, + service_instance_id, + collection_input_id) + values (?,?,?,?,?)", + undef, + $args{'object_type_uri'}, + $args{'namespace_type_uris'}, + $args{'article_name'}, + $siid, + $args{'collection_input_id'}); + my $id=$dbh->{mysql_insertid}; + return $id; +} + +# pass service_instance_lsid +sub delete_simple_input{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my ($collid) = $args{collection_input_id}; + my $statement1; my $statement2; + $siid && ($statement1 = "delete from simple_input where service_instance_id = ?"); + $collid && ($statement2 = "delete from simple_input where collection_input_id = ?"); + + $siid && ($dbh->do( $statement1, undef,($siid))); + $collid && ($dbh->do($statement2, undef,($collid))); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +sub delete_inputs { # this should replace all other delete_*_input + my ($self, %args) = @_; + my $dbh = $self->dbh; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $result_ids = $self->query_collection_input(service_instance_lsid => $self->lsid); + + my $statement = "delete from simple_input where service_instance_id = ?"; + + $dbh->do( $statement, undef,($siid)); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } + +} + +sub delete_output { # this should replace all other delete_*_output + +} + +# UGH this has to know too much bout the underlying database structure e.g. that one is null and other is full +# this problem is in MOBY::Central line 3321 3346 and 3374 +#****** FIX +# send service_instance_lsid, collection_input_id +sub query_simple_output{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $collid = $args{collection_output_id}; + my $dbh = $self->dbh; + my $id_to_use = $siid?$siid:$collid; + + my $statement = "select + simple_output_id, + object_type_uri, + namespace_type_uris, + article_name, + service_instance_id, + collection_output_id + from simple_output where "; + my $condition; + $siid && ($condition = " service_instance_id = ? and collection_output_id IS NULL"); + $collid && ($condition = " collection_output_id = ?"); + $statement .= $condition; + + + my $result = do_query($dbh, $statement, ($id_to_use)); + return $result; +} + +# pass args service_instance_id and collection_output_id +sub insert_simple_output { + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + + $dbh->do("insert into simple_output + (object_type_uri, + namespace_type_uris, + article_name, + service_instance_id, + collection_output_id) + values (?,?,?,?,?)", + undef,( + $args{'object_type_uri'}, + $args{'namespace_type_uris'}, + $args{'article_name'}, + $siid, + $args{'collection_output_id'})); + my $id=$dbh->{mysql_insertid}; + return $id; + +} + +# pass service_instance_id or collection_output_id +sub delete_simple_output{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my ($collid) = $args{collection_output_id}; + my $statement1; my $statement2; + $siid && ($statement1 = "delete from simple_output where service_instance_id = ?"); + $collid && ($statement2 = "delete from simple_output where collection_output_id = ?"); + + $siid && ($dbh->do( $statement1, undef,($siid))); + $collid && ($dbh->do($statement2, undef,($collid))); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +# pass service_instance_lsid +sub query_secondary_input{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + + my $statement = "select + secondary_input_id, + default_value, + maximum_value, + minimum_value, + enum_value, + datatype, + article_name, + service_instance_id + from secondary_input where service_instance_id = ?"; + my $result = do_query($dbh, $statement, ($siid)); + return $result; +} + +# pass default_value, maximum_value minimum_value enum_value datatype article_name service_instance_lsid +sub insert_secondary_input{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + $dbh->do(q{insert into secondary_input (default_value,maximum_value,minimum_value,enum_value,datatype,article_name,service_instance_id) values (?,?,?,?,?,?,?)}, + undef, + ( + $args{'default_value'}, $args{'maximum_value'}, + $args{'minimum_value'}, $args{'enum_value'}, + $args{'datatype'}, $args{'article_name'},$siid) + ); + return $dbh->{mysql_insertid}; +} + +# pass service_instance_lsid +sub delete_secondary_input{ + my ($self, %args) = @_; + my ($siid) = $self->_getSIIDFromLSID($args{service_instance_lsid}); + my $dbh = $self->dbh; + my $statement = "delete from secondary_input where service_instance_id=?"; + + $dbh->do( $statement, undef, ($siid)); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + + +# receives argument "type", that may be either an LSID or a type term +sub query_object { + my ($self, %args) = @_; + my $type = $args{type}; + my $condition = ""; + if ($type =~ /^urn\:lsid/){ + $condition = "where object_lsid = ?"; + } elsif ($type) { + $condition = "where object_type = ?"; + } + my $statement = "select + object_id, + object_lsid, + object_type, + description, + authority, + contact_email + from object $condition"; + + my $dbh = _getDBHandle("mobyobject"); + my $result; + if ($type){ + $result = do_query($dbh, $statement, ($type)); + } else { + $result = do_query($dbh, $statement); + } + return $result; +} + +# inserts a new tuple into object table +# pass object_type object_lsid description authority contact_email +sub insert_object{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + $dbh->do("insert into object + (object_type, + object_lsid, + description, + authority, + contact_email) + values (?,?,?,?,?)", + undef, + $args{'object_type'}, + $args{'object_lsid'}, + $args{'description'}, + $args{'authority'}, + $args{'contact_email'}); + my $id=$dbh->{mysql_insertid}; + return $id; +} + +# pass 'type' which is either an LSID or a term +sub delete_object{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $term = $args{type}; + return 0 unless $term; + my $result = $self->query_object(type => $term); + my $row = shift(@$result); + my $id = $row->{object_id}; + my $lsid = $row->{object_lsid}; + my $statement = "delete from object where object_lsid = ?"; + $dbh->do( $statement,undef, ($lsid) ); + + $self->_delete_object_term2term(id => $id); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +# pass "type" here, should be an LSID, preferably... +sub query_object_term2term{ + my ($self, %args) = @_; + my $type = $args{type}; + my $result = $self->query_object(type => $type); + my $row = shift(@$result); + my $id = $row->{object_id}; + return [{}] unless $id; + my $dbh = $self->dbh; + + my $statement = "select + assertion_id, + relationship_type, + object1_id, + object2_id, + object2_articlename + from object_term2term where object2_id = ?"; + my $result2 = do_query($dbh, $statement, ($id)); + return $result2; +} + +# pass object1_type, object2_type, object2_articlename, relationship_type +sub insert_object_term2term{ + my ($self, %args) = @_; + my $type1 = $args{object1_type}; + my $result = $self->query_object(type => $type1); + my $row = shift(@$result); + my $id1 = $row->{object_id}; + my $type2 = $args{object2_type}; + $result = $self->query_object(type => $type2); + $row = shift(@$result); + my $id2 = $row->{object_id}; + my $relationship_type = $args{relationship_type}; + my $object2_articlename = $args{object2_articlename}; + + my $dbh = $self->dbh; + $dbh->do( + q{insert into object_term2term (relationship_type, object1_id, object2_id, object2_articlename) values (?,?,?,?)}, + undef, + $relationship_type, + $id1, + $id2, + $object2_articlename + ); + + return $dbh->{mysql_insertid}; +} + +# pass object 'type' as term or lsid +# this should be a private routine, not a public one. +# SHOULD NOT BE DOCUMENTED IN THE API +sub _delete_object_term2term{ + my ($self, %args) = @_; + my $o1id = $args{id}; + return 0 unless defined($o1id); + my $dbh = $self->dbh; + my $statement = "delete from object_term2term where object1_id=?"; + $dbh->do( $statement,undef, ($o1id)); + + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +# pass servicename and authority_uri +sub query_service_existence { + my ($self, %args) = @_; + my $dbh = $self->dbh; + + my $servicename = $args{'servicename'}; + my $authURI = $args{'authority_uri'}; + my $result = $self->_query_authority(authority_uri => $authURI); + return 0 unless @$result[0]; + my $id = @$result[0]->{authority_id}; + return 0 unless $id; + my $statement = "select + service_instance_id, + category, + servicename, + service_type_uri, + authority_id, + url, + contact_email, + authoritative, + description, + signatureURL, + lsid + from service_instance where servicename = ? and authority_id = ?"; + my $final = do_query($dbh, $statement, ($servicename, $id)); + if (@$final[0]){return 1} else {return 0} + +} +# selects all the columns from service_instance table +# PAY ATTENTION to what this returns. Not auth_id but auth_uri!! +# IMPORTANT: must use quotes for the keys of the hash (eg. 'authority.authority_uri' => $value ) +sub query_service_instance { + my ($self, %args) = @_; + my $dbh = $self->dbh; + + my @args; + while (my ($k, $v) = each %args){ + push @args, ({$k => $v}, "and"); # format for the_add_condition subroutine + # but too bad won't be scalable for "or" + } + + if (keys(%args)){ pop @args;} # remove final "and" + + my $statement = "select + service_instance_id, + category, + servicename, + service_type_uri, + authority.authority_uri, + url, + service_instance.contact_email, + authoritative, + description, + signatureURL, + lsid + from service_instance, authority "; + my @bindvalues; + ($statement, @bindvalues) =_add_condition($statement, @args); + if (keys(%args)){ + $statement .= " and authority.authority_id = service_instance.authority_id"; + } else { + $statement .= " where authority.authority_id = service_instance.authority_id"; + } + my $final = do_query($dbh, $statement, @bindvalues); + return $final; +} + +# custom query for Moby::Central.pm->findService() +# hmmmmmmm.... I'm not sure that this routine should exist... +# it is redundant to the routine above, if the routine above were executed +# multiple times. I think that is the more correct (though less efficient) +# way to go, since it is "scalable" to every possible underlying data source +# ********FIX change this later... +sub match_service_type_uri{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $uri_list = $args{'service_type_uri'}; + my $statement = "select service_instance_id,category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid from service_instance where service_type_uri in ($uri_list)"; + my @bindvalues = (); + my $result = do_query($dbh, $statement, @bindvalues); + return $result; +} + +# passs........ blah blah..... +sub insert_service_instance { + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $authority_id; + if ($args{'authority_uri'}){ # need to transform URI to a row ID + my $result = $self->_query_authority(authority_uri => $args{'authority_uri'}); + return undef unless @$result[0]; + $authority_id = @$result[0]->{authority_id}; + return undef unless $authority_id; + } + + $dbh->do(q{insert into service_instance (category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid) values (?,?,?,?,?,?,?,?,?,?)}, + undef,( + $args{'category'}, + $args{'servicename'}, + $args{'service_type_uri'}, + $authority_id, + $args{'url'}, + $args{'contact_email'}, + $args{'authoritative'}, + $args{'description'}, + $args{'signatureURL'}, + $args{'lsid'})); + + my $id = $dbh->{mysql_insertid}; + return $id; +} + +# pass service_instance_lsid +sub delete_service_instance{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $statement = "delete from service_instance where lsid = ?"; + $dbh->do( $statement,undef, ($args{service_instance_lsid}) ); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +# Selects all columns EXCEPT authority_id +# pass authority_uri +sub query_authority { + my ($self, %args) = @_; + my $authURI = $args{authority_uri}; + my $dbh = $self->dbh; + + my $statement = "select + authority_common_name, + authority_uri, + contact_email + from authority where authority_uri = ?"; + my $result = do_query($dbh, $statement, ($authURI)); + return $result; +} + +# Selects all columns including authority_id +# pass authority_uri. NOTE THAT THIS IS A PRIVATE ROUTINE +# SHOULD NOT BE DOCUMENTED IN THE API +sub _query_authority { + my ($self, %args) = @_; + my $authURI = $args{authority_uri}; + my $dbh = $self->dbh; + + my $statement = "select + authority_common_name, + authority_uri, + authority_id, + contact_email + from authority where authority_uri = ?"; + my $result = do_query($dbh, $statement, ($authURI)); + return $result; +} + +# custom query routine used in Moby::Central.pm -> retrieveServiceProviders() +# no args passed +sub get_all_authorities{ + my ($self, @args) = @_; + my $dbh = $self->dbh; + my $statement = "select distinct authority_uri from authority"; + my @bindvalues = (); + my $result = do_query($dbh, $statement, @bindvalues); + return $result; +} + +# pass authority_common_name, authority_uri, contact_email, return ID of some sort +sub insert_authority{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + $dbh->do("insert into authority + (authority_common_name, + authority_uri, + contact_email) + values (?,?,?)", + undef, + ($args{'authority_common_name'}, + $args{'authority_uri'}, + $args{'contact_email'})); + my $id = $dbh->{mysql_insertid}; + return $id; +} + +# pass service_type, as term or LSID +sub query_service{ + my ($self, %args) = @_; + my $type = $args{type}; + my $condition = ""; + if ($type =~ /^urn\:lsid/){ + $condition = "where service_lsid = ?"; + } elsif ($type) { + $condition = "where service_type = ?"; + } else { + $condition = ""; + } + + my $dbh = _getDBHandle("mobyservice"); + + my $statement = "select + service_id, + service_lsid, + service_type, + description, + authority, + contact_email + from service $condition"; + my $result; + if ($type){ + $result = do_query($dbh, $statement, ($type)); + } else { + $result = do_query($dbh, $statement); + } + return $result; +} + +# pass in .... +sub insert_service{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + $dbh->do(q{insert into service (service_type, service_lsid, description, authority, contact_email) values (?,?,?,?,?)}, + undef, + ( + $args{'service_type'}, $args{'service_lsid'}, $args{'description'}, + $args{'authority'}, $args{'contact_email'} + ) + ); + return $dbh->{mysql_insertid}; +} + +# pass in 'type' as a term or lsid +sub delete_service{ + my ($self, %args) = @_; + my $type = $args{type}; + my $result = $self->query_service(type => $type); + my $row = shift(@$result); + my $id = $row->{service_id}; + my $lsid = $row->{service_lsid}; + return 0 unless $lsid; + my $dbh = $self->dbh; + my $statement = "delete from service where service_lsid = ?"; + $dbh->do( $statement, undef, ($lsid)); + $self->_delete_service_term2term(id => $id); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +sub query_service_term2term{ + my ($self, %args) = @_; + my $type = $args{type}; + my $result = $self->query_service(type => $type); + my $row = shift(@$result); + my $id = $row->{service_id}; + return [{}] unless $id; + my $dbh = $self->dbh; + + my $statement = "select + assertion_id, + relationship_type, + service1_id, + service2_id + from service_term2term where service2_id = ?"; + my $result2 = do_query($dbh, $statement, ($id)); + return $result2; +} + +#pass relationshiptype, servce1_type, service2_type +sub insert_service_term2term{ + my ($self, %args) = @_; + my $type1 = $args{service1_type}; + my $result = $self->query_service(type => $type1); + my $row = shift(@$result); + my $id1 = $row->{service_id}; + my $type2 = $args{service2_type}; + $result = $self->query_service(type => $type2); + $row = shift(@$result); + my $id2 = $row->{service_id}; + my $relationship_type = $args{relationship_type}; + + my $dbh = $self->dbh; + $dbh->do(q{insert into service_term2term (relationship_type, service1_id, service2_id) values (?,?,?)}, + undef, + ($relationship_type, + $id1, + $id2) + ); + + return $dbh->{mysql_insertid}; +} + + +# NOTE THAT THIS IS A PRIVATE FUNCTION AND SHOULD +# NOT BE DOCUMENTED IN THE API. +sub _delete_service_term2term{ + my ($self, %args) = @_; + my $id = $args{id}; + return 0 unless (defined($id)); + my $dbh = $self->dbh; + my $statement = "delete from service_term2term where service1_id=?"; + $dbh->do( $statement,undef, ($id)); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + + +sub query_relationship{ + my ($self, %args) = @_; + my $type = $args{type} || ""; +# return [{}] unless $type; + my $condition = ""; + if ($type =~ /^urn\:lsid/){ + $condition = " relationship_lsid = ? and "; + } elsif ($type) { + $condition = " relationship_type = ? and "; + } + my $ont = $args{ontology}; + + my $dbh = $self->dbh; + + my $statement = "select + relationship_id, + relationship_lsid, + relationship_type, + container, + description, + authority, + contact_email, + ontology + from relationship where $condition ontology = ?"; + + if ($type){ + return do_query($dbh, $statement, ($type, $ont)); + } else { + return do_query($dbh, $statement, ($ont)); + } +} + +sub query_namespace{ + my ($self, %args) = @_; + my $type = $args{type}; + my $condition = ""; + if ($type =~ /^urn\:lsid/){ + $condition = " where namespace_lsid = ?"; + } elsif ($type) { + $condition = " where namespace_type = ?"; + } else { + $condition = ""; + } + + my $dbh = _getDBHandle("mobynamespace"); + + my $statement = "select + namespace_id, + namespace_lsid, + namespace_type, + description, + authority, + contact_email + from namespace $condition"; + my $result; + if ($type){ + $result = do_query($dbh, $statement, ($type)); + } else { + $result = do_query($dbh, $statement); + } + return $result; +} + + +sub insert_namespace{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + $dbh->do(q{insert into namespace (namespace_type, namespace_lsid, description, authority,contact_email) values (?,?,?,?,?)}, + undef, + ( + $args{'namespace_type'}, $args{'namespace_lsid'},$args{'description'},$args{'authority'},$args{'contact_email'} + ) + ); + return $dbh->{mysql_insertid}; +} + +# pass namesapce_lsid +sub delete_namespace{ + my ($self, %args) = @_; + my $type = $args{type}; + my $result = $self->query_namespace(type => $type); + my $row = shift(@$result); + my $id = $row->{namespace_id}; + my $lsid = $row->{namespace_lsid}; + return 0 unless $lsid; + my $dbh = $self->dbh; + my $statement = "delete from namespace where namespace_lsid = ?"; + $dbh->do( $statement, undef, ($lsid)); + $self->_delete_namespace_term2term(id => $id); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} + +sub query_namespace_term2term{ + my ($self, %args) = @_; + my $type = $args{type}; + my $result = $self->query_namespace(type => $type); + my $row = shift(@$result); + my $id = $row->{namespace_id}; + return [{}] unless $id; + my $dbh = $self->dbh; + + my $statement = "select + assertion_id, + relationship_type, + namespace1_id, + namespace2_id + from namespace_term2term where namespace2_id = ?"; + my $result2 = do_query($dbh, $statement, ($id)); + return $result2; +} + +# PRIVATE, NOT PART OF API! +sub _delete_namespace_term2term{ + my ($self, %args) = @_; + my $id = $args{id}; + return 0 unless defined($id); + my $dbh = $self->dbh; + my $statement = "delete from namespace_term2term where namespace1_id=?"; + $dbh->do( $statement,undef, ($id)); + if ($dbh->err){ + return (1, $dbh->errstr); + } + else{ + return 0; + } +} +# pass type as LSID or term +sub check_object_usage{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $errorMsg = 1; + my $type = $args{type}; + return 0 unless $type; + my $result = $self->query_object(type => $type); + my $row = shift @$result; + my $lsid = $row->{object_lsid}; + + my ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join simple_input where object_type_uri = ?}, + undef, $lsid + ); + return $errorMsg + if ($id); + + ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join simple_output where object_type_uri = ?}, + undef, $lsid + ); + return $errorMsg + if ($id); + + ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join collection_input natural join simple_input where object_type_uri = ?}, + undef, $lsid + ); + return $errorMsg + if ($id); + + ($id) = $dbh->selectrow_array(q{select service_instance.service_instance_id from service_instance natural join collection_output natural join simple_output where object_type_uri = ?}, + undef, $lsid + ); + return $errorMsg + if ($id); + + return 0; +} + +# custom query routine for Moby::Central.pm -> deregisterNamespace() +sub check_namespace_usage{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $errorMsg = 1; + my $type = $args{type}; + return 0 unless $type; + my $result = $self->query_namespace(type => $type); + my $row = shift @$result; + my $lsid = $row->{namespace_lsid}; + + my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where INSTR(namespace_type_uris,'$lsid')" + ); + $sth->execute; + + while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { + my @nss = split ",", $ns; + foreach (@nss) { + $_ =~ s/\s//g; + my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; + return (1, $errstr) + if ( $_ eq $lsid ); + } + } + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where INSTR(namespace_type_uris,'$lsid')" + ); + $sth->execute; + while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { + my @nss = split ",", $ns; + foreach (@nss) { + $_ =~ s/\s//g; + my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; + return (1, $errstr) + if ( $_ eq $lsid ); + } + } + $sth = + $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where INSTR(namespace_type_uris, '$lsid')" + ); + $sth->execute; + while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { + my @nss = split ",", $ns; + foreach (@nss) { + $_ =~ s/\s//g; + my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; + return (1, $errstr) + if ( $_ eq $lsid ); + } + } + $sth = + $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where INSTR(namespace_type_uris, '$lsid')" + ); + $sth->execute; + while ( my ( $id, $ns ) = $sth->fetchrow_array() ) { + my @nss = split ",", $ns; + foreach (@nss) { + $_ =~ s/\s//g; + my $errstr = "Namespace Type $type ($_) is used by a service (service ID number $id) and may not be deregistered"; + return (1, $errstr) + if ( $_ eq $lsid ); + } + } + return (0, ""); +} + +# custom query routine for Moby::Central.pm -> findService() +sub check_keywords{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $param = $args{keywords}; + return ([{}]) unless (ref($param) =~ /ARRAY/); + my @keywords = @$param; + #my %findme = %$param; + my $searchstring; + foreach my $kw ( @keywords ) { + $kw =~ s/\*//g; + $kw = $dbh->quote("%$kw%"); + $searchstring .= " OR description like $kw "; + } + $searchstring =~ s/OR//; # remove just the first OR in the longer statement + + my $statement = "select service_instance_id,category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid from service_instance where $searchstring"; + my @bindvalues = (); + + my $ids = do_query($dbh, $statement, @bindvalues); + return ($ids); +} + +# custom query subroutine for Moby::Central.pm->_searchForSimple() +sub find_by_simple{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $inout = $args{'inout'}; + my $ancestor_string = $args{'ancestor_string'}; + my $namespaceURIs = $args{'namespaceURIs'}; + + my $query ="select service_instance_id, namespace_type_uris from simple_$inout where object_type_uri in ($ancestor_string) and service_instance_id IS NOT NULL " + ; # if service_instance_id is null then it must be a collection input. + my $nsquery; + foreach my $ns ( @{$namespaceURIs} ) { # namespaces are already URI's + $nsquery .= " OR INSTR(namespace_type_uris, '$ns') "; + } + if ($nsquery) { + $nsquery =~ s/OR//; # just the first + $nsquery .= " OR namespace_type_uris IS NULL"; + $query .= " AND ($nsquery) "; + } + + my $result = do_query($dbh, $query, ()); + return $result; +} + +# custom query subroutine for Moby::Central.pm->_searchForCollection() +sub find_by_collection{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $inout = $args{'inout'}; + my $objectURI = $args{'objectURI'}; + my $namespaceURIs = $args{'namespaceURIs'}; + + my $query = "select + c.service_instance_id, + s.namespace_type_uris + from + simple_$inout as s, + collection_$inout as c + where + s.collection_${inout}_id IS NOT NULL + AND s.collection_${inout}_id = c.collection_${inout}_id + AND object_type_uri = '$objectURI' "; + my $nsquery; + foreach my $ns ( @{$namespaceURIs} ) { # namespaces are already URI's + $nsquery .= " OR INSTR(namespace_type_uris, '$ns') "; + } + if ($nsquery) { + $nsquery =~ s/^\sOR//; # just the first + $nsquery .= " OR namespace_type_uris IS NULL"; + $query .= " AND ($nsquery) "; # add the AND clause + } + + my $result = do_query($dbh, $query, ()); + return $result; +} + +# custom query subroutine for Moby::Central.pm->RetrieveServiceNames +sub get_service_names{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $statement = "select authority_uri, servicename from authority as a, service_instance as s where s.authority_id = a.authority_id"; + my @bindvalues = (); + + my $result = do_query($dbh, $statement, @bindvalues); + return $result; +} + +# custom query for Moby::Central.pm->_flatten +sub get_parent_terms{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + + my $type_id = $args{'relationship_type_id'}; + my $statement = " + select + OE1.term + from + OntologyEntry as OE1, + OntologyEntry as OE2, + Term2Term as TT + where + ontologyentry2_id = OE2.id + and ontologyentry1_id = OE1.id + and relationship_type_id = $type_id + and OE2.term = ?"; + + my @bindvalues = (); + push(@bindvalues, $args{'term'}); + + my $result = do_query($dbh, $statement, @bindvalues); + return $result; +} + +# custom query subroutine for selecting from object_term2term and object tables +# used in Moby::OntologyServer.pm->retrieveObject() +sub get_object_relationships{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $type = $args{type}; + return 0 unless $type; + my $result = $self->query_object(type => $type); + my $row = shift @$result; + my $id = $row->{object_id}; + + my $statement = "select + relationship_type, + object_type, + object_lsid, + description, + authority, + contact_email, + object2_articlename + from object_term2term, object + where object1_id = ? and object2_id = object_id"; + + my $result2 = do_query($dbh, $statement, ($id)); + return $result2; +} + +# relationship query for any table used in Moby::OntologyServer->_doRelationshipQuery() +# note: returns a reference to an array containing ARRAY references +sub get_relationship{ + my ($self, %args) = @_; + my $dbh = $self->dbh; + my $direction = $args{'direction'}; + my $ontology = $args{'ontology'}; + my $relationship = $args{'relationship'}; # this is assumed to be an LSID + + my $type = $args{'term'}; + return 0 unless $type; + my $lsid; + if ($ontology eq "service"){ + my $result = $self->query_service(type => $type); + my $row = shift @$result; + $lsid = $row->{service_lsid}; + } else { + my $result = $self->query_object(type => $type); + my $row = shift @$result; + $lsid = $row->{object_lsid}; + } + my $defs; + my $extra_columns; + $extra_columns = ", relationship_type "; + if ($ontology eq "object"){$extra_columns .=", object2_articlename ";} + if ( $direction eq 'root' ) { + unless ( defined $relationship ) { + $defs = $self->dbh->selectall_arrayref( " + select distinct s2.${ontology}_lsid $extra_columns from + ${ontology}_term2term as t2t, + $ontology as s1, + $ontology as s2 + where + s1.${ontology}_id = t2t.${ontology}1_id and + s2.${ontology}_id = t2t.${ontology}2_id and + s1.${ontology}_lsid = ?", undef, $lsid ); # ") + } else { + $defs = $self->dbh->selectall_arrayref( " + select distinct s2.${ontology}_lsid $extra_columns from + ${ontology}_term2term as t2t, + $ontology as s1, + $ontology as s2 + where + relationship_type = ? and + s1.${ontology}_id = t2t.${ontology}1_id and + s2.${ontology}_id = t2t.${ontology}2_id and + s1.${ontology}_lsid = ?", undef, $relationship, $lsid ); # ") + } + } else { + unless ( defined $relationship ) { + $defs = $self->dbh->selectall_arrayref( " + select distinct s2.${ontology}_lsid $extra_columns from + ${ontology}_term2term as t2t, + $ontology as s1, + $ontology as s2 + where + s1.${ontology}_id = t2t.${ontology}1_id and + s2.${ontology}_id = t2t.${ontology}2_id and + s2.${ontology}_lsid = ?", undef, $lsid); # ") + } else { + $defs = $self->dbh->selectall_arrayref( " + select distinct s2.${ontology}_lsid $extra_columns from + ${ontology}_term2term as t2t, + $ontology as s1, + $ontology as s2 + where + relationship_type = ? and + s1.${ontology}_id = t2t.${ontology}1_id and + s2.${ontology}_id = t2t.${ontology}2_id and + s2.${ontology}_lsid = ?", undef, $relationship, $lsid ); # ") + } + } + return $defs; +} + +sub _checkURI { + +# my $uri = "http://www.ics.uci.edu/pub/ietf/uri/#Related"; +#print "$1, $2, $3, $4, $5, $6, $7, $8, $9" if +# $uri =~ m{^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?}; +# +#The license for this recipe is available here. +# +#Discussion: +# +#If the match is successful, a URL such as +# +#http://www.ics.uci.edu/pub/ietf/uri/#Related +# +#will be broken down into the following group match variables: +# +#$1 = http: +#$2 = http +#$3 = //www.ics.uci.edu +#$4 = www.ics.uci.edu +#$5 = /pub/ietf/uri/ +#$6 = +#$7 = +#$8 = #Related +#$9 = Related +# +#In general, this regular expression breaks a URI down into the following parts, +#as defined in the RFC: +# +#scheme = $2 +#authority = $4 +#path = $5 +#query = $7 +#fragment = $9 + +} + +sub DESTROY {} + +1; From fgibbons at pub.open-bio.org Thu Sep 15 10:09:44 2005 From: fgibbons at pub.open-bio.org (Frank Gibbons) Date: Thu Sep 15 18:01:02 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509151409.j8FE9iGI019624@pub.open-bio.org> fgibbons Thu Sep 15 10:09:44 EDT 2005 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory pub.open-bio.org:/tmp/cvs-serv19603 Added Files: RFC.html Log Message: - How to we handle changes to the API (RFCs) moby-live/Docs/MOBY-S_API RFC.html,NONE,1.1 From gss at pub.open-bio.org Wed Sep 14 18:05:49 2005 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu Sep 15 18:01:10 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509142205.j8EM5nii016998@pub.open-bio.org> gss Wed Sep 14 18:05:48 EDT 2005 Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core In directory pub.open-bio.org:/tmp/cvs-serv16973 Modified Files: .cvsignore Log Message: More to ignore moby-live/S-MOBY/ref-impl/core .cvsignore,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/.cvsignore,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/.cvsignore 2005/03/21 21:32:01 1.7 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/.cvsignore 2005/09/14 22:05:48 1.8 @@ -1,3 +1,4 @@ classes .classpath .project +.settings From gss at pub.open-bio.org Wed Sep 14 18:06:10 2005 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu Sep 15 18:01:12 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200509142206.j8EM6ADW017093@pub.open-bio.org> gss Wed Sep 14 18:06:10 EDT 2005 Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph In directory pub.open-bio.org:/tmp/cvs-serv17011/src/org/semanticmoby/graph Modified Files: MOBYCollection.java MOBYSubject.java MOBYGraphNode.java MOBYOrderedCollection.java MOBYResizableCollection.java MOBYEnumeration.java MOBYFixedCollection.java MOBYObject.java MOBYGraph.java MOBYMappingElement.java MOBYUnorderedCollection.java Added Files: MOBYServiceSet.java MOBYPropValStmt.java CollectionWrapper.java ContainerWrapper.java MOBYService.java ListWrapper.java Removed Files: MOBYPropertyValueConstraint.java MOBYProviderSet.java MOBYDescriptor.java MOBYDocument.java MOBYOntology.java MOBYNonPositiveIntegerConstraint.java MOBYPropertyValue.java MOBYDateConstraint.java MOBYSingleElement.java MOBYIntegerConstraint.java MOBYNonNegativeIntegerConstraint.java MOBYProvider.java MOBYPropertyValueStatement.java MOBYNumericConstraint.java MOBYLiteral.java MOBYPropertyValueException.java MOBYResource.java Log Message: Major API overhaul moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph MOBYServiceSet.java,NONE,1.1 MOBYPropValStmt.java,NONE,1.1 CollectionWrapper.java,NONE,1.1 ContainerWrapper.java,NONE,1.1 MOBYService.java,NONE,1.1 ListWrapper.java,NONE,1.1 MOBYCollection.java,1.2,1.3 MOBYSubject.java,1.2,1.3 MOBYGraphNode.java,1.2,1.3 MOBYOrderedCollection.java,1.2,1.3 MOBYResizableCollection.java,1.2,1.3 MOBYEnumeration.java,1.2,1.3 MOBYFixedCollection.java,1.2,1.3 MOBYObject.java,1.2,1.3 MOBYGraph.java,1.1,1.2 MOBYMappingElement.java,1.2,1.3 MOBYUnorderedCollection.java,1.2,1.3 MOBYPropertyValueConstraint.java,1.1,NONE MOBYProviderSet.java,1.2,NONE MOBYDescriptor.java,1.2,NONE MOBYDocument.java,1.2,NONE MOBYOntology.java,1.2,NONE MOBYNonPositiveIntegerConstraint.java,1.1,NONE MOBYPropertyValue.java,1.1,NONE MOBYDateConstraint.java,1.1,NONE MOBYSingleElement.java,1.2,NONE MOBYIntegerConstraint.java,1.1,NONE MOBYNonNegativeIntegerConstraint.java,1.1,NONE MOBYProvider.java,1.2,NONE MOBYPropertyValueS! tatement.java,1.1,NONE MOBYNumericConstraint.java,1.1,NONE MOBYLiteral.java,1.1,NONE MOBYPropertyValueException.java,1.1,NONE MOBYResource.java,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYCollection.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYCollection.java 2005/09/14 22:06:10 1.3 @@ -3,6 +3,7 @@ import java.util.*; import com.hp.hpl.jena.rdf.model.*; +import com.hp.hpl.jena.util.iterator.ExtendedIterator; /** * A common abstract class for collections, both fixed sized and @@ -10,54 +11,61 @@ */ public abstract class MOBYCollection extends MOBYGraphNode { - /** - * A list to hold the elements of the collection - */ - protected List elements = new ArrayList(); + protected CollectionWrapper wrapper; /** - * Create an instance with the initial list of elements - * @param initialElements the initial elements + * Creates an instance for the given model and defining statement */ - public MOBYCollection(List initialElements, Resource resource, - Model model) - { - super(resource, model); + public MOBYCollection(Model jenaModel, Statement definingStmt, + CollectionWrapper wrapper, List items) { + super(jenaModel, definingStmt); + this.wrapper = wrapper; - if (initialElements != null) { - elements.addAll(initialElements); + for (Iterator it = items.iterator(); it.hasNext();) + { + MOBYGraphNode node = (MOBYGraphNode) it.next(); + wrapper.add(node); } } /** - * Return the size of the collection. + * Returns the size of the collection. */ public int size() { - return elements.size(); + return wrapper.size(); } - + /** - * Return an iterator for traversing the elements + * Returns an iterator for traversing the elements */ - public Iterator iterator() + public ExtendedIterator iterator() { - return elements.iterator(); + return wrapper.iterator(); } - /** - * Return whether or not this object is a collection. - */ - public boolean isCollection() + public void add(MOBYGraphNode node) { - return true; + wrapper.add(node); } + /** - * Return whether or not this object is a singular element. + * Remove from the model all statements that make up this API object. + * This includes the defining statement (bnode rdf:type rdf:List), the + * statements that make up each of the nested API objects, and the + * statements that make this an RDF List, which are encapsulated in + * the Jena RDFList object. */ - public boolean isSingular() + public void removeStatements() { - return false; + ExtendedIterator it = wrapper.iterator(); + while (it.hasNext()) + { + MOBYGraphNode node = (MOBYGraphNode) it.next(); + node.removeStatements(); + } + it.close(); + wrapper.removeStatements(); } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYSubject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYSubject.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYSubject.java 2005/09/14 22:06:10 1.3 @@ -1,12 +1,19 @@ package org.semanticmoby.graph; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import org.semanticmoby.graph.*; +import org.semanticmoby.vocabulary.MOBY; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Resource; +import com.hp.hpl.jena.rdf.model.Statement; +import com.hp.hpl.jena.vocabulary.RDF; /** - * An object that represents the subject of one or more mappings. In + * A class that represents the subject of one or more mappings. In * RDF graph terms, this represents a node (either blank or a resource) * that is a moby:Subject, an RDF data structure (List, Bag, Seq, Alt), * or both. @@ -23,24 +30,87 @@ { /** * The collection of direct mappings, i.e. moby:mapsTo statements - * whose subject is this. + * whose subject is this; keyed by the mapsTo statement. */ - private MOBYUnorderedCollection directMappings; + private Map directMappingStmts; - public MOBYSubject(Resource resource, MOBYFixedCollection statements, - MOBYUnorderedCollection directMappings, - MOBYCollection nestedMappings, Model underlying) + /** + * Creates an instance with the given parameters; should be called from + * parsing code. + */ + public MOBYSubject(Model jenaModel, Statement definingStmt, List propValStmts, + Map directMappingStmts, MOBYCollection nestedMappings) { - super(resource, statements, nestedMappings, underlying); - this.directMappings = directMappings; + super(jenaModel, definingStmt, propValStmts, nestedMappings); + this.directMappingStmts = directMappingStmts; } - + + /** + * Creates an instance with the given parameters; should be called + * when creating an instance from scratch (i.e. not from parsing). + */ + public MOBYSubject(Model jenaModel, Resource head, List propValStmts, + List directMappings, MOBYCollection nestedMappings) + { + super(jenaModel, + jenaModel.createStatement(head, RDF.type, MOBY.Subject), + propValStmts, nestedMappings); + + for (Iterator it = directMappings.iterator(); it.hasNext();) + { + MOBYGraphNode node = (MOBYGraphNode) it.next(); + addDirectMapping(node); + } + } + + /** + * Add the given node to the direct mappings, and add a mapsTo + * statement to the underlying model + */ + public void addDirectMapping(MOBYGraphNode node) + { + this.directMappingStmts.put( + node, + jenaModel.createStatement( + getResource(), MOBY.mapsTo, node.getResource())); + } + + /** + * Remove the given node from the direct mappings and remove the + * underlying RDF statements from the Jena model + */ + public void removeDirectMapping(MOBYGraphNode node) + { + Statement stmt = (Statement) directMappingStmts.get(node); + if (stmt != null) { + jenaModel.remove(stmt); + } + node.removeStatements(); + } + /** - * Return the collection of direct mappings, i.e. moby:mapsTo statements - * whose subject is this. + * Return an iterator over the direct mappings + */ + public Iterator getDirectMappings() + { + return directMappingStmts.keySet().iterator(); + } + + /* + * (non-Javadoc) + * @see org.semanticmoby.graph.MOBYGraphNode#removeStatements() */ - public MOBYUnorderedCollection getDirectMappings() + public void removeStatements() { - return directMappings; + super.removeStatements(); + if (directMappingStmts != null) + { + for (Iterator it = directMappingStmts.keySet().iterator(); it.hasNext();) + { + MOBYGraphNode node = (MOBYGraphNode) it.next(); + removeDirectMapping(node); + } + directMappingStmts = null; + } } } =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYGraphNode.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYGraphNode.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYGraphNode.java 2005/09/14 22:06:10 1.3 @@ -3,31 +3,88 @@ import com.hp.hpl.jena.rdf.model.*; /** - * An abstract class for nodes in an RDF graph; these nodes are either - * collections or singular elements. + * An abstract class for representing parts of a MOBY graph structure. */ -public abstract class MOBYGraphNode extends MOBYDescriptor +public abstract class MOBYGraphNode { - public MOBYGraphNode(Resource resource, Model model) + /** + * The underlying Jena model that holds the statements for this + * graph component + */ + protected Model jenaModel; + + /** + * Graph nodes all have an rdf:type statement that makes them what they + * are, with the exception of MOBYMappingElement instances, which can at + * times have no defining statement (see the discussion in the class + * documentation for MOBYMappingElement). + */ + protected Statement definingStmt; + + /** + * Creates an instance for the given model and defining statement + */ + protected MOBYGraphNode(Model jenaModel, Statement definingStmt) { - super(resource, model); + this.jenaModel = jenaModel; + this.definingStmt = definingStmt; + + if (definingStmt != null) { + jenaModel.add(definingStmt); + } } - + /** - * Return whether or not this node represents a blank node + * Returns the model that holds statements describing this component */ - public boolean isBlank() + public Model getJenaModel() { - return (resource == null) || (resource.getURI() == null); + return jenaModel; } /** - * Return whether or not this object is a collection. + * Returns the defining statement for this component */ - public abstract boolean isCollection(); + public Statement getDefiningStmt() + { + return definingStmt; + } /** - * Return whether or not this object is a singular element. + * Returns the resource that is the subject of the defining statement + * if it has one, else returns null; */ - public abstract boolean isSingular(); + public Resource getResource() + { + return (definingStmt == null) ? null : definingStmt.getSubject(); + } + + /** + * Removes the statements representing this component; subclasses should + * also call removeDefiningStatement() and call removeStatements() on all + * MOBYGraphNode instances nested within them. + */ + public abstract void removeStatements(); + + /** + * Removes and nulls out the defining statement if it has not already + * been removed and nulled out. + */ + protected void removeDefiningStatement() + { + if (definingStmt != null) + { + jenaModel.remove(definingStmt); + definingStmt = null; + } + } + + /** + * Returns the URI of the underlying resource if there is a defining + * statement, else returns null. + */ + public String getURI() + { + return (getResource() == null) ? null : getResource().getURI(); + } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYOrderedCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYOrderedCollection.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYOrderedCollection.java 2005/09/14 22:06:10 1.3 @@ -3,6 +3,7 @@ import java.util.*; import com.hp.hpl.jena.rdf.model.*; +import com.hp.hpl.jena.vocabulary.RDF; /** * A class representing collections that can be resized (i.e. @@ -12,47 +13,24 @@ public class MOBYOrderedCollection extends MOBYResizableCollection { /** - * Create an instance with no elements - * @param resource the resource node that represents this collection - * @param underlyingJenaModel the Jena model from which this is stored + * Constructor for creating a fixed collection API object from scratch. */ - public MOBYOrderedCollection(Resource resource, - Model underlyingJenaModel) + public MOBYOrderedCollection(Model jenaModel, Resource head, List items) { - super(null, resource, underlyingJenaModel); + super(jenaModel, + jenaModel.createStatement(head, RDF.type, RDF.Seq), + new ContainerWrapper((Seq) head.as(Seq.class)), items); } /** - * Create an instance with the initial list of elements - * @param initialElements the initial elements - * @param resource the resource node that represents this collection - * @param underlyingJenaModel the Jena model from which this is stored + * Create an instance with the list of items */ - public MOBYOrderedCollection(List initialElements, Resource resource, - Model underlyingJenaModel) + public MOBYOrderedCollection(Model jenaModel, Statement definingStmt, + List items) { - super(initialElements, resource, underlyingJenaModel); - } - - /** - * Return the element at the given index - * @param index the zero-based index of the element to retrieve - * @return the element - */ - public Object get(int index) - { - return elements.get(index); - } - - /** - * Add the given element to the collection so that its new - * zero-based index is given index - * @param index the zero-based index at which the new element - * should be added - * @param elementToAdd the element to add - */ - public void add(int index, Object elementToAdd) - { - elements.add(index, elementToAdd); + super(jenaModel, + definingStmt, + new ContainerWrapper((Seq) definingStmt.getSubject().as(Seq.class)), + items); } } =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYResizableCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYResizableCollection.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYResizableCollection.java 2005/09/14 22:06:10 1.3 @@ -3,59 +3,23 @@ import java.util.*; import com.hp.hpl.jena.rdf.model.*; +import com.hp.hpl.jena.util.iterator.ExtendedIterator; +import com.hp.hpl.jena.vocabulary.RDF; /** * A class representing collections that can be resized (i.e. * elements added to or removed from); such collections can be - * either ordered or unordered. + * either ordered or unordered. This corresponds to the three + * RDF container classes, namely Bag, Seq, and Alt. */ public abstract class MOBYResizableCollection extends MOBYCollection { /** - * Create an instance with no elements - * @param resource the resource node that represents this collection - * @param model the Jena model from which this is derived + * Constructor for creating a resizable collection API object from scratch. */ - public MOBYResizableCollection(Resource resource, Model model) + public MOBYResizableCollection(Model jenaModel, Statement definingStmt, + CollectionWrapper wrapper, List items) { - super(null, resource, model); - } - - /** - * Create an instance with the initial list of elements - * @param initialElements the initial elements - * @param resource the resource node that represents this collection - * @param underlyingJenaModel the Jena model from which this is stored - */ - public MOBYResizableCollection(List initialElements, Resource resource, - Model underlyingJenaModel) - { - super(initialElements, resource, underlyingJenaModel); - } - - /** - * Add an element to the collection - * @param elementToAdd the element to add to the collection - */ - public void add(Object elementToAdd) - { - elements.add(elementToAdd); - } - - /** - * Remove an element from the collection - * @param elementToRemove the element to remove - */ - public void remove(Object elementToRemove) - { - elements.remove(elementToRemove); - } - - /** - * Remove all the elements from the collection - */ - public void clear() - { - elements.clear(); + super(jenaModel, definingStmt, wrapper, items); } } =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYEnumeration.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYEnumeration.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYEnumeration.java 2005/09/14 22:06:10 1.3 @@ -3,6 +3,7 @@ import java.util.*; import com.hp.hpl.jena.rdf.model.*; +import com.hp.hpl.jena.vocabulary.RDF; /** * A class representing collections that can be resized (i.e. @@ -14,25 +15,24 @@ public class MOBYEnumeration extends MOBYUnorderedCollection { /** - * Create an instance with no elements - * @param resource the resource node that represents this collection - * @param underlyingJenaModel the Jena model from which this is stored + * Constructor for creating a fixed collection API object from scratch. */ - public MOBYEnumeration(Resource resource, - Model underlyingJenaModel) + public MOBYEnumeration(Model jenaModel, Resource head, List items) { - super(null, resource, underlyingJenaModel); + super(jenaModel, + jenaModel.createStatement(head, RDF.type, RDF.Alt), + new ContainerWrapper((Alt) head.as(Alt.class)), items); } /** - * Create an instance with the initial list of elements - * @param initialElements the initial elements - * @param resource the resource node that represents this collection - * @param underlyingJenaModel the Jena model from which this is stored + * Create an instance with the list of items */ - public MOBYEnumeration(List initialElements, Resource resource, - Model underlyingJenaModel) + public MOBYEnumeration(Model jenaModel, Statement definingStmt, + List items) { - super(initialElements, resource, underlyingJenaModel); + super(jenaModel, + definingStmt, + new ContainerWrapper((Alt) definingStmt.getSubject().as(Alt.class)), + items); } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYFixedCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYFixedCollection.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYFixedCollection.java 2005/09/14 22:06:10 1.3 @@ -3,32 +3,34 @@ import java.util.*; import com.hp.hpl.jena.rdf.model.*; +import com.hp.hpl.jena.util.iterator.ExtendedIterator; +import com.hp.hpl.jena.vocabulary.RDF; /** - * A class for holding an ordered, fixed sized collection - * of objects; corresponds to an RDF List. + * A class for holding an ordered, fixed sized collection of API objects + * (subclasses of MOBYGraphNode); corresponds to an RDF List. */ public class MOBYFixedCollection extends MOBYCollection { /** - * Create an instance with the initial list of elements - * @param initialElements the initial elements - * @param resource the resource node that represents this collection - * @param model the Jena model from which this is derived + * Constructor for creating a fixed collection API object from scratch. */ - public MOBYFixedCollection(List initialElements, Resource resource, - Model model) + public MOBYFixedCollection(Model jenaModel, Resource head, List items) { - super(initialElements, resource, model); + super(jenaModel, + jenaModel.createStatement(head, RDF.type, RDF.List), + new ListWrapper((RDFList) head.as(RDFList.class)), items); } /** - * Return the element at the given index - * @param index the zero-based index of the element to retrieve - * @return the element + * Create an instance with the list of items */ - public Object get(int index) + public MOBYFixedCollection(Model jenaModel, Statement definingStmt, + List items) { - return elements.get(index); + super(jenaModel, + definingStmt, + new ListWrapper((RDFList) definingStmt.getSubject().as(RDFList.class)), + items); } } =================================================================== RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYObject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYObject.java 2005/03/21 21:29:44 1.2 +++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYObject.java 2005/09/14 22:06:10 1.3 @@ -1,16 +1,44 @@ package org.semanticmoby.graph; +import java.util.List; + +import org.semanticmoby.vocabulary.MOBY; + import com.hp.hpl.jena.rdf.model.*; +import com.hp.hpl.jena.vocabulary.RDF; /** - * An object that represents the object of a mapping. + * A class that represents the object of one or more mappings. In + * RDF graph terms, this represents a node (either blank or a resource) + * that is a moby:Subject, an RDF data structure (List, Bag, Seq, Alt), + * or both. + *
+ * As an RDF data structure, it can have one or more elements, each
+ * of which can itself be either a moby:Object, an RDF data structure,
+ * or both. This collection of elements is returned by getNestedMappings().
*/
public class MOBYObject extends MOBYMappingElement
{
- public MOBYObject(Resource resource, MOBYFixedCollection statements,
- MOBYCollection nestedElements, Model underlying)
+ /**
+ * Creates an instance with the given parameters; should be called from
+ * parsing code.
+ */
+ public MOBYObject(Model jenaModel, Statement definingStmt,
+ List propValStmts, MOBYCollection nestedMappings)
+ {
+ super(jenaModel, definingStmt, propValStmts, nestedMappings);
+ }
+
+ /**
+ * Creates an instance with the given parameters; should be called
+ * when creating an instance from scratch (i.e. not from parsing).
+ */
+ public MOBYObject(Model jenaModel, Resource head, List propValStmts,
+ MOBYCollection nestedMappings)
{
- super(resource, statements, nestedElements, underlying);
+ super(jenaModel,
+ jenaModel.createStatement(head, RDF.type, MOBY.Object),
+ propValStmts, nestedMappings);
}
}
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYGraph.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYGraph.java 2004/11/23 00:18:46 1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYGraph.java 2005/09/14 22:06:10 1.2
@@ -1,26 +1,105 @@
package org.semanticmoby.graph;
+import org.semanticmoby.vocabulary.MOBY;
+
import com.hp.hpl.jena.rdf.model.*;
+import com.hp.hpl.jena.vocabulary.RDF;
/**
- * This class represents singular (i.e. not collection) subgraphs
- * that have a single mapping.
+ * This class represents a singular (i.e. not collection) subgraph
+ * that has a single mapping.
*/
-public class MOBYGraph extends MOBYSingleElement
+public class MOBYGraph extends MOBYGraphNode
{
+ /**
+ * Wrapper object for the underlying subgraph pointed to by a
+ * hasMapping property
+ */
private MOBYGraphNode hasMapping;
- public MOBYGraph(Resource resource, MOBYGraphNode hasMapping, Model underlying)
+ /**
+ * The statement that asserts that this graph has the mapping wrapped
+ * by the hasMapping instance variable
+ */
+ private Statement hasMappingStmt;
+
+ /**
+ * Creates an instance for the given model, defining statement,
+ * hasMapping statement, and MOBYGraphNode that was parsed from
+ * the value of the hasMapping statement
+ */
+ public MOBYGraph(Model jenaModel, Statement definingStmt,
+ Statement hasMappingStmt, MOBYGraphNode hasMapping)
{
- super(resource, underlying);
+ super(jenaModel, definingStmt);
+ this.hasMappingStmt = hasMappingStmt;
this.hasMapping = hasMapping;
}
+
+ /**
+ * Creates an instance from scratch
+ */
+ public MOBYGraph(Model jenaModel)
+ {
+ super(jenaModel,
+ jenaModel.createStatement(
+ jenaModel.createResource(), RDF.type, MOBY.Graph));
+ }
+
+ /**
+ * Creates an instance from scratch, and includes an initial mapping
+ */
+ public MOBYGraph(Model jenaModel, MOBYGraphNode hasMapping)
+ {
+ this(jenaModel);
+ setHasMapping(hasMapping);
+ }
+
+ /**
+ * Sets the value of a hasMapping instance variable, and adds a hasMapping
+ * statement to the underlying model.
+ */
+ public void setHasMapping(MOBYGraphNode hasMapping)
+ {
+ removeHasMapping();
+ this.hasMapping = hasMapping;
+ hasMappingStmt = jenaModel.createStatement(
+ getResource(), MOBY.hasMapping, hasMapping.getResource());
+ jenaModel.add(hasMappingStmt);
+ }
+
+ /**
+ * Removes the hasMapping statement from the underlying model and nulls
+ * the hasMapping instance variable
+ */
+ public void removeHasMapping()
+ {
+ if (hasMapping != null)
+ {
+ jenaModel.remove(hasMappingStmt);
+ hasMappingStmt = null;
+ hasMapping.removeStatements();
+ hasMapping = null;
+ }
+ }
/**
- * Return the object of this graph's hasMapping property.
+ * Returns the object of this graph's hasMapping property.
*/
public MOBYGraphNode getHasMapping()
{
return hasMapping;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.semanticmoby.graph.MOBYGraphNode#removeStatements()
+ */
+ public void removeStatements()
+ {
+ removeDefiningStatement();
+ if (hasMapping != null) {
+ hasMapping.removeStatements();
+ }
+ }
}
\ No newline at end of file
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYMappingElement.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYMappingElement.java 2005/03/21 21:29:44 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYMappingElement.java 2005/09/14 22:06:10 1.3
@@ -1,37 +1,91 @@
package org.semanticmoby.graph;
-
+import java.util.Iterator;
+import java.util.List;
import com.hp.hpl.jena.rdf.model.*;
-
-public class MOBYMappingElement extends MOBYSingleElement
+/**
+ * This class represents graph nodes that are within a containing subgraph,
+ * which is pointed to by a hasMapping or mapsTo property. Such nodes can have
+ * property value setting statements (instances of MOBYPropertyValueStatement)
+ * associated with them. If the containing subgraph is pointed to by a
+ * hasMapping property, the node can optionally be an instance of moby:Subject,
+ * in which case its defining statement is the rdf:type statement making that
+ * assertion; if it is not a moby:Subject, then the defining statement is null.
+ * Similarly, if the containing subgraph is pointed to by a mapsTo property,
+ * the node can optionally be an instance of moby:Object, in which case its
+ * defining statement is the rdf:type statement making that assertion; if it
+ * is not a moby:Object, then the defining statement is null.
+ *
+ * Nodes represented by this class can also optionally be instances of
+ * collections (subclasses of MOBYCollection), in which case their collective
+ * nature is expressed through the nestedMappings instance variable.
+ */
+public abstract class MOBYMappingElement extends MOBYGraphNode
{
- private MOBYFixedCollection statements;
- private MOBYCollection nestedElements;
+ /**
+ * Property value statements whose subjects are this node's resource
+ */
+ private List propValStmts;
- public MOBYMappingElement(Resource resource, MOBYFixedCollection statements,
- MOBYCollection nestedElements, Model underlying)
+ /**
+ * A view of this node as a collection
+ */
+ private MOBYCollection nestedMappings;
+
+ /**
+ * Creates an instance with the given parameters.
+ */
+ protected MOBYMappingElement(Model jenaModel, Statement definingStmt,
+ List propValStmts, MOBYCollection nestedMappings)
{
- super(resource, underlying);
- this.statements = statements;
- this.nestedElements = nestedElements;
+ super(jenaModel, definingStmt);
+ this.propValStmts = propValStmts;
+ this.nestedMappings = nestedMappings;
}
-
+
/**
- * Return the collection of property-setting statements associated
+ * Returns the collection of property-setting statements associated
* with this mapping element.
*/
- public MOBYFixedCollection getPropertyValueStatements()
+ public List getPropValStmts()
{
- return statements;
+ return propValStmts;
}
/**
- * Return the collection of mappings that are nested within this
+ * Returns the collection of mappings that are nested within this
* mapping element through its role as a data structure.
*/
- public MOBYCollection getNestedElements() {
- return nestedElements;
+ public MOBYCollection getNestedMappings()
+ {
+ return nestedMappings;
}
-
-}
+
+ /**
+ * Removes the statements associated with this objects nested within
+ * this object.
+ */
+ public void removeStatements()
+ {
+ removeDefiningStatement();
+ if (propValStmts != null)
+ {
+ for (Iterator it = propValStmts.iterator(); it.hasNext();)
+ {
+ MOBYPropValStmt stmt = (MOBYPropValStmt) it.next();
+ stmt.removeStatements();
+ }
+ propValStmts = null;
+ }
+ if (nestedMappings != null)
+ {
+ for (Iterator it = nestedMappings.iterator(); it.hasNext();)
+ {
+ MOBYGraphNode node = (MOBYGraphNode) it.next();
+ node.removeStatements();
+ }
+ nestedMappings = null;
+ }
+ }
+}
\ No newline at end of file
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYUnorderedCollection.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYUnorderedCollection.java 2005/03/21 21:29:44 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/MOBYUnorderedCollection.java 2005/09/14 22:06:10 1.3
@@ -3,6 +3,8 @@
import java.util.*;
import com.hp.hpl.jena.rdf.model.*;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.vocabulary.RDF;
/**
* A class representing collections that can be resized (i.e.
@@ -12,25 +14,33 @@
public class MOBYUnorderedCollection extends MOBYResizableCollection
{
/**
- * Create an instance with no elements
- * @param resource the resource node that represents this collection
- * @param underlyingJenaModel the Jena model from which this is stored
+ * Constructor for creating a fixed collection API object from scratch.
*/
- public MOBYUnorderedCollection(Resource resource,
- Model underlyingJenaModel)
+ public MOBYUnorderedCollection(Model jenaModel, Resource head, List items)
{
- super(null, resource, underlyingJenaModel);
+ super(jenaModel,
+ jenaModel.createStatement(head, RDF.type, RDF.Bag),
+ new ContainerWrapper((Bag) head.as(Bag.class)), items);
}
/**
- * Create an instance with the initial list of elements
- * @param initialElements the initial elements
- * @param resource the resource node that represents this collection
- * @param underlyingJenaModel the Jena model from which this is stored
+ * Create an instance with the list of items
*/
- public MOBYUnorderedCollection(List initialElements, Resource resource,
- Model underlyingJenaModel)
+ public MOBYUnorderedCollection(Model jenaModel, Statement definingStmt,
+ List items)
{
- super(initialElements, resource, underlyingJenaModel);
+ super(jenaModel,
+ definingStmt,
+ new ContainerWrapper((Bag) definingStmt.getSubject().as(Bag.class)),
+ items);
+ }
+
+ /**
+ * Constructor for creating an unordered collection API object from scratch.
+ */
+ public MOBYUnorderedCollection(Model jenaModel, Statement definingStmt,
+ CollectionWrapper wrapper, List items)
+ {
+ super(jenaModel, definingStmt, wrapper, items);
}
}
\ No newline at end of file
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYPropertyValueConstraint.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYProviderSet.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYDescriptor.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYDocument.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYOntology.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYNonPositiveIntegerConstraint.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYPropertyValue.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYDateConstraint.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYSingleElement.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYIntegerConstraint.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYNonNegativeIntegerConstraint.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYProvider.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYPropertyValueStatement.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYNumericConstraint.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYLiteral.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYPropertyValueException.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/graph/RCS/MOBYResource.java,v: No such file or directory
From gss at pub.open-bio.org Wed Sep 14 18:06:11 2005
From: gss at pub.open-bio.org (Gary Schiltz)
Date: Thu Sep 15 18:01:22 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509142206.j8EM6BPu017112@pub.open-bio.org>
gss
Wed Sep 14 18:06:10 EDT 2005
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser
In directory pub.open-bio.org:/tmp/cvs-serv17011/src/org/semanticmoby/parser
Modified Files:
Parser.java
Added Files:
NamespaceBasedPropertyDetector.java MOBYPropertyDetector.java
Log Message:
Major API overhaul
moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser NamespaceBasedPropertyDetector.java,NONE,1.1 MOBYPropertyDetector.java,NONE,1.1 Parser.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser/Parser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser/Parser.java 2005/03/21 21:32:38 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/parser/Parser.java 2005/09/14 22:06:10 1.3
@@ -12,9 +12,9 @@
import com.hp.hpl.jena.vocabulary.*;
/**
- * This class is used to parse RDF models, stored as Jena2 models, into
- * objects that implement interfaces from the org.semanticmoby.graph
- * package.
+ * This class is used to parse RDF models, stored as Jena2 Model objects,
+ * into API wrapper objects that insulate the programmer from the details
+ * of RDF.
*/
public class Parser
{
@@ -28,6 +28,9 @@
*/
public final static String LANGUAGE_N3 = "N3";
+ private MOBYPropertyDetector propDetector =
+ new NamespaceBasedPropertyDetector();
+
/**
* Since models are stored in a single Jena model, we
* segregate the single model into multiple sub-models,
@@ -35,12 +38,6 @@
* plus all statements that are reachable from it.
*/
private List subModels = new ArrayList();
-
- /**
- * A map relating a property's URI to an Inference model derived from
- * its base model
- */
- private Map cachedPropertyModels = new HashMap();
/**
* Create and return a parser for parsing an N3 file
@@ -130,7 +127,7 @@
*/
public Parser(Model model)
{
- StmtIterator it = model.listStatements(null, RDF.type, MOBY.Provider);
+ StmtIterator it = model.listStatements(null, RDF.type, MOBY.Service);
while (it.hasNext())
{
Statement stmt = it.nextStatement();
@@ -143,84 +140,86 @@
}
/**
- * Parse a provider from the model. If the model contains
- * multiple providers, only one will be returned (at random). If
- * the model is expected to contain multiple providers, then call
- * parseProviders() instead to get all the providers in a
+ * Parse a MOBYService from the model. If the model contains multiple
+ * services, only one will be returned (at random), so if the model is
+ * expected to contain multiple services, then call parseServices() instead to get all the providers in a
* MOBYCollection.
*/
- public MOBYProvider parseProvider()
+ public MOBYService parseService()
+ throws NonCanonicalException
{
- MOBYUnorderedCollection providers = parseProviders();
+ List services = parseServices();
- if (providers.size() == 0) {
+ if (services.size() == 0) {
return null;
} else {
- return (MOBYProvider) providers.iterator().next();
+ return (MOBYService) services.iterator().next();
}
}
/**
- * Parse and return an unordered collection of providers
+ * Parse and return an list of MOBYService objects
*/
- public MOBYUnorderedCollection parseProviders()
+ public List parseServices()
+ throws NonCanonicalException
{
- ArrayList providers = new ArrayList();
+ ArrayList services = new ArrayList();
- // Parse each provider
- //
Iterator it = subModels.iterator();
while (it.hasNext())
{
Model model = (Model) it.next();
- StmtIterator it2 = model.listStatements(null, RDF.type, MOBY.Provider);
+ StmtIterator it2 = model.listStatements(null, RDF.type, MOBY.Service);
if (it2 != null)
{
Statement stmt = it2.nextStatement();
- Resource provider = stmt.getSubject();
- providers.add(parseProvider(provider));
+ services.add(parseService(stmt));
}
}
-
- // Create and return an unordered collection of the parsed providers
- //
- return new MOBYUnorderedCollection(providers, null, null);
+ return services;
}
/**
- * Parse a provider starting from the given resource (i.e. a resource that
- * is the subject of an rdf:type statement with object of moby:Provider)
+ * Parse a service starting from the given resource (i.e. a resource that
+ * is the subject of an rdf:type statement with object of moby:Service)
*/
- public MOBYProvider parseProvider(Resource provider)
+ public MOBYService parseService(Statement typeStmt)
+ throws NonCanonicalException
{
- Model model = provider.getModel();
+ Resource headResource = typeStmt.getSubject();
+
+ Model model = headResource.getModel();
- // First parse the scalar properties name, oneLineDescription, and aboutURI
- //
- Statement nameStmt = model.getProperty(provider, MOBY.name);
- Statement oneLineDescriptionStmt = model.getProperty(provider, MOBY.oneLineDescription);
- Statement aboutURIStmt = model.getProperty(provider, MOBY.aboutURI);
+ // First parse the scalar properties
+
+ Statement nameStmt =
+ model.getProperty(headResource, MOBY.name);
- // A provider can have multiple operatesOn properties, each of
+ Statement oneLineDescriptionStmt =
+ model.getProperty(headResource, MOBY.oneLineDescription);
+
+ Statement aboutURIStmt =
+ model.getProperty(headResource, MOBY.aboutURI);
+
+ // A service can have multiple operatesOn properties, each of
// which leads to a subgraph. Parse each of these subgraphs.
- //
- List operatesOn = new ArrayList();
- StmtIterator it = model.listStatements(provider, MOBY.operatesOn, (RDFNode) null);
+ Map operatesOn = new HashMap();
+ StmtIterator it =
+ model.listStatements(headResource, MOBY.operatesOn, (RDFNode) null);
while (it.hasNext())
{
- Statement stmt = it.nextStatement();
- Resource r = (Resource) stmt.getObject();
- operatesOn.add(parseOperatesOn(r));
+ Statement operatesOnStmt = it.nextStatement();
+ Resource r = (Resource) operatesOnStmt.getObject();
+ operatesOn.put(operatesOnStmt, parseOperatesOn(r));
}
- // Create and return a new Provider object using the provider URI, name,
+ // Create and return a new Service object using the service URI, name,
// oneLineDescription, aboutURI, and collection of operatesOn subgraphs
//
- return new MOBYProvider(
- provider, nameStmt, oneLineDescriptionStmt, aboutURIStmt,
- new MOBYUnorderedCollection(operatesOn, provider, model),
- model);
+ return new MOBYService(model, typeStmt, nameStmt,
+ oneLineDescriptionStmt,
+ aboutURIStmt, operatesOn);
}
/**
@@ -231,25 +230,48 @@
* each element of the data structure should be a mapping subgraph.
*/
private MOBYGraphNode parseOperatesOn(Resource res)
+ throws NonCanonicalException
{
Model model = res.getModel();
if (isGraph(res))
{
- // The resource is a MOBY Graph, so should have exactly one
+ // Throw an exception if it is also a data structure
+ if (isDataStructure(res))
+ {
+ throw new NonCanonicalException(
+ "A resource was found to be both a Graph " +
+ "and Data Structure", model);
+ }
+
+ // The defining statement for the MOBYGraph instance
+ Statement typeStmt = model.listStatements(
+ res, RDF.type, MOBY.Graph).nextStatement();
+
+ // The statement that asserts the hasMapping property
+ Statement hasMappingStmt = model.listStatements(
+ res, MOBY.hasMapping, (RDFNode) null).nextStatement();
+
+ // Since the resource is a MOBY Graph, it should have exactly one
// hasMapping property that leads to its mapping subgraph.
- //
Resource hasMapping = getResourcePropertyValue(res, MOBY.hasMapping);
- return new MOBYGraph(res, parseHasMapping(hasMapping), model);
+ return new MOBYGraph(model, typeStmt, hasMappingStmt,
+ parseHasMapping(hasMapping));
}
else
{
+ // Throw an exception if it is also a graph
+ if (isGraph(res))
+ {
+ throw new NonCanonicalException(
+ "A resource was found to be both a Graph " +
+ "and Data Structure", model);
+ }
// The resource is a data structure, so has multiple mapping
// subgraphs, each of which is headed by an element in the
// data structure. Iterate through the data structure elements,
// parsing a mapping subgraph from each by recursively calling
// this method.
- //
Iterator it = iteratorFor(res);
List subgraphs = new ArrayList();
while (it.hasNext())
@@ -260,7 +282,6 @@
// Create and return a collection of the subgraphs; the type
// of the collection depends on the type of the passed resource
- //
return collectionFor(res, subgraphs);
}
}
@@ -273,37 +294,52 @@
* each element of the data structure should be a mapped subgraph.
*/
private MOBYSubject parseHasMapping(Resource res)
+ throws NonCanonicalException
{
- Model model = res.getModel();
-
- // Collect the properties of this subject resource that are
- // subproperties of moby:Property, and create MOBY statements
- // for each.
- //
- List statements = mobyPropertyStatementsOf(res);
+ Model model = res.getModel();
+
+ // It is *not* legal for the object of a hasMapping to be *neither*
+ // a Subject nor a data structure, so throw an exception if this is
+ // the case.
+ if ((! isSubject(res)) && (! isDataStructure(res)))
+ {
+ throw new NonCanonicalException(
+ "A hasMapping property was found to have a value that " +
+ "is neither a Subject nor a data structure", model);
+ }
+
+ // Collect the properties of this subject that are
+ // meant to be filled in by the client
+ List propValStmts = mobyPropertyStatementsOf(res);
// List of direct mappings, i.e. those related through hasMapping
// properties.
- //
- List directMappings = new ArrayList();
+ Map directMappings = new HashMap();
// List of nested hasMapping subgraphs
- //
List nestedMappings = new ArrayList();
+ // The statement that asserts this to be of rdf:type moby:Subject.
+ // Since it is legal for this to not be a Subject, then the statement
+ // can be null
+ Statement typeStmt = null;
+
if (isSubject(res))
{
+ typeStmt = model.listStatements(
+ res, RDF.type, MOBY.Subject).nextStatement();
+
// The resource is a MOBY Subject, so should have one or more
// mapsTo properties that lead to its mapped subgraphs.
- //
List mapsTo = new ArrayList();
- StmtIterator it = model.listStatements(res, MOBY.mapsTo, (RDFNode) null);
+ StmtIterator it =
+ model.listStatements(res, MOBY.mapsTo, (RDFNode) null);
while (it.hasNext())
{
- Statement stmt = it.nextStatement();
- Resource mapsToSubject = stmt.getResource();
+ Statement mapsToStmt = it.nextStatement();
+ Resource mapsToSubject = mapsToStmt.getResource();
MOBYGraphNode object = parseMapsTo(mapsToSubject);
- directMappings.add(object);
+ directMappings.put(object, mapsToStmt);
}
}
@@ -313,7 +349,6 @@
// nested in each element. For each element in the data structure,
// recursively call this method to create a mapping subgraph, an
// save the parsed object in the nestedMappings list.
- //
Iterator it = iteratorFor(res);
while (it.hasNext())
{
@@ -322,13 +357,66 @@
}
}
- // Create and return a Subject to describe this hasMapping subgraph
- //
- return new MOBYSubject(res,
- new MOBYFixedCollection(statements, res, model),
- new MOBYUnorderedCollection(directMappings, res, model),
- collectionFor(res, nestedMappings),
- model);
+ return new MOBYSubject(model, typeStmt, propValStmts, directMappings,
+ collectionFor(res, nestedMappings));
+ }
+
+ /**
+ * Parse the object of an mapsTo statement, which should be a
+ * Subject, a data structure, or both. If the object is a Subject,
+ * then it should be connected to one or more mapped subgraphs through
+ * mapsTo properties. If the object is a data structure, then
+ * each element of the data structure should be a mapped subgraph.
+ */
+ private MOBYObject parseMapsTo(Resource res)
+ throws NonCanonicalException
+ {
+ Model model = res.getModel();
+
+ // It is *not* legal for the object of a mapsTo to be *neither*
+ // an Object nor a data structure, so throw an exception if this is
+ // the case.
+ if ((! isObject(res)) && (! isDataStructure(res)))
+ {
+ throw new NonCanonicalException(
+ "A mapsTo property was found to have a value " +
+ "is neither an Object nor a data structure", model);
+ }
+
+ // Collect the properties of this subject that are
+ // meant to be filled in by the client
+ List propValStmts = mobyPropertyStatementsOf(res);
+
+ // List of nested Object subgraphs
+ List nestedObjects = new ArrayList();
+
+ // The statement that asserts this to be of rdf:type moby:Object.
+ // Since it is legal for this to not be an Object, then the statement
+ // can be null
+ Statement typeStmt = null;
+
+ if (isObject(res))
+ {
+ typeStmt = model.listStatements(
+ res, RDF.type, MOBY.Object).nextStatement();
+ }
+
+ if (isDataStructure(res))
+ {
+ // The resource is a data structure, so has a mapping subgraph
+ // nested in each element. For each element in the data structure,
+ // recursively call this method to create a mapping subgraph, an
+ // save the parsed object in the nestedMappings list.
+ Iterator it = iteratorFor(res);
+ while (it.hasNext())
+ {
+ Resource r = (Resource) it.next();
+ nestedObjects.add(parseMapsTo(r));
+ }
+ }
+
+ return new MOBYObject(model, typeStmt, propValStmts,
+ collectionFor(res, nestedObjects));
}
@@ -336,14 +424,15 @@
* Parse the object of a mapsTo statement, which should be an
* Object, a data structure, or both. If the object is a data
* structure, then each element of the data structure should
- * be a mapped subgraph.
+ * in turn be an Object, a data structure, or both.
*/
+ /*
private MOBYObject parseMapsTo(Resource res)
{
- // Collect the properties of this subject resource that are
- // subproperties of moby:Property, and create MOBY statements
- // for each.
- //
+ Model model = res.getModel();
+
+ // Collect the properties of this object that are
+ // meant to be filled in by the service
List statements = mobyPropertyStatementsOf(res);
// List of nested mapsTo statements
@@ -364,14 +453,11 @@
nested.add(parseMapsTo(r));
}
}
-
- // Create and return a new MOBYObject
- //
- Model model = res.getModel();
return new MOBYObject(res,
new MOBYFixedCollection(statements, res, model),
collectionFor(res, nested), model);
}
+ */
/**
* Return a list of statements for whom the subject is a given resource,
@@ -381,86 +467,22 @@
private List mobyPropertyStatementsOf(Resource res)
{
// The statements to return
- //
List stmts = new ArrayList();
// Iterate over the statements whose subjects are the resource
- //
StmtIterator it = res.listProperties();
while (it.hasNext())
{
Statement stmt = it.nextStatement();
- Property p = stmt.getPredicate();
- RDFNode pval = stmt.getObject();
-
- // Try to retrieve a description of the property at
- // its URI.
- //
- InfModel model = getPropertyModel(p);
-
- if (isMobyProperty(p, model))
+ if (stmt.getObject().isAnon() &&
+ !propDetector.isMOBYProperty(stmt.getPredicate()))
{
- MOBYPropertyValueStatement pvalStmt =
- new MOBYPropertyValueStatement(stmt, model);
-
- Statement s = p.getProperty(RDFS.range);
-
- if ((s != null) && (s.getObject().canAs(Resource.class)))
- {
- Resource range = (Resource) s.getObject();
- if (range.equals(XSD.date)) {
- pvalStmt.setConstraint(new MOBYDateConstraint());
- } else if (range.equals(XSD.integer)) {
- pvalStmt.setConstraint(new MOBYIntegerConstraint());
- } else if (range.equals(XSD.nonNegativeInteger)) {
- pvalStmt.setConstraint(
- new MOBYNonNegativeIntegerConstraint());
- } else if (range.equals(XSD.nonPositiveInteger)) {
- pvalStmt.setConstraint(
- new MOBYNonPositiveIntegerConstraint());
- }
- }
-
- stmts.add(pvalStmt);
+ stmts.add(stmt);
}
}
return stmts;
}
- /**
- * Get the model describing a given property by doing a GET
- * on its URI, and creating an inference model from it.
- */
- private InfModel getPropertyModel(Property p)
- {
- InfModel cachedModel = (InfModel)
- cachedPropertyModels.get(p.getURI());
-
- if (cachedModel == null)
- {
- Model model = ModelRetriever.retrieveModel(p.getURI());
-
- if (model != null)
- {
- cachedModel = ModelFactory.createRDFSModel(model);
- cachedPropertyModels.put(p.getURI(), cachedModel);
- }
- }
- return cachedModel;
- }
-
- /**
- * Return whether or not the given property is a MOBY property.
- * This will be true if there is a statement in the model saying
- * that the property is an rdfs:subPropertyOf moby:Property.
- */
- private boolean isMobyProperty(Property p, InfModel model)
- {
- return
- model != null &&
- model.contains(p, RDFS.subPropertyOf, MOBY.Property);
- }
-
private Resource getResourcePropertyValue(Resource subject, Property property)
{
Statement s = subject.getModel().getProperty(subject, property);
@@ -490,21 +512,31 @@
* an RDF:Seq yields a MOBYOrderedCollection; an RDF Alt yields a
* MOBYEnumeration.
*/
- private MOBYCollection collectionFor(Resource res, List elements)
+ private MOBYCollection collectionFor(Resource res, List items)
{
+ Model model = res.getModel();
if (isList(res)) {
- return new MOBYFixedCollection(elements, res, res.getModel());
+ return new MOBYFixedCollection(
+ model, typeStatement(res, RDF.List), items);
} else if (isBag(res)) {
- return new MOBYUnorderedCollection(elements, res, res.getModel());
+ return new MOBYUnorderedCollection(
+ model, typeStatement(res, RDF.Bag), items);
} else if (isSeq(res)) {
- return new MOBYOrderedCollection(elements, res, res.getModel());
+ return new MOBYOrderedCollection(
+ model, typeStatement(res, RDF.Seq), items);
} else if (isAlt(res)) {
- return new MOBYEnumeration(elements, res, res.getModel());
+ return new MOBYEnumeration(
+ model, typeStatement(res, RDF.Alt), items);
} else {
return null;
}
}
+ private Statement typeStatement(Resource subject, Resource objectType) {
+ return subject.getModel().listStatements(
+ subject, RDF.type, objectType).nextStatement();
+ }
+
/**
* Return whether or not the given resource is an RDF List
*/
From gss at pub.open-bio.org Wed Sep 14 18:06:11 2005
From: gss at pub.open-bio.org (Gary Schiltz)
Date: Thu Sep 15 18:01:23 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509142206.j8EM6B0i017132@pub.open-bio.org>
gss
Wed Sep 14 18:06:11 EDT 2005
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/vocabulary
In directory pub.open-bio.org:/tmp/cvs-serv17011/src/org/semanticmoby/vocabulary
Modified Files:
MOBY.java
Log Message:
Major API overhaul
moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/vocabulary MOBY.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java 2004/11/23 00:18:46 1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java 2005/09/14 22:06:10 1.2
@@ -31,7 +31,7 @@
model.setNsPrefix(getNsPrefix(), getURI());
}
- public static final Resource Provider = resource(getURI(), "Provider");
+ public static final Resource Service = resource(getURI(), "Service");
public static final Resource Graph = resource(getURI(), "Graph");
public static final Resource Subject = resource(getURI(), "Subject");
public static final Resource Object = resource(getURI(), "Object");
From gss at pub.open-bio.org Wed Sep 14 18:06:11 2005
From: gss at pub.open-bio.org (Gary Schiltz)
Date: Thu Sep 15 18:01:24 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509142206.j8EM6BH0017151@pub.open-bio.org>
gss
Wed Sep 14 18:06:11 EDT 2005
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/servlet
In directory pub.open-bio.org:/tmp/cvs-serv17011/src/org/semanticmoby/servlet
Modified Files:
AbstractMobyServlet.java
Log Message:
Major API overhaul
moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/servlet AbstractMobyServlet.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java 2004/11/23 00:18:46 1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java 2005/09/14 22:06:11 1.2
@@ -58,7 +58,7 @@
* in, that serves as "input" to the provider.
* @return a graph containing the work product of the provider.
*/
- protected abstract void handleRequest(MOBYProvider requestGraph);
+ protected abstract void handleRequest(MOBYService requestGraph);
/**
* A utility method for getting a buffered reader (as returned by
@@ -108,16 +108,16 @@
MOBY.GRAPH_PARAMETER_NAME, request);
Parser parser = Parser.forString(
graphString, Parser.LANGUAGE_RDF_XML);
- MOBYProvider provider = parser.parseProvider();
+ MOBYService service = parser.parseService();
// Invoke the abstract handleRequest() method in order for the
// provider servlet to do whatever it does to the graph.
//
- handleRequest(provider);
+ handleRequest(service);
// Send the graph back in response
//
- provider.serialize(out);
+ service.serialize(out);
}
catch (Throwable t)
{
From gss at pub.open-bio.org Wed Sep 14 18:06:55 2005
From: gss at pub.open-bio.org (Gary Schiltz)
Date: Thu Sep 15 18:01:48 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509142206.j8EM6tJN017217@pub.open-bio.org>
gss
Wed Sep 14 18:06:55 EDT 2005
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools
In directory pub.open-bio.org:/tmp/cvs-serv17172/src/org/semanticmoby/ref/tools
Modified Files:
InvocationBroker.java KeywordFinder.java KeywordList.java
URIInvestigator.java KeywordQuery.java DiscoveryQuery.java
Log Message:
Changed to work after major API overhaul
moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools InvocationBroker.java,1.2,1.3 KeywordFinder.java,1.2,1.3 KeywordList.java,1.1,1.2 URIInvestigator.java,1.2,1.3 KeywordQuery.java,1.2,1.3 DiscoveryQuery.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/InvocationBroker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/InvocationBroker.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/InvocationBroker.java 2005/09/14 22:06:55 1.3
@@ -16,7 +16,7 @@
/**
* This class is used to invoke and display the results of Semantic
- * MOBY providers.
+ * MOBY services.
*/
public class InvocationBroker
{
@@ -55,64 +55,64 @@
this.out = out;
}
- private String rdfxmlString(MOBYProvider provider)
+ private String rdfxmlString(MOBYService service)
{
StringWriter writer = new StringWriter();
- provider.getModel().write(writer);
+ service.getJenaModel().write(writer);
return writer.toString();
}
- private String n3String(MOBYProvider provider)
+ private String n3String(MOBYService service)
{
StringWriter writer = new StringWriter();
- provider.getModel().write(writer, "N3");
+ service.getJenaModel().write(writer, "N3");
return writer.toString();
}
/**
- * Handle a request to invoke a provider at a given URI.
- * If the provider requires inputs, and the provider has
+ * Handle a request to invoke a service at a given URI.
+ * If the service requires inputs, and the service has
* a valid inputURI property, redirect to the URI that is
- * the value of the property. If the provider requires input
+ * the value of the property. If the service requires input
* and has no inputURI property, then build a simple input
* GUI from scratch.
*
- * If the provider doesn't require any inputs, then do an HTTP
- * POST to the provider URI, passing the graph as a parameter.
+ * If the service doesn't require any inputs, then do an HTTP
+ * POST to the service URI, passing the graph as a parameter.
*/
- public void invokeURI(String providerURI)
+ public void invokeURI(String serviceURI)
{
- // Try to retrieve and parse a provider graph from the URI;
+ // Try to retrieve and parse a service graph from the URI;
// on failure, print a message and return.
//
- MOBYProvider canonicalProvider = null;
+ MOBYService service = null;
try
{
Model model = ModelFactory.createDefaultModel();
- model.read(providerURI);
+ model.read(serviceURI);
Parser parser = new Parser(model);
- canonicalProvider = parser.parseProvider();
+ service = parser.parseService();
}
catch (Throwable t)
{
- out.println("No valid provider could be found at");
- out.print("");
- out.print(" "); out.println(providerURI); out.println("");
+ out.println("No valid service could be found at");
+ out.print("");
+ out.print(" "); out.println(serviceURI); out.println("");
return;
}
- if (requiresInputs(canonicalProvider))
+ if (requiresInputs(service))
{
- // Since the provider requires input, either redirect to its
+ // Since the service requires input, either redirect to its
// inputURI (if it has one) or build a simple GUI for it.
//
try
{
- String inputURI = getInputURI(canonicalProvider);
+ String inputURI = getInputURI(service);
if (inputURI == null) {
- buildInputGUI(canonicalProvider);
+ buildInputGUI(service);
}
else
{
@@ -128,23 +128,23 @@
if (status == HttpStatus.SC_OK) {
response.sendRedirect(inputURI);
} else {
- buildInputGUI(canonicalProvider);
+ buildInputGUI(service);
}
}
} catch (Throwable t) {
- buildInputGUI(canonicalProvider);
+ buildInputGUI(service);
}
}
else // No input required
{
try
{
- // Invoke the provider
+ // Invoke the service
//
HTTPRequest rqst =
- HTTPRequest.newPostRequest(canonicalProvider.getURI());
+ HTTPRequest.newPostRequest(service.getURI());
rqst.addParameter(MOBY.GRAPH_PARAMETER_NAME,
- rdfxmlString(canonicalProvider));
+ rdfxmlString(service));
HTTPResponse resp = rqst.send();
// Check the status
@@ -158,16 +158,16 @@
Model model = ModelFactory.createDefaultModel();
model.read(resp.getBodyAsStream(), "");
Parser parser = new Parser(model);
- MOBYProvider resultsProvider = parser.parseProvider();
+ MOBYService resultsService = parser.parseService();
- String outputURI = getOutputURI(resultsProvider);
+ String outputURI = getOutputURI(resultsService);
if (outputURI == null)
{
// No output URI was specified, so build a generic
// display of the results
//
- buildOutputGUI(resultsProvider);
+ buildOutputGUI(resultsService);
}
else
{
@@ -186,7 +186,7 @@
// by trying to invoke it.
//
rqst = HTTPRequest.newPostRequest(outputURI);
- String graphString = rdfxmlString(resultsProvider);
+ String graphString = rdfxmlString(resultsService);
rqst.addParameter(
MOBY.GRAPH_PARAMETER_NAME, graphString);
resp = rqst.send();
@@ -204,22 +204,22 @@
// The output URI returned a status other than
// 200 OK, so fall back to a default output GUI
//
- buildOutputGUI(resultsProvider);
+ buildOutputGUI(resultsService);
}
}
catch (Throwable t)
{
- buildOutputGUI(resultsProvider);
+ buildOutputGUI(resultsService);
}
}
} else {
- out.println("Sorry - an error occurred invoking the provider");
+ out.println("Sorry - an error occurred invoking the service");
}
}
catch (Throwable t)
{
- out.println("Sorry - an error occurred invoking the provider");
+ out.println("Sorry - an error occurred invoking the service");
return;
}
}
@@ -243,57 +243,55 @@
dispatcher.forward(request, response);
}
- private String getInputURI(MOBYProvider provider)
+ private String getInputURI(MOBYService service)
{
try {
- Model model = provider.getModel();
- Statement stmt = model.listStatements(
- provider.getResource(), MOBY.inputURI,
- (String) null).nextStatement();
+ Model model = service.getJenaModel();
+ Statement stmt =
+ model.getProperty(service.getResource(), MOBY.inputURI);
return stmt.getString();
} catch (Throwable t) {
return null;
}
}
- private String getOutputURI(MOBYProvider provider)
+ private String getOutputURI(MOBYService service)
{
try {
- Model model = provider.getModel();
- Statement stmt = model.listStatements(
- provider.getResource(), MOBY.outputURI,
- (String) null).nextStatement();
+ Model model = service.getJenaModel();
+ Statement stmt =
+ model.getProperty(service.getResource(), MOBY.outputURI);
return stmt.getString();
} catch (Throwable t) {
return null;
}
}
- public void buildInputGUI(MOBYProvider provider)
+ public void buildInputGUI(MOBYService service)
{
- out.println("This provider has not provided a valid URL for");
+ out.println("This service has not provided a valid URL for");
out.println("gathering its required inputs.");
}
- public void buildOutputGUI(MOBYProvider provider)
+ public void buildOutputGUI(MOBYService service)
throws IOException, ServletException
{
HttpSession session = request.getSession(true);
session.setAttribute("n3Graph",
- n3String(provider)
+ n3String(service)
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll("\"", """));
session.setAttribute("rdfxmlGraph",
- rdfxmlString(provider)
+ rdfxmlString(service)
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll("\"", """));
redirectToPage("/jsp/display.jsp");
}
- private boolean requiresInputs(MOBYProvider provider)
+ private boolean requiresInputs(MOBYService service)
{
- return getInputURI(provider) != null;
+ return getInputURI(service) != null;
}
}
\ No newline at end of file
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordFinder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordFinder.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordFinder.java 2005/09/14 22:06:55 1.3
@@ -12,15 +12,15 @@
public class KeywordFinder
{
/**
- * The MOBY provider for which to find keywords
+ * The MOBY service for which to find keywords
*/
- private MOBYProvider provider;
+ private MOBYService service;
/**
- * The underlying Jena model on which the MOBY provider
+ * The underlying Jena model on which the MOBY service
* is based
*/
- private Model providerModel;
+ private Model serviceModel;
/**
* A keyword list object to hold the keywords that are
@@ -29,17 +29,17 @@
private KeywordList keywords = null;
/**
- * Construct an instance for the given provider and model
+ * Construct an instance for the given service and model
*/
- public KeywordFinder(MOBYProvider provider, Model providerModel)
+ public KeywordFinder(MOBYService service)
{
- this.provider = provider;
- this.providerModel = providerModel;
+ this.service = service;
+ this.serviceModel = service.getJenaModel();
}
/**
* Retrieve, if necessary, and return the keywords associated
- * with the provider.
+ * with the service.
*/
public KeywordList getKeywords()
throws Exception
@@ -53,21 +53,20 @@
}
/**
- * Collect keywords for the provider
+ * Collect keywords for the service
*/
private void collectKeywords()
{
- // Add keywords from classes that the provider is asserted to
- // be an instance of (i.e. provider rdf:type
*
- * @author Martin Senger
+ * @author Martin Senger
* @version $Id$
*/
@@ -101,6 +106,17 @@
}
}
+ // read all namespaces
+ if (cmd.hasOption ("-n")) {
+ Map namespaces = worker.getNamespaces();
+ for (Iterator it = namespaces.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry entry = (Map.Entry)it.next();
+ System.out.println (entry.getKey());
+ if (details)
+ System.out.println ("\t" + entry.getValue());
+ }
+ }
+
} catch (Exception e) {
System.err.println ("===ERROR===");
e.printStackTrace();
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java 2005/09/04 13:45:37 1.9
+++ /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java 2005/09/19 08:08:32 1.10
@@ -14,7 +14,6 @@
import org.tulsoft.shared.FileUtils;
import org.tulsoft.shared.GException;
-import java.net.*;
import java.util.*;
import java.io.*;
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/PopulateLocalCentralForTesting.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/Clients/PopulateLocalCentralForTesting.java 2005/05/19 15:57:24 1.4
+++ /home/repository/moby/moby-live/Java/src/Clients/PopulateLocalCentralForTesting.java 2005/09/19 08:08:32 1.5
@@ -7,9 +7,6 @@
import org.biomoby.shared.*;
import org.biomoby.client.*;
-import java.net.*;
-import java.util.*;
-
/**
* This is a very specialized client, meant solely for testing
* purposes, and to be used on a local installation of a Moby Central
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java 2005/08/31 00:48:39 1.5
+++ /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java 2005/09/19 08:08:32 1.6
@@ -8,7 +8,6 @@
import org.biomoby.shared.*;
import org.biomoby.client.*;
-import java.net.*;
import java.util.*;
/**
From senger at pub.open-bio.org Mon Sep 19 04:08:33 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Mon Sep 19 05:01:38 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509190808.j8J88WK6029270@pub.open-bio.org>
senger
Mon Sep 19 04:08:32 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv29075/src/main/org/biomoby/service/dashboard
Modified Files:
NOTES RegistryPanel.java
Log Message:
caching also namespaces
moby-live/Java/src/main/org/biomoby/service/dashboard NOTES,1.3,1.4 RegistryPanel.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/09/18 14:09:42 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/09/19 08:08:32 1.4
@@ -1,9 +1,16 @@
TODO with views:
----------------
+* change onMethods() to be protected or even private...
+
+* add a progress bar to the status bar (on the right)
+ - add also a cancel buton there
+ - do not allow more than one progressbar-aware action in the same time
+ file:///c/Development/java-tutorial/uiswing/components/progress.html
+
? small icons to buttons
? use FileSystemView in file choosers
-* alltools2: - PrefsUtils may become just a common parent for both *WithHistory classes
- - combo box history is not updated if exit happened while focus is till in the text field
+? alltools2:
+ - combo box history is not updated if exit happened while focus is till in the text field
? configure dashboard from menu:
* configure dashbard (add/remove dynamically panels)
@@ -11,6 +18,20 @@
* running from run-dashboard does not work
+TODO for cache:
+---------------
+* add namespaces and service types
+* store services under names: authority-service_name
+* emit log events
+* poor-man update: keep what's there but add what is not there
+ (and perhaps delete what should not be thre) - but do not
+ check any age of existing
+* getInfo() method
+* corresponding changes with command-line clients for cache
+ implementations
+
+? start to work on/think of the RDF-based cache
+
Registry panel
--------------
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/09/18 14:09:42 1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/09/19 08:08:32 1.6
@@ -52,6 +52,9 @@
// names of user preferences keys
static final String USE_CACHE = "use-cache";
+ // associated model working behind the scenes
+ RegistryModel registryModel;
+
// components that are used from more methods
JFileChooserWithHistory cacheDir;
JLabel labelCacheDir;
@@ -70,6 +73,15 @@
// else if (prop.equalsIgnoreCase (PROP_DATA_IDENTITY)) setDataIdentity (newVal);
}
+ /*********************************************************************
+ * Default constructor
+ ********************************************************************/
+ public RegistryPanel() {
+ super();
+// registryModel = new RegistryModel (this);
+ registryModel = new RegistryModel();
+ }
+
/**************************************************************************
*
**************************************************************************/
@@ -153,7 +165,7 @@
/**************************************************************************
*
**************************************************************************/
- public void onUseCache (boolean enabled) {
+ protected void onUseCache (boolean enabled) {
cacheDir.setEnabled (enabled);
labelCacheDir.setEnabled (enabled);
setPrefValue (USE_CACHE, enabled);
@@ -331,4 +343,34 @@
}
+// public void actionPerformed(ActionEvent e) {
+// ...
+// if (icon == null) { //haven't viewed this photo before
+// loadImage(imagedir + pic.filename, current);
+// } else {
+// updatePhotograph(current, pic);
+// }
+// }
+// ...
+// //Load an image in a separate thread.
+// private void loadImage(final String imagePath, final int index) {
+// final SwingWorker worker = new SwingWorker() {
+// ImageIcon icon = null;
+
+// public Object construct() {
+// icon = new ImageIcon(getURL(imagePath));
+// return icon; //return value not used by this program
+// }
+
+// //Runs on the event-dispatching thread.
+// public void finished() {
+// Photo pic = (Photo)pictures.elementAt(index);
+// pic.setIcon(icon);
+// if (index == current)
+// updatePhotograph(index, pic);
+// }
+// };
+// worker.start();
+// }
+
}
From senger at pub.open-bio.org Mon Sep 19 04:08:32 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Mon Sep 19 05:01:44 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509190808.j8J88Wj6029217@pub.open-bio.org>
senger
Mon Sep 19 04:08:32 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/config/templates
In directory pub.open-bio.org:/tmp/cvs-serv29075/src/config/templates
Modified Files:
DataTypeTemplate.java MembersHASTemplate.java
MethodsHASTemplate.java MethodsHAS_string_Template.java
ServicePISetTemplate.java ServicePISimpleTemplate.java
ServicePOSetTemplate.java ServicePOSimpleTemplate.java
ServiceParameterTemplate.java ServiceSkeletonTemplate.java
ToStringHASTemplate.java ToXMLHASTemplate.java
Log Message:
caching also namespaces
moby-live/Java/src/config/templates DataTypeTemplate.java,1.1,1.2 MembersHASTemplate.java,1.1,1.2 MethodsHASTemplate.java,1.1,1.2 MethodsHAS_string_Template.java,1.1,1.2 ServicePISetTemplate.java,1.1,1.2 ServicePISimpleTemplate.java,1.1,1.2 ServicePOSetTemplate.java,1.1,1.2 ServicePOSimpleTemplate.java,1.1,1.2 ServiceParameterTemplate.java,1.1,1.2 ServiceSkeletonTemplate.java,1.1,1.2 ToStringHASTemplate.java,1.1,1.2 ToXMLHASTemplate.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/DataTypeTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/DataTypeTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/DataTypeTemplate.java 2005/09/19 08:08:32 1.2
@@ -6,11 +6,6 @@
package org.biomoby.shared.datatypes;
-import org.biomoby.shared.MobyException;
-import org.jdom.Element;
-import java.util.Vector;
-import java.util.Enumeration;
-
/**
* Data type name: @DATATYPE@.
* Authority: @AUTHORITY@
@@ -57,8 +52,8 @@
/**************************************************************************
*
*************************************************************************/
- public Element toXML() {
- Element elem_I_am_sorry_that_this_produces_a_warning = super.toXML();
+ public org.jdom.Element toXML() {
+ org.jdom.Element elem_I_am_sorry_that_this_produces_a_warning = super.toXML();
elem_I_am_sorry_that_this_produces_a_warning.setName (DATA_TYPE_NAME);
@TO_XML@
return elem_I_am_sorry_that_this_produces_a_warning;
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/MembersHASTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/MembersHASTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/MembersHASTemplate.java 2005/09/19 08:08:32 1.2
@@ -1,5 +1,5 @@
/** An article name for a member of this object. */
public static final String ARTICLE_NAME_@ESC_UPPER_ARTICLE_NAME@ = "@ARTICLE_NAME@";
// elements are of type @CHILDTYPE_NAME@
- protected Vector @ESC_ARTICLE_NAME@ = new Vector();
+ protected java.util.Vector @ESC_ARTICLE_NAME@ = new java.util.Vector();
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/MethodsHASTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/MethodsHASTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/MethodsHASTemplate.java 2005/09/19 08:08:32 1.2
@@ -19,7 +19,7 @@
* only one value
*************************************************************************/
public void set_@ESC_ARTICLE_NAME@ (@CHILDTYPE_NAME@[] value) {
- this.@ESC_ARTICLE_NAME@ = new Vector();
+ this.@ESC_ARTICLE_NAME@ = new java.util.Vector();
for (int i = 0; i < value.length; i++)
set_@ESC_ARTICLE_NAME@ (value[i]);
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/MethodsHAS_string_Template.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/MethodsHAS_string_Template.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/MethodsHAS_string_Template.java 2005/09/19 08:08:32 1.2
@@ -21,7 +21,7 @@
* only one value
*************************************************************************/
public void set_@ESC_ARTICLE_NAME@ (String[] value) {
- this.@ESC_ARTICLE_NAME@ = new Vector();
+ this.@ESC_ARTICLE_NAME@ = new java.util.Vector();
for (int i = 0; i < value.length; i++)
set_@ESC_ARTICLE_NAME@ (value[i]);
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java 2005/09/19 08:08:32 1.2
@@ -3,10 +3,10 @@
*
* @param request represents input data coming from a client
* @return a type specific object (that is known to this service)
- * @throws MobyException if something goes wrong
+ * @throws org.biomoby.shared.MobyException if something goes wrong
*************************************************************************/
public @DATATYPE@[] get_@ESC_ARTICLE_NAME@Set (MobyJob request)
- throws MobyException {
+ throws org.biomoby.shared.MobyException {
return (@DATATYPE@[])request.getDataSet ("@ARTICLE_NAME@", "@DATATYPE@");
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServicePISimpleTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ServicePISimpleTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ServicePISimpleTemplate.java 2005/09/19 08:08:32 1.2
@@ -3,9 +3,9 @@
*
* @param request represents input data coming from a client
* @return a type specific object (that is known to this service)
- * @throws MobyException if something goes wrong
+ * @throws org.biomoby.shared.MobyException if something goes wrong
*************************************************************************/
public @DATATYPE@ get_@ESC_ARTICLE_NAME@ (MobyJob request)
- throws MobyException {
+ throws org.biomoby.shared.MobyException {
return (@DATATYPE@)request.getData ("@ARTICLE_NAME@", "@DATATYPE@");
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServicePOSetTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ServicePOSetTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ServicePOSetTemplate.java 2005/09/19 08:08:32 1.2
@@ -3,10 +3,10 @@
*
* @param response represents output data that will go to a client
* @param values is to be stored in the 'response'
- * @throws MobyException if something goes wrong
+ * @throws org.biomoby.shared.MobyException if something goes wrong
*************************************************************************/
public void set_@ESC_ARTICLE_NAME@Set (MobyJob response, @DATATYPE@[] values)
- throws MobyException {
+ throws org.biomoby.shared.MobyException {
response.setDataSet (values, "@ARTICLE_NAME@");
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServicePOSimpleTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ServicePOSimpleTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ServicePOSimpleTemplate.java 2005/09/19 08:08:32 1.2
@@ -3,10 +3,10 @@
*
* @param response represents output data that will go to a client
* @param value is to be stored in the 'response'
- * @throws MobyException if something goes wrong
+ * @throws org.biomoby.shared.MobyException if something goes wrong
*************************************************************************/
public void set_@ESC_ARTICLE_NAME@ (MobyJob response, @DATATYPE@ value)
- throws MobyException {
+ throws org.biomoby.shared.MobyException {
response.setData (value, "@ARTICLE_NAME@");
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServiceParameterTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ServiceParameterTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ServiceParameterTemplate.java 2005/09/19 08:08:32 1.2
@@ -4,10 +4,10 @@
*
* @param request represents input data coming from a client
* @return value of a "secondary" parameter
- * @throws MobyException if something goes wrong
+ * @throws org.biomoby.shared.MobyException if something goes wrong
*************************************************************************/
public String getParameter_@ESC_ARTICLE_NAME@ (MobyJob request)
- throws MobyException {
+ throws org.biomoby.shared.MobyException {
return request.getParameter ("@ARTICLE_NAME@");
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServiceSkeletonTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ServiceSkeletonTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ServiceSkeletonTemplate.java 2005/09/19 08:08:32 1.2
@@ -4,8 +4,6 @@
package @PACKAGE_NAME@;
import org.biomoby.service.BaseService;
-import org.biomoby.shared.MobyException;
-import org.biomoby.shared.parser.MobyParameter;
import org.biomoby.shared.parser.MobyJob;
import org.biomoby.shared.parser.MobyPackage;
import org.biomoby.shared.datatypes.*;
@@ -61,7 +59,7 @@
// and return an XML back
return mobyOutput.toXML();
- } catch (MobyException e) {
+ } catch (org.biomoby.shared.MobyException e) {
return error (e.getMessage(), mobyOutput);
}
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ToStringHASTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ToStringHASTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ToStringHASTemplate.java 2005/09/19 08:08:32 1.2
@@ -1,2 +1,2 @@
- for (Enumeration en = @ESC_ARTICLE_NAME@.elements(); en.hasMoreElements(); )
+ for (java.util.Enumeration en = @ESC_ARTICLE_NAME@.elements(); en.hasMoreElements(); )
buf_I_am_sorry_that_this_produces_a_warning.append ( ((@CHILDTYPE_NAME@)en.nextElement()).format (1) );
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ToXMLHASTemplate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/config/templates/ToXMLHASTemplate.java 2005/08/26 06:27:03 1.1
+++ /home/repository/moby/moby-live/Java/src/config/templates/ToXMLHASTemplate.java 2005/09/19 08:08:32 1.2
@@ -1,2 +1,2 @@
- for (Enumeration en = @ESC_ARTICLE_NAME@.elements(); en.hasMoreElements(); )
+ for (java.util.Enumeration en = @ESC_ARTICLE_NAME@.elements(); en.hasMoreElements(); )
elem_I_am_sorry_that_this_produces_a_warning.addContent ( ((@CHILDTYPE_NAME@)en.nextElement()).toXML() );
From senger at pub.open-bio.org Mon Sep 19 04:09:22 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Mon Sep 19 05:01:45 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509190809.j8J89Mqj029314@pub.open-bio.org>
senger
Mon Sep 19 04:09:22 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv29299/src/main/org/biomoby/service/dashboard
Added Files:
RegistryModel.java
Log Message:
moby-live/Java/src/main/org/biomoby/service/dashboard RegistryModel.java,NONE,1.1
From senger at pub.open-bio.org Mon Sep 19 04:11:53 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Mon Sep 19 05:04:15 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509190811.j8J8Briq029359@pub.open-bio.org>
senger
Mon Sep 19 04:11:53 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory pub.open-bio.org:/tmp/cvs-serv29344/src/Clients
Added Files:
TestAnt.java
Log Message:
moby-live/Java/src/Clients TestAnt.java,NONE,1.1
From senger at pub.open-bio.org Mon Sep 19 12:19:27 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Mon Sep 19 13:11:49 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509191619.j8JGJRgQ030536@pub.open-bio.org>
senger
Mon Sep 19 12:19:27 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory pub.open-bio.org:/tmp/cvs-serv30520/Java/src/Clients
Removed Files:
TestAnt.java
Log Message:
moby-live/Java/src/Clients TestAnt.java,1.1,NONE
rcsdiff: /home/repository/moby/moby-live/Java/src/Clients/RCS/TestAnt.java,v: No such file or directory
From senger at pub.open-bio.org Tue Sep 20 03:30:09 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Tue Sep 20 04:23:18 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509200730.j8K7U9YS003941@pub.open-bio.org>
senger
Tue Sep 20 03:30:09 EDT 2005
Update of /home/repository/moby/moby-live/Java/docs/images
In directory pub.open-bio.org:/tmp/cvs-serv3903/images
Modified Files:
stylesheet.css
Added Files:
smile.gif smile_sad.gif
Log Message:
moby-live/Java/docs/images smile.gif,NONE,1.1 smile_sad.gif,NONE,1.1 stylesheet.css,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/images/stylesheet.css,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/08/29 13:21:59 1.4
+++ /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/09/20 07:30:09 1.5
@@ -93,3 +93,8 @@
color: navy;
}
+b.step {
+ background-color: white;
+ color: navy;
+ font-size: 8pt;
+ }
From senger at pub.open-bio.org Tue Sep 20 03:30:09 2005
From: senger at pub.open-bio.org (Martin Senger)
Date: Tue Sep 20 04:23:40 2005
Subject: [MOBY-guts] biomoby commit
Message-ID: <200509200730.j8K7U9nq003922@pub.open-bio.org>
senger
Tue Sep 20 03:30:09 EDT 2005
Update of /home/repository/moby/moby-live/Java/docs
In directory pub.open-bio.org:/tmp/cvs-serv3903
Modified Files:
index.html
Added Files:
EclipseAndJMoby.html
Log Message:
moby-live/Java/docs EclipseAndJMoby.html,NONE,1.1 index.html,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Java/docs/index.html 2005/08/28 10:43:27 1.13
+++ /home/repository/moby/moby-live/Java/docs/index.html 2005/09/20 07:30:09 1.14
@@ -44,6 +44,7 @@