From senger at pub.open-bio.org Mon Mar 13 05:22:21 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Mon, 13 Mar 2006 05:22:21 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603131022.k2DAML7u020278@pub.open-bio.org> senger Mon Mar 13 05:22:20 EST 2006 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv20258 Modified Files: build.xml Log Message: better quoting of log4j - needed for Windows moby-live/Java build.xml,1.51,1.52 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- /home/repository/moby/moby-live/Java/build.xml 2006/02/21 14:43:10 1.51 +++ /home/repository/moby/moby-live/Java/build.xml 2006/03/13 10:22:20 1.52 @@ -66,7 +66,7 @@ we can create a proper piece of a command-line in log4j.value - that is used in general.filter to update run-scripts --> - + From senger at pub.open-bio.org Mon Mar 13 11:12:32 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Mon, 13 Mar 2006 11:12:32 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603131612.k2DGCW5P021462@pub.open-bio.org> senger Mon Mar 13 11:12:32 EST 2006 Update of /home/repository/moby/moby-live/Java/src/config/templates In directory pub.open-bio.org:/tmp/cvs-serv21443/src/config/templates Modified Files: ServicePISetTemplate.java Log Message: changes in Moses templates of generated skeletons moby-live/Java/src/config/templates ServicePISetTemplate.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java 2005/09/19 08:08:32 1.2 +++ /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java 2006/03/13 16:12:32 1.3 @@ -7,6 +7,12 @@ *************************************************************************/ public @DATATYPE@[] get_ at ESC_ARTICLE_NAME@Set (MobyJob request) throws org.biomoby.shared.MobyException { - return (@DATATYPE@[])request.getDataSet ("@ARTICLE_NAME@", "@DATATYPE@"); + MobyObject[] objs_I_am_sorry_that_this_produces_a_warning = request.getDataSet ("@ARTICLE_NAME@", "@DATATYPE@"); + synchronized (objs_I_am_sorry_that_this_produces_a_warning) { + @DATATYPE@[] result_I_am_sorry_that_this_produces_a_warning = new @DATATYPE@ [objs_I_am_sorry_that_this_produces_a_warning.length]; + for (int i = 0; i < objs_I_am_sorry_that_this_produces_a_warning.length; i++) + result_I_am_sorry_that_this_produces_a_warning[i] = (@DATATYPE@)objs_I_am_sorry_that_this_produces_a_warning[i]; + return result_I_am_sorry_that_this_produces_a_warning; + } } From gss at pub.open-bio.org Mon Mar 13 14:04:58 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Mon, 13 Mar 2006 14:04:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603131904.k2DJ4wYT021852@pub.open-bio.org> gss Mon Mar 13 14:04:58 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv21827/WebRoot Modified Files: search-results.jsp Log Message: Remove explicit import of MOBY vocabulary file; for some reason, Tomcat had problems compiling the page s-moby/ref-impl/semanticmoby.org/WebRoot search-results.jsp,1.8,1.9 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2005/12/04 23:11:49 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2006/03/13 19:04:58 1.9 @@ -3,7 +3,7 @@ <%@ page import="java.util.*" %> <%@ page import="org.semanticmoby.graph.*" %> <%@ page import="org.semanticmoby.ref.tools.*" %> -<%@ page import="org.semanticmoby.vocabulary.MOBY" %> +<%@ page import="org.semanticmoby.vocabulary.*" %> <%@ page errorPage="/error.jsp" %> <%@ include file="/data-header.jsp" %> <% dataBean.setPageTitle("Search Results"); %> From kawas at pub.open-bio.org Tue Mar 14 11:11:44 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 14 Mar 2006 11:11:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141611.k2EGBi3U025733@pub.open-bio.org> kawas Tue Mar 14 11:11:43 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv25707/org/biomoby/registry/definitions/types Modified Files: JNamespacesSqlImpl.java Log Message: new method to retrieve full namespace information, like lsid, contact_email, authority, etc for use (in the RDF) by clients moby-live/Java/src/main/org/biomoby/registry/definitions/types JNamespacesSqlImpl.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.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/registry/definitions/types/JNamespacesSqlImpl.java 2005/08/29 20:19:20 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:11:43 1.2 @@ -22,6 +22,8 @@ */ public final class JNamespacesSqlImpl implements JNamespaceI{ private static final String sql = "SELECT namespace_type, description FROM namespace ORDER BY namespace_type asc"; + + private static final String sql_all = "SELECT namespace_type, description, namespace_lsid, authority, contact_email FROM namespace ORDER BY namespace_type asc"; private final String newline = System.getProperty("line.separator"); @@ -119,7 +121,44 @@ return array; } + /** + * Get all the data in the db regrading namespaces. + * @return + */ + public String[][] getFullNamespacesAsArray() { + /*ensure that the connection isnt null*/ + if (connection == null) + return null; + + ArrayList sb = new ArrayList(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[]{ rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5)}); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + public static void main(String[] args) throws MobyException { - System.out.println(new JNamespacesSqlImpl().getNamespacesAsArray()); + String[][] namespaces =new JNamespacesSqlImpl().getFullNamespacesAsArray(); + for (int i = 0; i < namespaces.length; i++) { + String[] namespace = namespaces[i]; + for (int j = 0; j < namespace.length; j++) { + System.out.print(namespace[j] + " "); + } + System.out.println(); + } } } From kawas at pub.open-bio.org Tue Mar 14 11:23:06 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 14 Mar 2006 11:23:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141623.k2EGN6r2025797@pub.open-bio.org> kawas Tue Mar 14 11:23:06 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv25768/org/biomoby/registry/definitions/types Modified Files: JServicesSqlImpl.java JNamespacesSqlImpl.java Log Message: new method to retrieve full service type information, like lsid, contact_email, authority, etc for use (in the RDF) by registry clients moby-live/Java/src/main/org/biomoby/registry/definitions/types JServicesSqlImpl.java,1.1,1.2 JNamespacesSqlImpl.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.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/registry/definitions/types/JServicesSqlImpl.java 2005/08/29 20:19:20 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java 2006/03/14 16:23:06 1.2 @@ -16,115 +16,175 @@ import org.biomoby.shared.MobyException; /** - * @author Eddie Kawas - * mySQL implementation of JServicesI - *

email me at edward.kawas at gmail.com + * @author Eddie Kawas mySQL implementation of JServicesI + *

+ * email me at edward.kawas at gmail.com */ -public final class JServicesSqlImpl implements JServiceI{ - private static final String sql = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description " - + "FROM service as ot1, service_term2term as rt, service as ot2 " - + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; - - private Connection connection = null; - - private final String newline = System.getProperty("line.separator"); - - /** - * - * @throws MobyException if database driver cannot be found or there is an database access error. - */ - public JServicesSqlImpl() throws MobyException { - try { - // Load the JDBC driver - String driverName = "com.mysql.jdbc.Driver"; - Class.forName(driverName); - // get certain properties from mobycentral.config - Map map = MobyCentralConfig.getMobyService(); - // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");//localhost:3306"; //TODO - make this a property - String mydatabase = (String) map.get("dbname");//"mobyobject"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");//"moby_external"; - String password = (String) map.get("password");//""; - - /* String serverName = "mobycentral.icapture.ubc.ca:3306"; - String mydatabase = "mobyservice"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = "moby_external"; - String password = "";*/ - this.connection = DriverManager.getConnection(url, username, - password); - } catch (ClassNotFoundException e) { - throw new MobyException( - "Could not find database driver. Please ensure that you have the right libraries present"); - } catch (SQLException e) { - e.printStackTrace(); - throw new MobyException("Database access error."); - } - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JServiceI#getServices() - */ - public final String getServices() { - StringBuffer sb = new StringBuffer(); - /*ensure connection is not null*/ - if (connection == null) - return ""; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) + "\t" + rs.getString(2) + "\t" - + rs.getString(3) + "\t" + rs.getString(4) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JServiceI#getServicesAsArray() - */ - public String[][] getServicesAsArray() { - ArrayList sb = new ArrayList(); - /*ensure connection is not null*/ - if (connection == null) - return null; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.add(new String[] {rs.getString(1) , rs.getString(2), rs.getString(3), rs.getString(4)}); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray( array ); - return array; - } - - public static void main(String[] args) throws MobyException { - System.out.println(new JServicesSqlImpl().getServicesAsArray()); - } +public final class JServicesSqlImpl implements JServiceI { + private static final String sql = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description " + + "FROM service as ot1, service_term2term as rt, service as ot2 " + + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; + + private static final String sql_all = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description, ot1.service_lsid, ot1.authority, ot1.contact_email " + + "FROM service as ot1, service_term2term as rt, service as ot2 " + + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; + + private Connection connection = null; + + private final String newline = System.getProperty("line.separator"); + + /** + * + * @throws MobyException + * if database driver cannot be found or there is an database + * access error. + */ + public JServicesSqlImpl() throws MobyException { + try { + // Load the JDBC driver + String driverName = "com.mysql.jdbc.Driver"; + Class.forName(driverName); + // get certain properties from mobycentral.config + Map map = MobyCentralConfig.getMobyService(); + // Create a connection to the database + String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; + // //TODO + // - + // make + // this + // a + // property + String mydatabase = (String) map.get("dbname");// "mobyobject"; + String url = "jdbc:mysql://" + serverName + "/" + mydatabase; + String username = (String) map.get("username");// "moby_external"; + String password = (String) map.get("password");// ""; + + /* + * String serverName = "mobycentral.icapture.ubc.ca:3306"; String + * mydatabase = "mobyservice"; String url = "jdbc:mysql://" + + * serverName + "/" + mydatabase; String username = "moby_external"; + * String password = ""; + */ + this.connection = DriverManager.getConnection(url, username, password); + } catch (ClassNotFoundException e) { + throw new MobyException( + "Could not find database driver. Please ensure that you have the right libraries present"); + } catch (SQLException e) { + e.printStackTrace(); + throw new MobyException("Database access error."); + } + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JServiceI#getServices() + */ + public final String getServices() { + StringBuffer sb = new StringBuffer(); + /* ensure connection is not null */ + if (connection == null) + return ""; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + "\t" + rs.getString(2) + "\t" + rs.getString(3) + "\t" + + rs.getString(4) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JServiceI#getServicesAsArray() + */ + public String[][] getServicesAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), + rs.getString(4) }); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + /** + * Get all the data in the db regrading service types. + * @return an array of String[] objects. The String[] consists of + * {service_type, relationship_type, to_service_type, description, service_lsid, authority, + * contact_email}. Note that relationship_type is the relationship that service_type has + * with to_service_type. + */ + public String[][] getFullServicesAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), + rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7) }); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + public static void main(String[] args) throws MobyException { + String[][] services = new JServicesSqlImpl().getFullServicesAsArray(); + for (int i = 0; i < services.length; i++) { + String[] service = services[i]; + for (int j = 0; j < service.length; j++) { + System.out.print(service[j] + " "); + } + System.out.println(); + } + } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:11:43 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:23:06 1.3 @@ -16,149 +16,165 @@ import org.biomoby.shared.MobyException; /** - * @author Eddie Kawas - * mySQL implementation of JNamespaceI. - *

email me at edward.kawas at gmail.com + * @author Eddie Kawas mySQL implementation of JNamespaceI. + *

+ * email me at edward.kawas at gmail.com */ -public final class JNamespacesSqlImpl implements JNamespaceI{ - private static final String sql = "SELECT namespace_type, description FROM namespace ORDER BY namespace_type asc"; - - private static final String sql_all = "SELECT namespace_type, description, namespace_lsid, authority, contact_email FROM namespace ORDER BY namespace_type asc"; - - private final String newline = System.getProperty("line.separator"); - - private Connection connection = null; - - /** - * - * @throws MobyException if database driver cannot be found or there is an database access error. - */ - public JNamespacesSqlImpl() throws MobyException { - try { - // Load the JDBC driver - String driverName = "com.mysql.jdbc.Driver"; - Class.forName(driverName); - // get certain properties from mobycentral.config - Map map = MobyCentralConfig.getMobyNamespace(); - // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");//localhost:3306"; //TODO - make this a property - String mydatabase = (String) map.get("dbname");//"mobyobject"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");//"moby_external"; - String password = (String) map.get("password");//""; - - /* String serverName = "mobycentral.icapture.ubc.ca:3306"; - String mydatabase = "mobynamespace"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = "moby_external"; - String password = "";*/ - this.connection = DriverManager.getConnection(url, username, - password); - } catch (ClassNotFoundException e) { - throw new MobyException( - "Could not find database driver. Please ensure that you have the right libraries present"); - } catch (SQLException e) { - e.printStackTrace(); - throw new MobyException("Database access error."); - } - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespaces() - */ - public final String getNamespaces() { - /*ensure that the connection isnt null*/ - if (connection == null) - return ""; - - StringBuffer sb = new StringBuffer(); - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) + "\t" + rs.getString(2) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespacesAsArray() - */ - public String[][] getNamespacesAsArray() { - /*ensure that the connection isnt null*/ - if (connection == null) - return null; - - ArrayList sb = new ArrayList(); - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.add(new String[]{ rs.getString(1), rs.getString(2)}); - } - } catch (SQLException e) { - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray(array); - return array; - } - - /** - * Get all the data in the db regrading namespaces. - * @return - */ - public String[][] getFullNamespacesAsArray() { - /*ensure that the connection isnt null*/ - if (connection == null) - return null; - - ArrayList sb = new ArrayList(); - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql_all); - } catch (SQLException ex) { - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.add(new String[]{ rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5)}); - } - } catch (SQLException e) { - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray(array); - return array; - } - - public static void main(String[] args) throws MobyException { - String[][] namespaces =new JNamespacesSqlImpl().getFullNamespacesAsArray(); - for (int i = 0; i < namespaces.length; i++) { - String[] namespace = namespaces[i]; - for (int j = 0; j < namespace.length; j++) { - System.out.print(namespace[j] + " "); +public final class JNamespacesSqlImpl implements JNamespaceI { + private static final String sql = "SELECT namespace_type, description FROM namespace ORDER BY namespace_type asc"; + + private static final String sql_all = "SELECT namespace_type, description, namespace_lsid, authority, contact_email FROM namespace ORDER BY namespace_type asc"; + + private final String newline = System.getProperty("line.separator"); + + private Connection connection = null; + + /** + * + * @throws MobyException + * if database driver cannot be found or there is an database + * access error. + */ + public JNamespacesSqlImpl() throws MobyException { + try { + // Load the JDBC driver + String driverName = "com.mysql.jdbc.Driver"; + Class.forName(driverName); + // get certain properties from mobycentral.config + Map map = MobyCentralConfig.getMobyNamespace(); + // Create a connection to the database + String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; + // //TODO + // - + // make + // this + // a + // property + String mydatabase = (String) map.get("dbname");// "mobyobject"; + String url = "jdbc:mysql://" + serverName + "/" + mydatabase; + String username = (String) map.get("username");// "moby_external"; + String password = (String) map.get("password");// ""; + + /* + * String serverName = "mobycentral.icapture.ubc.ca:3306"; String + * mydatabase = "mobynamespace"; String url = "jdbc:mysql://" + + * serverName + "/" + mydatabase; String username = "moby_external"; + * String password = ""; + */ + this.connection = DriverManager.getConnection(url, username, password); + } catch (ClassNotFoundException e) { + throw new MobyException( + "Could not find database driver. Please ensure that you have the right libraries present"); + } catch (SQLException e) { + e.printStackTrace(); + throw new MobyException("Database access error."); + } + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespaces() + */ + public final String getNamespaces() { + /* ensure that the connection isnt null */ + if (connection == null) + return ""; + + StringBuffer sb = new StringBuffer(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + "\t" + rs.getString(2) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespacesAsArray() + */ + public String[][] getNamespacesAsArray() { + /* ensure that the connection isnt null */ + if (connection == null) + return null; + + ArrayList sb = new ArrayList(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + /** + * Get all the data in the db regrading namespaces. + * + * @return an array of String[] objects. The String[] consists of + * {namespace_type, description, namespace_lsid, authority, + * contact_email}. + */ + public String[][] getFullNamespacesAsArray() { + /* ensure that the connection isnt null */ + if (connection == null) + return null; + + ArrayList sb = new ArrayList(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), + rs.getString(4), rs.getString(5) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + public static void main(String[] args) throws MobyException { + String[][] namespaces = new JNamespacesSqlImpl().getFullNamespacesAsArray(); + for (int i = 0; i < namespaces.length; i++) { + String[] namespace = namespaces[i]; + for (int j = 0; j < namespace.length; j++) { + System.out.print(namespace[j] + " "); } - System.out.println(); - } - } + System.out.println(); + } + } } From kawas at pub.open-bio.org Tue Mar 14 11:43:23 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 14 Mar 2006 11:43:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141643.k2EGhNrM025854@pub.open-bio.org> kawas Tue Mar 14 11:43:23 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv25829/org/biomoby/shared Modified Files: MobyPrimaryDataSimple.java Log Message: added lsids to the parsed object moby-live/Java/src/main/org/biomoby/shared MobyPrimaryDataSimple.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java 2005/11/06 16:23:50 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java 2006/03/14 16:43:23 1.8 @@ -12,6 +12,8 @@ import java.util.Vector; import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** @@ -63,11 +65,27 @@ for (int i = 0; i < children.getLength(); i++) { String childName = children.item (i).getNodeName(); if (childName.equals ("objectType")) { - if (children.item (i).getFirstChild() != null) - setDataType (new MobyDataType (children.item (i).getFirstChild().getNodeValue())); + if (children.item (i).getFirstChild() != null) { + MobyDataType mdt = new MobyDataType (children.item (i).getFirstChild().getNodeValue()); + NamedNodeMap map = (children.item (i).getAttributes()); + if (map != null) { + Node node = map.getNamedItemNS(children.item(i).getNamespaceURI(),"lsid"); + if (node != null) + mdt.setLSID(node.getNodeValue()); + } + setDataType (mdt); + } } else if (childName.equals ("Namespace")) { - if (children.item (i).getFirstChild() != null) - addNamespace (new MobyNamespace (children.item (i).getFirstChild().getNodeValue())); + if (children.item (i).getFirstChild() != null) { + MobyNamespace namespace = new MobyNamespace (children.item(i).getFirstChild().getNodeValue()); + NamedNodeMap map = (children.item (i).getAttributes()); + if (map != null) { + Node node = map.getNamedItemNS(children.item(i).getNamespaceURI(),"lsid"); + if (node != null) + namespace.setLSID(node.getNodeValue()); + } + addNamespace (namespace); + } } } } From gss at pub.open-bio.org Tue Mar 14 12:52:27 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 12:52:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141752.k2EHqRN2026055@pub.open-bio.org> gss Tue Mar 14 12:52:26 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF In directory pub.open-bio.org:/tmp/cvs-serv26030/WebRoot/WEB-INF Added Files: log4j.properties Log Message: There are still references to this file in the code base that cause errors when it is missing, so I'm adding it back until the discrepency is resolved s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF log4j.properties,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/log4j.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/log4j.properties 2006/03/02 08:20:42 1.2 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/log4j.properties 2006/03/14 17:52:26 1.3 @@ -14,4 +14,5 @@ log4j.appender.R.layout.ConversionPattern=%d %4c %-5p - %m%n log4j.appender.R.File=smoby.log log4j.appender.R.MaxFileSize=5000KB -log4j.appender.R.MaxBackupIndex=1 \ No newline at end of file +log4j.appender.R.MaxBackupIndex=1 + From senger at pub.open-bio.org Tue Mar 14 18:22:31 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Tue, 14 Mar 2006 18:22:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603142322.k2ENMVUL027754@pub.open-bio.org> senger Tue Mar 14 18:22:31 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv27735/docs Modified Files: Dashboard.html Log Message: moby-live/Java/docs Dashboard.html,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Dashboard.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/docs/Dashboard.html 2006/02/20 08:30:21 1.5 +++ /home/repository/moby/moby-live/Java/docs/Dashboard.html 2006/03/14 23:22:31 1.6 @@ -47,21 +47,25 @@ At the moment, the only way to start Dashboard on your machine is to have a jMoby CVS local copy (how to do -it). Once it is built, type either: +it). Once it is built, type:

 ./build-dev.sh dashboard
 
-or + +Later, you can also use the following (the reason for runing at least +once the above is that it creates a dashboard configuration file - +more about it below): +
 build/run/run-dashboard
 
-On Windows, similarly, either +On Windows, similarly
@@ -69,7 +73,7 @@
 
-or +and
@@ -307,7 +311,7 @@
 
Martin Senger
-Last modified: Mon Feb 20 16:04:41 2006 +Last modified: Tue Mar 14 23:09:09 2006
From gss at pub.open-bio.org Tue Mar 14 19:43:38 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:43:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150043.k2F0hcVM028276@pub.open-bio.org> gss Tue Mar 14 19:43:38 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv28251/src/org/semanticmoby/ref/tools Modified Files: URIInvestigator.java Log Message: Got rid of multithreading; converted to Unix line endings s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools URIInvestigator.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/02 08:54:32 1.16 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/15 00:43:38 1.17 @@ -14,23 +14,12 @@ /** - * This class is used to investigate URLs that potentially contain MOBY graphs. - * Multiple instances can exist, each investigating a different URL. Keeping a - * map of URL->instance mappings in the instances class variable is a simple - * way to prevent multiple instances from investigating the same URL at any one - * time. The static investigate() method adds to this map when it creates - * instances to investigate URLs; the run() method removes its instance once - * it is finished. + * Instances of this class are used to investigate URLs that are believed to + * contain MOBY resource description graphs. */ public class URIInvestigator { /** - * A map associating URLs being investigated with the instances that are - * doing the investigating. - */ - private static Map instances = new HashMap(); - - /** * The URL that is to be investigated for possible inclusion in the * metadata repository. */ @@ -40,82 +29,11 @@ * Create an instance for investingating the given resource URL * @param resourceURL the URL to investigate */ - private URIInvestigator(String resourceURL) { - + public URIInvestigator(String resourceURL) { this.resourceURL = resourceURL; } /** - * Investigate a URL for the possibility that it contains a MOBY graph, - * by creating an instance in which the investigation is to be conducted, - * and calling the instance's start() method. If the URL is already being - * investigated, then this call is a NO-OP. - * @param resourceURL the URL to investigate - */ - public synchronized static void investigate(String resourceURL) { - - synchronized (instances) { - - if (instances.get(resourceURL) != null) { - - if (Log.WARN) Log.warn("Already investigating " + resourceURL); - - return; - } - - URIInvestigator investigator = new URIInvestigator(resourceURL); - instances.put(resourceURL, investigator); - investigator.start(); - } - } - - - /** - * Start running in a separate thread. - */ - private void start() { - - new Thread() { - - public void run() { - - URIInvestigator.this.run(); - } - }.start(); - } - - - /** - * Find out what's at the URL that is being investigated. If doing a GET - * on it returns a MOBY graph, then register the graph in the metadata - * repository. If it does not contain a MOBY graph, then try de-registering - * it from the repository. - */ - private void run() { - - try { - - String repositoryName = - MOBYProperties.getProperty("DB_REPOSITORY_NAME", true); - syncGraph(); - } catch (MissingPropertyException e) { - - e.printStackTrace(); - if (Log.ERROR) Log.error("Missing DB_REPOSITORY_NAME property"); - } finally { - - // Regardless of the results of the URL investigation, remove - // this instance from the static instances map. - // - synchronized (instances) { - - instances.remove(resourceURL); - } - } - } - - - /** * Synchronize the resource URL's MOBY graph (if there is one) with the * graph stored in the metadata repository (if there is one). This involves * doing an HTTP GET on the resource URL; if there is already a graph stored @@ -126,13 +44,13 @@ * modified), then there is nothing to do; if the request returns a 404 * (resource not found), then remove the graph from the database. */ - synchronized private void syncGraph() { + public void investigate() { // The storage manager is used to access the metadata repository StorageManager manager = new StorageManager(); // Find out if the resource is already registered, and if so, when - // was its graph last modified. + // its graph was last modified. Date lastModifiedDate = null; boolean alreadyRegistered = false; @@ -314,19 +232,20 @@ } + /** + * Deregisters the resource being investigated. + * @param manager the StorageManager used to actually do the deregistration + * @param removing if the removing flag is set, a message is written to the + * log stating that the resource has been removed + */ private void deregisterResource(StorageManager manager, boolean removing) { - try { - manager.deregisterResource(resourceURL); - if (removing) { - if(Log.INFO) Log.info("REMOVED : " + resourceURL); } } catch (StorageException e) { - e.printStackTrace(); if (Log.ERROR) Log.error("Unable to de-register resource " + resourceURL); } From gss at pub.open-bio.org Tue Mar 14 19:45:49 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:45:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150045.k2F0jnf8028311@pub.open-bio.org> gss Tue Mar 14 19:45:49 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv28286/src/org/semanticmoby/ref/tools Modified Files: MetadataRetriever.java Log Message: Simplified, fixed several bugs; converted line endings to Unix s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools MetadataRetriever.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MetadataRetriever.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MetadataRetriever.java 2006/01/31 00:30:08 1.4 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MetadataRetriever.java 2006/03/15 00:45:49 1.5 @@ -1,29 +1,22 @@ package org.semanticmoby.ref.tools; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.StringTokenizer; - -import org.semanticmoby.graph.MOBYResource; -import org.semanticmoby.vocabulary.MOBY; - -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.RDFNode; -import com.hp.hpl.jena.rdf.model.Statement; -import com.hp.hpl.jena.rdf.model.StmtIterator; +import java.io.*; +import java.net.*; +import java.util.*; + +import org.semanticmoby.api.*; +import org.semanticmoby.graph.*; +import org.semanticmoby.vocabulary.*; + +import com.hp.hpl.jena.rdf.model.*; /** - * This class is responsible for retrieving a list of words to associate - * with a resource. It traverses the resource graph searching for MOBY - * metadata properties, and builds a set of URLs from the metadata property - * values. For each of the URLs in the resulting set, it then opens an HTTP - * connection to the URL and reads all the words it finds, up to a set - * number of bytes, and adds these words to a set. + * This class is responsible for retrieving a list of words to associate with + * a resource. It traverses the resource graph searching for moby:metadata + * properties, and collects a set of URLs from the property values. For each + * URL in the resulting set, it then opens a connection to the URL and reads + * all the words it finds, up to a set number of bytes, and adds these words + * to a set. */ public class MetadataRetriever { @@ -37,90 +30,84 @@ */ int maxBytes; + /** + * The set of keywords being accumulated + */ private Set keywords = null; + /** + * Creates an instance for retrieving up to some number of bytes + * from moby:metadata URLs associated with a model + * @param model the model containing the moby:metadata statements + * @param maxBytes the maximum number of bytes to retrieve + */ public MetadataRetriever(Model model, int maxBytes) { this.model = model; this.maxBytes = maxBytes; } + /** + * Retrieves, if necessary, and returns the set of keywords + */ public Set getKeywords() { if (keywords == null) { - keywords = retrieveKeywords(); + retrieveKeywords(); } return keywords; } - private Set retrieveKeywords() { + /** + * Retrieves and returns the set of keywords from the moby:metadata + * URL properties in the model + */ + private void retrieveKeywords() { - Set words = new HashSet(); + keywords = new HashSet(); Iterator it = getMetadataURLs().iterator(); int addedSoFar = 0; while (it.hasNext() && addedSoFar < maxBytes) { String url = (String) it.next(); - addedSoFar += addKeywords(words, url, addedSoFar); + addedSoFar += addKeywords(url, addedSoFar); } - return words; } - private int addKeywords(Set words, String urlString, int addedSoFar) { - + /** + * Adds keywords for the given URL string and returns the number of + * bytes added. + */ + private int addKeywords(String urlString, int addedSoFar) { + int added = 0; InputStream stream = null; + int remaining = maxBytes - addedSoFar; try { + // Open a connection to the URL from which keywords are to be read URL url = new URL(urlString); stream = url.openStream(); - - int available = stream.available(); - int allowed = maxBytes - addedSoFar; - - // If reading all that is available would result in some words not - // being read, we might read part of a word. In that case, read - // 100 bytes extra and discard the last word. - int toRead = 0; - boolean discardLastWord; - - if (allowed >= available) { - // The number of bytes allowed to be read is at least as - // many as what is available, so read everything and don't - // discard the last word - toRead = available; - discardLastWord = false; - } else { - // The number of bytes available is greater than the number - // allowed to be read, so read the allowed number plus a - // few extra in order to hopefully get to a token separator, - // but discard the last word read. - toRead = allowed + 20; - discardLastWord = true; - } - - // Read up to toRead bytes into a buffer - byte[] buffer = new byte[toRead]; - stream.read(buffer, 0, toRead); - - // Use a string tokenizer to break the buffer into words - StringTokenizer st = new StringTokenizer(new String(buffer)); - while (st.hasMoreTokens()) { - String word = st.nextToken(); - - // remove all symbols except for letters, _, -, ., ' - word.toLowerCase(); - word.replaceAll("[^a-z:-_.\']", ""); - - // Add the word if either we are not discarding the final - // one, or if this word is not the final one - if ((! discardLastWord) || st.hasMoreTokens()) { - - words.add(word); - added += word.length(); - } + + // Create a buffer for accumulating characters from the stream + StringBuffer sb = new StringBuffer(); + + char ch; + while (((ch = (char) stream.read()) != -1) && (remaining > 0)) { + if (Character.isWhitespace(ch)) { + // If we hit a whitespace character, convert the buffer + // into a lowercase string, add it to the buffer, and + // reset the buffer + keywords.add(sb.toString().toLowerCase()); + sb = new StringBuffer(); + } else { + // Add the character to the buffer + sb.append(ch); + added++; + remaining--; + } } } catch (Throwable t) { - t.printStackTrace(); + Log.error("Error while reading " + urlString + ": " + t.getMessage()); } finally { // Regardless of what happens, try to close the stream if it // was created @@ -128,7 +115,8 @@ try { stream.close(); } catch (Throwable t) { - t.printStackTrace(); + Log.error("Error closing connection to " + + urlString + ": " + t.getMessage()); } } } @@ -153,19 +141,20 @@ // not a literal, so add it inside a try/catch block urls.add(stmt.getString()); } catch (Throwable t) { - t.printStackTrace(); + Log.warn("A moby:metadata property with a " + + "non-string value was found"); } } return urls; } - + /* public static void main(String[] args) throws Throwable { String resourceURL = - "http://www.semanticmoby.org/examples/proxies/gramene-query"; + "http://www.semanticmoby.org/examples/proxies/flybase-genequery"; Model m = ModelFactory.createDefaultModel(); m.read(resourceURL); - MetadataRetriever r = new MetadataRetriever(m, 15); + MetadataRetriever r = new MetadataRetriever(m, 100000); Set keys = r.getKeywords(); for (Iterator it = keys.iterator(); it.hasNext();) { System.out.println(it.next()); From gss at pub.open-bio.org Tue Mar 14 19:51:11 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:51:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150051.k2F0pB4N028369@pub.open-bio.org> gss Tue Mar 14 19:51:11 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv28344/src/org/semanticmoby/ref/servlets Modified Files: PostResourcesServlet.java Log Message: Fixed to use updated URIInvestigator class; convert line endings to Unix s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets PostResourcesServlet.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/02 08:54:32 1.3 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/15 00:51:11 1.4 @@ -36,11 +36,13 @@ for (int i = 0; i < resourceCount; i++) { String resourceURL = request.getParameter("resource-" + (i + 1)); - if (Log.INFO) Log.info("resourceURL = " + resourceURL); + if (Log.DEBUG) Log.debug("resourceURL = " + resourceURL); if (resourceURL != null) { if (!resourceURL.equals("")) { - URIInvestigator.investigate(resourceURL); + URIInvestigator investigator = + new URIInvestigator(resourceURL); + investigator.investigate(); count++; } } From gss at pub.open-bio.org Tue Mar 14 19:52:17 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:52:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150052.k2F0qHO4028402@pub.open-bio.org> gss Tue Mar 14 19:52:17 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv28377/src/org/semanticmoby/ref/servlets Modified Files: ResourceInvestigationServlet.java Log Message: Fixed to use updated URIInvestigator class s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets ResourceInvestigationServlet.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/02 08:54:32 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/15 00:52:17 1.10 @@ -20,7 +20,6 @@ */ public class ResourceInvestigationServlet extends BaseServlet { - /** * Respond to an HTTP GET message */ @@ -54,8 +53,8 @@ e2.printStackTrace(); } } else { - - URIInvestigator.investigate(resourceURL); + URIInvestigator investigator = new URIInvestigator(resourceURL); + investigator.investigate(); dataBean.setUrl(resourceURL); From gss at pub.open-bio.org Tue Mar 14 19:57:38 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:57:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150057.k2F0vc3p028474@pub.open-bio.org> gss Tue Mar 14 19:57:37 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api In directory pub.open-bio.org:/tmp/cvs-serv28449/src/org/semanticmoby/api Modified Files: Log.java Log Message: Set DEBUG to false for release s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api Log.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/02 08:54:32 1.1 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/15 00:57:37 1.2 @@ -15,7 +15,7 @@ /** * Sets a static final switch, for whether to log debug messages. */ - public static final boolean DEBUG = true; + public static final boolean DEBUG = false; /** * Sets a static final switch, for whether to log info messages. From kawas at pub.open-bio.org Wed Mar 15 11:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMckp032204@pub.open-bio.org> kawas Wed Mar 15 11:22:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/ui/graphical/servlet/jTypes Modified Files: Types.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes Types.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes/Types.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes/Types.java 2006/01/03 19:24:15 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes/Types.java 2006/03/15 16:22:38 1.5 @@ -32,24 +32,43 @@ // super.init(); // try to load environment variables set in context.xml try { - Context c = new InitialContext(); - String MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); - String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); - String MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); - if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { - // set MOBY_CENTRAL_CONFIG - System.setProperty("MOBY_CENTRAL_CONFIG",MOBY_CENTRAL_CONFIG); - } - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - // set MOBY_SERVER - System.setProperty("MOBY_SERVER",MOBY_SERVER); - } - if (MOBY_URI != null && !MOBY_URI.equals("")) { - // set MOBY_URI - System.setProperty("MOBY_URI",MOBY_URI); - } - - } catch (Exception e) {} + Context c = new InitialContext(); + + try { + String MOBY_CENTRAL_CONFIG = null; + MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); + if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { + // set MOBY_CENTRAL_CONFIG + System.out.println("init(setting MOBY_CENTRAL_CONFIG)"); + System.setProperty("MOBY_CENTRAL_CONFIG", MOBY_CENTRAL_CONFIG); + } + + } catch (Exception ex) { + } + try { + String MOBY_SERVER = null; + MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + // set MOBY_SERVER + System.out.println("init(setting MOBY_SERVER)"); + System.setProperty("MOBY_SERVER", MOBY_SERVER); + } + } catch (Exception ex) { + } + + try { + String MOBY_URI = null; + MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); + if (MOBY_URI != null && !MOBY_URI.equals("")) { + // set MOBY_URI + System.out.println("init(setting MOBY_URI)"); + System.setProperty("MOBY_URI", MOBY_URI); + } + } catch (Exception ex) { + } + + } catch (Exception e) { + } } /* (non-Javadoc) From kawas at pub.open-bio.org Wed Mar 15 11:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMctG032185@pub.open-bio.org> kawas Wed Mar 15 11:22:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java RDFConfigure.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.12,1.13 RDFConfigure.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/02/27 22:42:30 1.12 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/03/15 16:22:38 1.13 @@ -335,10 +335,7 @@ MobyData[] secondaryInputs = services[i].getSecondaryInputs(); // consumes MobyData[] outputs = services[i].getPrimaryOutputs(); // produces // start creating the rdf - Resource subject = model.createResource( - "urn:lsid:biomoby.org:serviceinstance:" - + services[i].getAuthority() + "," - + services[i].getName(), + Resource subject = model.createResource(services[i].getLSID(), FetaVocabulary.serviceDescription); subject.addProperty(FetaVocabulary.hasServiceDescriptionLocation, services[i].getSignatureURL()); @@ -396,10 +393,9 @@ .addProperty( ServiceDescriptionPredicates.object_type, model - .createResource("http://biomoby.org/RESOURCES/MOBY-S/Objects#" - + simpleData + .createResource(simpleData .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = simpleData.getNamespaces(); if (namespaces.length > 0) { @@ -412,9 +408,8 @@ parameterNamespace .addProperty( ServiceDescriptionPredicates.namespace_type, - model.createResource(NS - + namespaces[k] - .getName())); + model.createResource(namespaces[k] + .getLSID())); } } hasOperation.addProperty(FetaVocabulary.inputParameter, @@ -442,10 +437,9 @@ parameter .addProperty( ServiceDescriptionPredicates.object_type, - model.createResource(OBJ - + setOfSimpleData[k] + model.createResource(setOfSimpleData[k] .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = setOfSimpleData[k] .getNamespaces(); if (namespaces.length > 0) { @@ -456,9 +450,8 @@ .addProperty( ServiceDescriptionPredicates.namespace_type, model - .createResource(NS - + namespaces[index] - .getName())); + .createResource(namespaces[index] + .getLSID())); } parameter .addProperty( @@ -565,10 +558,9 @@ .addProperty( ServiceDescriptionPredicates.object_type, model - .createResource("http://biomoby.org/RESOURCES/MOBY-S/Objects#" - + simpleData + .createResource(simpleData .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = simpleData.getNamespaces(); if (namespaces.length > 0) { Resource parameterNamespace = model @@ -584,9 +576,8 @@ parameterNamespace .addProperty( ServiceDescriptionPredicates.namespace_type, - model.createResource(NS - + namespaces[k] - .getName())); + model.createResource(namespaces[k] + .getLSID())); } } hasOperation.addProperty( @@ -614,10 +605,9 @@ parameter .addProperty( ServiceDescriptionPredicates.object_type, - model.createResource(OBJ - + setOfSimpleData[k] + model.createResource(setOfSimpleData[k] .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = setOfSimpleData[k] .getNamespaces(); if (namespaces.length > 0) { @@ -628,9 +618,8 @@ .addProperty( ServiceDescriptionPredicates.namespace_type, model - .createResource(NS - + namespaces[index] - .getName())); + .createResource(namespaces[index] + .getLSID())); } parameter .addProperty( @@ -715,6 +704,98 @@ } return services.length == 1; } + + public final static boolean serviceInstanceExists(String uri, String name, String lsid) { + Central central = null; + MobyService service = null; + MobyService[] services = null; + // initialize central + try { + String registryURL; + String registryNamespace; + Map map = RegistryOS.getEnv(); + if (!map.isEmpty()) { + registryURL = (String) map.get("MOBY_SERVER"); + registryNamespace = (String) map.get("MOBY_URI"); + if (registryURL == null) { + // use default registry, since we dont have a local one + central = new CentralImpl(); + } else if (registryNamespace == null) { + // use default namespace since one isnt defined + central = new CentralImpl(registryURL); + } else { + // use defined url and namespacce + central = new CentralImpl(registryURL, registryNamespace); + } + } else { + // use default registry since we cant determine if local one + // exists + central = new CentralImpl(); + } + } catch (MobyException e) { + return false; + } + // set up the query service + service = new MobyService(name); + service.setAuthority(uri); + // query for the service + try { + services = central.findService(service); + } catch (MobyException e1) { + return false; + } + if (services.length == 1) { + service = services[0]; + return (service.getLSID().equals(lsid)); + } + return false; + } + + public final static String getLatestLSID(String uri, String name, String lsid) { + Central central = null; + MobyService service = null; + MobyService[] services = null; + // initialize central + try { + String registryURL; + String registryNamespace; + Map map = RegistryOS.getEnv(); + if (!map.isEmpty()) { + registryURL = (String) map.get("MOBY_SERVER"); + registryNamespace = (String) map.get("MOBY_URI"); + if (registryURL == null) { + // use default registry, since we dont have a local one + central = new CentralImpl(); + } else if (registryNamespace == null) { + // use default namespace since one isnt defined + central = new CentralImpl(registryURL); + } else { + // use defined url and namespacce + central = new CentralImpl(registryURL, registryNamespace); + } + } else { + // use default registry since we cant determine if local one + // exists + central = new CentralImpl(); + } + } catch (MobyException e) { + return ""; + } + // set up the query service + service = new MobyService(name); + service.setAuthority(uri); + // query for the service + try { + services = central.findService(service); + } catch (MobyException e1) { + return ""; + } + if (services.length == 1) { + service = services[0]; + return (service.getLSID()); + } + return ""; + } /** * @@ -729,11 +810,8 @@ * @throws LSIDException */ public final static void main(String[] args) throws Exception { - Central central = new CentralImpl(); - System.out.println(central.findService(new MobyService( - "aSimpleInputOutputService"))[0]); String str = (findService("bioinfo.icapture.ubc.ca", - "aSimpleInputOutputService", false)); + "parseBlastText", false)); System.out.println(str); // System.out.println(findService("bioinfo.genopole-toulouse.prd.fr",null, // false)); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/02/20 05:51:09 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/15 16:22:38 1.9 @@ -18,20 +18,21 @@ import org.biomoby.shared.Central; import org.biomoby.shared.MobyResourceRef; -import com.hp.hpl.jena.graph.Node; -import com.hp.hpl.jena.rdf.model.Bag; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.NodeIterator; -import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFReader; import com.hp.hpl.jena.rdf.model.RDFWriter; +import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.StmtIterator; +import com.hp.hpl.jena.vocabulary.DC; import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /* * Created on Oct 21, 2004

@@ -43,8 +44,8 @@ * @author Eddie Kawas *

* This class was created to create RDF documents describing BioMoby - * ontologies. This class requires the use of Environment variables in - * order to work correctly. + * ontologies. This class requires the use of Environment variables in + * order to work correctly. *

* For questions, comments, or bugs *

@@ -57,77 +58,78 @@ * Some constants for use in the rdfs */ private static Map URI_MAP = new HashMap(); - static { - boolean __success = false; + static { + boolean __success = false; // attempt 1 - servlet context - try { - Context c = new InitialContext(); - String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - Central central = new CentralImpl(MOBY_SERVER); - MobyResourceRef[] refs = central.getResourceRefs(); - for (int i = 0; i < refs.length; i++) { - String url = refs[i].getResourceLocation().toExternalForm(); - if (url.lastIndexOf("#") < 0) - url = url + "#"; - URI_MAP.put(refs[i].getResourceName(),url); + try { + Context c = new InitialContext(); + String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + Central central = new CentralImpl(MOBY_SERVER); + MobyResourceRef[] refs = central.getResourceRefs(); + for (int i = 0; i < refs.length; i++) { + String url = refs[i].getResourceLocation().toExternalForm(); + if (url.lastIndexOf("#") < 0) + url = url + "#"; + URI_MAP.put(refs[i].getResourceName(), url); } - __success = true; - } - - } catch (Exception e) { - e.printStackTrace(); - } - // attempt 2 - environment variables - if (!__success) { - // maybe try for environment variables - Properties p = MobyProperties.PROPERTIES(); - String MOBY_SERVER = (String) p.get("MOBY_SERVER"); - try { - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - Central central = new CentralImpl(MOBY_SERVER); - MobyResourceRef[] refs = central.getResourceRefs(); - for (int i = 0; i < refs.length; i++) { - String url = refs[i].getResourceLocation().toExternalForm(); - if (url.lastIndexOf("#") < 0) - url = url + "#"; - URI_MAP.put(refs[i].getResourceName(),url); + __success = true; + } + + } catch (Exception e) { + e.printStackTrace(); + } + // attempt 2 - environment variables + if (!__success) { + // maybe try for environment variables + Properties p = MobyProperties.PROPERTIES(); + String MOBY_SERVER = (String) p.get("MOBY_SERVER"); + try { + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + Central central = new CentralImpl(MOBY_SERVER); + MobyResourceRef[] refs = central.getResourceRefs(); + for (int i = 0; i < refs.length; i++) { + String url = refs[i].getResourceLocation().toExternalForm(); + if (url.lastIndexOf("#") < 0) + url = url + "#"; + URI_MAP.put(refs[i].getResourceName(), url); + } + __success = true; } - __success = true; - } - }catch (Exception ex) { - // die here? - ex.printStackTrace(); - } - } - //attempt 3 - default to mobycentral - if (!__success) { - // default to mobycentral - try { - Central central = new CentralImpl(); - MobyResourceRef[] refs = central.getResourceRefs(); - for (int i = 0; i < refs.length; i++) { - String url = refs[i].getResourceLocation().toExternalForm(); - if (url.lastIndexOf("#") < 0) - url = url + "#"; - URI_MAP.put(refs[i].getResourceName(),url); + } catch (Exception ex) { + // die here? + ex.printStackTrace(); + } + } + // attempt 3 - default to mobycentral + if (!__success) { + // default to mobycentral + try { + Central central = new CentralImpl(); + MobyResourceRef[] refs = central.getResourceRefs(); + for (int i = 0; i < refs.length; i++) { + String url = refs[i].getResourceLocation().toExternalForm(); + if (url.lastIndexOf("#") < 0) + url = url + "#"; + URI_MAP.put(refs[i].getResourceName(), url); } - __success = true; - }catch (Exception ex) { - // die here? - ex.printStackTrace(); - } - } + __success = true; + } catch (Exception ex) { + // die here? + ex.printStackTrace(); + } + } } - final public static String URI_OBJECT = (String)URI_MAP.get("Object"); //"http://biomoby.org/RESOURCES/MOBY-S/Objects#"; - final public static String URI_SERVICE = (String)URI_MAP.get("Service"); //"http://biomoby.org/RESOURCES/MOBY-S/Services#"; + final public static String URI_OBJECT = (String) URI_MAP.get("Object"); // "http://biomoby.org/RESOURCES/MOBY-S/Objects#"; - final public static String URI_NAMESPACE = (String)URI_MAP.get("Namespace"); //"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; + final public static String URI_SERVICE = (String) URI_MAP.get("Service"); // "http://biomoby.org/RESOURCES/MOBY-S/Services#"; - final public static String URI_PREDICATE = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; + final public static String URI_NAMESPACE = (String) URI_MAP.get("Namespace"); // "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; - final public static String URI_ServiceINSTANCE = (String)URI_MAP.get("ServiceInstance"); //"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; + final public static String URI_PREDICATE = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; + + final public static String URI_ServiceINSTANCE = (String) URI_MAP.get("ServiceInstance"); // "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; private Model model = null; @@ -160,26 +162,52 @@ *

* * @param myObject - - * the URI of the object in question + * the URI (lsid) of the object in question * @return the rdf representation of the object in question. * @throws IOException */ public final byte[] retrieveObjectRDF(String myObject) throws IOException { - rdf = ModelFactory.createDefaultModel(); - rdf.setNsPrefixes(model.getNsPrefixMap()); - Resource r = model.getResource(myObject); - Resource resource = rdf.createResource(r.getURI()).addProperty( - RDF.type, RDFS.Class); - - // copy resource r's properties - copyResourceAndProperties(r, resource); - // now get the output ready - - FilteredStream aPrintStream = new FilteredStream( - new ByteArrayOutputStream()); - createOutputRDF(aPrintStream); - // System.out.println(aPrintStream.getOutput()); - return aPrintStream.getOutput().getBytes(); + + String latest = getLatestLSID(myObject); + boolean exists = objectExists(myObject) || objectExisted(myObject); + if (exists) + if (latest.equals(myObject)) { + rdf = ModelFactory.createDefaultModel(); + rdf.setNsPrefixes(model.getNsPrefixMap()); + Resource r = model.getResource(myObject); + Resource resource = rdf.createResource(r.getURI()) + .addProperty(RDF.type, RDFS.Class); + + // copy resource r's properties + copyResourceAndProperties(r, resource); + // now get the output ready + + FilteredStream aPrintStream = new FilteredStream(new ByteArrayOutputStream()); + createOutputRDF(aPrintStream); + // System.out.println(aPrintStream.getOutput()); + return aPrintStream.getOutput().getBytes(); + } else { + Model model = ModelFactory.createDefaultModel(); + Resource resource = model.createResource(myObject); + model.add(model.createStatement(resource, RDFS.isDefinedBy, model + .createLiteral(latest))); + model.add(model.createStatement(resource, RDFS.comment, model + .createLiteral("The Namespace/Datatype/ServiceType described by the LSID: " + myObject + + " has since been modified. Please update your lsid."))); + FilteredStream aPrintStream = new FilteredStream(new ByteArrayOutputStream()); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + writer.setProperty("tab", "5"); + writer.write(model, aPrintStream, null); + return aPrintStream.getOutput().getBytes(); + } + else { + return ("" + + "" + "") + .getBytes(); + } + } /* @@ -195,39 +223,45 @@ /* * given the source, the new resource is a copy */ - private final void copyResourceAndProperties(Resource sourceResource, - Resource newResource) { + private final void copyResourceAndProperties(Resource sourceResource, Resource newResource) { // add the properties to the resource in question if (sourceResource.hasProperty(RDFS.comment)) { - String str = sourceResource.getProperty(RDFS.comment).getObject() - .toString(); + String str = sourceResource.getProperty(RDFS.comment).getObject().toString(); if (str.indexOf("~") != -1) str = str.substring(0, str.indexOf("~")); - newResource.addProperty(RDFS.comment, rdf.createLiteral(str, "en")); + newResource.addProperty(RDFS.comment, rdf.createLiteral(str)); } if (sourceResource.hasProperty(RDFS.label)) { - String str = sourceResource.getProperty(RDFS.label).getObject() - .toString(); + String str = sourceResource.getProperty(RDFS.label).getObject().toString(); + if (str.indexOf("~") != -1) + str = str.substring(0, str.indexOf("~")); + newResource.addProperty(RDFS.label, rdf.createLiteral(str)); + } + if (sourceResource.hasProperty(DC.publisher)) { + String str = sourceResource.getProperty(DC.publisher).getObject().toString(); if (str.indexOf("~") != -1) str = str.substring(0, str.indexOf("~")); - newResource.addProperty(RDFS.label, rdf.createLiteral(str, "en")); + newResource.addProperty(DC.publisher, rdf.createLiteral(str)); } - // TODO - add the ofType property if it exists + if (sourceResource.hasProperty(DC.creator)) { + String str = sourceResource.getProperty(RDFS.label).getObject().toString(); + if (str.indexOf("~") != -1) + str = str.substring(0, str.indexOf("~")); + newResource.addProperty(DC.creator, rdf.createLiteral(str)); + } + // add the ofType property if it exists if (sourceResource.hasProperty(Predicates.ofType)) { - String str = sourceResource.getProperty(Predicates.ofType) - .getObject().toString(); + String str = sourceResource.getProperty(Predicates.ofType).getObject().toString(); if (str.indexOf("~") != -1) str = str.substring(0, str.indexOf("~")); newResource.addProperty(Predicates.ofType, str); } if (sourceResource.hasProperty(RDFS.subClassOf)) { - String parent = sourceResource.getProperty(RDFS.subClassOf) - .getObject().asNode().getURI(); - Resource parentResource = rdf.createResource(parent).addProperty( - RDF.type, RDFS.Class); + String parent = sourceResource.getProperty(RDFS.subClassOf).getObject().asNode() + .getURI(); + Resource parentResource = rdf.createResource(parent).addProperty(RDF.type, RDFS.Class); - copyResourceAndProperties(model - .getResource(parentResource.getURI()), parentResource); + copyResourceAndProperties(model.getResource(parentResource.getURI()), parentResource); newResource.addProperty(RDFS.subClassOf, parentResource); } @@ -237,26 +271,22 @@ if (it != null) { while (it.hasNext()) { Statement next = it.nextStatement(); -// Resource subject = next.getSubject(); -// Property predicate = next.getPredicate(); + // Resource subject = next.getSubject(); + // Property predicate = next.getPredicate(); RDFNode object = next.getObject(); -// Node node = object.asNode(); + // Node node = object.asNode(); if (object instanceof Resource) { Resource res = (Resource) object; - String type = res.getProperty(RDF.type).getObject() - .toString(); - String articleName = res - .getProperty(Predicates.articleName).getObject() + String type = res.getProperty(RDF.type).getObject().toString(); + String articleName = res.getProperty(Predicates.articleName).getObject() .toString(); if (articleName.indexOf("~") != -1) - articleName = articleName.substring(0, articleName - .indexOf("~")); + articleName = articleName.substring(0, articleName.indexOf("~")); type = type.substring(type.indexOf("#") + 1); Resource hasa = rdf.createResource( // ModelFactory.createDefaultModel().createResource( rdf.createResource(URI_OBJECT + type)).addProperty( - Predicates.articleName, - rdf.createTypedLiteral(articleName)); + Predicates.articleName, rdf.createTypedLiteral(articleName)); newResource.addProperty(Predicates.hasa, hasa); } else { @@ -271,26 +301,22 @@ if (it != null) { while (it.hasNext()) { Statement next = it.nextStatement(); -// Resource subject = next.getSubject(); -// Property predicate = next.getPredicate(); + // Resource subject = next.getSubject(); + // Property predicate = next.getPredicate(); RDFNode object = next.getObject(); -// Node node = object.asNode(); + // Node node = object.asNode(); if (object instanceof Resource) { Resource res = (Resource) object; - String type = res.getProperty(RDF.type).getObject() - .toString(); - String articleName = res - .getProperty(Predicates.articleName).getObject() + String type = res.getProperty(RDF.type).getObject().toString(); + String articleName = res.getProperty(Predicates.articleName).getObject() .toString(); if (articleName.indexOf("~") != -1) - articleName = articleName.substring(0, articleName - .indexOf("~")); + articleName = articleName.substring(0, articleName.indexOf("~")); type = type.substring(type.indexOf("#") + 1); Resource has = rdf.createResource( // ModelFactory.createDefaultModel().createResource( rdf.createResource(URI_OBJECT + type)).addProperty( - Predicates.articleName, - rdf.createTypedLiteral(articleName)); + Predicates.articleName, rdf.createTypedLiteral(articleName)); newResource.addProperty(Predicates.has, has); } else { @@ -312,204 +338,43 @@ * @return the rdf representation of the service instance. * @throws IOException */ - public final byte[] retrieveServiceInstanceRDF(String myObject) - throws IOException { - String localname = myObject.substring(myObject.indexOf("#") + 1); + public final byte[] retrieveServiceInstanceRDF(String lsid) throws IOException { + LSID theLsid; + try { + theLsid = new LSID(lsid); + } catch (MalformedLSIDException e) { + throw new IOException(e.getLocalizedMessage()); + } + String localname = theLsid.getObject(); String[] details = localname.split(","); - return ServiceInstanceRDF.findService(details[0], details[1], false) - .getBytes(); - - } - - /* - * @param resource - the resource to add the property to @param _bag - the - * bag to add all the properties to @param property - the predicate for the - * adding the bag to the resource - */ - private final void addPropertyToResourceInBag(Resource resource, Bag _bag, - Property property) { - // get all of the objects of uri the - // same as resource with the property we are looking for. - NodeIterator _resource; - _resource = model.listObjectsOfProperty(resource, property); - - // iterator should only have one item - the main bag - while (_resource.hasNext()) { - // create a bag - should be a bag. - Resource _mainBag = (Resource) model.getRDFNode(_resource - .nextNode().asNode()); - - StmtIterator mainBagIterator = _mainBag.listProperties(); - while (mainBagIterator.hasNext()) { - // iterate through the statements for the bag - Statement statement = mainBagIterator.nextStatement(); - Node object = statement.getObject().asNode(); -// Property pred = statement.getPredicate(); - if (object.isBlank()) { - // object is an item in the mainBag - // the item that is a resource - Resource item = statement.getResource(); - // get the statements for the item in the bag - // could be a bag or just a simple -// StmtIterator sit = item.listProperties(); - if (item.hasProperty(RDF.type, Predicates.Simple)) { - // create a simple article - Resource _li = rdf.createResource(); - _li.addProperty(RDF.type, Predicates.Simple); - _li.addProperty(Predicates.object_type, model - .getResource(item.getProperty( - Predicates.object_type).getObject() - .toString())); - if (item.hasProperty(Predicates.articleName)) { - String str = item.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf("~") > 0) - str = str.substring(0, str.indexOf("~")); - _li.addProperty(Predicates.articleName, rdf - .createTypedLiteral(str)); - } - StmtIterator namespaceIt = item - .listProperties(Predicates.namespace_type); - while (namespaceIt.hasNext()) { - _li.addProperty(Predicates.namespace_type, model - .getResource(namespaceIt.nextStatement() - .getObject().toString())); - } - _bag.add(_li); - } - if (item.hasProperty(RDF.type, Predicates.Secondary)) { - // create a secondary article - Resource _li = rdf.createResource(); - _li.addProperty(RDF.type, Predicates.Secondary); - boolean isInt = false; - if (item.hasProperty(Predicates.datatype)) { - String str = item.getProperty(Predicates.datatype) - .getObject().toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - if (str.equalsIgnoreCase("Integer")) - isInt = true; - _li.addProperty(Predicates.datatype, rdf - .createTypedLiteral(str)); - } - if (item.hasProperty(Predicates.articleName)) { - String str = item.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - _li.addProperty(Predicates.articleName, rdf - .createTypedLiteral(str)); - } - if (item.hasProperty(Predicates.default_value)) { - String str = item.getProperty( - Predicates.default_value).getObject() - .toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - _li.addProperty(Predicates.default_value, rdf - .createTypedLiteral(str)); - } - if (item.hasProperty(Predicates.min)) { - String str = item.getProperty(Predicates.min) - .getObject().toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - _li.addProperty(Predicates.min, rdf - .createTypedLiteral(Integer.parseInt(str))); - } - if (item.hasProperty(Predicates.max)) { - String str = item.getProperty(Predicates.max) - .getObject().toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf(":")); - } - _li.addProperty(Predicates.max, rdf - .createTypedLiteral(Integer.parseInt(str))); - } - StmtIterator enumIter = item - .listProperties(Predicates.enumeration); - while (enumIter.hasNext()) { - String str = enumIter.nextStatement().getObject() - .toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - if (isInt && !str.equals("")) - _li.addProperty(Predicates.enumeration, rdf - .createTypedLiteral(Integer - .parseInt(str))); - else - _li.addProperty(Predicates.enumeration, rdf - .createTypedLiteral(str)); - } - // add the item to the bag - _bag.add(_li); - } - if (item.hasProperty(RDF.type, Predicates.Collection)) { - // create a collection - Bag collectionBag = rdf.createBag(); - collectionBag.addProperty(RDF.type, - Predicates.Collection); - collectionBag.addProperty(RDFS.subClassOf, RDF.Bag); - if (item.hasProperty(Predicates.articleName)) { - String str = item.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf("~") > 0) - str = str.substring(0, str.indexOf("~")); - collectionBag.addProperty(Predicates.articleName, - str); - } - // Resource collectionResource = - // item.getProperty(MobyResources.Collection).getResource(); - StmtIterator simples = item.listProperties(); - while (simples.hasNext()) { - Statement cStatement = simples.nextStatement(); - if (cStatement.getObject().asNode().isBlank()) { - Resource simple = cStatement.getResource(); - Resource _li = rdf.createResource(); - _li.addProperty(RDF.type, Predicates.Simple); - _li.addProperty(Predicates.object_type, model - .getResource(simple.getProperty( - Predicates.object_type) - .getObject().toString())); - if (simple.hasProperty(Predicates.articleName)) { - String str = simple.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf(":") > 0) - str = str - .substring(0, str.indexOf("~")); - _li.addProperty(Predicates.articleName, rdf - .createTypedLiteral(str)); - } - StmtIterator namespaceIt = simple - .listProperties(Predicates.namespace_type); - while (namespaceIt.hasNext()) { - _li.addProperty(Predicates.namespace_type, - model.getResource(namespaceIt - .nextStatement() - .getObject().toString())); - } - collectionBag.add(_li); - } - } - // add the collection to the bag - _bag.add(collectionBag); - } - } + if (ServiceInstanceRDF.serviceInstanceExists(details[0], details[1], lsid)) + return ServiceInstanceRDF.findService(details[0], details[1], false).getBytes(); + else { + if (ServiceInstanceRDF.serviceInstanceExists(details[0], details[1])) { + // return rdf that points to latest + Model model = ModelFactory.createDefaultModel(); + Resource resource = model.createResource(lsid); + model.add(model.createStatement(resource, RDFS.isDefinedBy, model + .createLiteral(ServiceInstanceRDF.getLatestLSID(details[0], details[1], + lsid)))); + model.add(model.createStatement(resource, RDFS.comment, model + .createLiteral("The service described by the LSID: " + lsid + + " has since been modified. Please update your lsid."))); + + FilteredStream aPrintStream = new FilteredStream(new ByteArrayOutputStream()); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + writer.setProperty("tab", "5"); + writer.write(model, aPrintStream, null); + return aPrintStream.getOutput().getBytes(); + } else { + return ("" + + "" + "") + .getBytes(); } - } - // finally add the property to our resource - resource.addProperty(property, _bag); } /** @@ -522,36 +387,70 @@ * otherwise false is returned. * * @param myObject - - * the string to query the RDF model with. + * the string to query the RDF model with (an lsid). * @return - true if myObject exists in the RDF model, false otherwise. */ public final boolean objectExists(String myObject) { NodeIterator rits = model.listObjects(); - System.out.println("Searching for Object " + myObject); while (rits.hasNext()) { RDFNode RDFnode = rits.nextNode(); if (RDFnode == null) { - System.out.println("Search for Object " + myObject + " failed (1)."); return false; } String node = RDFnode.toString(); if (node.indexOf("~") > 0) node = node.substring(0, node.indexOf("~")); - if (node.indexOf(":") > 0) - node = node.substring(0, node.indexOf(":")); if (node.equalsIgnoreCase(myObject)) return true; } - System.out.println("Search for Object " + myObject + " failed (2)."); return false; } + public final boolean objectExisted(String lsid) { + ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); + LSID theLsid = null; + try { + theLsid = new LSID(lsid); + } catch (MalformedLSIDException e) { + System.err.println("Error checking if an object existed " + e.getLocalizedMessage()); + return false; + } + + while (rIter.hasNext()) { + Resource resource = rIter.nextResource(); + if (resource.getLocalName() != null) + if (resource.getLocalName().equals(theLsid.getObject())) + return true; + } + return false; + } + + public final String getLatestLSID(String lsid) { + ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); + LSID theLsid = null; + try { + theLsid = new LSID(lsid); + } catch (MalformedLSIDException e) { + System.err.println("Error obtaining the latest LSID - " + e.getLocalizedMessage()); + return ""; + } + + while (rIter.hasNext()) { + Resource resource = rIter.nextResource(); + if (resource.getLocalName() != null) + if (resource.getLocalName().equals(theLsid.getObject())) + return resource.getURI(); + } + return ""; + } + public static void main(String[] args) throws IOException { RDFConfigure rdfc = new RDFConfigure( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#"); + "http://biomoby.org/RESOURCES/MOBY-S/Services#"); System.out - .println(rdfc.objectExists( - ("SW"))); + .println(new String( + rdfc + .retrieveObjectRDF(("urn:lsid:biomoby.org:servicetype:Analysis")))); } @@ -560,8 +459,7 @@ public FilteredStream(OutputStream aStream) { super(aStream); - sb = new StringBuffer("" - + newline); + sb = new StringBuffer("" + newline); } public void write(byte b[]) throws IOException { From kawas at pub.open-bio.org Wed Mar 15 11:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMcDC032135@pub.open-bio.org> kawas Wed Mar 15 11:22:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/registry/definitions/types Modified Files: JServicesSqlImpl.java JObjectsSqlImpl.java JNamespacesSqlImpl.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/registry/definitions/types JServicesSqlImpl.java,1.2,1.3 JObjectsSqlImpl.java,1.1,1.2 JNamespacesSqlImpl.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java 2006/03/14 16:23:06 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java 2006/03/15 16:22:37 1.3 @@ -25,7 +25,7 @@ + "FROM service as ot1, service_term2term as rt, service as ot2 " + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; - private static final String sql_all = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description, ot1.service_lsid, ot1.authority, ot1.contact_email " + private static final String sql_all = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description, ot1.service_lsid, ot1.authority, ot1.contact_email, ot2.service_lsid " + "FROM service as ot1, service_term2term as rt, service as ot2 " + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; @@ -48,12 +48,12 @@ Map map = MobyCentralConfig.getMobyService(); // Create a connection to the database String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; - // //TODO - // - - // make - // this - // a - // property + // //TODO + // - + // make + // this + // a + // property String mydatabase = (String) map.get("dbname");// "mobyobject"; String url = "jdbc:mysql://" + serverName + "/" + mydatabase; String username = (String) map.get("username");// "moby_external"; @@ -143,9 +143,11 @@ /** * Get all the data in the db regrading service types. + * * @return an array of String[] objects. The String[] consists of - * {service_type, relationship_type, to_service_type, description, service_lsid, authority, - * contact_email}. Note that relationship_type is the relationship that service_type has + * {service_type, relationship_type, to_service_type, description, + * service_lsid, authority, contact_email, to_service_type_lsid}. + * Note that relationship_type is the relationship that service_type has * with to_service_type. */ public String[][] getFullServicesAsArray() { @@ -166,7 +168,7 @@ while (rs.next()) { // Get the data from the row using the column index sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), - rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7) }); + rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7), rs.getString(8) }); } } catch (SQLException e) { // TODO - throw exception - Database access error =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.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/registry/definitions/types/JObjectsSqlImpl.java 2005/08/29 20:19:20 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java 2006/03/15 16:22:37 1.2 @@ -21,179 +21,221 @@ * email me at edward.kawas at gmail.com */ public final class JObjectsSqlImpl implements JObjectsI { - private static final String sql = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " - + "FROM object as ot1, object_term2term as rt, object as ot2 " - + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id " - + "ORDER BY ot1.object_type"; - - private final String newline = System.getProperty("line.separator"); - - private Connection connection = null; - - /** - * - * @throws MobyException - * if database driver cannot be found or there is an database - * access error. - */ - public JObjectsSqlImpl() throws MobyException { - try { - // Load the JDBC driver - String driverName = "com.mysql.jdbc.Driver"; - Class.forName(driverName); - // get certain properties from mobycentral.config - Map map = MobyCentralConfig.getMobyObject(); - // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");//localhost:3306"; - // //TODO - // - make - // this a - // property - String mydatabase = (String) map.get("dbname");//"mobyobject"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");//"moby_external"; - String password = (String) map.get("password");//""; - - /* - * String serverName = "mobycentral.icapture.ubc.ca:3306"; String - * mydatabase = "mobyobject"; String url = "jdbc:mysql://" + - * serverName + "/" + mydatabase; String username = "moby_external"; - * String password = ""; - */ - this.connection = DriverManager.getConnection(url, username, - password); - } catch (ClassNotFoundException e) { - throw new MobyException( - "Could not find database driver. Please ensure that you have the right libraries present"); - } catch (SQLException e) { - e.printStackTrace(); - throw new MobyException("Database access error: " + e.getSQLState()); - } - } - - /* - * (non-Javadoc) - * - * @see org.biomoby.registry.definitions.types.JObjectsI#getObjects() - */ - public final String getObjects() { - StringBuffer sb = new StringBuffer(); - /* ensure connection is not null */ - if (connection == null) - return ""; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) - + "\t" - + rs.getString(2) - + "\t" - + rs.getString(3) - + ((rs.getString(4) == null || rs.getString(4).equals( - "")) ? "\t" : "(" + rs.getString(4) + ")\t") - + rs.getString(5) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - /** - * - * @param name - * the name of the object to get information on - * @return a tab delimited string containing object, object relationship, - * object type that this relationship is with, the articlename (if - * it exists), and description - */ - public final String getObject(String name) { - String _SQL = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " - + "FROM object as ot1, object_term2term as rt, object as ot2 " - + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id and ot1.object_type = '" - + name + "' " + "ORDER BY ot1.object_type"; - StringBuffer sb = new StringBuffer(); - /* ensure connection is not null */ - if (connection == null) - return ""; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(_SQL); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) - + "\t" - + rs.getString(2) - + "\t" - + rs.getString(3) - + ((rs.getString(4) == null || rs.getString(4).equals( - "")) ? "\t" : "(" + rs.getString(4) + ")\t") - + rs.getString(5) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - public static void main(String[] args) throws MobyException { - System.out.println(new JObjectsSqlImpl().getObjectsAsArray()); - } - - /* - * (non-Javadoc) - * - * @see org.biomoby.registry.definitions.types.JObjectsI#getObjectsAsArray() - */ - public String[][] getObjectsAsArray() { - ArrayList sb = new ArrayList(); - /* ensure connection is not null */ - if (connection == null) - return null; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb - .add(new String[] { - rs.getString(1), - rs.getString(2), - rs.getString(3), - ((rs.getString(4) == null || - rs.getString(4).equals("")) ? - "" : "(" + rs.getString(4) + ")"), - rs.getString(5) }); - } - } catch (SQLException e) { - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray(array); - return array; - } + private static final String sql = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " + + "FROM object as ot1, object_term2term as rt, object as ot2 " + + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id " + + "ORDER BY ot1.object_type"; + + private static final String sql_all = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description," + + " ot1.object_lsid, ot1.authority, ot1.contact_email, ot2.object_lsid " + + "FROM object as ot1, object_term2term as rt, object as ot2 " + + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id " + + "ORDER BY ot1.object_type"; + + private final String newline = System.getProperty("line.separator"); + + private Connection connection = null; + + /** + * + * @throws MobyException + * if database driver cannot be found or there is an database + * access error. + */ + public JObjectsSqlImpl() throws MobyException { + try { + // Load the JDBC driver + String driverName = "com.mysql.jdbc.Driver"; + Class.forName(driverName); + // get certain properties from mobycentral.config + Map map = MobyCentralConfig.getMobyObject(); + // Create a connection to the database + String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; + // //TODO + // - make + // this a + // property + String mydatabase = (String) map.get("dbname");// "mobyobject"; + String url = "jdbc:mysql://" + serverName + "/" + mydatabase; + String username = (String) map.get("username");// "moby_external"; + String password = (String) map.get("password");// ""; + + /* + * String serverName = "mobycentral.icapture.ubc.ca:3306"; String + * mydatabase = "mobyobject"; String url = "jdbc:mysql://" + + * serverName + "/" + mydatabase; String username = "moby_external"; + * String password = ""; + */ + this.connection = DriverManager.getConnection(url, username, password); + } catch (ClassNotFoundException e) { + throw new MobyException( + "Could not find database driver. Please ensure that you have the right libraries present"); + } catch (SQLException e) { + e.printStackTrace(); + throw new MobyException("Database access error: " + e.getSQLState()); + } + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JObjectsI#getObjects() + */ + public final String getObjects() { + StringBuffer sb = new StringBuffer(); + /* ensure connection is not null */ + if (connection == null) + return ""; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + + "\t" + + rs.getString(2) + + "\t" + + rs.getString(3) + + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "\t" : "(" + + rs.getString(4) + ")\t") + rs.getString(5) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /** + * + * @param name + * the name of the object to get information on + * @return a tab delimited string containing object, object relationship, + * object type that this relationship is with, the articlename (if + * it exists), and description + */ + public final String getObject(String name) { + String _SQL = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " + + "FROM object as ot1, object_term2term as rt, object as ot2 " + + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id and ot1.object_type = '" + + name + "' " + "ORDER BY ot1.object_type"; + StringBuffer sb = new StringBuffer(); + /* ensure connection is not null */ + if (connection == null) + return ""; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(_SQL); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + + "\t" + + rs.getString(2) + + "\t" + + rs.getString(3) + + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "\t" : "(" + + rs.getString(4) + ")\t") + rs.getString(5) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JObjectsI#getObjectsAsArray() + */ + public String[][] getObjectsAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { + rs.getString(1), + rs.getString(2), + rs.getString(3), + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "" : "(" + + rs.getString(4) + ")"), rs.getString(5) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + /** + * + * @return + */ + public String[][] getFullObjectsAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { + rs.getString(1), + rs.getString(2), + rs.getString(3), + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "" : "(" + + rs.getString(4) + ")"), rs.getString(5), rs.getString(6), + rs.getString(7), rs.getString(8), rs.getString(9) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + public static void main(String[] args) throws MobyException { + String[][] datatypes = new JObjectsSqlImpl().getFullObjectsAsArray(); + for (int i = 0; i < datatypes.length; i++) { + String[] datatype = datatypes[i]; + for (int j = 0; j < datatype.length; j++) { + System.out.print(datatype[j] + " "); + } + System.out.println(); + } + } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.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/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:23:06 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/15 16:22:37 1.4 @@ -43,24 +43,12 @@ // get certain properties from mobycentral.config Map map = MobyCentralConfig.getMobyNamespace(); // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; - // //TODO - // - - // make - // this - // a - // property - String mydatabase = (String) map.get("dbname");// "mobyobject"; + String serverName = map.get("url") + ":" + map.get("port"); + String mydatabase = (String) map.get("dbname"); String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");// "moby_external"; - String password = (String) map.get("password");// ""; + String username = (String) map.get("username"); + String password = (String) map.get("password"); - /* - * String serverName = "mobycentral.icapture.ubc.ca:3306"; String - * mydatabase = "mobynamespace"; String url = "jdbc:mysql://" + - * serverName + "/" + mydatabase; String username = "moby_external"; - * String password = ""; - */ this.connection = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException e) { throw new MobyException( From kawas at pub.open-bio.org Wed Mar 15 11:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMc4Q032161@pub.open-bio.org> kawas Wed Mar 15 11:22:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: MobyAuthority.java LSIDAuthorityMetaData.java LSIDDataLookup.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.4,1.5 LSIDAuthorityMetaData.java,1.3,1.4 LSIDDataLookup.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/02/27 23:53:57 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/03/15 16:22:37 1.5 @@ -57,11 +57,9 @@ return new LSIDMetadataPort[] { new SOAPLocation("BioMOBYMetadataSOAPPort", "http://" + properties.getProperty("lsid_domain") + ":" - + properties.getProperty("lsid_port") - + "/authority/metadata"), - new HTTPLocation("BioMOBYMetadataHTTPPort", properties - .getProperty("lsid_domain"), Integer - .parseInt(properties.getProperty("lsid_port")), + + properties.getProperty("lsid_port") + "/authority/metadata"), + new HTTPLocation("BioMOBYMetadataHTTPPort", properties.getProperty("lsid_domain"), + Integer.parseInt(properties.getProperty("lsid_port")), "/authority/metadata") }; } @@ -77,12 +75,9 @@ return new LSIDDataPort[] { new SOAPLocation("BioMOBYDataSOAPPort", "http://" + properties.getProperty("lsid_domain") + ":" - + properties.getProperty("lsid_port") - + "/authority/data"), - new HTTPLocation("BioMOBYDataHTTPPort", properties - .getProperty("lsid_domain"), Integer - .parseInt(properties.getProperty("lsid_port")), - "/authority/data") }; + + properties.getProperty("lsid_port") + "/authority/data"), + new HTTPLocation("BioMOBYDataHTTPPort", properties.getProperty("lsid_domain"), + Integer.parseInt(properties.getProperty("lsid_port")), "/authority/data") }; } /* @@ -90,8 +85,7 @@ * * @see com.ibm.lsid.server.LSIDAuthorityService#getAvailableServices(com.ibm.lsid.server.LSIDRequestContext) */ - public ExpiringResponse getAvailableServices(LSIDRequestContext ctx) - throws LSIDServerException { + public ExpiringResponse getAvailableServices(LSIDRequestContext ctx) throws LSIDServerException { LSID lsid = ctx.getLsid(); String url = ctx.getReqUrl(); try { @@ -109,8 +103,7 @@ return new ExpiringResponse(wsdl.toString(), getExpiration()); } catch (LSIDException e) { throw new LSIDServerException(e, e.getErrorCode(), - "Simple Authority Error in getAvailableOperations(" + lsid - + "): "); + "Simple Authority Error in getAvailableOperations(" + lsid + "): "); } } @@ -119,19 +112,26 @@ * * @see com.ibm.lsid.server.LSIDService#initService(com.ibm.lsid.server.LSIDServiceConfig) */ - public void initService(LSIDServiceConfig config) - throws LSIDServerException { + public void initService(LSIDServiceConfig config) throws LSIDServerException { lookup = new LSIDDataLookup(); try { + Context c = new InitialContext(); - String LSID_SERVER = (String) c - .lookup("java:comp/env/LSID_SERVER"); - String LSID_PORT = (String) c.lookup("java:comp/env/LSID_PORT"); - if (LSID_SERVER != null && !LSID_SERVER.equals("")) { - properties.setProperty("lsid_domain", LSID_SERVER); + try { + String LSID_SERVER = (String) c.lookup("java:comp/env/LSID_SERVER"); + + if (LSID_SERVER != null && !LSID_SERVER.equals("")) { + properties.setProperty("lsid_domain", LSID_SERVER); + } + } catch (Exception ex) { } - if (LSID_PORT != null && !LSID_PORT.equals("")) { - properties.setProperty("lsid_port", LSID_PORT); + + try { + String LSID_PORT = (String) c.lookup("java:comp/env/LSID_PORT"); + if (LSID_PORT != null && !LSID_PORT.equals("")) { + properties.setProperty("lsid_port", LSID_PORT); + } + } catch (Exception ex) { } } catch (Exception e) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.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/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java 2005/08/31 23:57:34 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java 2006/03/15 16:22:37 1.4 @@ -1,10 +1,10 @@ - package org.biomoby.client.ui.graphical.servlet.lsid.authority; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.Date; -import org.biomoby.client.rdf.builder.RDFConfigure; +import org.biomoby.client.rdf.builder.ServiceInstanceRDF; import com.ibm.lsid.MetadataResponse; import com.ibm.lsid.server.LSIDMetadataService; @@ -29,112 +29,113 @@ * email me at edward.kawas at gmail.com */ public class LSIDAuthorityMetaData implements LSIDMetadataService { - private LSIDDataLookup lookup = null; - + private LSIDDataLookup lookup = null; + + public void initService(LSIDServiceConfig cf) throws LSIDServerException { + lookup = new LSIDDataLookup(); + } + + public MetadataResponse getMetadata(LSIDRequestContext req, String[] acceptedFormats) + throws LSIDServerException { + byte[] data = null; + int lsType; + try { + lsType = lookup.lsidType(req.getLsid()); + } catch (LSIDServerException ex) { + ex.printStackTrace(); + lsType = LSIDDataLookup.UNKNOWN; + } + if (lsType == LSIDDataLookup.UNKNOWN) + throw new LSIDServerException(201, "Error in getMetaData: Unknown LSID: " + + req.getLsid()); + + switch (lsType) { + case LSIDDataLookup.NAMESPACE_TYPE: { + /* type is namespace */ + try { + data = lookup.lsidLookup[1].retrieveObjectRDF(req.getLsid().toString()); + + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.OBJECT_CLASS: { + try { + /* type is object */ + data = lookup.lsidLookup[0].retrieveObjectRDF(req.getLsid().toString()); + + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.SERVICE_TYPE: { + /* type is service */ + try { + data = lookup.lsidLookup[2].retrieveObjectRDF(req.getLsid().toString()); + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.SERVICE_RELATION: + case LSIDDataLookup.OBJECT_RELATION: + /* type is relationship */ + { + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + } + break; + case LSIDDataLookup.SERVICE_INSTANCE: + /* type is serviceinstance */ + { + try { + data = lookup.lsidLookup[3].retrieveServiceInstanceRDF(req.getLsid().toString()); + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.MOBY_PREDICATE: + /* type is rdfpredicate */{ + // TODO - find the predicate that was requested. + } + break; + default: + throw new LSIDServerException(201, "1. Unknown LSID"); + } + return new MetadataResponse(new ByteArrayInputStream(data), new Date(), + MetadataResponse.RDF_FORMAT); + } + + private String makeFirstUpperCase(String name) { + if (name.length() <= 1) + return name.toUpperCase(); + char[] letters = name.toCharArray(); + letters[0] = Character.toUpperCase(letters[0]); + return new String(letters); + } - public void initService(LSIDServiceConfig cf) throws LSIDServerException { - lookup = new LSIDDataLookup(); - } - - - public MetadataResponse getMetadata(LSIDRequestContext req, - String[] acceptedFormats) throws LSIDServerException { - byte[] data = null; - int lsType; - try { - lsType = lookup.lsidType(req.getLsid()); - } catch (LSIDServerException ex) { - ex.printStackTrace(); - lsType = LSIDDataLookup.UNKNOWN; - } - if (lsType == LSIDDataLookup.UNKNOWN) - throw new LSIDServerException(201, "Error in getMetaData: Unknown LSID: " + req.getLsid()); - - switch (lsType) { - case LSIDDataLookup.NAMESPACE_TYPE: { - /* type is namespace */ - try { - data = lookup.lsidLookup[1].retrieveObjectRDF(RDFConfigure.URI_NAMESPACE+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.OBJECT_CLASS: { - try { - /* type is object */ - data = lookup.lsidLookup[0].retrieveObjectRDF(RDFConfigure.URI_OBJECT+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.SERVICE_TYPE: { - /* type is service */ - try { - data = lookup.lsidLookup[2].retrieveObjectRDF(RDFConfigure.URI_SERVICE+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.SERVICE_RELATION: - case LSIDDataLookup.OBJECT_RELATION: - /* type is relationship */ - { - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - } - break; - case LSIDDataLookup.SERVICE_INSTANCE: - /* type is serviceinstance */ - { - try { - data = lookup.lsidLookup[3].retrieveServiceInstanceRDF(RDFConfigure.URI_ServiceINSTANCE+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.MOBY_PREDICATE: - /* type is rdfpredicate */{ - //TODO - find the predicate that was requested. - } - break; - default: - throw new LSIDServerException(201, "1. Unknown LSID"); - } - return new MetadataResponse(new ByteArrayInputStream(data), new Date(), MetadataResponse.RDF_FORMAT); - } - - private String makeFirstUpperCase(String name) { - if (name.length() <= 1) - return name.toUpperCase(); - char[] letters = name.toCharArray(); - letters[0] = Character.toUpperCase(letters[0]); - return new String(letters); - } - } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.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/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java 2006/02/27 23:51:43 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java 2006/03/15 16:22:37 1.6 @@ -16,6 +16,7 @@ */ package org.biomoby.client.ui.graphical.servlet.lsid.authority; + import java.io.IOException; import java.util.HashMap; import java.util.Properties; @@ -28,197 +29,218 @@ import com.ibm.lsid.server.LSIDServerException; public class LSIDDataLookup { - - public static final int UNKNOWN = -1; - public static final int NAMESPACE_TYPE = 0; + public static final int UNKNOWN = -1; - public static final int OBJECT_CLASS = 1; + public static final int NAMESPACE_TYPE = 0; - public static final int SERVICE_TYPE = 2; + public static final int OBJECT_CLASS = 1; - public static final int SERVICE_RELATION = 3; - - public static final int OBJECT_RELATION = 4; - - public static final int SERVICE_INSTANCE = 5; - - public static final int MOBY_PREDICATE = 6; - - private Properties mobycentral = MobyProperties.SERVICE_INSTANCE_PROPERTIES(); - private Properties mobyobject = MobyProperties.OBJECT_PROPERTIES(); - private Properties mobyservice = MobyProperties.SERVICE_PROPERTIES(); - private Properties mobynamespace = MobyProperties.NAMESPACE_PROPERTIES(); - private Properties mobyrelationship = MobyProperties.RELATIONSHIP_PROPERTIES(); - - /** - * 0 - object - * 1 - namespace - * 2 - service - * 3 - service instance - * - */ - public RDFConfigure lsidLookup[] = {null,null,null,null}; - - - public LSIDDataLookup() { - - } - - /** - * - * @param lsid an lsid to check whether we have 'data' on it or not - * @return true if getData has actual data under the namespace of the lsid. False otherwise. - */ - public boolean isValidDataType (LSID lsid) { - String ns = lsid.getNamespace(); - if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")) || ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) - return true; - return false; - } - - - public int dataLsidType(LSID lsid) { - String ns = lsid.getNamespace(); - String id = lsid.getObject(); - String ver = lsid.getRevision(); - /*if (ver != null || (ver != null && ver.length() != 0)) - return UNKNOWN;*/ - if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { - return LSIDDataLookup.OBJECT_CLASS; - } - if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { - return LSIDDataLookup.SERVICE_INSTANCE; - } - return UNKNOWN; - } - - public int lsidType(LSID lsid) throws LSIDServerException { - String ns = lsid.getNamespace(); - String id = lsid.getObject(); - String ver = lsid.getRevision(); - int result = UNKNOWN; - String authority = lsid.getAuthority().getAuthority(); - - /*if (ver != null || (ver != null && ver.length() != 0)) - return UNKNOWN;*/ - - if (ns.equalsIgnoreCase(mobynamespace.getProperty("lsid_namespace"))) { - //if (lsidLookup[1] == null) { - if (!authority.equals(mobynamespace.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[1] = new RDFConfigure(RDFConfigure.URI_NAMESPACE); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - //} - if (lsidLookup[1].objectExists(lsid.getObject())) - result = NAMESPACE_TYPE; - } - else if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { - //if (lsidLookup[0] == null) { - if (!authority.equals(mobyobject.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[0] = new RDFConfigure(RDFConfigure.URI_OBJECT); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - // } - if (lsidLookup[0].objectExists(lsid.getObject())) - result = OBJECT_CLASS; - } - else if (ns.equalsIgnoreCase(mobyservice.getProperty("lsid_namespace"))) { - // if (lsidLookup[2] == null) { - if (!authority.equals(mobyservice.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[2] = new RDFConfigure(RDFConfigure.URI_SERVICE); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - // } - if (lsidLookup[2].objectExists(lsid.getObject())) - result = SERVICE_TYPE; - } - else if (ns.equalsIgnoreCase("objectrelation")){ - - } - else if (ns.equalsIgnoreCase("servicerelation")) { - - } - else if (ns.equalsIgnoreCase("rdfpredicates")) { - if (isValidPredicate(id)) { - return MOBY_PREDICATE; - } - return UNKNOWN; - - } - else if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { - String str = lsid.getObject(); - // make sure that the service instance is in the form - // domain,serviceInstanceName - // if (lsidLookup[3] == null) { - if (!authority.equals(mobycentral.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[3] = new RDFConfigure(RDFConfigure.URI_ServiceINSTANCE); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - // } - String[] parsed = str.split(","); - if (parsed.length != 2) - throw new LSIDServerException(LSIDServerException.UNKNOWN_LSID, "Unknown Service Instance LSID. Form should be urn:lsid:biomoby.org:serviceinstance:authorsURI,serviceInstanceName"); - if (ServiceInstanceRDF.serviceInstanceExists(parsed[0],parsed[1])) - result = SERVICE_INSTANCE; - } - else - return UNKNOWN; - - return result; - } - - - /* - * a hash of known predicates. - */ - private final HashMap known_predicates = new HashMap(); - - /* - * method to init the hash of known predicates. - * TODO - add new rdfpredicates here! - */ - private void initHash() { - // add the objects that are valid for the namespace rdfpredicates - known_predicates.put("mobyOntology", "A phrase representing one of the bioMoby ontologies."); - known_predicates.put("mobyontology", "A phrase representing one of the bioMoby ontologies."); - } - /** - * - * PRE:the key is in the known_predicates

- * POST:the value that is mapped to the specific key is returned

- * @param key - a valid key contained in known_predicates. - * @return - the value that is mapped to the the key. - */ - public String getKnownValue(String key) { - return (String) known_predicates.get(key); - } - - /** - * - * PRE:None.

- * POST:If pred is a valid predicate, true is returned, otherwise false is returned

- * @param pred - the predicate to check for - * @return true if pred is a valid predicate, false otherwise. - */ - public boolean isValidPredicate(String pred) { - return known_predicates.containsKey(pred); - } -} + public static final int SERVICE_TYPE = 2; + public static final int SERVICE_RELATION = 3; + + public static final int OBJECT_RELATION = 4; + + public static final int SERVICE_INSTANCE = 5; + + public static final int MOBY_PREDICATE = 6; + + private Properties mobycentral = MobyProperties.SERVICE_INSTANCE_PROPERTIES(); + + private Properties mobyobject = MobyProperties.OBJECT_PROPERTIES(); + + private Properties mobyservice = MobyProperties.SERVICE_PROPERTIES(); + + private Properties mobynamespace = MobyProperties.NAMESPACE_PROPERTIES(); + + private Properties mobyrelationship = MobyProperties.RELATIONSHIP_PROPERTIES(); + + /** + * 0 - object 1 - namespace 2 - service 3 - service instance + * + */ + public RDFConfigure lsidLookup[] = { null, null, null, null }; + + public LSIDDataLookup() { + + } + + /** + * + * @param lsid + * an lsid to check whether we have 'data' on it or not + * @return true if getData has actual data under the namespace of the lsid. + * False otherwise. + */ + public boolean isValidDataType(LSID lsid) { + String ns = lsid.getNamespace(); + if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")) + || ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) + return true; + return false; + } + + public int dataLsidType(LSID lsid) { + String ns = lsid.getNamespace(); + String id = lsid.getObject(); + String ver = lsid.getRevision(); + /* + * if (ver != null || (ver != null && ver.length() != 0)) return + * UNKNOWN; + */ + if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { + return LSIDDataLookup.OBJECT_CLASS; + } + if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { + return LSIDDataLookup.SERVICE_INSTANCE; + } + return UNKNOWN; + } + + public int lsidType(LSID lsid) throws LSIDServerException { + String ns = lsid.getNamespace(); + String id = lsid.getObject(); + String ver = lsid.getRevision(); + int result = UNKNOWN; + String authority = lsid.getAuthority().getAuthority(); + + /* + * if (ver != null || (ver != null && ver.length() != 0)) return + * UNKNOWN; + */ + + if (ns.equalsIgnoreCase(mobynamespace.getProperty("lsid_namespace"))) { + // if (lsidLookup[1] == null) { + if (!authority.equals(mobynamespace.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[1] = new RDFConfigure(RDFConfigure.URI_NAMESPACE); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + if (lsidLookup[1].objectExists(lsid.toString())) + result = NAMESPACE_TYPE; + else if (lsidLookup[1].objectExisted(lsid.getObject())) + result = NAMESPACE_TYPE; + } else if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { + // if (lsidLookup[0] == null) { + if (!authority.equals(mobyobject.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[0] = new RDFConfigure(RDFConfigure.URI_OBJECT); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + if (lsidLookup[0].objectExists(lsid.toString())) + result = OBJECT_CLASS; + else if (lsidLookup[0].objectExisted(lsid.getObject())) + result = OBJECT_CLASS; + } else if (ns.equalsIgnoreCase(mobyservice.getProperty("lsid_namespace"))) { + // if (lsidLookup[2] == null) { + if (!authority.equals(mobyservice.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[2] = new RDFConfigure(RDFConfigure.URI_SERVICE); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + if (lsidLookup[2].objectExists(lsid.toString())) + result = SERVICE_TYPE; + else if (lsidLookup[2].objectExists(lsid.getObject())) + result = SERVICE_TYPE; + } else if (ns.equalsIgnoreCase("objectrelation")) { + + } else if (ns.equalsIgnoreCase("servicerelation")) { + + } else if (ns.equalsIgnoreCase("rdfpredicates")) { + if (isValidPredicate(id)) { + return MOBY_PREDICATE; + } + return UNKNOWN; + + } else if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { + String str = lsid.getObject(); + // make sure that the service instance is in the form + // domain,serviceInstanceName + // if (lsidLookup[3] == null) { + if (!authority.equals(mobycentral.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[3] = new RDFConfigure(RDFConfigure.URI_ServiceINSTANCE); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + + String[] parsed = str.split(","); + if (parsed.length != 2) + throw new LSIDServerException( + LSIDServerException.UNKNOWN_LSID, + "Unknown Service Instance LSID. Form should be urn:lsid:biomoby.org:serviceinstance:authorsURI,serviceInstanceName:version"); + if (ServiceInstanceRDF.serviceInstanceExists(parsed[0], parsed[1], lsid.toString())) + result = SERVICE_INSTANCE; + else if (ServiceInstanceRDF.serviceInstanceExists(parsed[0], parsed[1])) + result = SERVICE_INSTANCE; + + } else + return UNKNOWN; + + return result; + } + + /* + * a hash of known predicates. + */ + private final HashMap known_predicates = new HashMap(); + + /* + * method to init the hash of known predicates. TODO - add new rdfpredicates + * here! + */ + private void initHash() { + // add the objects that are valid for the namespace rdfpredicates + known_predicates + .put("mobyOntology", "A phrase representing one of the bioMoby ontologies."); + known_predicates + .put("mobyontology", "A phrase representing one of the bioMoby ontologies."); + } + + /** + * + * PRE:the key is in the known_predicates + *

+ * POST:the value that is mapped to the specific key is returned + *

+ * + * @param key - + * a valid key contained in known_predicates. + * @return - the value that is mapped to the the key. + */ + public String getKnownValue(String key) { + return (String) known_predicates.get(key); + } + + /** + * + * PRE:None. + *

+ * POST:If pred is a valid predicate, true is returned, otherwise + * false is returned + *

+ * + * @param pred - + * the predicate to check for + * @return true if pred is a valid predicate, false otherwise. + */ + public boolean isValidPredicate(String pred) { + return known_predicates.containsKey(pred); + } +} From gss at pub.open-bio.org Wed Mar 15 12:41:55 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Wed, 15 Mar 2006 12:41:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151741.k2FHftrE032614@pub.open-bio.org> gss Wed Mar 15 12:41:55 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv32589/src/org/semanticmoby/ref/tools Modified Files: URIInvestigator.java Log Message: Removed constructor and made investigate(url) static synchronized s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools URIInvestigator.java,1.17,1.18 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/15 00:43:38 1.17 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/15 17:41:55 1.18 @@ -20,20 +20,6 @@ public class URIInvestigator { /** - * The URL that is to be investigated for possible inclusion in the - * metadata repository. - */ - private String resourceURL; - - /** - * Create an instance for investingating the given resource URL - * @param resourceURL the URL to investigate - */ - public URIInvestigator(String resourceURL) { - this.resourceURL = resourceURL; - } - - /** * Synchronize the resource URL's MOBY graph (if there is one) with the * graph stored in the metadata repository (if there is one). This involves * doing an HTTP GET on the resource URL; if there is already a graph stored @@ -44,7 +30,7 @@ * modified), then there is nothing to do; if the request returns a 404 * (resource not found), then remove the graph from the database. */ - public void investigate() { + public static synchronized void investigate(String resourceURL) { // The storage manager is used to access the metadata repository StorageManager manager = new StorageManager(); @@ -156,7 +142,7 @@ if (Log.DEBUG) Log.debug("deregistering resource " + resourceURL); // De-register the resource, printing a removal message if // a resource couldn't be parsed - deregisterResource(manager, resource == null); + deregisterResource(resourceURL, manager, resource == null); if (Log.ERROR) Log.error("Couldn't parse a resource from graph at " + resourceURL); } @@ -201,7 +187,7 @@ if (alreadyRegistered) { - deregisterResource(manager, true); + deregisterResource(resourceURL, manager, true); if(Log.INFO) Log.info("ALREADY REGISTERED : " + resourceURL); } else { @@ -238,7 +224,9 @@ * @param removing if the removing flag is set, a message is written to the * log stating that the resource has been removed */ - private void deregisterResource(StorageManager manager, boolean removing) { + private static void deregisterResource( String resourceURL, + StorageManager manager, + boolean removing ) { try { manager.deregisterResource(resourceURL); if (removing) { From gss at pub.open-bio.org Wed Mar 15 12:42:16 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Wed, 15 Mar 2006 12:42:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151742.k2FHgG7O032656@pub.open-bio.org> gss Wed Mar 15 12:42:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv32627/src/org/semanticmoby/ref/servlets Modified Files: ResourceInvestigationServlet.java PostResourcesServlet.java Log Message: Changed to adapt to URIInvestigator changes s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets ResourceInvestigationServlet.java,1.10,1.11 PostResourcesServlet.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/15 00:52:17 1.10 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/15 17:42:16 1.11 @@ -53,8 +53,7 @@ e2.printStackTrace(); } } else { - URIInvestigator investigator = new URIInvestigator(resourceURL); - investigator.investigate(); + URIInvestigator.investigate(resourceURL); dataBean.setUrl(resourceURL); =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/15 00:51:11 1.4 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/15 17:42:16 1.5 @@ -40,9 +40,7 @@ if (resourceURL != null) { if (!resourceURL.equals("")) { - URIInvestigator investigator = - new URIInvestigator(resourceURL); - investigator.investigate(); + URIInvestigator.investigate(resourceURL); count++; } } From kawas at pub.open-bio.org Wed Mar 15 12:56:26 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 12:56:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151756.k2FHuQEE032758@pub.open-bio.org> kawas Wed Mar 15 12:56:26 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv32733/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: fixed a crucial bug. For some strange reason a whole block of code was removed in the commit from 1.6 to 1.7. Added it back. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.13,1.14 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/02 17:59:33 1.13 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/15 17:56:26 1.14 @@ -111,13 +111,15 @@ // non null signature url SignatureURLConnection connection = new SignatureURLConnection(); MobyService[] rdfServices = null; - + // only process signature urls once if (signatureURLsProcessed.containsKey(signatureURL)) continue; else signatureURLsProcessed.put(signatureURL, ""); + rdfServices = connection.extractServicesFromURL(signatureURL); + if (rdfServices == null) { // add the url to the bad list so that the hitlist // doesnt grow by the number of services at the service From kawas at pub.open-bio.org Wed Mar 15 12:57:07 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 12:57:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151757.k2FHv7q2000344@pub.open-bio.org> kawas Wed Mar 15 12:57:07 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv319/org/biomoby/registry/rdfagent/verifier Modified Files: MobyServiceComparator.java Log Message: add comparing or lsid for the services moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier MobyServiceComparator.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java 2006/02/20 05:51:10 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java 2006/03/15 17:57:07 1.3 @@ -123,6 +123,14 @@ + service2.getDescription() + "."); isDifferent = true; } + + // compare lsids + if (!service1.getLSID().equals(service2.getLSID())) { + addDifference("Service1 has LSID " + + service1.getLSID() + " which is different from " + + service2.getLSID() + "."); + isDifferent = true; + } // compare email if (!service1.getEmailContact().equals(service2.getEmailContact())) { From kawas at pub.open-bio.org Wed Mar 15 16:18:41 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 16:18:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603152118.k2FLIfTH000899@pub.open-bio.org> kawas Wed Mar 15 16:18:41 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv874/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java Log Message: moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.13,1.14 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/03/15 16:22:38 1.13 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/03/15 21:18:41 1.14 @@ -185,6 +185,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -249,6 +250,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -675,6 +677,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -717,6 +720,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -763,6 +767,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); From kawas at pub.open-bio.org Wed Mar 15 16:33:02 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 16:33:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603152133.k2FLX2m9001007@pub.open-bio.org> kawas Wed Mar 15 16:33:02 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory pub.open-bio.org:/tmp/cvs-serv982/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: MobyAuthority.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.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/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/03/15 16:22:37 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/03/15 21:33:02 1.6 @@ -124,6 +124,7 @@ properties.setProperty("lsid_domain", LSID_SERVER); } } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); } try { @@ -132,9 +133,39 @@ properties.setProperty("lsid_port", LSID_PORT); } } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); } + try { + String CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); + if (CONFIG != null && !CONFIG.equals("")) { + System.setProperty("MOBY_CENTRAL_CONFIG", CONFIG); + properties.setProperty("MOBY_CENTRAL_CONFIG", CONFIG); + } + } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); + } + try { + String CONFIG = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (CONFIG != null && !CONFIG.equals("")) { + properties.setProperty("MOBY_SERVER", CONFIG); + System.setProperty("MOBY_SERVER", CONFIG); + } + } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); + } + try { + String CONFIG = (String) c.lookup("java:comp/env/MOBY_URI"); + if (CONFIG != null && !CONFIG.equals("")) { + System.setProperty("MOBY_URI", CONFIG); + properties.setProperty("MOBY_URI", CONFIG); + } + } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); + } + } catch (Exception e) { + System.err.println(e.getLocalizedMessage()); } } } \ No newline at end of file From lxm at pub.open-bio.org Wed Mar 15 22:37:53 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Wed, 15 Mar 2006 22:37:53 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603160337.k2G3brBb001815@pub.open-bio.org> lxm Wed Mar 15 22:37:53 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies In directory pub.open-bio.org:/tmp/cvs-serv1748 Modified Files: flybase-genequery gramene-query lin ncbi-megablast pubmed sgd-quicksearch tair-mapviewer tair-seqviewer wormbase-query Removed Files: flybase-genequery.n3 gramene-query.n3 ncbi-megablast.n3 pubmed.n3 sgd-quicksearch.n3 tair-mapviewer.n3 tair-seqviewer.n3 wormbase-query.n3 Log Message: made several changes to the formatting of the rdf files for the proxy resources, changed to use the rdf shortcut format, changed to use the xml entity definitions for attribute expansion, changed to use the moby entity as the default xml namespace, these changes should make future maintenance of these files much easier, things (uris) will only need to be changed in one place in the files also, removed the n3 versions of the files as these versions have not been maintained recently and are a few versions behind the rdf files s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies flybase-genequery,1.10,1.11 gramene-query,1.9,1.10 lin,1.4,1.5 ncbi-megablast,1.7,1.8 pubmed,1.8,1.9 sgd-quicksearch,1.9,1.10 tair-mapviewer,1.7,1.8 tair-seqviewer,1.8,1.9 wormbase-query,1.7,1.8 flybase-genequery.n3,1.8,NONE gramene-query.n3,1.7,NONE ncbi-megablast.n3,1.7,NONE pubmed.n3,1.7,NONE sgd-quicksearch.n3,1.8,NONE tair-mapviewer.n3,1.7,NONE tair-seqviewer.n3,1.8,NONE wormbase-query.n3,1.7,NONE =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/flybase-genequery,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/flybase-genequery 2006/02/09 22:37:02 1.10 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/flybase-genequery 2006/03/16 03:37:53 1.11 @@ -1,29 +1,41 @@ - - - - FlyBase Gene Query - Flybase - http://flybase.bio.indiana.edu - FlyBase gene query form at flybase.bio.indiana.edu - http://flybase.bio.indiana.edu/genes/fbgquery.hform - http://www.semanticmoby.org/examples/proxies/flybase-genequery-metadata.txt - - - - - - - - - - - - - + + + + + + + + +]> + + + + + FlyBase Gene Query + http://flybase.bio.indiana.edu/.data/docs/refman/refman-C.html#C3 + Flybase + http://flybase.bio.indiana.edu + FlyBase gene query form at flybase.bio.indiana.edu + http://flybase.bio.indiana.edu/genes/fbgquery.hform + http://www.semanticmoby.org/examples/proxies/flybase-genequery-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/gramene-query,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/gramene-query 2006/02/09 22:37:02 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/gramene-query 2006/03/16 03:37:53 1.10 @@ -1,29 +1,41 @@ - - - - Gramene Query - Gramene - http://www.gramene.org - Cereal grains database query at gramene.org - http://www.gramene.org/ - http://www.semanticmoby.org/examples/proxies/gramene-query-metadata.txt - - - - - - - - - - - - - + + + + + + + + +]> + + + + + Gramene Query + http://www.gramene.org/about/index.html + Gramene + http://www.gramene.org + Cereal grains database query at gramene.org + http://www.gramene.org/ + http://www.semanticmoby.org/examples/proxies/gramene-query-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/02/09 22:37:02 1.4 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/03/16 03:37:53 1.5 @@ -5,40 +5,37 @@ - + ]> + xmlns:proxy = "&proxy;" + xmlns = "&moby;"> + + + Legume Information Network + http://lin.ncgr.org/help/index.html + The Legume Information System + http://www.comparative-legumes.org + A Proxy to the Legume Information Network + http://lin.ncgr.org + http://www.semanticmoby.org/examples/proxies/lin-metadata.txt + + + + + + + + + + - - - Legume Information Network - The Legume Information System - http://www.comparative-legumes.org - A Proxy to the Legume Information Network - http://lin.ncgr.org - http://www.semanticmoby.org/examples/proxies/lin-metadata.txt - - - - - - - - - - - - - - - - + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/ncbi-megablast,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/ncbi-megablast 2005/12/13 23:10:24 1.7 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/ncbi-megablast 2006/03/16 03:37:53 1.8 @@ -1,29 +1,41 @@ - - - - - - - - - - - - - - - NCBI Mega BLAST - NCBI - http://www.ncbi.nlm.nih.gov - NCBI MegaBlast resource provided by NCBI - http://www.ncbi.nlm.nih.gov/BLAST/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORMAT=Semiauto&ALIGNMENTS=50&ALIGNMENT_VIEW=Tabular&CLIENT=web&DATABASE=nr&DESCRIPTIONS=100&ENTREZ_QUERY=%28none%29&EXPECT=10&FILTER=L&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&NCBI_GI=on&PAGE=MegaBlast&SERVICE=plain&SET_DEFAULTS.x=34&SET_DEFAULTS.y=8&SHOW_OVERVIEW=on&END_OF_HTTPGET=Yes&SHOW_LINKOUT=yes&GET_SEQUENCE=yes&PERC_IDENT=None,1,-2 - http://www.semanticmoby.org/examples/proxies/ncbi-megablast-metadata.txt - - + + + + + + + + +]> + + + + + NCBI Mega BLAST + http://www.ncbi.nlm.nih.gov/blast/megablast.shtml + NCBI + http://www.ncbi.nlm.nih.gov + NCBI MegaBlast resource provided by NCBI + http://www.ncbi.nlm.nih.gov/BLAST/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORMAT=Semiauto&ALIGNMENTS=50&ALIGNMENT_VIEW=Tabular&CLIENT=web&DATABASE=nr&DESCRIPTIONS=100&ENTREZ_QUERY=%28none%29&EXPECT=10&FILTER=L&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&NCBI_GI=on&PAGE=MegaBlast&SERVICE=plain&SET_DEFAULTS.x=34&SET_DEFAULTS.y=8&SHOW_OVERVIEW=on&END_OF_HTTPGET=Yes&SHOW_LINKOUT=yes&GET_SEQUENCE=yes&PERC_IDENT=None,1,-2 + http://www.semanticmoby.org/examples/proxies/ncbi-megablast-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/pubmed,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/pubmed 2006/02/09 22:37:02 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/pubmed 2006/03/16 03:37:53 1.9 @@ -1,29 +1,41 @@ - - - - - - - - PubMed - NCBI - http://www.ncbi.nlm.nih.gov - Entrez PubMed resource provided by NCBI - http://www.ncbi.nlm.nih.gov/entrez/query.fcgi? - http://www.semanticmoby.org/examples/proxies/pubmed-metadata.txt - - - - - - - - - + + + + + + + + +]> + + + + + PubMed + http://www.ncbi.nlm.nih.gov/entrez/query/static/overview.html + NCBI + http://www.ncbi.nlm.nih.gov + Entrez PubMed resource provided by NCBI + http://www.ncbi.nlm.nih.gov/entrez/query.fcgi? + http://www.semanticmoby.org/examples/proxies/pubmed-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/sgd-quicksearch,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/sgd-quicksearch 2005/12/14 18:07:11 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/sgd-quicksearch 2006/03/16 03:37:53 1.10 @@ -1,29 +1,41 @@ - - - - - - - - SGD Quick Search - SGD - http://www.yeastgenome.org - Saccharomyces cerevisiae quick search - http://db.yeastgenome.org/cgi-bin/search/quickSearch - http://www.semanticmoby.org/examples/proxies/sgd-quicksearch-metadata.txt - - - - - - - - - + + + + + + + + +]> + + + + + SGD Quick Search + http://www.yeastgenome.org/SearchContents.shtml + SGD + http://www.yeastgenome.org + Saccharomyces cerevisiae quick search + http://db.yeastgenome.org/cgi-bin/search/quickSearch + http://www.semanticmoby.org/examples/proxies/sgd-quicksearch-metadata.txt + + + + + + + + + + + + + + \ No newline at end of file =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2005/12/13 23:10:24 1.7 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2006/03/16 03:37:53 1.8 @@ -1,29 +1,41 @@ - - - - TAIR Map Viewer - TAIR - http://www.arabidopsis.org - Arabidopsis Map Viewer resource provided by TAIR - http://www.arabidopsis.org/servlets/mapper - http://www.semanticmoby.org/examples/proxies/tair-mapviewer-metadata.txt - - - - - - - - - - - - - + + + + + + + + +]> + + + + + TAIR Map Viewer + http://www.arabidopsis.org/mapViewer/help/tairmapa.jsp + TAIR + http://www.arabidopsis.org + Arabidopsis Map Viewer resource provided by TAIR + http://www.arabidopsis.org/servlets/mapper + http://www.semanticmoby.org/examples/proxies/tair-mapviewer-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-seqviewer,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-seqviewer 2005/12/13 23:10:24 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-seqviewer 2006/03/16 03:37:53 1.9 @@ -1,29 +1,41 @@ - - - - - - - - - - - - TAIR Sequence Viewer - TAIR - http://www.arabidopsis.org - Arabidopsis Sequence Viewer resource provided by TAIR - http://www.arabidopsis.org/servlets/sv - http://www.semanticmoby.org/examples/proxies/tair-seqviewer-metadata.txt - - - - - + + + + + + + + +]> + + + + + TAIR Sequence Viewer + http://www.arabidopsis.org/seqViewer/help/sv_intro.jsp + TAIR + http://www.arabidopsis.org + Arabidopsis Sequence Viewer resource provided by TAIR + http://www.arabidopsis.org/servlets/sv + http://www.semanticmoby.org/examples/proxies/tair-seqviewer-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/wormbase-query,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/wormbase-query 2005/12/13 23:10:24 1.7 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/wormbase-query 2006/03/16 03:37:53 1.8 @@ -1,29 +1,41 @@ - - - - - - - - - - - WormBase Query - WormBase - http://www.wormbase.org - C. elegans database query at wormbase.org - http://www.wormbase.org/ - http://www.semanticmoby.org/examples/proxies/wormbase-query-metadata.txt - - - - - - + + + + + + + + +]> + + + + + WormBase Query + http://www.wormbase.org/db/searches/basic + WormBase + http://www.wormbase.org + C. elegans database query at wormbase.org + http://www.wormbase.org/ + http://www.semanticmoby.org/examples/proxies/wormbase-query-metadata.txt + + + + + + + + + + + + + + rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/flybase-genequery.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/gramene-query.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/ncbi-megablast.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/pubmed.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/sgd-quicksearch.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/tair-mapviewer.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/tair-seqviewer.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/wormbase-query.n3,v: No such file or directory From lxm at pub.open-bio.org Wed Mar 15 23:07:12 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Wed, 15 Mar 2006 23:07:12 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603160407.k2G47CfB001925@pub.open-bio.org> lxm Wed Mar 15 23:07:12 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css In directory pub.open-bio.org:/tmp/cvs-serv1881/css Modified Files: smoby.css Log Message: simple bug fixes, bugs 3310 3313 3314 3315 s-moby/ref-impl/semanticmoby.org/WebRoot/css smoby.css,1.5,1.6 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css/smoby.css,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css/smoby.css 2006/02/16 18:44:19 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css/smoby.css 2006/03/16 04:07:11 1.6 @@ -1,5 +1,5 @@ -BODY {background: url(/images/pinstripe.gif); font: sans-serif; color: #0033cc;} +BODY {background: url(/images/pinstripe.gif); font-family: sans-serif; color: #0033cc;} FONT.build {color: #dddddd;} From lxm at pub.open-bio.org Wed Mar 15 23:07:12 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Wed, 15 Mar 2006 23:07:12 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603160407.k2G47CiT001906@pub.open-bio.org> lxm Wed Mar 15 23:07:11 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv1881 Modified Files: about.jsp Log Message: simple bug fixes, bugs 3310 3313 3314 3315 s-moby/ref-impl/semanticmoby.org/WebRoot about.jsp,1.5,1.6 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/about.jsp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/about.jsp 2005/11/17 02:53:02 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/about.jsp 2006/03/16 04:07:11 1.6 @@ -21,7 +21,7 @@ - DrgaonDB - The Antirrhinum majus (Snapdragon) Database + DragonDB - The Antirrhinum majus (Snapdragon) Database @@ -97,6 +97,16 @@ + +Please visit us at the + + VPIN Project Website + + +
+
+
+ <%@ include file="/footer.jsp" %> From kawas at pub.open-bio.org Thu Mar 16 10:20:44 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 16 Mar 2006 10:20:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603161520.k2GFKiWU004046@pub.open-bio.org> kawas Thu Mar 16 10:20:44 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared In directory pub.open-bio.org:/tmp/cvs-serv4016/org/biomoby/client/ui/graphical/applets/shared Modified Files: Construct.java MobyTree.java Log Message: abilitiy to use the new rdf or not (i.e. backwards compatible). moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared Construct.java,1.3,1.4 MobyTree.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/Construct.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/ui/graphical/applets/shared/Construct.java 2005/09/30 14:44:58 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/Construct.java 2006/03/16 15:20:44 1.4 @@ -1,5 +1,7 @@ package org.biomoby.client.ui.graphical.applets.shared; +import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; @@ -10,6 +12,7 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.StmtIterator; +import com.ibm.lsid.LSID; /* * @@ -64,10 +67,11 @@ // create an empty model Model model = new ModelMem(); - InputStream in = new URL(url).openStream(); - + InputStream ins = new URL(url).openStream(); + BufferedInputStream in = new BufferedInputStream(ins); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); // read the RDF/XML data - model.read(new InputStreamReader(in), ""); + model.read(reader, ""); StmtIterator iter; Statement stmt; @@ -145,10 +149,24 @@ String sub = stmt.getSubject().getURI(); String obj = stmt.getObject().toString(); - if (sub != null) - sub = sub.substring(sub.indexOf("#") + 1, sub.length()); - if (obj!= null) - obj = obj.substring(obj.indexOf("#") + 1, obj.length()); + if (sub != null) { + if (sub.indexOf("#") > 0) + sub = sub.substring(sub.indexOf("#") + 1, sub.length()); + try { + LSID lsid = new LSID(sub); + sub = lsid.getObject(); + } catch (Exception e) { + } + } + if (obj!= null) { + if (obj.indexOf("#") > 0) + obj = obj.substring(obj.indexOf("#") + 1, obj.length()); + try { + LSID lsid = new LSID(obj); + obj = lsid.getObject(); + } catch (Exception e) { + } + } if (stmt.getPredicate().getURI().indexOf(property) > 0) { //System.out.println(obj); @@ -184,4 +202,9 @@ return homes; } + + public static void main(String[] args) { + Construct c = new Construct("http://biomoby.org/RESOURCES/MOBY-S/Objects"); + System.out.println(c.createHomes("subClassOf")); + } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/MobyTree.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/MobyTree.java 2005/10/12 17:57:54 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/MobyTree.java 2006/03/16 15:20:44 1.5 @@ -15,6 +15,8 @@ import javax.swing.JTree; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; @@ -48,7 +50,9 @@ private HashMap hashmap; // will contain the nodes private String rdf = ""; String name = ""; + private boolean done = false; private static final boolean DEBUG = false; + private String last = ""; /** * A moby tree is constructed with the root node labeled as 'name'

* and the material for the tree taken from the RDF located at @@ -77,7 +81,7 @@ * the url rdf. The tree is created by looking for the property property

* @param canEdit - if true then nodes in tree can be edited, otherwise they cannot. * @param rdf - the url of the RDF describing Moby Objects, Services, Service Types, and Namespaces - * @param name - the name of the root node in the tree. + * @param name - the name of the root node in the tree, which is present in the rdf document. * @param property - the property to parse the rdf document and base a tree on */ public MobyTree(boolean canEdit, String rdf, String name, String property) { @@ -106,7 +110,21 @@ tree.setEditable(canEdit); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); - + tree.addTreeSelectionListener(new TreeSelectionListener() { + public void valueChanged(TreeSelectionEvent evt) { + // Get all nodes whose selection status has changed + TreePath[] paths = evt.getPaths(); + // Iterate through all affected nodes + for (int i = 0; i < paths.length; i++) { + if (evt.isAddedPath(i)) { + last = (String)paths[i] + .getLastPathComponent().toString(); + } else { + //TODO necessary? + } + } + } + }); } /* @@ -317,11 +335,12 @@ public void makeObjectTree(String name) { // create nodes with Object root and its children Household h = (Household) hashmap.get(name); - + // TODO catch null pointers here if (DEBUG) System.out.println(h.toString()); fillSubTree(null, h.getChildren(), this); + done = true; } /** @@ -344,9 +363,11 @@ } public void reload(String name) { + done = false; hashmap = new Construct(rdf).createHomes(); makeObjectTree(name); this.refreshTree(name); + done = true; } public void collapseMobyTree() { @@ -354,10 +375,19 @@ tree.collapseRow(0); } + public boolean done(){ + return done; + } + + + public String getLastSelected(){ + return last; + } + public static void main(String[] args) { JFrame frame = new JFrame(); - MobyTree tree = new MobyTree(false, "http://localhost:8080/RESOURCES/MOBY-S/Objects", "Object"); - tree.makeObjectTree("Object"); + MobyTree tree = new MobyTree(false, "http://biomoby.org/RESOURCES/MOBY-S/Objects", "DNASequence", "subClassOf"); + tree.makeObjectTree("DNASequence"); tree.setPreferredSize(new Dimension(400, 400)); // Add button to the frame frame.getContentPane().add(tree, BorderLayout.CENTER); From kawas at pub.open-bio.org Thu Mar 16 13:11:23 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 16 Mar 2006 13:11:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603161811.k2GIBN7w007265@pub.open-bio.org> kawas Thu Mar 16 13:11:23 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv7240/org/biomoby/client/rdf/builder Modified Files: RDFConfigure.java Log Message: replaced predicate RDFS:isDefinedBy to something more appropriate moby-live/Java/src/main/org/biomoby/client/rdf/builder RDFConfigure.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/15 16:22:38 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/16 18:11:23 1.10 @@ -21,6 +21,7 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.NodeIterator; +import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFReader; import com.hp.hpl.jena.rdf.model.RDFWriter; @@ -189,7 +190,11 @@ } else { Model model = ModelFactory.createDefaultModel(); Resource resource = model.createResource(myObject); - model.add(model.createStatement(resource, RDFS.isDefinedBy, model + Map map = model.getNsPrefixMap(); + map.put("lsid","http://lsid.omg.org/predicates#"); + model.setNsPrefixes(map); + Property prop = model.createProperty("http://lsid.omg.org/predicates#latest"); + model.add(model.createStatement(resource, prop, model .createLiteral(latest))); model.add(model.createStatement(resource, RDFS.comment, model .createLiteral("The Namespace/Datatype/ServiceType described by the LSID: " + myObject @@ -354,7 +359,11 @@ // return rdf that points to latest Model model = ModelFactory.createDefaultModel(); Resource resource = model.createResource(lsid); - model.add(model.createStatement(resource, RDFS.isDefinedBy, model + Property prop = model.createProperty("http://lsid.omg.org/predicates#latest"); + Map map = model.getNsPrefixMap(); + map.put("lsid","http://lsid.omg.org/predicates#"); + model.setNsPrefixes(map); + model.add(model.createStatement(resource, prop, model .createLiteral(ServiceInstanceRDF.getLatestLSID(details[0], details[1], lsid)))); model.add(model.createStatement(resource, RDFS.comment, model From gss at pub.open-bio.org Thu Mar 16 16:48:23 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:48:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162148.k2GLmNdD008118@pub.open-bio.org> gss Thu Mar 16 16:48:22 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet In directory pub.open-bio.org:/tmp/cvs-serv8093/src/org/semanticmoby/servlet Modified Files: AbstractMobyServlet.java Log Message: Removed a printStackTrace call s-moby/ref-impl/core/src/org/semanticmoby/servlet AbstractMobyServlet.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java 2006/01/11 10:24:39 1.11 +++ /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java 2006/03/16 21:48:22 1.12 @@ -72,7 +72,8 @@ /** * A utility method for getting a buffered reader (as returned by * the abstract getDescriptionGraphReader() method) for reading - * from a file. + * from a file. If the reader cannot be instantiated (as is the case + * when the file doesn't exist), then return null. */ protected BufferedReader getFileReader(String fileName) { @@ -81,7 +82,6 @@ new InputStreamReader( getServletContext().getResourceAsStream(fileName))); } catch (Throwable t) { - t.printStackTrace(); return null; } } From gss at pub.open-bio.org Thu Mar 16 16:51:43 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLph1R008305@pub.open-bio.org> gss Thu Mar 16 16:51:43 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis In directory pub.open-bio.org:/tmp/cvs-serv8229/WebRoot/examples/lis Modified Files: GOAnnotatedAccessionForVPINWrapper Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis GOAnnotatedAccessionForVPINWrapper,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis/GOAnnotatedAccessionForVPINWrapper,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis/GOAnnotatedAccessionForVPINWrapper 2006/02/09 22:46:41 1.2 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis/GOAnnotatedAccessionForVPINWrapper 2006/03/16 21:51:43 1.3 @@ -5,47 +5,47 @@ - - - + + + ]> + xmlns:ncgr-acc = "&ncgr-acc;" + xmlns = "&moby;"> - - - Wrapper for LIS GO Annotated Transcript Sequence Accessions Service - Wrapper for the LIS service that returns annotated transcript sequences for a given GO id - MOBY - http://www.semanticmoby.org - &moby-ex;lis - http://lin.ncgr.org/services/GOAnnotatedAccessionForVPIN.txt - - - - - - - - - - - - - - - - - - - + + Wrapper for LIS GO Annotated Transcript Sequence Accessions Service + + Wrapper for the LIS service that returns annotated transcript sequences + for a given GO id + + MOBY + http://www.semanticmoby.org + &moby-ex;lis + http://lin.ncgr.org/services/GOAnnotatedAccessionForVPIN.txt + + + + + + + + + + + + + + + + \ No newline at end of file From gss at pub.open-bio.org Thu Mar 16 16:51:45 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLpjWX008360@pub.open-bio.org> gss Thu Mar 16 16:51:45 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary In directory pub.open-bio.org:/tmp/cvs-serv8335/src/org/semanticmoby/vocabulary Modified Files: MOBY.java Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/core/src/org/semanticmoby/vocabulary MOBY.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java 2005/12/13 18:54:32 1.9 +++ /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java 2006/03/16 21:51:45 1.10 @@ -69,7 +69,7 @@ property(getURI(), "metadata"); public static String getURI() { - return "http://www.semanticmoby.org/ontologies/core/"; + return "http://ontologies.ncgr.org/moby/"; } public static String getNsPrefix() { From gss at pub.open-bio.org Thu Mar 16 16:51:43 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLphCp008324@pub.open-bio.org> gss Thu Mar 16 16:51:43 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello In directory pub.open-bio.org:/tmp/cvs-serv8229/WebRoot/examples/hello Modified Files: hello-world.rdf Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello hello-world.rdf,1.10,1.11 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello/hello-world.rdf,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello/hello-world.rdf 2005/12/14 18:07:11 1.10 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello/hello-world.rdf 2006/03/16 21:51:43 1.11 @@ -1,31 +1,43 @@ - - - - VPIN Hello World resource - Simple example of a VPIN resource - http://www.semanticmoby.org/examples/hello/display-hello-world - VPIN - http://www.semanticmoby.org - http://www.semanticmoby.org/examples/hello/metadata.txt - - - - - - - - - - - - + + + + + + + + + +]> + + + + + VPIN Hello World resource + Simple example of a VPIN resource + &ex;display-hello-world + VPIN + http://www.semanticmoby.org + http://www.semanticmoby.org/examples/hello/metadata.txt + + + + + + + + + + + + - + + \ No newline at end of file From gss at pub.open-bio.org Thu Mar 16 16:51:43 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLphe0008286@pub.open-bio.org> gss Thu Mar 16 16:51:43 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies In directory pub.open-bio.org:/tmp/cvs-serv8229/WebRoot/examples/proxies Modified Files: lin wormbase-query tair-seqviewer tair-mapviewer flybase-genequery pubmed ncbi-megablast sgd-quicksearch gramene-query Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies lin,1.5,1.6 wormbase-query,1.8,1.9 tair-seqviewer,1.9,1.10 tair-mapviewer,1.8,1.9 flybase-genequery,1.11,1.12 pubmed,1.9,1.10 ncbi-megablast,1.8,1.9 sgd-quicksearch,1.10,1.11 gramene-query,1.10,1.11 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/03/16 03:37:53 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/03/16 21:51:43 1.6 @@ -6,7 +6,7 @@ - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/resources In directory pub.open-bio.org:/tmp/cvs-serv8658/resources Added Files: smoby.example.properties Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/resources smoby.example.properties,NONE,1.1 From gss at pub.open-bio.org Thu Mar 16 18:19:44 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 18:19:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162319.k2GNJi2x008718@pub.open-bio.org> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF In directory pub.open-bio.org:/tmp/cvs-serv8658/WebRoot/WEB-INF Removed Files: smoby.example.properties Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF smoby.example.properties,1.5,NONE rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/RCS/smoby.example.properties,v: No such file or directory From gss at pub.open-bio.org Thu Mar 16 18:19:44 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 18:19:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162319.k2GNJiLX008702@pub.open-bio.org> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build In directory pub.open-bio.org:/tmp/cvs-serv8658/build Modified Files: build.xml Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/build build.xml,1.14,1.15 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build/build.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build/build.xml 2006/02/15 06:58:03 1.14 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build/build.xml 2006/03/16 23:19:44 1.15 @@ -68,23 +68,8 @@ - - - - - The file smoby.properties is missing from the WebRoot/WEB-INF - directory. The file smoby.example.properties should be copied - to smoby.properties, which should then be modified to include - appropriate values for database connections, etc. - - - - + - + From gss at pub.open-bio.org Thu Mar 16 18:19:44 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 18:19:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162319.k2GNJitm008683@pub.open-bio.org> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv8658/src/org/semanticmoby/ref/tools Modified Files: MOBYProperties.java Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools MOBYProperties.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/02 08:54:32 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/16 23:19:44 1.6 @@ -16,7 +16,7 @@ /** * The path to the S-MOBY properties file. */ - private static String PROP_FILE_NAME = "/WEB-INF/smoby.properties"; + private static String PROP_FILE_NAME = "../smoby.properties"; /** * A static Properties object for accessing the properties file. From gss at pub.open-bio.org Thu Mar 16 20:12:19 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1CJRu009245@pub.open-bio.org> gss Thu Mar 16 20:12:19 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv9201/src/org/semanticmoby/ref/servlets Modified Files: BaseServlet.java Added Files: InitServlet.java Log Message: Moved initialization functionality into InitServlet s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets InitServlet.java,NONE,1.1 BaseServlet.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/BaseServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/BaseServlet.java 2006/01/07 01:15:49 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/BaseServlet.java 2006/03/17 01:12:18 1.10 @@ -6,65 +6,24 @@ import javax.servlet.*; import javax.servlet.http.*; -import org.apache.log4j.*; - - /** * A common base class for servlets that are part of the * Semantic MOBY site itself. */ public abstract class BaseServlet extends HttpServlet { - private static boolean log4jInitialized = false; public HttpServletRequest request; public HttpServletResponse response; public DataBean dataBean; /** - * Perform various initialization tasks. - */ - public void init() throws UnavailableException { - - // initialize local variables - ServletContext ctx = getServletContext(); - - // Initialize the MOBYProperties class. - try { - - MOBYProperties.initProps(ctx); - } catch (FileNotFoundException e) { - - e.printStackTrace(); - ctx.log(e, "MOBY properties file was not found"); - throw new UnavailableException(this, e.getMessage()); - } catch (IOException e) { - - e.printStackTrace(); - ctx.log(e, "MOBY properties file could not be read"); - throw new UnavailableException(this, e.getMessage()); - } - - // Initialize log4j - synchronized (BaseServlet.class) { - - if (!log4jInitialized) { - - String path = ctx.getRealPath("/WEB-INF/log4j.properties"); - PropertyConfigurator.configure(path); - log4jInitialized = true; - } - } - } - - - /** * Don't handle a get request, instead just forward the page back to the * index.jsp page. */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - getServletContext().getRequestDispatcher("/index.jsp").forward(request, - response); + getServletContext() + .getRequestDispatcher("/index.jsp") + .forward(request, response); } } From gss at pub.open-bio.org Thu Mar 16 20:12:37 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1Cb6n009300@pub.open-bio.org> gss Thu Mar 16 20:12:37 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF In directory pub.open-bio.org:/tmp/cvs-serv9275/WebRoot/WEB-INF Modified Files: web.xml Log Message: Added entry for InitServlet s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF web.xml,1.12,1.13 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/web.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/web.xml 2006/02/15 07:58:44 1.12 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/web.xml 2006/03/17 01:12:37 1.13 @@ -2,28 +2,24 @@ - - Object factory for DataBean instances. - bean/DataBeanFactory - org.semanticmoby.ref.tools.DataBean - - - - - Resource reference to a factory for java.sql.Connection - instances that may be used for talking to a particular - database that is configured in the server.xml file. - - - jdbc/Postgres - - - javax.sql.DataSource - - - Container - - + + Object factory for DataBean instances. + bean/DataBeanFactory + org.semanticmoby.ref.tools.DataBean + + + + Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. + jdbc/Postgres + javax.sql.DataSource + Container + + + + InitServlet + 0 + org.semanticmoby.ref.servlets.InitServlet + SqlQueryServlet @@ -145,6 +141,7 @@ + SqlQueryServlet /sql-query-servlet @@ -229,6 +226,10 @@ LISExampleServlet /examples/lis + + InitServlet + /servlet/InitServlet + From gss at pub.open-bio.org Thu Mar 16 20:12:19 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1CJmC009265@pub.open-bio.org> gss Thu Mar 16 20:12:19 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv9201/WebRoot Modified Files: header.jsp Log Message: Moved initialization functionality into InitServlet s-moby/ref-impl/semanticmoby.org/WebRoot header.jsp,1.13,1.14 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/header.jsp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/header.jsp 2006/03/02 08:54:32 1.13 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/header.jsp 2006/03/17 01:12:19 1.14 @@ -1,29 +1,5 @@ <%@ page import="com.hp.hpl.jena.db.impl.DriverRDB"%> <%@ page import="org.semanticmoby.api.*"%> -<% if (!dataBean.wasInitialized()) { %> - - <% ServletContext context = getServletContext(); %> - <% try { - MOBYProperties.initProps(context); - Log.init(context.getRealPath("/smoby-log.html")); %> - - <% System.getProperties().put( - "http.proxySet", - MOBYProperties.getProperty("PROXY_SET", false)); %> - <% System.getProperties().put( - "http.proxyHost", - MOBYProperties.getProperty("PROXY_HOST", false)); %> - <% System.getProperties().put( - "http.proxyPort", - MOBYProperties.getProperty("PROXY_PORT", false)); %> - - <% dataBean.setInitialized(true); %> - - <% } catch (Exception e) { - e.printStackTrace(); - } %> - -<% } %> From gss at pub.open-bio.org Thu Mar 16 20:12:19 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1CJef009226@pub.open-bio.org> gss Thu Mar 16 20:12:18 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv9201/src/org/semanticmoby/ref/tools Modified Files: MOBYProperties.java Log Message: Moved initialization functionality into InitServlet s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools MOBYProperties.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/16 23:19:44 1.6 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/17 01:12:18 1.7 @@ -14,9 +14,10 @@ public abstract class MOBYProperties { /** - * The path to the S-MOBY properties file. + * The path to the S-MOBY properties file. It should be located in + * the servlet container's conf/ directory. */ - private static String PROP_FILE_NAME = "../smoby.properties"; + private static String PROP_FILE_NAME = "../../conf/smoby.properties"; /** * A static Properties object for accessing the properties file. @@ -38,12 +39,10 @@ if (required && (value == null)) { - throw new MissingPropertyException(propName, - "Property " + propName + - " not found in " + - PROP_FILE_NAME); + throw new MissingPropertyException( + propName, "Property " + propName + + " not found in " + PROP_FILE_NAME); } - return value; } @@ -58,7 +57,6 @@ */ public static String getProperty(String propName) throws MissingPropertyException { - return getProperty(propName, false); } @@ -69,10 +67,10 @@ * @throws IOException if the file cannot be read */ public static void initProps(ServletContext context) - throws FileNotFoundException, IOException { - - if (props == null) // Only try to read it once - { + throws FileNotFoundException, IOException { + + // Only try to read it once + if (props == null) { props = new Properties(); @@ -80,9 +78,8 @@ if (path == null) { - throw new FileNotFoundException("Properties file \"" + - PROP_FILE_NAME + - "\" not found"); + throw new FileNotFoundException( + "Properties file \"" + PROP_FILE_NAME + "\" not found"); } props.load(new FileInputStream(path)); From lxm at pub.open-bio.org Fri Mar 17 13:44:16 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiGIL011677@pub.open-bio.org> lxm Fri Mar 17 13:44:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv11648/WebRoot Modified Files: footer.jsp search-results.jsp Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/WebRoot footer.jsp,1.8,1.9 search-results.jsp,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/footer.jsp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/footer.jsp 2006/02/16 18:44:19 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/footer.jsp 2006/03/17 18:44:16 1.9 @@ -73,7 +73,7 @@
-build-2006-2j updated: 02-16-2006 +build-2006-3a updated: 03-21-2006 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2006/03/13 19:04:58 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2006/03/17 18:44:16 1.10 @@ -62,10 +62,11 @@
<% if ((moreInfo != null) && (moreInfo.trim().length() > 0)) { %> - For more information see - - <%= moreInfo %> - + For more information see: +
+ + <%= moreInfo %> + <% } %>

From lxm at pub.open-bio.org Fri Mar 17 13:44:17 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiHlM011736@pub.open-bio.org> lxm Fri Mar 17 13:44:17 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv11648/src/org/semanticmoby/ref/servlets Modified Files: InitServlet.java Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets InitServlet.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/InitServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/InitServlet.java 2006/03/17 01:12:18 1.1 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/InitServlet.java 2006/03/17 18:44:17 1.2 @@ -28,56 +28,64 @@ * mapping in web.xml. */ public class InitServlet extends HttpServlet { - - /** - * Contains any code that needs to be run when the servlet container - * starts up. - */ - public void init() throws ServletException { - - ServletContext ctx = getServletContext(); - - // Read the smoby.properties file + + /** + * Contains any code that needs to be run when the servlet container + * starts up. + */ + public void init() throws ServletException { + + ServletContext ctx = getServletContext(); + + // Read the smoby.properties file try { + MOBYProperties.initProps(ctx); - } catch (FileNotFoundException e) { + } + + catch (FileNotFoundException e) { + Log.error("MOBY properties file was not found"); throw new ServletException(e); - } catch (IOException e) { - Log.error("MOBY properties file could not be read"); + } + + catch (IOException e) { + + Log.error("MOBY properties file could not be read"); throw new ServletException(e); } - + // Initialize logging String path = ctx.getRealPath("/WEB-INF/log4j.properties"); PropertyConfigurator.configure(path); Log.init(ctx.getRealPath("/smoby-log.html")); - + // Initialize some system properties pertaining to HTTP proxies try { - System.getProperties().put( - "http.proxySet", - MOBYProperties.getProperty("PROXY_SET", false)); - System.getProperties().put( + + System.getProperties().put( + "http.proxySet", + MOBYProperties.getProperty("PROXY_SET", false)); + System.getProperties().put( "http.proxyHost", MOBYProperties.getProperty("PROXY_HOST", false)); - System.getProperties().put( + System.getProperties().put( "http.proxyPort", MOBYProperties.getProperty("PROXY_PORT", false)); + } - Context initCtx = new InitialContext(); - Context envCtx = (Context) initCtx.lookup("java:comp/env"); - DataBean dataBean = (DataBean) envCtx.lookup("bean/DataBeanFactory"); - dataBean.setInitialized(true); - - } catch (Throwable t) { - t.printStackTrace(); + catch (Exception e) { + + e.printStackTrace(); + throw new ServletException(e); } - } - - /** - * Contains any code that needs to be run when the servlet container - * is shut down. - */ - public void destroy() {} + } + + + /** + * Contains any code that needs to be run when the servlet container + * is shut down. + */ + public void destroy() { + } } From lxm at pub.open-bio.org Fri Mar 17 13:44:17 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiHEO011715@pub.open-bio.org> lxm Fri Mar 17 13:44:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api In directory pub.open-bio.org:/tmp/cvs-serv11648/src/org/semanticmoby/api Modified Files: Log.java Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api Log.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/15 00:57:37 1.2 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/17 18:44:16 1.3 @@ -43,6 +43,12 @@ private static String fileName = "smoby-log.html"; + static { + + init(); + } + + /** * Initializes the logger. * @param fileName The path/name of the log file to use. From lxm at pub.open-bio.org Fri Mar 17 13:44:17 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiHgX011696@pub.open-bio.org> lxm Fri Mar 17 13:44:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies In directory pub.open-bio.org:/tmp/cvs-serv11648/WebRoot/examples/proxies Modified Files: tair-mapviewer Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies tair-mapviewer,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2006/03/16 21:51:43 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2006/03/17 18:44:16 1.10 @@ -18,7 +18,7 @@ TAIR Map Viewer - http://www.arabidopsis.org/mapViewer/help/tairmapa.jsp + http://www.arabidopsis.org/mapViewer/help/tairmapa.jsp TAIR http://www.arabidopsis.org Arabidopsis Map Viewer resource provided by TAIR From gss at pub.open-bio.org Fri Mar 17 16:53:11 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Fri, 17 Mar 2006 16:53:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603172153.k2HLrBSR012407@pub.open-bio.org> gss Fri Mar 17 16:53:11 EST 2006 Update of /home/repository/moby/s-moby/ref-impl In directory pub.open-bio.org:/tmp/cvs-serv12370/ref-impl Removed Files: cvstag.log Log Message: cvstag.log moved from ref-impl one level up to top s-moby/ref-impl cvstag.log,1.1,NONE rcsdiff: /home/repository/moby/s-moby/ref-impl/RCS/cvstag.log,v: No such file or directory From gss at pub.open-bio.org Fri Mar 17 16:53:11 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Fri, 17 Mar 2006 16:53:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603172153.k2HLrBkQ012391@pub.open-bio.org> gss Fri Mar 17 16:53:11 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv12370 Added Files: cvstag.log Log Message: cvstag.log moved from ref-impl one level up to top s-moby cvstag.log,NONE,1.1 From gss at pub.open-bio.org Fri Mar 17 16:54:08 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Fri, 17 Mar 2006 16:54:08 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603172154.k2HLs8Zj012442@pub.open-bio.org> gss Fri Mar 17 16:54:08 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv12420 Removed Files: README.txt Log Message: Removed unnecessary file s-moby README.txt,1.2,NONE rcsdiff: /home/repository/moby/s-moby/RCS/README.txt,v: No such file or directory From gss at pub.open-bio.org Mon Mar 20 12:01:27 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Mon, 20 Mar 2006 12:01:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603201701.k2KH1Rec030899@pub.open-bio.org> gss Mon Mar 20 12:01:27 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv30872 Modified Files: cvstag.log Log Message: Removed reference to ref-impl directory, since we're tagging everything now s-moby cvstag.log,1.1,1.2 =================================================================== RCS file: /home/repository/moby/s-moby/cvstag.log,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/s-moby/cvstag.log 2006/03/17 21:53:11 1.1 +++ /home/repository/moby/s-moby/cvstag.log 2006/03/20 17:01:27 1.2 @@ -6,6 +6,6 @@ command: "cvs tag ref-impl" Tag Date Description ---------------- ---------- ---------------------------------------------- -smoby_01_00_000 03/17/2006 Re-registration fixed, registration now single - threaded, logging via Log class +------------- ---------- ---------------------------------------------- +build-2006-3a 03/17/2006 Re-registration fixed, registration now single + threaded, logging via Log class From gss at pub.open-bio.org Mon Mar 20 12:06:06 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Mon, 20 Mar 2006 12:06:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603201706.k2KH66CO030955@pub.open-bio.org> gss Mon Mar 20 12:06:06 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv30930 Modified Files: cvstag.log Log Message: Clarified instructions s-moby cvstag.log,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/cvstag.log,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/cvstag.log 2006/03/20 17:01:27 1.2 +++ /home/repository/moby/s-moby/cvstag.log 2006/03/20 17:06:06 1.3 @@ -1,9 +1,10 @@ This file is to document tagged versions of the CVS heirarchy descending from this directory. The process should be: just before tagging, add an entry to this file that describes the major features of the version being -tagged, and commit this file. Then, set CVSROOT to the value in CVS/Root, -change directory to the directory just above this, and enter the following -command: "cvs tag ref-impl" +tagged, and commit this file. Then, in the directory that contains this +file, enter the following command: + + cvs tag . Tag Date Description ------------- ---------- ---------------------------------------------- From mwilkinson at pub.open-bio.org Tue Mar 21 20:12:02 2006 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue, 21 Mar 2006 20:12:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220112.k2M1C2bd003849@pub.open-bio.org> mwilkinson Tue Mar 21 20:12:02 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv3826/Perl/MOBY Modified Files: Central.pm service_instance.pm Log Message: allow registration of services that include a user-defined LSID. This is required for the agent to properly register services based on service-provider-edited RDF, which must by necessily also have an updated LSID in order to reflect that it is edited moby-live/Perl/MOBY Central.pm,1.248,1.249 service_instance.pm,1.36,1.37 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.248 retrieving revision 1.249 diff -u -r1.248 -r1.249 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/02 17:27:09 1.248 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/22 01:12:02 1.249 @@ -1074,6 +1074,8 @@ moby YourServiceNameHere TypeOntologyTerm + http://path.to/your/signature/RDF.rdf + urn:lsid:biomoby.org:serviceinstance:myservice:version your.URI.here http://URL.to.your/Service.script; your_name at contact.address.com @@ -1215,7 +1217,7 @@ $serviceName, $serviceType, $AuthURI, $contactEmail, $URL, $authoritativeService, $desc, $Category, $INPUTS, - $OUTPUTS, $SECONDARY, $signatureURL + $OUTPUTS, $SECONDARY, $signatureURL, $serviceLSID ) = &_registerServicePayload($payload); @@ -1225,7 +1227,7 @@ # THE IMPLICATION IS THAT THEY ARE ASKING YOU TO VISIT THEIR urL now!!!! if ( defined $signatureURL ) { my $ch = 0; - my $i; + my $i; # first check if any other parameters were filled-in. If so, then the implication is that they want us to register based on the data they have provided foreach $i ( $serviceName, $serviceType, $AuthURI, $contactEmail, $URL, $desc) { if ( defined $i && $i ne "") { @@ -1250,6 +1252,7 @@ } #--------------------------------------------------------------- + $authoritativeService = (defined($authoritativeService) && $authoritativeService) ? 1 : 0; my $error; $error .= "missing serviceName \n" unless defined $serviceName; @@ -1337,6 +1340,7 @@ authoritative => $authoritativeService, description => $desc, signatureURL => $signatureURL, + lsid => $serviceLSID ); return &_error( "Service registration failed for unknown reasons", "" ) if ( !defined $SVC ); @@ -1392,15 +1396,15 @@ my $RDF = _getServiceInstanceRDF(name=>$serviceName, auth=>$AuthURI, url=>$ENV{MOBY_SERVER}, uri=>$ENV{MOBY_URI}); unless ($RDF) { - return &_success( "Registration successful but LSID resolution error", - $SVC->service_instance_id, "" ); + return &_success( "Registration successful but unable to create RDF - please contact your MOBY Central administrator", + $SVC->lsid, "" ); } unless ( $RDF =~ /RDF/ ) { return &_success( - "Registration successful but LSID resolution error $RDF", - $SVC->service_instance_id, "" ); + "Registration successful but RDF is not correctly formatted:\n\n $RDF", + $SVC->lsid, "" ); } - return &_success( "Registration successful", $SVC->service_instance_id, + return &_success( "Registration successful", $SVC->lsid, $RDF ); } @@ -1656,6 +1660,7 @@ &_nodeTextContent( $Object, "authoritativeService" ); my $URL = &_nodeTextContent( $Object, "URL" ); my $signatureURL = &_nodeTextContent( $Object, "signatureURL" ); + my $serviceLSID = &_nodeTextContent( $Object, "serviceLSID" ); my $desc = &_nodeCDATAContent( $Object, "Description" ); my $INPUTS = &_nodeRawContent( $Object, "Input" ); # returns array ref my $OUTPUTS = &_nodeRawContent( $Object, "Output" ); # returns array ref @@ -1665,7 +1670,7 @@ $serviceName, $serviceType, $AuthURI, $contactEmail, $URL, $authoritativeService, $desc, $Category, $INPUTS, - $OUTPUTS, $SECONDARIES, $signatureURL + $OUTPUTS, $SECONDARIES, $signatureURL, $serviceLSID ); } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/02/24 01:21:26 1.36 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 01:12:02 1.37 @@ -230,14 +230,16 @@ #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; - my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; - my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; - $LSID_Auth ||="biomoby.org"; - $LSID_NS ||="serviceinstance"; - my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" - . $self->authority_uri . "," - . $self->servicename.":"."$date"; # LSID with timestamp - $self->lsid($service_lsid); + unless ($self->lsid){ # if we were not passed an lsid by the service creator, we had better make one now + my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; + my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; + $LSID_Auth ||="biomoby.org"; + $LSID_NS ||="serviceinstance"; + my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" + . $self->authority_uri . "," + . $self->servicename.":"."$date"; # LSID with timestamp + $self->lsid($service_lsid); + } my $id = $self->adaptor->insert_service_instance( category => $self->category, servicename => $self->servicename, @@ -248,7 +250,7 @@ authoritative => $self->authoritative, description => $self->description, signatureURL => $self->signatureURL, - lsid => $service_lsid + lsid => $self->lsid ); return undef unless $id; $self->service_instance_id($id); From kawas at pub.open-bio.org Tue Mar 21 20:22:37 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 21 Mar 2006 20:22:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220122.k2M1MbII003932@pub.open-bio.org> kawas Tue Mar 21 20:22:37 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv3907 Modified Files: Central.pm Log Message: a semi-colon was missing moby-live/Perl/MOBY Central.pm,1.249,1.250 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.249 retrieving revision 1.250 diff -u -r1.249 -r1.250 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/22 01:12:02 1.249 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/22 01:22:37 1.250 @@ -1240,7 +1240,7 @@ my $path = $conf->{mobycentral}->{rdfagent}; # PRE: $path = complete path to the run-RDFagent.bat or .sh file *AND* the agent is configured correctly $signatureURL =~ s/\s+//g; - my $rez = system("$path -url $signatureURL" ) + my $rez = system("$path -url $signatureURL" ); return &_success( "The RDFagent call was successful.", "","" ) From kawas at pub.open-bio.org Tue Mar 21 21:51:30 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 21 Mar 2006 21:51:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220251.k2M2pUgL004201@pub.open-bio.org> kawas Tue Mar 21 21:51:30 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv4175 Modified Files: service_instance.pm Log Message: checking of the lsids that service providers pass in moby-live/Perl/MOBY service_instance.pm,1.37,1.38 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 01:12:02 1.37 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 02:51:30 1.38 @@ -230,7 +230,26 @@ #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; - unless ($self->lsid){ # if we were not passed an lsid by the service creator, we had better make one now + if ($self->lsid){ + # we were passed in an LSID, so lets construct a correct one and append the revision + use LS::ID; + my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; + my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; + $LSID_Auth ||="biomoby.org"; + $LSID_NS ||="serviceinstance"; + my $rev = ""; + my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" + . $self->authority_uri . "," + . $self->servicename.":"; + # create a new lsid + my $lsid = LS::ID->new($self->lsid); + # ensure that the lsid was valid syntacticly + return undef unless $lsid; + $rev = $lsid->_revision; + return undef unless $rev; + $self->lsid($service_lsid . $rev); + } else { + # create an LSID if one wasnt passed in my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; $LSID_Auth ||="biomoby.org"; @@ -238,7 +257,7 @@ my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" . $self->authority_uri . "," . $self->servicename.":"."$date"; # LSID with timestamp - $self->lsid($service_lsid); + $self->lsid($service_lsid); } my $id = $self->adaptor->insert_service_instance( category => $self->category, From senger at pub.open-bio.org Wed Mar 22 02:36:41 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Wed, 22 Mar 2006 02:36:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220736.k2M7afK1004844@pub.open-bio.org> senger Wed Mar 22 02:36:41 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes In directory pub.open-bio.org:/tmp/cvs-serv4787/src/main/org/biomoby/shared/datatypes Modified Files: MapPrimitiveDataTypes.java Log Message: moby-live/Java/src/main/org/biomoby/shared/datatypes MapPrimitiveDataTypes.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java 2005/08/29 13:21:59 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java 2006/03/22 07:36:40 1.3 @@ -10,6 +10,8 @@ import org.biomoby.shared.MobyException; import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; /** * Class containing static mapping between Biomoby primitive data @@ -51,7 +53,26 @@ public Class getClass (String dataTypeName) throws MobyException { String className = (String)type2class.get (dataTypeName); - if (className == null) return null; + if (className == null) { + + // a hack: sometimes the 'dataTypeName' is wrong - it is + // the last piece of a class name (e.g. text_base64) + // instead of a rel data type name (e.g. text-base64) - so + // I try here to find it anyway, but this will go away + // when MobyObject (and all generated datatypes) return + // its data ype name properly... + String classNameEnding = "." + dataTypeName; + for (Iterator it = type2class.entrySet().iterator(); it.hasNext(); ) { + Map.Entry entry = (Map.Entry)it.next(); + String cName = (String)entry.getValue(); + if ( cName.endsWith (classNameEnding) ) { + className = cName; + break; + } + } + if (className == null) + return null; + } try { return Class.forName (className); } catch (Exception e) { From senger at pub.open-bio.org Wed Mar 22 02:36:40 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Wed, 22 Mar 2006 02:36:40 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220736.k2M7aeXx004806@pub.open-bio.org> senger Wed Mar 22 02:36:40 EST 2006 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv4787 Modified Files: build.xml Log Message: moby-live/Java build.xml,1.52,1.53 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- /home/repository/moby/moby-live/Java/build.xml 2006/03/13 10:22:20 1.52 +++ /home/repository/moby/moby-live/Java/build.xml 2006/03/22 07:36:40 1.53 @@ -1509,7 +1509,7 @@ + description="Generate jar files with generated data types and skeletons."> From senger at pub.open-bio.org Wed Mar 22 02:36:41 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Wed, 22 Mar 2006 02:36:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220736.k2M7afci004825@pub.open-bio.org> senger Wed Mar 22 02:36:40 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/renderers In directory pub.open-bio.org:/tmp/cvs-serv4787/src/main/org/biomoby/service/dashboard/renderers Modified Files: renderers.conf.xml Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard/renderers renderers.conf.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/renderers/renderers.conf.xml,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/renderers/renderers.conf.xml 2006/02/19 18:42:56 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/renderers/renderers.conf.xml 2006/03/22 07:36:40 1.2 @@ -4,6 +4,7 @@ + From mwilkinson at pub.open-bio.org Wed Mar 22 16:38:58 2006 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed, 22 Mar 2006 16:38:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603222138.k2MLcwMN007427@pub.open-bio.org> mwilkinson Wed Mar 22 16:38:58 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv7408/Perl/MOBY Modified Files: service_instance.pm Log Message: dueling code with Eddie. This version validates the structure of an incoming LSID prior to creating the service instance, rather than imposing our structure on the LSID. The only part that is imposed is the timestamp, which we have promised in our RFC will have a particular format. Services that attempt to register with an LSID that is incorrectly formatted will fail - service_instance returns undef, MOBY::Central returns failure registration object. Unfortunately, at the moment service_instance.pm has no way of passing back the REASON for the failure, so it may be a bit cryptic to the person trying to register the service.... moby-live/Perl/MOBY service_instance.pm,1.38,1.39 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 02:51:30 1.38 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 21:38:58 1.39 @@ -182,7 +182,10 @@ } return undef unless $self->authority_uri; return undef unless $self->servicename; - + if( $self->lsid){ + my $l = $self->lsid; # but is LSID valid format? + return undef unless $l =~ m'urn\:lsid\:[^:/?#\.]+(\.[^:/?#\.]+)+\:[^:/?#\.]+\:[^:/?#\.]+\:\d\d\-\d\d\-\d\dT\d\d\-\d\d\-\d\d'; + } if ( $self->test ) { return $self->service_instance_exists } # returns boolean $self->authority( $self->_get_authority() ); # as MOBY::authority object @@ -230,32 +233,16 @@ #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; - if ($self->lsid){ - # we were passed in an LSID, so lets construct a correct one and append the revision - use LS::ID; - my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; - my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; - $LSID_Auth ||="biomoby.org"; - $LSID_NS ||="serviceinstance"; - my $rev = ""; - my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" - . $self->authority_uri . "," - . $self->servicename.":"; - # create a new lsid - my $lsid = LS::ID->new($self->lsid); - # ensure that the lsid was valid syntacticly - return undef unless $lsid; - $rev = $lsid->_revision; - return undef unless $rev; - $self->lsid($service_lsid . $rev); - } else { + unless ($self->lsid){ # create an LSID if one wasnt passed in my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; $LSID_Auth ||="biomoby.org"; $LSID_NS ||="serviceinstance"; + +# TODO - # MOBY Central should validate the format of authority uri and servicename when it starts up, sice we are using them to construct LSID's my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" - . $self->authority_uri . "," + . $self->authority_uri . "," . $self->servicename.":"."$date"; # LSID with timestamp $self->lsid($service_lsid); } From kawas at pub.open-bio.org Thu Mar 23 10:11:42 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 23 Mar 2006 10:11:42 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231511.k2NFBgfn010151@pub.open-bio.org> kawas Thu Mar 23 10:11:42 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv10125/org/biomoby/client/rdf/builder Modified Files: RDFConfigure.java Log Message: moby-live/Java/src/main/org/biomoby/client/rdf/builder RDFConfigure.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.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/rdf/builder/RDFConfigure.java 2006/03/16 18:11:23 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/23 15:11:42 1.11 @@ -333,13 +333,13 @@ /** * - * PRE:myObject is the valid uri for the service instance. + * PRE:lsid is the valid lsid for the service instance. *

* POST:the rdf representing the service instance is returned. *

* - * @param myObject - - * the uri of the service instance + * @param lsid - + * the lsid of the service instance * @return the rdf representation of the service instance. * @throws IOException */ @@ -415,6 +415,11 @@ return false; } + /** + * + * @param lsid the lsid of the object to check existence for + * @return true if the object existed, perhaps under a different LSID revision, false otherwise. + */ public final boolean objectExisted(String lsid) { ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); LSID theLsid = null; @@ -434,6 +439,11 @@ return false; } + /** + * + * @param lsid the LSID to use as a template for finding the latest LSID + * @return the latest lsid or the empty string if one was not found + */ public final String getLatestLSID(String lsid) { ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); LSID theLsid = null; From kawas at pub.open-bio.org Thu Mar 23 10:16:56 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 23 Mar 2006 10:16:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231516.k2NFGuon010204@pub.open-bio.org> kawas Thu Mar 23 10:16:56 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv10179/org/biomoby/registry/definitions/types Modified Files: JObjectsSqlImpl.java Log Message: moby-live/Java/src/main/org/biomoby/registry/definitions/types JObjectsSqlImpl.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java 2006/03/15 16:22:37 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java 2006/03/23 15:16:56 1.3 @@ -195,7 +195,36 @@ /** * - * @return + * method that returns the various object types, object relationship, object + * type that this relationship is with, the articlename (if it exists), + * description, the objects lsid, the authority of the creator of the + * object, the email address of the creator, and the LSID for the + * relationship this object has with the other object all tab-delimited. + *

+ * PRE:None. + *

+ * POST:A string array containing sub string arrays containing the + * various object types, object relationship, object type that this + * relationship is with, the articlename (if it exists), description, the + * objects lsid, the authority of the creator of the object, the email + * address of the creator, and the LSID for the relationship this object has + * with the other object all tab-delimited + *

+ * Example of the structure that is returned: [[object type, relationship + * type, object type relationship is with, articlename, description of the + * object type, object lsid, authority, email, lsid of the object this + * object has a relationship with]] + *

+ * note that articlename may not be applicable to all relationship + * types + * + * @return A string array, with each item in the array being another string + * array containing the various object types, object relationship, + * object type that this relationship is with, the articlename (if + * it exists), description, the objects lsid, the authority of the + * creator of the object, the email address of the creator, and the + * LSID for the relationship this object has with the other object + * all tab-delimited. */ public String[][] getFullObjectsAsArray() { ArrayList sb = new ArrayList(); @@ -228,6 +257,7 @@ sb.toArray(array); return array; } + public static void main(String[] args) throws MobyException { String[][] datatypes = new JObjectsSqlImpl().getFullObjectsAsArray(); for (int i = 0; i < datatypes.length; i++) { From mwilkinson at pub.open-bio.org Thu Mar 23 13:00:50 2006 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu, 23 Mar 2006 13:00:50 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231800.k2NI0o8U011505@pub.open-bio.org> mwilkinson Thu Mar 23 13:00:50 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv11482/MOBY Modified Files: OntologyServer.pm service_instance.pm Log Message: timestamp format was wrong. four digit year, not two digit year moby-live/Perl/MOBY OntologyServer.pm,1.100,1.101 service_instance.pm,1.39,1.40 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2006/02/21 00:43:36 1.100 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2006/03/23 18:00:50 1.101 @@ -1380,7 +1380,7 @@ my $URI; my ($sec,$min,$hour,$mday,$month,$year, $wday,$yday,$dst) =gmtime(time); -my $date = sprintf ("%02d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); +my $date = sprintf ("%04d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); # $id = lc($id); if ( $self->ontology eq 'object' ) { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 21:38:58 1.39 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/23 18:00:50 1.40 @@ -184,7 +184,7 @@ return undef unless $self->servicename; if( $self->lsid){ my $l = $self->lsid; # but is LSID valid format? - return undef unless $l =~ m'urn\:lsid\:[^:/?#\.]+(\.[^:/?#\.]+)+\:[^:/?#\.]+\:[^:/?#\.]+\:\d\d\-\d\d\-\d\dT\d\d\-\d\d\-\d\d'; + return undef unless $l =~ m'urn\:lsid\:[^:/?#\.]+(\.[^:/?#\.]+)+\:[^:/?#\.]+\:[^:/?#\.]+\:\d\d\d\d-\d\d\-\d\dT\d\d\-\d\d\-\d\d'; } if ( $self->test ) { return $self->service_instance_exists } # returns boolean @@ -229,7 +229,7 @@ ) { # then create it de novo if we have enough information # create a timestamp for the LSID my ($sec,$min,$hour,$mday,$month,$year, $wday,$yday,$dst) =gmtime(time); - my $date = sprintf ("%02d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); + my $date = sprintf ("%04d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; From kawas at pub.open-bio.org Fri Mar 24 12:52:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 12:52:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603241752.k2OHqcHX015350@pub.open-bio.org> kawas Fri Mar 24 12:52:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv15307/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: fixed a bug where the rdf is valid RDF, but doesnt contain a valid service description. This resulted in a null pointer exception. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/23 19:10:31 1.15 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/24 17:52:38 1.16 @@ -77,7 +77,7 @@ if (badURLs.containsKey(signatureURL)) { Log.warning("The signature url, " + signatureURL + ", has already been" + newline + " processed and was invalid" - + " for one reason or another."); + + " for one reason or another." ); removeInvalidSignatureURLServiceFromRegistry(registryService, central, "The service has an invalid signature url.", ((Integer) badURLs @@ -116,7 +116,8 @@ // add the url to the bad list so that the hitlist // doesnt grow by the number of services at the service // description location - badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); + badURLs.put(signatureURL, + (connection.getBadUrlMap().get(signatureURL))); // rdf is missing removeInvalidSignatureURLService(registryService, central, "The signature url was missing, or the rdf document was invalid.", @@ -129,7 +130,8 @@ // this would happen if a url contained rdf but not // current rdf - badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); + badURLs.put(signatureURL, + (connection.getBadUrlMap().get(signatureURL))); // no services found in the document removeInvalidSignatureURLService(registryService, central, "given, " + signatureURL + ", no service was found called " @@ -589,10 +591,12 @@ if (enableServiceUpdates) { // TODO keep track of the revision on the new service - change the // revision to the one in the document - int code = removeChangedServiceFromRegistry(registryService, central, differences); + int code = removeChangedServiceFromRegistry(registryService, central, differences, + rdfService.getEmailContact()); if (code == 200) { if (addServiceToRegistry(rdfService, central)) { // service was added + } else { // service was not added, so replace with old one? if (!addServiceToRegistry(registryService, central)) { @@ -746,7 +750,7 @@ * remove a changed service */ private int removeChangedServiceFromRegistry(MobyService service, Central central, - String changes) { + String changes, String email) { // create and optionally save the report Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, @@ -768,7 +772,9 @@ } if (sendMailOnChanged) { - sendMail(service, report); + MobyService ms = service; + ms.setEmailContact(email); + sendMail(ms, report); } Log.info("Service, (" + service.getName() + ", " + service.getAuthority() From kawas at pub.open-bio.org Fri Mar 24 12:52:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 12:52:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603241752.k2OHqcPL015332@pub.open-bio.org> kawas Fri Mar 24 12:52:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory pub.open-bio.org:/tmp/cvs-serv15307/org/biomoby/registry/rdfagent/util Modified Files: SignatureURLConnection.java Log Message: fixed a bug where the rdf is valid RDF, but doesnt contain a valid service description. This resulted in a null pointer exception. moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/02 03:20:52 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/24 17:52:38 1.9 @@ -187,14 +187,20 @@ Log.severe("There was something wrong with the model: " + newline + e.getLocalizedMessage()); performURLErrorHandling(url, 501); + return new MobyService[]{}; } Log.info("Parsing complete."); if (parser.isRDFValid()) { // RDF was valid and no bad service found + if (services.length == 0) { + performURLErrorHandling(url, 501); + return services; + } if (services != null) return services; } else { + Log.info("RDF contained some invalid services."); // RDF was found to contain bad services // process the bad ones and return the good ones. String errors = parser.getErrors(); @@ -218,6 +224,10 @@ } } } + if (services.length == 0) { + performURLErrorHandling(url, 501); + return services; + } if (services != null) return services; } @@ -270,7 +280,11 @@ central = new CentralDataAccessImpl(); int count = central.getErrorCountForURL(url); if (count == 0) { - central.insertErrorCountForURL(url, code); + if (central.insertErrorCountForURL(url, code)) { + Log.info("Error count for " + url + " was inserted! The count is 1."); + } else { + Log.warning("Error count for " + url + " was not inserted! Make sure that the DB parameters are correct!"); + } } else { if ((++count) >= Constants.REGISTRY_DEREGISTER_COUNT) { central.deleteErrorCountForURL(url); From kawas at pub.open-bio.org Fri Mar 24 13:16:57 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 13:16:57 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603241816.k2OIGv5o015427@pub.open-bio.org> kawas Fri Mar 24 13:16:56 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory pub.open-bio.org:/tmp/cvs-serv15402/org/biomoby/registry/rdfagent/util Modified Files: SignatureURLConnection.java Log Message: the service_validation table wasnt updated properly. In cases where there was a file at the signatureURL, the table removed the entry for the url even though the file contained in valid 'stuff' in it. moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/24 17:52:38 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/24 18:16:56 1.10 @@ -92,31 +92,31 @@ urlConnection.disconnect(); Log.info("Closing the url connection."); - if (Constants.REGISTRY_ENABLE_DEREGISTER) { - // remove the url from the hit list if necessary and if - // deregistration is enabled - CentralDataAccess central = null; - try { - central = new CentralDataAccessImpl(); - int count = central.getErrorCountForURL(url); - if (count != 0) { - Log.info("Attempting to remove " + url - + " from the 'hit list'."); - if (central.deleteErrorCountForURL(url)) { - Log.info("Removal success!"); - } else { - Log.info("Removal failed."); - } - } - if (central != null) - central.cleanup(); - } catch (MobyException e) { - Log.exception(this.getClass().getName(), - "getRdfFromURL(String)", e); - Log.severe(e.getLocalizedMessage()); - code = 417; - } - } +// if (Constants.REGISTRY_ENABLE_DEREGISTER) { +// // remove the url from the hit list if necessary and if +// // deregistration is enabled +// CentralDataAccess central = null; +// try { +// central = new CentralDataAccessImpl(); +// int count = central.getErrorCountForURL(url); +// if (count != 0) { +// Log.info("Attempting to remove " + url +// + " from the 'hit list'."); +// if (central.deleteErrorCountForURL(url)) { +// Log.info("Removal success!"); +// } else { +// Log.info("Removal failed."); +// } +// } +// if (central != null) +// central.cleanup(); +// } catch (MobyException e) { +// Log.exception(this.getClass().getName(), +// "getRdfFromURL(String)", e); +// Log.severe(e.getLocalizedMessage()); +// code = 417; +// } +// } Log.info("Got an RDF model."); if (code == 200 || code == 202) return model; @@ -194,11 +194,15 @@ if (parser.isRDFValid()) { // RDF was valid and no bad service found if (services.length == 0) { + // there was nothing in the document performURLErrorHandling(url, 501); return services; } - if (services != null) + if (services != null) { + // RDF document was ok after all, so remove url from hitlist + removeFromHitlist(url); return services; + } } else { Log.info("RDF contained some invalid services."); // RDF was found to contain bad services @@ -225,11 +229,15 @@ } } if (services.length == 0) { + // there was nothing in the document performURLErrorHandling(url, 501); return services; } - if (services != null) + if (services != null) { + // RDF document was ok after all, so remove url from hitlist + removeFromHitlist(url); return services; + } } } return new MobyService[] {}; @@ -239,6 +247,36 @@ * */ + /** + * @param url + */ + private void removeFromHitlist(String url) { + if (Constants.REGISTRY_ENABLE_DEREGISTER) { + // remove the url from the hit list if necessary and if + // deregistration is enabled + CentralDataAccess central = null; + try { + central = new CentralDataAccessImpl(); + int count = central.getErrorCountForURL(url); + if (count != 0) { + Log.info("Attempting to remove " + url + + " from the 'hit list'."); + if (central.deleteErrorCountForURL(url)) { + Log.info("Removal success!"); + } else { + Log.info("Removal failed."); + } + } + if (central != null) + central.cleanup(); + } catch (MobyException e) { + Log.exception(this.getClass().getName(), + "getRdfFromURL(String)", e); + Log.severe(e.getLocalizedMessage()); + } + } + } + private void performURLErrorHandling(String url, int code) { if (code == 400) { Log From kawas at pub.open-bio.org Fri Mar 24 19:35:27 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 19:35:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603250035.k2P0ZRft016265@pub.open-bio.org> kawas Fri Mar 24 19:35:27 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv16240/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: in cases where the revision on the LSIDs are not different but there were modifications, it would be nice to know what the changes were. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/24 17:52:38 1.16 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/25 00:35:27 1.17 @@ -226,7 +226,7 @@ Log.info("The service " + rdfServices[i].getUniqueName() + " and the service " + registryService.getUniqueName() - + " have lsids that describe different services."); + + " have lsids that describe different services." + newline + "The differences found were: "+newline + comparator.getDifferences()); } @@ -352,7 +352,7 @@ + newline + "to update the service. Please modify " + newline - + "the LSID revision for your service."); + + "the LSID revision for your service." + newline + "The differences found were: "+newline + comparator.getDifferences()); } continue; } @@ -565,7 +565,7 @@ + " have the same LSID (and revision) " + newline + "and due to this, the agent chose not " + newline + "to update the service. Please modify " + newline - + "the LSID revision for your service."); + + "the LSID revision for your service." + newline + "The differences found were: "+newline + comparator.getDifferences()); } continue; } From kawas at pub.open-bio.org Wed Mar 15 11:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMcLu032225@pub.open-bio.org> kawas Wed Mar 15 11:22:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/ui/graphical/servlet/jresources Modified Files: RESOURCE.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.13,1.14 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/01/03 19:24:15 1.13 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/03/15 16:22:38 1.14 @@ -19,17 +19,15 @@ import javax.servlet.http.HttpServletResponse; import org.biomoby.client.CentralDigestImpl; +import org.biomoby.client.CentralImpl; import org.biomoby.client.rdf.builder.ServiceInstanceRDF; import org.biomoby.client.rdf.vocabulary.Predicates; -import org.biomoby.client.rdf.vocabulary.XMLTypes; import org.biomoby.registry.definitions.types.JNamespacesSqlImpl; import org.biomoby.registry.definitions.types.JObjectsSqlImpl; import org.biomoby.registry.definitions.types.JServicesSqlImpl; -import org.biomoby.registry.properties.RegistryOS; +import org.biomoby.shared.Central; import org.biomoby.shared.CentralDigest; import org.biomoby.shared.MobyException; -import org.biomoby.shared.MobyNamespace; -import org.biomoby.shared.MobyPrimaryDataSimple; import org.biomoby.shared.MobyService; import org.w3c.rdf.model.ModelException; @@ -51,336 +49,352 @@ /** * * @author Eddie Kawas - *

This class was created to replace the old perl RESOURCES script. Using this - * class provides access to the RDF documents describing the object, service type, - * services, namespace and predicate ontologies. - *

if you have any questions, please email me at ed.kawas at gmail.com - * + *

+ * This class was created to replace the old perl RESOURCES script. + * Using this class provides access to the RDF documents describing the + * object, service type, services, namespace and predicate ontologies. + *

+ * if you have any questions, please email me at ed.kawas at gmail.com + * */ public class RESOURCE extends HttpServlet { - /** - * - */ - private static final long serialVersionUID = 1L; - - private static final String Four0FourError = "" - + "" - + "" - + "Apache Tomcat - Error report

HTTP Status 404 - Resource not found


type Status report

message The requested resource was not found.

description The requested resource () is not available.


 

"; - - - private static final String OBJ = "http://biomoby.org/RESOURCES/MOBY-S/Objects#"; - - private static final String SRV = "http://biomoby.org/RESOURCES/MOBY-S/Services#"; - - private static final String NS = "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; - - private static final String MP = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; - - private static final String SI = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; - - private static boolean RUN_MAIN = false; - - /* - * (non-Javadoc) - * - * @see javax.servlet.GenericServlet#init() - */ - public final void init() throws ServletException { - // super.init(); - // try to load environment variables set in context.xml - try { - Context c = new InitialContext(); - String MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); - String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); - String MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); - if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { - // set MOBY_CENTRAL_CONFIG - System.setProperty("MOBY_CENTRAL_CONFIG",MOBY_CENTRAL_CONFIG); - } - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - // set MOBY_SERVER - System.setProperty("MOBY_SERVER",MOBY_SERVER); - } - if (MOBY_URI != null && !MOBY_URI.equals("")) { - // set MOBY_URI - System.setProperty("MOBY_URI",MOBY_URI); - } - - } catch (Exception e) {} - } - - protected final void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - PrintWriter out = response.getWriter(); - String path = request.getPathInfo(); - Pattern p = Pattern.compile("/MOBY\\-S/(\\S+)"); - Matcher m = p.matcher(path); - if (path == null || !m.matches()) { - out - .println(" not MOBY-S

not MOBY-S

"); - return; - } else { - String ontology = m.group(1); - if (ontology.equals("Objects") || ontology.equals("Namespaces") - || ontology.equals("ServiceInstances") - || ontology.equals("FULL") || ontology.equals("Predicates") - || ontology.equals("Services")|| ontology.equals("ServiceDescription")) { - // generate rdf - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - if (ontology.equals("Objects")) { - try { - model = getObjects(model); - } catch (MobyException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get Objects"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Objects"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("Namespaces")) { - try { - model = getNamespaces(model); - } catch (MobyException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get Namespaces"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Namespaces"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("Services")) { - try { - model = getServices(model); - } catch (MobyException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get Services"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Service"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("ServiceInstances")) { - try { - model = getServiceInstances(model); - } catch (Exception e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get ServiceInstances"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=ServiceInstances"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("Predicates")) { - String s = getPredicates(); - - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Predicates"); - out.write(s); - out.close(); - return; - } else if (ontology.equals("ServiceDescription")) { - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=ServiceDescription"); - out.write(serviceDescriptionVocabulary); - out.close(); - return; - } else if (ontology.equals("FULL")) { - try { - model = getAll(model); - } catch (Exception e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get All"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=All"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } - } else { - // response.sendError(HttpServletResponse.SC_NOT_FOUND); - out.println(RESOURCE.Four0FourError); - return; - } - } - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model a model that we can add statements to. - * @return an rdf model that contains all of the moby objects. - * @throws MobyException - */ - public final Model getAll(Model model) throws Exception { - model = getObjects(model); - model = getServices(model); - model = getNamespaces(model); - // add the predicates to the model - RDFReader reader = model.getReader(); - reader.read(model, new ByteArrayInputStream(getPredicates().getBytes()), null); - try { - model = getServiceInstances(model); - } catch (ModelException e) { - e.printStackTrace(); - return null; - } - return model; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @return - * @throws ModelException - */ - private final Model getServiceInstances(Model model) throws Exception { - if (RUN_MAIN) { - createNsMap(model); - } - CentralDigest central = null; - MobyService[] services = null; - try { - // TODO should i make this more general by adding a parameter for the endpoint? - String registryURL; + /** + * + */ + private static final long serialVersionUID = 1L; + + private static final String Four0FourError = "" + + "" + + "" + + "Apache Tomcat - Error report

HTTP Status 404 - Resource not found


type Status report

message The requested resource was not found.

description The requested resource () is not available.


 

"; + + private static final String OBJ = "http://biomoby.org/RESOURCES/MOBY-S/Objects#"; + + private static final String SRV = "http://biomoby.org/RESOURCES/MOBY-S/Services#"; + + private static final String NS = "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; + + private static final String MP = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; + + private static final String SI = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; + + private static boolean RUN_MAIN = false; + + /* + * (non-Javadoc) + * + * @see javax.servlet.GenericServlet#init() + */ + public final void init() throws ServletException { + // super.init(); + // try to load environment variables set in context.xml + System.out.println("init(setting environment variables)"); + try { + Context c = new InitialContext(); + + try { + String MOBY_CENTRAL_CONFIG = null; + MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); + if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { + // set MOBY_CENTRAL_CONFIG + System.out.println("init(setting MOBY_CENTRAL_CONFIG)"); + System.setProperty("MOBY_CENTRAL_CONFIG", MOBY_CENTRAL_CONFIG); + } + + } catch (Exception ex) { + } + try { + String MOBY_SERVER = null; + MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + // set MOBY_SERVER + System.out.println("init(setting MOBY_SERVER)"); + System.setProperty("MOBY_SERVER", MOBY_SERVER); + } + } catch (Exception ex) { + } + + try { + String MOBY_URI = null; + MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); + if (MOBY_URI != null && !MOBY_URI.equals("")) { + // set MOBY_URI + System.out.println("init(setting MOBY_URI)"); + System.setProperty("MOBY_URI", MOBY_URI); + } + } catch (Exception ex) { + } + + } catch (Exception e) { + } + } + + protected final void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + PrintWriter out = response.getWriter(); + String path = request.getPathInfo(); + Pattern p = Pattern.compile("/MOBY\\-S/(\\S+)"); + Matcher m = p.matcher(path); + if (path == null || !m.matches()) { + out + .println(" not MOBY-S

not MOBY-S

"); + return; + } else { + String ontology = m.group(1); + if (ontology.equals("Objects") || ontology.equals("Namespaces") + || ontology.equals("ServiceInstances") || ontology.equals("FULL") + || ontology.equals("Predicates") || ontology.equals("Services") + || ontology.equals("ServiceDescription")) { + // generate rdf + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + if (ontology.equals("Objects")) { + try { + model = getObjects(model); + } catch (MobyException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get Objects"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Objects"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("Namespaces")) { + try { + model = getNamespaces(model); + } catch (MobyException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get Namespaces"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Namespaces"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("Services")) { + try { + model = getServices(model); + } catch (MobyException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get Services"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Service"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("ServiceInstances")) { + try { + model = getServiceInstances(model); + } catch (Exception e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get ServiceInstances"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", + "attachment;filename=ServiceInstances"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("Predicates")) { + String s = getPredicates(); + + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Predicates"); + out.write(s); + out.close(); + return; + } else if (ontology.equals("ServiceDescription")) { + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", + "attachment;filename=ServiceDescription"); + out.write(serviceDescriptionVocabulary); + out.close(); + return; + } else if (ontology.equals("FULL")) { + try { + model = getAll(model); + } catch (Exception e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Could not get All"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=All"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } + } else { + // response.sendError(HttpServletResponse.SC_NOT_FOUND); + out.println(RESOURCE.Four0FourError); + return; + } + } + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * a model that we can add statements to. + * @return an rdf model that contains all of the moby objects. + * @throws MobyException + */ + public final Model getAll(Model model) throws Exception { + model = getObjects(model); + model = getServices(model); + model = getNamespaces(model); + // add the predicates to the model + RDFReader reader = model.getReader(); + reader.read(model, new ByteArrayInputStream(getPredicates().getBytes()), null); + try { + model = getServiceInstances(model); + } catch (ModelException e) { + e.printStackTrace(); + return null; + } + return model; + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @return + * @throws ModelException + */ + private final Model getServiceInstances(Model model) throws Exception { + if (RUN_MAIN) { + createNsMap(model); + } + + CentralDigest central = null; + MobyService[] services = null; + try { + String registryURL; String registryNamespace; - Map map = RegistryOS.getEnv(); - if (!map.isEmpty()) { - registryURL = (String) map.get("MOBY_SERVER"); - registryNamespace = (String) map.get("MOBY_URI"); + if (!System.getProperties().isEmpty()) { + registryURL = System.getProperty("MOBY_SERVER"); + registryNamespace = System.getProperty("MOBY_URI"); + System.out.println("System vars: " + registryURL + ", " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralDigestImpl(); @@ -389,723 +403,763 @@ central = new CentralDigestImpl(registryURL); } else { // use defined url and namespacce - central = new CentralDigestImpl(registryURL, - registryNamespace); + central = new CentralDigestImpl(registryURL, registryNamespace); } } else { - // use default registry since we cant determine if local one exists + // use default registry since we cant determine if local one + // exists central = new CentralDigestImpl(); } - services = central.getServices(); - } catch (MobyException e) { - e.printStackTrace(); - } - if (central == null || services == null) - throw new MobyException( - "Could not retrieve useful information from CentralDigestImpl().getServices(String)"); - return ServiceInstanceRDF.createRDFModel(model, services); - } - - private final Resource createSimpleDataItem(Model model, - MobyPrimaryDataSimple simpleData, Resource _li) { - _li.addProperty(RDF.type, Predicates.Simple); - _li.addProperty(Predicates.object_type, model.createResource(OBJ - + simpleData.getDataType().getName())); - if (!simpleData.getName().equals("")) - _li.addProperty(Predicates.articleName, model - .createTypedLiteral(simpleData.getName())); - MobyNamespace[] ns = null; - if ((ns = simpleData.getNamespaces()) != null) { - for (int k = 0; k < ns.length; k++) { - MobyNamespace mns = ns[k]; - _li.addProperty(Predicates.namespace_type, model - .createResource(NS + mns.getName())); - // .addProperty(RDF.type, RDFS.Class)); - } - } - return _li; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @return - * @throws MobyException - */ - private final Model getServices(Model model) throws MobyException { - - String[][] str = getTypes("Services"); - if (str.equals("")) { - return null; - } - if (RUN_MAIN) { - createNsMap(model); - } - Resource subject = _addClassResource(model, SRV, "Service", - "a base Service class, never instantiated"); - model.add(model.createStatement(subject, RDF.type, RDFS.Class)); - for (int i = 0; i < str.length; i++) { - String[] _line = str[i]; - String sub = _line[0]; - String pred = _line[1]; - String obj = _line[2]; - String def = _line[3]; - Matcher m; - m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - Resource _subject = _addClassResource(model, SRV, sub, def); - _addSubClass(model, _subject, SRV, obj); - } - } - return model; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @return - * @throws MobyException - */ - private final Model getNamespaces(Model model) throws MobyException { - String[][] str = getTypes("Namespaces"); - if (str == null) { - return null; - } - if (RUN_MAIN) { - createNsMap(model); - } - Resource subject = _addClassResource(model, NS, "Namespace", - "a base Namespace identifier, never instantiated"); - model.add(model.createStatement(subject, RDF.type, RDFS.Class)); - for (int x = 0; x < str.length; x++) { - String[] _line = str[x]; - String sub = _line[0]; - String def = ""; - if (_line.length > 1) - def = _line[1]; - Resource _subject = _addClassResource(model, NS, sub, def); - _addSubClass(model, _subject, NS, "Namespace"); - } - return model; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @throws MobyException - */ - private final Model getObjects(Model model) throws MobyException { - String[][] str = getTypes("Objects"); - if (str == null) { - return null; - } - // add mobyPred prefix to model - if (RUN_MAIN) { - createNsMap(model); - } - // create the base object type "class" - Resource subject = _addClassResource(model, OBJ, "Object", - "a base object class consisting of a namespace and an identifier"); - model.add(model.createStatement(subject, DC.publisher, model - .createLiteral("www.illuminae.com", "en"))); - model.add(model.createStatement(subject, DC.creator, model - .createLiteral("markw at illuminae.com", "en"))); - - //model.add(model.createStatement(subject, RDFS.subClassOf, Predicates.DataComponent)); - for (int x = 0; x < str.length; x++) { - String[] _line = str[x]; - String sub, pred, obj, def, articlename = ""; - sub = _line[0]; - pred = _line[1]; - obj = _line[2]; - articlename = _line[3]; - def = _line[4]; - Matcher m; - if (articlename.indexOf("(") >= 0) - articlename = articlename.substring(articlename.indexOf("(")+1, articlename.indexOf(")")); - - Resource _subject = _addClassResource(model, OBJ, sub, def); - - m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - // System.out.println("is " +pred); - _addSubClass(model, _subject, OBJ, obj); - } - m = Pattern.compile(".*:hasa$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - // System.out.println("hasa " +pred); - Resource bnode = model.createResource(model.getProperty(OBJ - + obj)); - _addHasaHas(model, bnode, _subject, Predicates.hasa, OBJ, obj, - articlename); - } - m = Pattern.compile(".*:has$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - // System.out.println("has " + pred); - Resource bnode = model.createResource(model.getProperty(OBJ - + obj)); - _addHasaHas(model, bnode, _subject, Predicates.has, OBJ, obj, - articlename); - } - } - return model; - } - - private final void createNsMap(Model model) { - Map map = model.getNsPrefixMap(); - map.put("moby", Predicates.getURI()); - map.put("mobyObject", OBJ); - map.put("serviceInstances", SI); - map.put("mobyNamespace", NS); - map.put("mobyService", SRV); - model.setNsPrefixes(map); - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @param _resource - * @param subject - * @param mp2 - * @param string - * @param obj2 - * @param obj3 - * @param articlename - */ - private final void _addHasaHas(Model model, Resource bnode, - Resource subject, Property prop, String objNS, String object, - String articlename) { - Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); - Matcher m = p.matcher(object); - object = (m.matches() ? m.group(1) : object); - Resource resource = model.createResource(objNS + object); - model.add(model.createStatement(subject, prop, bnode)); - model.add(model.createStatement(bnode, Predicates.articleName, model - .createLiteral(articlename, "en"))); - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @param mp2 - * @param bnode - * @param string - * @param articlename - */ - private final void _addClassLiteral(Model model, String pns, - Resource subject, String predicate, String value) { - - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @param subject - * @param obj2 - * @param obj3 - */ - private final void _addSubClass(Model model, Resource subject, - String objNS, String object) { - Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); - Matcher m = p.matcher(object); - object = (m.matches() ? m.group(1) : object); - Resource resource = model.createResource(objNS + object); - model.add(model.createStatement(subject, RDFS.subClassOf, resource)); - } - - private final Resource _addClassResource(Model model, String ns, - String thing, String def) { - Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); - Matcher m = p.matcher(thing); - String label = (m.matches() ? m.group(1) : thing); - Resource resource = model.createResource(ns + thing); - //addOfTypeProperty(model, resource, thing); - model.add(model.createStatement(resource, RDF.type, RDFS.Class)); - model.add(model.createStatement(resource, RDFS.label, model - .createLiteral(label, "en"))); - model.add(model.createStatement(resource, RDFS.comment, model - .createLiteral(def, "en"))); - return resource; - } - - /** - * @param model - * @param resource - * @param thing - */ - private void addOfTypeProperty(Model model, Resource resource, String name) { - // make sure that we declare the ns for the datatype - Map map = model.getNsPrefixMap(); - if (!map.containsValue(XMLTypes.getURI())) { - map.put(XMLTypes.getPrefix(), XMLTypes.getURI()); - } - model.setNsPrefixes(map); - if (name.equalsIgnoreCase("string")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_STRING)); - } else if (name.equalsIgnoreCase("integer")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_INTEGER)); - } else if (name.equalsIgnoreCase("float")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_FLOAT)); - } else if (name.equalsIgnoreCase("datatime")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_DATE_TIME)); - } - } - - private final String[][] getTypes(String type) throws MobyException { - if (type.equalsIgnoreCase("objects")) { - try { - return new JObjectsSqlImpl().getObjectsAsArray(); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (type.equalsIgnoreCase("services")) { - try { - return new JServicesSqlImpl().getServicesAsArray(); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (type.equalsIgnoreCase("namespaces")) { - try { - return new JNamespacesSqlImpl().getNamespacesAsArray(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return null; - } - - /* - * - */ - private String getURL(String url) { - StringBuffer sb = new StringBuffer(); - try { - URL _url = new URL(url); - BufferedReader in = new BufferedReader(new InputStreamReader(_url - .openStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) - sb.append(inputLine + "\n"); - in.close(); - } catch (Exception e) { - e.printStackTrace(); - System.err.println("Could not retrieve contents of URL."); - } - return sb.toString(); - } - - protected final void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.GenericServlet#getServletInfo() - */ - public final String getServletInfo() { - return "jRESOURCE - JAVA implementation of the old /RESOURCES/ perl script by Edward Kawas"; - } - - private final String getObjects() throws MobyException { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - model = getObjects(model); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - private final String getNamespaces() throws MobyException { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - model = getNamespaces(model); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - private final String getServices() throws MobyException { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - model = getServices(model); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - private final String getServiceInstances() { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - try { - model = getServiceInstances(model); - } catch (Exception e) { - e.printStackTrace(); - return ""; - } - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - /** - * - * @param str - * @return an RDF document describing the ontology represented by str. - * @throws MobyException - */ - public final String getRESOURCES(String str) throws MobyException { - String name = ""; - if (str.lastIndexOf("/") > 0) { - // this is a url - name = str.substring(str.lastIndexOf("/") + 1); - } else - name = str; - - if (name.equalsIgnoreCase("Objects")) { - return getObjects(); - } else if (name.equalsIgnoreCase("Services")) { - return getServices(); - } else if (name.equalsIgnoreCase("ServiceInstances")) { - return getServiceInstances(); - } else if (name.equalsIgnoreCase("Namespaces")) { - return getNamespaces(); - } else if (name.equalsIgnoreCase("Predicates")) { - return getPredicates(); - } - - return ""; - } - - private String getPredicates() { - StringBuffer buffer = new StringBuffer(); - buffer.append( - "" + System.getProperty("line.separator") + ""); - // add the predicates here - buffer.append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "The BioMoby Predicates Vocabulary (moby)", - "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the moby namespace.")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#hasa", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "hasa","The subject contains exactly one object.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#has", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "has","The subject contains one or more object.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "articleName","Uses a non-controlled vocabulary to describe the intended semantic relationship between the Subject node, and the node in which the Subject is associated through a HAS or HASA relationship.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#componentName", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "componentName","The subject is known to be named object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#namespace_type", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "namespace_type","The subject resource is applicable under the object namespace.", - "http://www.w3.org/2000/01/rdf-schema#Class", //TODO - namespace? - "http://www.w3.org/2000/01/rdf-schema#Resource")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#object_type", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "object_type","The subject resource is a resource object.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://www.w3.org/2000/01/rdf-schema#Resource")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#consumes", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "consumes","The subject container takes as input object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#produces", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "produces","The subject container produces as output object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#performs_task", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "performs_task","The subject performs the task of the object resource.", - "http://www.w3.org/2000/01/rdf-schema#Class", //TODO servicetype? - "http://www.w3.org/2000/01/rdf-schema#Resource")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#default_value", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "default_value","The subject has a default value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#min", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "min","The subject has a minimum value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#max", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "max","The subject has a maximum value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#enum", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "enum","The subject may assume the value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#datatype", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "datatype","Idiomatic property used for structured values.", - "http://www.w3.org/2001/XMLSchema#type", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#signatureURL", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "signatureURL","Object is a URL that contains information on the subject.", - "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#", //TODO - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#authoritative", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "authoritative","The object states whether the subject is authoritative.", - "http://www.w3.org/2000/01/rdf-schema#Class", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#ofType", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "ofType","The subject is of primitive type object.", - "http://www.w3.org/2000/01/rdf-schema#Class", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleInputData", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "sampleInputData","Object is a sample of valid input that subject can handle.", - "http://www.w3.org/2000/01/rdf-schema#Property", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleOutputData", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "sampleOutputData","Object is a sample of valid output created by running the subject.", - "http://www.w3.org/2000/01/rdf-schema#Property", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#approvedBy", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "approvedBy","The subject has been approved by object.", - "http://www.w3.org/2000/01/rdf-schema#Property", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Simple", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "Simple","A class representing a simple input or output.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "Secondary","A class representing a secondary input.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Collection", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "Collection","A container for objects representing Simples.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "mobyThing","NOT SURE", - "http://www.w3.org/2000/01/rdf-schema#Class")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "MobyMessageComponent","NOT SURE", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "DataComponent","NOT SURE", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#StructuralComponent", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "StructuralComponent","NOT SURE", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); - - - // end the addition of predicates here - buffer.append( - "" + System.getProperty("line.separator") + "" + - ""); - return buffer.toString(); - } - - private String createPropertyBlock(String about, String definedBy, - String label, String comment, String domain, String range) { - String s = - "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - " " + label + "" + System.getProperty("line.separator") + "" + - " " + comment + "" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - "" + System.getProperty("line.separator") + ""; - return s; - } - - private String createClassBlock(String about, String definedBy, - String label, String comment, String subClassOf) { - String s = - "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - " "+ label +"" + System.getProperty("line.separator") + "" + - " "+ comment +"" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - "" + System.getProperty("line.separator") + ""; - return s; - } - - private String createDescriptionBlock(String about, String[] seeAlsos) { - if (seeAlsos == null) - return "" + System.getProperty("line.separator") + ""; - StringBuffer sb = new StringBuffer(); - sb.append(" " + System.getProperty("line.separator") + ""); - for (int x = 0; x < seeAlsos.length; x++) { - sb.append(" " + System.getProperty("line.separator") + ""); - } - sb.append("" + System.getProperty("line.separator") + ""); - return sb.toString(); - } - - private String createOntologyBlock(String about, String title, - String description) { - String s ="" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + " " + title + "" + System.getProperty("line.separator") + "" - + " " + description + "" + System.getProperty("line.separator") + "" - + "" + System.getProperty("line.separator") + ""; - return s; - } - - private String createEscapedComment(String comment) { - String s = "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + ""; - return s; - } - - public static void main(String[] args) throws Exception { - System.out.println(new RESOURCE().getRESOURCES("ServiceInstances")); - } - - private final String serviceDescriptionVocabulary = "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "]>" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - ""; + services = central.getServices(); + } catch (MobyException e) { + e.printStackTrace(); + } + if (central == null || services == null) + throw new MobyException( + "Could not retrieve useful information from CentralDigestImpl().getServices(String)"); + return ServiceInstanceRDF.createRDFModel(model, services); + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @return + * @throws MobyException + */ + private final Model getServices(Model model) throws MobyException { + + String[][] str = getTypes("Services"); + if (str.equals("")) { + return null; + } + if (RUN_MAIN) { + createNsMap(model); + } + Resource subject = _addClassResource(model, "Service", + "urn:lsid:biomoby.org:servicetype:Service:2001-09-21T16-00-00Z", + "a base Service class, never instantiated", "openinformatics.com", + "markw at illuminae.com"); + model.add(model.createStatement(subject, RDF.type, RDFS.Class)); + for (int i = 0; i < str.length; i++) { + String[] _line = str[i]; + String sub, pred, obj, def, lsid, authority, email, obj_lsid; + if (_line.length > 7) { + sub = _line[0]; + pred = _line[1]; + obj = _line[2]; + def = _line[3]; + lsid = _line[4]; + authority = _line[5]; + email = _line[6]; + obj_lsid = _line[7]; + } else { + continue; + } + Matcher m; + m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // service types only have isa relationships and every service + // type has a parent, except the base service Service + Resource _subject = _addClassResource(model, sub, lsid, def, authority, email); + _addSubClass(model, _subject, obj_lsid); + } + } + return model; + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @return + * @throws MobyException + */ + private final Model getNamespaces(Model model) throws MobyException { + String[][] str = getTypes("Namespaces"); + if (str == null) { + return null; + } + if (RUN_MAIN) { + createNsMap(model); + } + Resource subject = _addClassResource(model, "Namespace", NS + "Namespace", + "a base Namespace identifier, never instantiated", null, null); + model.add(model.createStatement(subject, RDF.type, RDFS.Class)); + for (int x = 0; x < str.length; x++) { + String[] _line = str[x]; + String sub = _line[0]; + String def = ""; + String lsid = ""; + String authority = ""; + String email = ""; + if (_line.length > 4) { + def = _line[1]; + lsid = _line[2]; + authority = _line[3]; + email = _line[4]; + } else { + continue; + } + Resource _subject = _addClassResource(model, sub, lsid, def, authority, email); + _addSubClass(model, _subject, NS + "Namespace"); + } + return model; + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @throws MobyException + */ + private final Model getObjects(Model model) throws MobyException { + String[][] str = getTypes("Objects"); + if (str == null) { + return null; + } + // add mobyPred prefix to model + if (RUN_MAIN) { + createNsMap(model); + } + // create the base object type "class" + Resource subject = _addClassResource(model, "Object", + "urn:lsid:biomoby.org:objectclass:Object", + "a base object class consisting of a namespace and an identifier", + "openinformatics.com", "jason at openinformatics.com"); + + for (int x = 0; x < str.length; x++) { + String[] _line = str[x]; + String sub = "", pred = "", obj = "", def = "", articlename = "", lsid = "", authority = "", email = "", obj_lsid = ""; + Matcher m; + if (_line.length > 8) { + sub = _line[0]; + pred = _line[1]; + obj = _line[2]; + articlename = _line[3]; + def = _line[4]; + lsid = _line[5]; + authority = _line[6]; + email = _line[7]; + obj_lsid = _line[8]; + + if (articlename.indexOf("(") >= 0) + articlename = articlename.substring(articlename.indexOf("(") + 1, articlename + .indexOf(")")); + + } else { + continue; + } + Resource _subject = _addClassResource(model, sub, lsid, def, authority, email); + + m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // System.out.println("is " +pred); + _addSubClass(model, _subject, obj_lsid); + } + m = Pattern.compile(".*:hasa$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // System.out.println("hasa " +pred); + Resource bnode = model.createResource(model.getProperty(OBJ + obj)); + _addHasaHas(model, bnode, _subject, Predicates.hasa, OBJ, obj, articlename); + } + m = Pattern.compile(".*:has$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // System.out.println("has " + pred); + Resource bnode = model.createResource(model.getProperty(OBJ + obj)); + _addHasaHas(model, bnode, _subject, Predicates.has, OBJ, obj, articlename); + } + } + return model; + } + + private final void createNsMap(Model model) { + Map map = model.getNsPrefixMap(); + map.put("moby", Predicates.getURI()); + map.put("mobyObject", OBJ); + map.put("serviceInstances", SI); + map.put("mobyNamespace", NS); + map.put("mobyService", SRV); + model.setNsPrefixes(map); + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @param _resource + * @param subject + * @param mp2 + * @param string + * @param obj2 + * @param obj3 + * @param articlename + */ + private final void _addHasaHas(Model model, Resource bnode, Resource subject, Property prop, + String objNS, String object, String articlename) { + Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); + Matcher m = p.matcher(object); + object = (m.matches() ? m.group(1) : object); + Resource resource = model.createResource(objNS + object); + model.add(model.createStatement(subject, prop, bnode)); + model.add(model.createStatement(bnode, Predicates.articleName, model.createLiteral( + articlename, "en"))); + } + + private final void _addSubClass(Model model, Resource subject, String lsid) { + Resource resource = model.createResource(lsid); + model.add(model.createStatement(subject, RDFS.subClassOf, resource)); + } + + /* + * TODO + */ + private final Resource _addClassResource(Model model, String label, String lsid, String def, + String authority, String email) { + Resource resource = model.createResource(lsid); + // addOfTypeProperty(model, resource, thing); + model.add(model.createStatement(resource, RDF.type, RDFS.Class)); + model.add(model.createStatement(resource, RDFS.label, model.createLiteral(label))); + model.add(model.createStatement(resource, RDFS.comment, model.createLiteral(def, "en"))); + // add email and authority + if (email != null && !email.equals("")) + model.add(model.createStatement(resource, DC.creator, model.createLiteral(email))); + if (authority != null && !authority.equals("")) + model + .add(model.createStatement(resource, DC.publisher, model + .createLiteral(authority))); + return resource; + } + + private final String[][] getTypes(String type) throws MobyException { + if (type.equalsIgnoreCase("objects")) { + try { + return new JObjectsSqlImpl().getFullObjectsAsArray(); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (type.equalsIgnoreCase("services")) { + try { + return new JServicesSqlImpl().getFullServicesAsArray(); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (type.equalsIgnoreCase("namespaces")) { + try { + return new JNamespacesSqlImpl().getFullNamespacesAsArray(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /* + * + */ + private String getURL(String url) { + StringBuffer sb = new StringBuffer(); + try { + URL _url = new URL(url); + BufferedReader in = new BufferedReader(new InputStreamReader(_url.openStream())); + String inputLine; + while ((inputLine = in.readLine()) != null) + sb.append(inputLine + "\n"); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("Could not retrieve contents of URL."); + } + return sb.toString(); + } + + protected final void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.GenericServlet#getServletInfo() + */ + public final String getServletInfo() { + return "jRESOURCE - JAVA implementation of the old /RESOURCES/ perl script by Edward Kawas"; + } + + private final String getObjects() throws MobyException { + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + model = getObjects(model); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + private final String getNamespaces() throws MobyException { + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + model = getNamespaces(model); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + private final String getServices() throws MobyException { + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + model = getServices(model); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + private final String getServiceInstances() { + Model model = ModelFactory.createDefaultModel(); + try { + model = getServiceInstances(model); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + /** + * + * @param str + * @return an RDF document describing the ontology represented by str. + * @throws MobyException + */ + public final String getRESOURCES(String str) throws MobyException { + String name = ""; + if (str.lastIndexOf("/") > 0) { + // this is a url + name = str.substring(str.lastIndexOf("/") + 1); + } else + name = str; + + if (name.equalsIgnoreCase("Objects")) { + return getObjects(); + } else if (name.equalsIgnoreCase("Services")) { + return getServices(); + } else if (name.equalsIgnoreCase("ServiceInstances")) { + return getServiceInstances(); + } else if (name.equalsIgnoreCase("Namespaces")) { + return getNamespaces(); + } else if (name.equalsIgnoreCase("Predicates")) { + return getPredicates(); + } + + return ""; + } + + private String getPredicates() { + StringBuffer buffer = new StringBuffer(); + buffer + .append("" + + System.getProperty("line.separator") + ""); + // add the predicates here + buffer + .append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#", + "The BioMoby Predicates Vocabulary (moby)", + "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the moby namespace.")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#hasa", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "hasa", + "The subject contains exactly one object.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#has", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "has", + "The subject contains one or more object.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); + + buffer + .append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", + "articleName", + "Uses a non-controlled vocabulary to describe the intended semantic relationship between the Subject node, and the node in which the Subject is associated through a HAS or HASA relationship.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#componentName", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "componentName", + "The subject is known to be named object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#namespace_type", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "namespace_type", + "The subject resource is applicable under the object namespace.", + "http://www.w3.org/2000/01/rdf-schema#Class", // TODO - + // namespace? + "http://www.w3.org/2000/01/rdf-schema#Resource")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#object_type", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "object_type", + "The subject resource is a resource object.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://www.w3.org/2000/01/rdf-schema#Resource")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#consumes", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "consumes", + "The subject container takes as input object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#produces", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "produces", + "The subject container produces as output object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#performs_task", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "performs_task", + "The subject performs the task of the object resource.", + "http://www.w3.org/2000/01/rdf-schema#Class", // TODO + // servicetype? + "http://www.w3.org/2000/01/rdf-schema#Resource")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#default_value", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "default_value", + "The subject has a default value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#min", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "min", + "The subject has a minimum value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#max", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "max", + "The subject has a maximum value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#enum", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "enum", + "The subject may assume the value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#datatype", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "datatype", + "Idiomatic property used for structured values.", + "http://www.w3.org/2001/XMLSchema#type", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#signatureURL", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "signatureURL", + "Object is a URL that contains information on the subject.", + "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#", // TODO + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#authoritative", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "authoritative", + "The object states whether the subject is authoritative.", + "http://www.w3.org/2000/01/rdf-schema#Class", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#ofType", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "ofType", + "The subject is of primitive type object.", + "http://www.w3.org/2000/01/rdf-schema#Class", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleInputData", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "sampleInputData", + "Object is a sample of valid input that subject can handle.", + "http://www.w3.org/2000/01/rdf-schema#Property", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleOutputData", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "sampleOutputData", + "Object is a sample of valid output created by running the subject.", + "http://www.w3.org/2000/01/rdf-schema#Property", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#approvedBy", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "approvedBy", + "The subject has been approved by object.", + "http://www.w3.org/2000/01/rdf-schema#Property", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Simple", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "Simple", + "A class representing a simple input or output.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "Secondary", + "A class representing a secondary input.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Collection", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "Collection", + "A container for objects representing Simples.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "mobyThing", "NOT SURE", + "http://www.w3.org/2000/01/rdf-schema#Class")); + + buffer.append(createClassBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "MobyMessageComponent", + "NOT SURE", "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing")); + + buffer.append(createClassBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "DataComponent", "NOT SURE", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); + + buffer.append(createClassBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#StructuralComponent", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "StructuralComponent", + "NOT SURE", "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); + + // end the addition of predicates here + buffer.append("" + System.getProperty("line.separator") + "" + ""); + return buffer.toString(); + } + + private String createPropertyBlock(String about, String definedBy, String label, + String comment, String domain, String range) { + String s = "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + " " + label + + "" + System.getProperty("line.separator") + "" + " " + + comment + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + " " + System.getProperty("line.separator") + "" + "" + + System.getProperty("line.separator") + ""; + return s; + } + + private String createClassBlock(String about, String definedBy, String label, String comment, + String subClassOf) { + String s = "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + " " + label + + "" + System.getProperty("line.separator") + "" + " " + + comment + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + "" + + System.getProperty("line.separator") + ""; + return s; + } + + private String createDescriptionBlock(String about, String[] seeAlsos) { + if (seeAlsos == null) + return "" + System.getProperty("line.separator") + ""; + StringBuffer sb = new StringBuffer(); + sb.append(" " + + System.getProperty("line.separator") + ""); + for (int x = 0; x < seeAlsos.length; x++) { + sb.append(" " + + System.getProperty("line.separator") + ""); + } + sb.append("" + System.getProperty("line.separator") + ""); + return sb.toString(); + } + + private String createOntologyBlock(String about, String title, String description) { + String s = "" + System.getProperty("line.separator") + "" + + System.getProperty("line.separator") + "" + " " + title + + "" + System.getProperty("line.separator") + "" + " " + + description + "" + System.getProperty("line.separator") + "" + + "" + System.getProperty("line.separator") + ""; + return s; + } + + private String createEscapedComment(String comment) { + String s = "" + System.getProperty("line.separator") + "" + + System.getProperty("line.separator") + ""; + return s; + } + + public static void main(String[] args) throws Exception { + CentralDigest central = new CentralDigestImpl( + "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl"); + MobyService[] services = central.getServices(); + + Model m = ServiceInstanceRDF.createRDFModel(ModelFactory.createDefaultModel(), services); + RDFWriter writer = m.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + writer.setProperty("tab", "5"); + writer.write(m, System.out, null); + } + + private final String serviceDescriptionVocabulary = "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "]>" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + ""; } \ No newline at end of file From kawas at pub.open-bio.org Wed Mar 15 12:28:15 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 12:28:15 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151728.k2FHSFCN032473@pub.open-bio.org> kawas Wed Mar 15 12:28:15 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory pub.open-bio.org:/tmp/cvs-serv32436/org/biomoby/shared/extended Modified Files: NamespaceParser.java DataTypeParser.java ServiceInstanceParser.java ServiceTypeParser.java Log Message: Added support for LSIDs with versioning information. moby-live/Java/src/main/org/biomoby/shared/extended NamespaceParser.java,1.4,1.5 DataTypeParser.java,1.3,1.4 ServiceInstanceParser.java,1.10,1.11 ServiceTypeParser.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2006/02/16 18:28:15 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2006/03/15 17:28:15 1.5 @@ -17,6 +17,8 @@ import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -156,8 +158,15 @@ while (iterator.hasNext()) { Resource resource = iterator.nextResource(); // extract the name of the namespace - String name = resource.getLocalName(); + LSID lsid = null; + try { + lsid = new LSID(resource.getURI()); + } catch (MalformedLSIDException e) { + throw new MobyException("Expected an LSID as a URI, instead got " + resource.getURI()+ " " + e.getLocalizedMessage()); + } + String name = lsid.getObject(); MobyNamespace namespace = new MobyNamespace(name); + namespace.setLSID(lsid.getLsid()); // extract the comment (a literal in the document) String description = resource.getProperty(RDFS.comment).getLiteral().getString(); namespace.setDescription(description); @@ -191,7 +200,7 @@ public static void main(String[] args) throws MobyException { // show how to use this class - NamespaceParser p = new NamespaceParser("http://biomoby.org/RESOURCES/MOBY-S/Namespaces"); + NamespaceParser p = new NamespaceParser("http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/Namespaces"); MobyNamespace[] namespaces = p.getMobyNamespacesFromRDF(); for (int i = 0; i < namespaces.length; i++) { System.out.println(namespaces[i]); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.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/shared/extended/DataTypeParser.java 2006/02/16 18:28:15 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2006/03/15 17:28:15 1.4 @@ -22,6 +22,8 @@ import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -157,20 +159,28 @@ Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); reader.read(model, new StringReader(getRdfAsString()), null); - // TODO start querying the model and creating Data Type objects ResIterator iterator = model.listSubjects(); while (iterator.hasNext()) { Resource resource = iterator.nextResource(); - String name = resource.getLocalName(); - if (name == null) + + if (resource.getLocalName() == null) continue; + + LSID lsid = null; + try { + lsid = new LSID(resource.getURI()); + } catch (MalformedLSIDException e) { + throw new MobyException("Expected an LSID as a URI, instead got " + resource.getURI()+ " " + e.getLocalizedMessage()); + } + String name = lsid.getObject(); String parent = null; if (resource.hasProperty(RDFS.subClassOf)) { - parent = ((Resource)resource.getProperty(RDFS.subClassOf).getObject()).getLocalName(); + parent = ((Resource)resource.getProperty(RDFS.subClassOf).getObject()).getURI(); } String description = resource.getProperty(RDFS.comment).getLiteral().getString(); // create the base datatype without container relationships MobyDataType datatype = new MobyDataType(name); + datatype.setLSID(lsid.getLsid()); datatype.setComment(description); datatype.setParentNames((parent == null ? new String[0] : new String[]{parent})); // now add the container relationships @@ -216,7 +226,7 @@ return sb.toString(); } public static void main(String[] args) throws MobyException { - DataTypeParser d = new DataTypeParser("http://biomoby.org/RESOURCES/MOBY-S/Objects"); + DataTypeParser d = new DataTypeParser("http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/Objects"); MobyDataType[] types = d.getMobyDataTypesFromRDF(); for (int i = 0; i < types.length; i++) { System.out.println(types[i]); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.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/shared/extended/ServiceInstanceParser.java 2006/02/27 22:46:45 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/03/15 17:28:15 1.11 @@ -42,25 +42,25 @@ * An example of how to use this class is below: * *


- *          import org.biomoby.shared.MobyService;
- *          import org.biomoby.shared.Utils;
- *          import org.biomoby.shared.extended.ServiceInstanceParser;
- *          
- *          ...
- *                
- *                     ServiceInstanceParser p = new ServiceInstanceParser(
- *    				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
- *    		MobyService[] services = p.getMobyServicesFromRDF();
- *    		if (!p.isRDFValid()) {
- *    			System.out.println("One or more services in the RDF were invalid");
- *    			System.out.println("The errors are the following:");
- *    			System.out.println(Utils.format(p.getErrors(),2));
- *    			
- *     		}
- *    		System.out.println("The valid services are:");
- *    		for (int i = 0; i < services.length; i++) {
- *    			System.out.println((services[i]));
- *    		}
+ *            import org.biomoby.shared.MobyService;
+ *            import org.biomoby.shared.Utils;
+ *            import org.biomoby.shared.extended.ServiceInstanceParser;
+ *            
+ *            ...
+ *                  
+ *                       ServiceInstanceParser p = new ServiceInstanceParser(
+ *      				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
+ *      		MobyService[] services = p.getMobyServicesFromRDF();
+ *      		if (!p.isRDFValid()) {
+ *      			System.out.println("One or more services in the RDF were invalid");
+ *      			System.out.println("The errors are the following:");
+ *      			System.out.println(Utils.format(p.getErrors(),2));
+ *      			
+ *       		}
+ *      		System.out.println("The valid services are:");
+ *      		for (int i = 0; i < services.length; i++) {
+ *      			System.out.println((services[i]));
+ *      		}
  * 
* *

@@ -206,7 +206,8 @@ name = resource.getProperty(FetaVocabulary.hasServiceNameText) .getObject().toString(); MobyService service = new MobyService(name); - + // set the lsid + service.setLSID(resource.getURI()); // get the signatureURL String signatureURL = ""; if (resource @@ -300,326 +301,357 @@ Map outputCollectionMap = new HashMap(); // is the current service bad? while (inputs.hasNext()) { - + Resource parameter = (Resource) inputs.nextStatement() .getObject(); - if (parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().getProperty(RDF.type).getObject() - .toString().endsWith("simpleParameter")) { - // we have a simple - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " + service.getName() - + " was missing an object type}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - currentlyBad = true; - success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " + service.getName() - + " was missing an article name}"); - errors.append(newline); - continue; - } - - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " + service.getName() - + " was missing a non empty article name}"); - errors.append(newline); - continue; - } - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); + if (!parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().hasProperty(RDF.type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " did not have a parameter type of type RDF:type}"); + errors.append(newline); + continue; + } else { + if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("simpleParameter")) { + // we have a simple + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " was missing an object type}"); + errors.append(newline); + continue; } - } - MobyPrimaryDataSimple primaryInput = new MobyPrimaryDataSimple(); - primaryInput.setDataType(new MobyDataType(datatype)); - primaryInput.setName(articlename); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryInput.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + currentlyBad = true; + success = false; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " was missing an article name}"); + errors.append(newline); + continue; } - } - service.addInput(primaryInput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("collectionParameter")) { - // we have a collection - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - currentlyBad = true; - success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() - + " was missing an object type.}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection for service " - + service.getName() - + " was missing an article name.}"); - errors.append(newline); - continue; - } - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() - + " was missing a non empty article name.}"); - errors.append(newline); - continue; - } - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " was missing a non empty article name}"); + errors.append(newline); + continue; } - } - - MobyPrimaryDataSet collection = null; - if (inputCollectionMap.containsKey(articlename)) { - collection = (MobyPrimaryDataSet) inputCollectionMap - .get(articlename); - } else - collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple input = new MobyPrimaryDataSimple( - ""); - input.setDataType(new MobyDataType(datatype)); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - input.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + MobyPrimaryDataSimple primaryInput = new MobyPrimaryDataSimple(); + primaryInput + .setDataType(new MobyDataType(datatype)); + primaryInput.setName(articlename); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + primaryInput + .addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } + } + service.addInput(primaryInput); + } else if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("collectionParameter")) { + // we have a collection + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + currentlyBad = true; + success = false; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection input for service " + + service.getName() + + " was missing an object type.}"); + errors.append(newline); + continue; } - } - collection.addElement(input); - inputCollectionMap.put(articlename, collection); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("secondaryParameter")) { - // we have a secondary - if (!parameter - .hasProperty(ServiceDescriptionPredicates.datatype)) { - currentlyBad = true; - success = false; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing moby datatype" - + " (one of String, Float, Integer, DateTime).}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing an article name.}"); - errors.append(newline); - continue; - } - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.datatype) - .getLiteral().getValue().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype - .substring(datatype.indexOf("#") + 1); - if (datatype.indexOf(":") > 0) - datatype = datatype - .substring(datatype.indexOf(":") + 1); - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getLiteral().getValue().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing a non empty article name.}"); - errors.append(newline); - continue; - } - - // create the datatype - MobySecondaryData secondary = new MobySecondaryData( - articlename); - secondary.setDataType(datatype); - - if (parameter - .hasProperty(FetaVocabulary.hasDefaultValue)) { - secondary.setDefaultValue(parameter.getProperty( - FetaVocabulary.hasDefaultValue) - .getLiteral().getValue().toString()); - } - // process the description - if (parameter - .hasProperty(ServiceDescriptionPredicates.secondary_description)) { - secondary.setDescription(parameter.getProperty( - ServiceDescriptionPredicates.secondary_description) - .getLiteral().getValue().toString()); - } - - if (parameter - .hasProperty(ServiceDescriptionPredicates.max)) { - try { - secondary - .setMaximumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.max) - .getLiteral() - .getValue().toString())); - } catch (NumberFormatException e) { + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection for service " + + service.getName() + + " was missing an article name.}"); + errors.append(newline); + continue; + } + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { success = false; currentlyBad = true; errors .append(service.getName() + "," + service.getAuthority() - + "{Invalid maximum value for secondary input.}"); + + "{Collection input for service " + + service.getName() + + " was missing a non empty article name.}"); errors.append(newline); continue; } - } - if (parameter - .hasProperty(ServiceDescriptionPredicates.min)) { - try { - secondary - .setMinimumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.min) - .getLiteral() - .getValue().toString())); - } catch (NumberFormatException e) { + + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + + MobyPrimaryDataSet collection = null; + if (inputCollectionMap.containsKey(articlename)) { + collection = (MobyPrimaryDataSet) inputCollectionMap + .get(articlename); + } else + collection = new MobyPrimaryDataSet(articlename); + MobyPrimaryDataSimple input = new MobyPrimaryDataSimple( + ""); + input.setDataType(new MobyDataType(datatype)); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + input.addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } + } + collection.addElement(input); + inputCollectionMap.put(articlename, collection); + } else if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("secondaryParameter")) { + // we have a secondary + if (!parameter + .hasProperty(ServiceDescriptionPredicates.datatype)) { + currentlyBad = true; + success = false; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid secondary input found. Missing moby datatype" + + " (one of String, Float, Integer, DateTime).}"); + errors.append(newline); + continue; + } + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; errors .append(service.getName() + "," + service.getAuthority() - + "{Invalid minimum value for secondary input.}"); + + "{Invalid secondary input found. Missing an article name.}"); errors.append(newline); continue; } - } - if (parameter - .hasProperty(ServiceDescriptionPredicates.enumeration)) { - StmtIterator enumerations = parameter - .listProperties(ServiceDescriptionPredicates.enumeration); - while (enumerations.hasNext()) { - secondary.addAllowedValue(enumerations - .nextStatement().getLiteral() - .getValue().toString()); + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.datatype) + .getLiteral().getValue().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .indexOf("#") + 1); + if (datatype.indexOf(":") > 0) + datatype = datatype.substring(datatype + .indexOf(":") + 1); + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getLiteral().getValue().toString(); + if (articlename.equals("")) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid secondary input found. Missing a non empty article name.}"); + errors.append(newline); + continue; } + + // create the datatype + MobySecondaryData secondary = new MobySecondaryData( + articlename); + secondary.setDataType(datatype); + + if (parameter + .hasProperty(FetaVocabulary.hasDefaultValue)) { + secondary.setDefaultValue(parameter + .getProperty( + FetaVocabulary.hasDefaultValue) + .getLiteral().getValue().toString()); + } + // process the description + if (parameter + .hasProperty(ServiceDescriptionPredicates.secondary_description)) { + secondary + .setDescription(parameter + .getProperty( + ServiceDescriptionPredicates.secondary_description) + .getLiteral().getValue() + .toString()); + } + + if (parameter + .hasProperty(ServiceDescriptionPredicates.max)) { + try { + secondary + .setMaximumValue(Integer + .parseInt(parameter + .getProperty( + ServiceDescriptionPredicates.max) + .getLiteral() + .getValue() + .toString())); + } catch (NumberFormatException e) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid maximum value for secondary input.}"); + errors.append(newline); + continue; + } + } + if (parameter + .hasProperty(ServiceDescriptionPredicates.min)) { + try { + secondary + .setMinimumValue(Integer + .parseInt(parameter + .getProperty( + ServiceDescriptionPredicates.min) + .getLiteral() + .getValue() + .toString())); + } catch (NumberFormatException e) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid minimum value for secondary input.}"); + errors.append(newline); + continue; + } + } + if (parameter + .hasProperty(ServiceDescriptionPredicates.enumeration)) { + StmtIterator enumerations = parameter + .listProperties(ServiceDescriptionPredicates.enumeration); + while (enumerations.hasNext()) { + secondary.addAllowedValue(enumerations + .nextStatement().getLiteral() + .getValue().toString()); + } + } + service.addInput(secondary); + } else { + // everything else is ignored. } - service.addInput(secondary); - } else { - // everything else is ignored. } } @@ -628,182 +660,211 @@ while (outputs.hasNext()) { Resource parameter = (Resource) outputs.nextStatement() .getObject(); - if (parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().getProperty(RDF.type).getObject() - .toString().endsWith("simpleParameter")) { - // we have a simple - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - currentlyBad = true; - success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() - + " was missing an object type.}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() - + " was missing an article name}"); - errors.append(newline); - continue; - } - - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - // throw new MobyException("Output for service " + - // service.getName() + " was missing a non empty - // article name"); - } - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); + if (!parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().hasProperty(RDF.type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Output for service " + + service.getName() + + " did not have a parameter type of type RDF:type}"); + errors.append(newline); + continue; + } else { + if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("simpleParameter")) { + // we have a simple + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + currentlyBad = true; + success = false; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Output for service " + + service.getName() + + " was missing an object type.}"); + errors.append(newline); + continue; } - } - MobyPrimaryDataSimple primaryOutput = new MobyPrimaryDataSimple(); - primaryOutput.setDataType(new MobyDataType(datatype)); - primaryOutput.setName(articlename); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryOutput.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Output for service " + + service.getName() + + " was missing an article name}"); + errors.append(newline); + continue; } - } - service.addOutput(primaryOutput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("collectionParameter")) { - // we have a collection - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," +service.getAuthority()+ "{Collection Output for service " - + service.getName() - + " was missing an object type.}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," +service.getAuthority()+ "{Collection for service " - + service.getName() - + " was missing an article name.}"); - errors.append(newline); - continue; - } - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," +service.getAuthority()+ "{Collection output for service " - + service.getName() - + " was missing a non empty article name.}"); - errors.append(newline); - continue; - } + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { + // throw new MobyException("Output for service " + // + + // service.getName() + " was missing a non empty + // article name"); + } + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + MobyPrimaryDataSimple primaryOutput = new MobyPrimaryDataSimple(); + primaryOutput + .setDataType(new MobyDataType(datatype)); + primaryOutput.setName(articlename); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + primaryOutput + .addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } + } + service.addOutput(primaryOutput); + } else if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("collectionParameter")) { + // we have a collection + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection Output for service " + + service.getName() + + " was missing an object type.}"); + errors.append(newline); + continue; + } + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection for service " + + service.getName() + + " was missing an article name.}"); + errors.append(newline); + continue; + } + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Collection output for service " + + service.getName() + + " was missing a non empty article name.}"); + errors.append(newline); + continue; - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); } - } - MobyPrimaryDataSet collection = null; - if (outputCollectionMap.containsKey(articlename)) { - collection = (MobyPrimaryDataSet) outputCollectionMap - .get(articlename); - } else - collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple output = new MobyPrimaryDataSimple( - ""); - output.setDataType(new MobyDataType(datatype)); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - output.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + + MobyPrimaryDataSet collection = null; + if (outputCollectionMap.containsKey(articlename)) { + collection = (MobyPrimaryDataSet) outputCollectionMap + .get(articlename); + } else + collection = new MobyPrimaryDataSet(articlename); + MobyPrimaryDataSimple output = new MobyPrimaryDataSimple( + ""); + output.setDataType(new MobyDataType(datatype)); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + output.addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } } + collection.addElement(output); + outputCollectionMap.put(articlename, collection); } - collection.addElement(output); - outputCollectionMap.put(articlename, collection); } } @@ -940,7 +1001,7 @@ MalformedURLException, IOException { // show how to use this class ServiceInstanceParser p = new ServiceInstanceParser( - "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances"); + "http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/ServiceInstances"); MobyService[] services = p.getMobyServicesFromRDF(); if (!p.isRDFValid()) { System.out.println("One or more services in the RDF were invalid"); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2006/02/16 18:28:15 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2006/03/15 17:28:15 1.5 @@ -17,6 +17,8 @@ import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -154,8 +156,15 @@ ResIterator iterator = model.listSubjects(); while (iterator.hasNext()) { Resource resource = iterator.nextResource(); - String name = resource.getLocalName(); + LSID lsid = null; + try { + lsid = new LSID(resource.getURI()); + } catch (MalformedLSIDException e) { + throw new MobyException("Expected an LSID as a URI, instead got " + resource.getURI()+ " " + e.getLocalizedMessage()); + } + String name = lsid.getObject(); MobyServiceType servicetype = new MobyServiceType(name); + servicetype.setLSID(lsid.getLsid()); if (!resource.hasProperty(RDFS.subClassOf)) { continue; } @@ -192,7 +201,7 @@ } public static void main(String[] args) throws MobyException { - ServiceTypeParser p = new ServiceTypeParser("http://biomoby.org/RESOURCES/MOBY-S/Services"); + ServiceTypeParser p = new ServiceTypeParser("http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/Services"); MobyServiceType[] types = p.getMobyServiceTypesFromRDF(); for (int i = 0; i < types.length; i++) { System.out.println(types[i]); From kawas at pub.open-bio.org Wed Mar 15 15:23:47 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 15:23:47 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603152023.k2FKNlfc000748@pub.open-bio.org> kawas Wed Mar 15 15:23:47 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory pub.open-bio.org:/tmp/cvs-serv718/org/biomoby/shared/extended Modified Files: ServiceInstanceParser.java Log Message: stripped lsids from inputs/outputs and namespaces so that these parsed services can be registered into mobycentral. moby-live/Java/src/main/org/biomoby/shared/extended ServiceInstanceParser.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/03/15 17:28:15 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/03/15 20:23:47 1.12 @@ -33,6 +33,8 @@ import com.hp.hpl.jena.shared.JenaException; import com.hp.hpl.jena.vocabulary.DC; import com.hp.hpl.jena.vocabulary.RDF; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -42,25 +44,25 @@ * An example of how to use this class is below: * *


- *            import org.biomoby.shared.MobyService;
- *            import org.biomoby.shared.Utils;
- *            import org.biomoby.shared.extended.ServiceInstanceParser;
- *            
- *            ...
- *                  
- *                       ServiceInstanceParser p = new ServiceInstanceParser(
- *      				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
- *      		MobyService[] services = p.getMobyServicesFromRDF();
- *      		if (!p.isRDFValid()) {
- *      			System.out.println("One or more services in the RDF were invalid");
- *      			System.out.println("The errors are the following:");
- *      			System.out.println(Utils.format(p.getErrors(),2));
- *      			
+ *             import org.biomoby.shared.MobyService;
+ *             import org.biomoby.shared.Utils;
+ *             import org.biomoby.shared.extended.ServiceInstanceParser;
+ *             
+ *             ...
+ *                   
+ *                        ServiceInstanceParser p = new ServiceInstanceParser(
+ *       				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
+ *       		MobyService[] services = p.getMobyServicesFromRDF();
+ *       		if (!p.isRDFValid()) {
+ *       			System.out.println("One or more services in the RDF were invalid");
+ *       			System.out.println("The errors are the following:");
+ *       			System.out.println(Utils.format(p.getErrors(),2));
+ *       			
+ *        		}
+ *       		System.out.println("The valid services are:");
+ *       		for (int i = 0; i < services.length; i++) {
+ *       			System.out.println((services[i]));
  *       		}
- *      		System.out.println("The valid services are:");
- *      		for (int i = 0; i < services.length; i++) {
- *      			System.out.println((services[i]));
- *      		}
  * 
* *

@@ -126,8 +128,7 @@ this.url = url; else { this.url = null; - throw new MobyException("Invalid url specified by " - + url.toExternalForm() + "."); + throw new MobyException("Invalid url specified by " + url.toExternalForm() + "."); } this.parsedOkay = false; errors = new StringBuffer(); @@ -173,8 +174,7 @@ * @throws MobyException * if there is a parsing error */ - public MobyService[] getMobyServicesFromRDF(Model model) - throws MobyException { + public MobyService[] getMobyServicesFromRDF(Model model) throws MobyException { // clear out any old information ArrayList list = new ArrayList(); if (model != null) { @@ -196,40 +196,34 @@ this.errors = new StringBuffer(); boolean success = true; - ResIterator rIterator = model - .listSubjectsWithProperty(FetaVocabulary.hasServiceNameText); + ResIterator rIterator = model.listSubjectsWithProperty(FetaVocabulary.hasServiceNameText); while (rIterator.hasNext()) { boolean currentlyBad = false; Resource resource = rIterator.nextResource(); String name = ""; if (resource.hasProperty(FetaVocabulary.hasServiceNameText)) - name = resource.getProperty(FetaVocabulary.hasServiceNameText) - .getObject().toString(); + name = resource.getProperty(FetaVocabulary.hasServiceNameText).getObject() + .toString(); MobyService service = new MobyService(name); // set the lsid service.setLSID(resource.getURI()); // get the signatureURL String signatureURL = ""; - if (resource - .hasProperty(FetaVocabulary.hasServiceDescriptionLocation)) - signatureURL = resource.getProperty( - FetaVocabulary.hasServiceDescriptionLocation) + if (resource.hasProperty(FetaVocabulary.hasServiceDescriptionLocation)) + signatureURL = resource.getProperty(FetaVocabulary.hasServiceDescriptionLocation) .getObject().toString(); service.setSignatureURL(signatureURL); // set the service type if (resource.hasProperty(FetaVocabulary.hasOperation)) { - Resource hoResource = resource.getProperty( - FetaVocabulary.hasOperation).getResource(); + Resource hoResource = resource.getProperty(FetaVocabulary.hasOperation) + .getResource(); if (hoResource.hasProperty(FetaVocabulary.performsTask)) { - Resource ptResource = hoResource.getProperty( - FetaVocabulary.performsTask).getResource(); - StmtIterator stmtIterator = ptResource - .listProperties(RDF.type); + Resource ptResource = hoResource.getProperty(FetaVocabulary.performsTask) + .getResource(); + StmtIterator stmtIterator = ptResource.listProperties(RDF.type); while (stmtIterator.hasNext()) { - RDFNode typeNode = stmtIterator.nextStatement() - .getObject(); - if (!typeNode.toString().equals( - FetaVocabulary.operationTask.toString())) { + RDFNode typeNode = stmtIterator.nextStatement().getObject(); + if (!typeNode.toString().equals(FetaVocabulary.operationTask.toString())) { String serviceType = typeNode.toString(); String[] parsedServiceType = serviceType.split("#"); if (parsedServiceType.length == 2) @@ -244,29 +238,26 @@ // set the category if (resource.hasProperty(DC.format)) { - String category = resource.getProperty(DC.format).getObject() - .toString(); + String category = resource.getProperty(DC.format).getObject().toString(); service.setCategory(category); } // set the authority, email address and authoritative values if (resource.hasProperty(FetaVocabulary.providedBy)) { - Resource org = (Resource) resource.getProperty( - FetaVocabulary.providedBy).getObject(); + Resource org = (Resource) resource.getProperty(FetaVocabulary.providedBy) + .getObject(); if (org.hasProperty(DC.publisher)) { - String authorityURI = org.getProperty(DC.publisher) - .getObject().toString(); + String authorityURI = org.getProperty(DC.publisher).getObject().toString(); service.setAuthority(authorityURI); } if (org.hasProperty(DC.creator)) { - String email = org.getProperty(DC.creator).getObject() - .toString(); + String email = org.getProperty(DC.creator).getObject().toString(); service.setEmailContact(email); } if (org.hasProperty(ServiceDescriptionPredicates.authoritative)) { String authoritative = org.getProperty( - ServiceDescriptionPredicates.authoritative) - .getObject().toString().trim(); + ServiceDescriptionPredicates.authoritative).getObject().toString() + .trim(); if (authoritative.equalsIgnoreCase("true")) service.setAuthoritative(true); else @@ -276,222 +267,205 @@ // set the url for the service if (resource.hasProperty(FetaVocabulary.locationURI)) { - String serviceUrl = resource.getProperty( - FetaVocabulary.locationURI).getObject().toString(); + String serviceUrl = resource.getProperty(FetaVocabulary.locationURI).getObject() + .toString(); service.setURL(serviceUrl); } // set the description if (resource.hasProperty(FetaVocabulary.hasServiceDescriptionText)) { - String description = resource.getProperty( - FetaVocabulary.hasServiceDescriptionText).getObject() - .toString(); + String description = resource.getProperty(FetaVocabulary.hasServiceDescriptionText) + .getObject().toString(); service.setDescription(description); } // process in/outputs - StmtIterator arguements = resource - .listProperties(FetaVocabulary.hasOperation); + StmtIterator arguements = resource.listProperties(FetaVocabulary.hasOperation); while (arguements.hasNext()) { Statement s = arguements.nextStatement(); Resource r = (Resource) s.getObject(); - StmtIterator inputs = r - .listProperties(FetaVocabulary.inputParameter); + StmtIterator inputs = r.listProperties(FetaVocabulary.inputParameter); // collections to be added at the end the current scope Map inputCollectionMap = new HashMap(); Map outputCollectionMap = new HashMap(); // is the current service bad? while (inputs.hasNext()) { - Resource parameter = (Resource) inputs.nextStatement() - .getObject(); - if (!parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().hasProperty(RDF.type)) { + Resource parameter = (Resource) inputs.nextStatement().getObject(); + if (!parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .hasProperty(RDF.type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + " did not have a parameter type of type RDF:type}"); errors.append(newline); continue; } else { - if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("simpleParameter")) { + if (parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString().endsWith( + "simpleParameter")) { // we have a simple // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + " was missing an object type}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { currentlyBad = true; success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + " was missing an article name}"); errors.append(newline); continue; } - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the input simple parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Input for service " - + service.getName() - + " was missing a non empty article name}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + + " was missing a non empty article name}"); errors.append(newline); continue; } // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the input parameters' namespace LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); namespaces.add(namespace); } } MobyPrimaryDataSimple primaryInput = new MobyPrimaryDataSimple(); - primaryInput - .setDataType(new MobyDataType(datatype)); + primaryInput.setDataType(new MobyDataType(datatype)); primaryInput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - primaryInput - .addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + primaryInput.addNamespace(new MobyNamespace((String) nsIterator + .next())); } } service.addInput(primaryInput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() + } else if (parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().getProperty(RDF.type).getObject().toString() .endsWith("collectionParameter")) { // we have a collection // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { currentlyBad = true; success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection input for service " + service.getName() + " was missing an object type.}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection for service " + service.getName() + " was missing an article name.}"); errors.append(newline); continue; } // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the collection input parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() - + " was missing a non empty article name.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection input for service " + service.getName() + + " was missing a non empty article name.}"); errors.append(newline); continue; } // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); namespaces.add(namespace); } } @@ -502,38 +476,32 @@ .get(articlename); } else collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple input = new MobyPrimaryDataSimple( - ""); + MobyPrimaryDataSimple input = new MobyPrimaryDataSimple(""); input.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - input.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + input + .addNamespace(new MobyNamespace((String) nsIterator + .next())); } } collection.addElement(input); inputCollectionMap.put(articlename, collection); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() + } else if (parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().getProperty(RDF.type).getObject().toString() .endsWith("secondaryParameter")) { // we have a secondary - if (!parameter - .hasProperty(ServiceDescriptionPredicates.datatype)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.datatype)) { currentlyBad = true; success = false; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing moby datatype" - + " (one of String, Float, Integer, DateTime).}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Invalid secondary input found. Missing moby datatype" + + " (one of String, Float, Integer, DateTime).}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; errors @@ -545,18 +513,16 @@ continue; } String datatype = parameter.getProperty( - ServiceDescriptionPredicates.datatype) - .getLiteral().getValue().toString(); + ServiceDescriptionPredicates.datatype).getLiteral().getValue() + .toString(); if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .indexOf("#") + 1); + datatype = datatype.substring(datatype.indexOf("#") + 1); if (datatype.indexOf(":") > 0) - datatype = datatype.substring(datatype - .indexOf(":") + 1); + datatype = datatype.substring(datatype.indexOf(":") + 1); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getLiteral().getValue().toString(); + FetaVocabulary.hasParameterNameText).getLiteral().getValue() + .toString(); if (articlename.equals("")) { success = false; currentlyBad = true; @@ -570,82 +536,56 @@ } // create the datatype - MobySecondaryData secondary = new MobySecondaryData( - articlename); + MobySecondaryData secondary = new MobySecondaryData(articlename); secondary.setDataType(datatype); - if (parameter - .hasProperty(FetaVocabulary.hasDefaultValue)) { - secondary.setDefaultValue(parameter - .getProperty( - FetaVocabulary.hasDefaultValue) - .getLiteral().getValue().toString()); + if (parameter.hasProperty(FetaVocabulary.hasDefaultValue)) { + secondary.setDefaultValue(parameter.getProperty( + FetaVocabulary.hasDefaultValue).getLiteral().getValue() + .toString()); } // process the description if (parameter .hasProperty(ServiceDescriptionPredicates.secondary_description)) { - secondary - .setDescription(parameter - .getProperty( - ServiceDescriptionPredicates.secondary_description) - .getLiteral().getValue() - .toString()); + secondary.setDescription(parameter.getProperty( + ServiceDescriptionPredicates.secondary_description) + .getLiteral().getValue().toString()); } - if (parameter - .hasProperty(ServiceDescriptionPredicates.max)) { + if (parameter.hasProperty(ServiceDescriptionPredicates.max)) { try { - secondary - .setMaximumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.max) - .getLiteral() - .getValue() - .toString())); + secondary.setMaximumValue(Integer.parseInt(parameter + .getProperty(ServiceDescriptionPredicates.max) + .getLiteral().getValue().toString())); } catch (NumberFormatException e) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid maximum value for secondary input.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Invalid maximum value for secondary input.}"); errors.append(newline); continue; } } - if (parameter - .hasProperty(ServiceDescriptionPredicates.min)) { + if (parameter.hasProperty(ServiceDescriptionPredicates.min)) { try { - secondary - .setMinimumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.min) - .getLiteral() - .getValue() - .toString())); + secondary.setMinimumValue(Integer.parseInt(parameter + .getProperty(ServiceDescriptionPredicates.min) + .getLiteral().getValue().toString())); } catch (NumberFormatException e) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid minimum value for secondary input.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Invalid minimum value for secondary input.}"); errors.append(newline); continue; } } - if (parameter - .hasProperty(ServiceDescriptionPredicates.enumeration)) { + if (parameter.hasProperty(ServiceDescriptionPredicates.enumeration)) { StmtIterator enumerations = parameter .listProperties(ServiceDescriptionPredicates.enumeration); while (enumerations.hasNext()) { - secondary.addAllowedValue(enumerations - .nextStatement().getLiteral() - .getValue().toString()); + secondary.addAllowedValue(enumerations.nextStatement() + .getLiteral().getValue().toString()); } } service.addInput(secondary); @@ -655,69 +595,62 @@ } } - StmtIterator outputs = r - .listProperties(FetaVocabulary.outputParameter); + StmtIterator outputs = r.listProperties(FetaVocabulary.outputParameter); while (outputs.hasNext()) { - Resource parameter = (Resource) outputs.nextStatement() - .getObject(); - if (!parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().hasProperty(RDF.type)) { + Resource parameter = (Resource) outputs.nextStatement().getObject(); + if (!parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .hasProperty(RDF.type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Output for service " + service.getName() + " did not have a parameter type of type RDF:type}"); errors.append(newline); continue; } else { - if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("simpleParameter")) { + if (parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString().endsWith( + "simpleParameter")) { // we have a simple // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { currentlyBad = true; success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Output for service " + service.getName() + " was missing an object type.}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Output for service " + service.getName() + " was missing an article name}"); errors.append(newline); continue; } // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the output simple parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { // throw new MobyException("Output for service " // + @@ -726,96 +659,91 @@ } // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); + namespaces.add(namespace); } } MobyPrimaryDataSimple primaryOutput = new MobyPrimaryDataSimple(); - primaryOutput - .setDataType(new MobyDataType(datatype)); + primaryOutput.setDataType(new MobyDataType(datatype)); primaryOutput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - primaryOutput - .addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + primaryOutput.addNamespace(new MobyNamespace( + (String) nsIterator.next())); } } service.addOutput(primaryOutput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() + } else if (parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().getProperty(RDF.type).getObject().toString() .endsWith("collectionParameter")) { // we have a collection // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection Output for service " + service.getName() + " was missing an object type.}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection for service " + service.getName() + " was missing an article name.}"); errors.append(newline); continue; } // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the output collection parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Collection output for service " - + service.getName() - + " was missing a non empty article name.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection output for service " + service.getName() + + " was missing a non empty article name.}"); errors.append(newline); continue; @@ -823,25 +751,27 @@ // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); namespaces.add(namespace); } } @@ -852,14 +782,13 @@ .get(articlename); } else collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple output = new MobyPrimaryDataSimple( - ""); + MobyPrimaryDataSimple output = new MobyPrimaryDataSimple(""); output.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - output.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + output.addNamespace(new MobyNamespace((String) nsIterator + .next())); } } collection.addElement(output); @@ -875,8 +804,8 @@ .get((String) it.next())); } for (it = outputCollectionMap.keySet().iterator(); it.hasNext();) { - service.addOutput((MobyPrimaryDataSet) outputCollectionMap - .get((String) it.next())); + service.addOutput((MobyPrimaryDataSet) outputCollectionMap.get((String) it + .next())); } } if (!currentlyBad) @@ -893,8 +822,7 @@ * @throws MobyException * if there are any parsing errors */ - public MobyService[] getMobyServicesFromRDF(String rdf) - throws MobyException { + public MobyService[] getMobyServicesFromRDF(String rdf) throws MobyException { // lets start parsing ArrayList list = new ArrayList(); @@ -924,8 +852,7 @@ this.url = url; else { this.url = null; - throw new MobyException("Invalid url specified by " - + url.toExternalForm() + "."); + throw new MobyException("Invalid url specified by " + url.toExternalForm() + "."); } } @@ -997,11 +924,10 @@ return errors.toString(); } - public static void main(String[] args) throws MobyException, - MalformedURLException, IOException { + public static void main(String[] args) throws MobyException, MalformedURLException, IOException { // show how to use this class ServiceInstanceParser p = new ServiceInstanceParser( - "http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/ServiceInstances"); + "http://bioinfo.icapture.ubc.ca/ekawas/services/parseBlastText.rdf"); MobyService[] services = p.getMobyServicesFromRDF(); if (!p.isRDFValid()) { System.out.println("One or more services in the RDF were invalid"); From kawas at pub.open-bio.org Thu Mar 23 14:10:32 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 23 Mar 2006 14:10:32 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231910.k2NJAWaf011717@pub.open-bio.org> kawas Thu Mar 23 14:10:31 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv11688/org/biomoby/registry/rdfagent/verifier Modified Files: MobyServiceComparator.java Processor.java Log Message: updated the agent so that if a modified service doesnt have an updated revision, then the agent will not update the service. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier MobyServiceComparator.java,1.3,1.4 Processor.java,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.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/registry/rdfagent/verifier/MobyServiceComparator.java 2006/03/15 17:57:07 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java 2006/03/23 19:10:31 1.4 @@ -5,6 +5,7 @@ import java.util.Map; import org.biomoby.shared.MobyData; +import org.biomoby.shared.MobyException; import org.biomoby.shared.MobyNamespace; import org.biomoby.shared.MobyPrimaryDataSet; import org.biomoby.shared.MobyPrimaryDataSimple; @@ -21,25 +22,25 @@ * *

  * 
- *  		// create 2 services and do stuff with them
- *  		MobyService service1 = new MobyService();
- *  		MobyService service2 = new MobyService();
- * 
- *  		...
- * 
- *  		// now use the MobyServiceComparator class 
- *  		MobyServiceComparator c = new MobyServiceComparator();
- *  		if (c.areServicesDifferent(service1, service2)) {
- *  			// print out the differences
- *  			System.out.println(c.getDifferences());
- *  		} else {
- *  			System.out.println("The 2 services are identical");
- *  		}
+ *   		// create 2 services and do stuff with them
+ *   		MobyService service1 = new MobyService();
+ *   		MobyService service2 = new MobyService();
+ *  
+ *   		...
  *  
- *  		// lets check if the inputs and outputs for service 1 are valid
- *  		if (c.areInputsOutputsForServiceValid(service1)) {
- *  			System.out.println("The inputs/outputs are valid!");
- *  		}
+ *   		// now use the MobyServiceComparator class 
+ *   		MobyServiceComparator c = new MobyServiceComparator();
+ *   		if (c.areServicesDifferent(service1, service2)) {
+ *   			// print out the differences
+ *   			System.out.println(c.getDifferences());
+ *   		} else {
+ *   			System.out.println("The 2 services are identical");
+ *   		}
+ *   
+ *   		// lets check if the inputs and outputs for service 1 are valid
+ *   		if (c.areInputsOutputsForServiceValid(service1)) {
+ *   			System.out.println("The inputs/outputs are valid!");
+ *   		}
  * 
  * 
* @@ -53,7 +54,7 @@ /** * Constructor - * + * */ public MobyServiceComparator() { init(); @@ -73,8 +74,7 @@ * @return true if the service signatures are not equal, false otherwise. * For services that are null, true is always returned. */ - public boolean areServicesDifferent(MobyService service1, - MobyService service2) { + public boolean areServicesDifferent(MobyService service1, MobyService service2) { init(); if (service1 == null || service2 == null) return true; @@ -87,23 +87,21 @@ // compare the name - usually different if using this class stand // alone if (!service1.getName().equals(service2.getName())) { - addDifference("Service1 has name " + service1.getName() - + " which is different from " + service2.getName() + "."); + addDifference("Service1 has name " + service1.getName() + " which is different from " + + service2.getName() + "."); isDifferent = true; } // compare authorities if (!service1.getAuthority().equals(service2.getAuthority())) { addDifference("Service1 has authority " + service1.getAuthority() - + " which is different from " + service2.getAuthority() - + "."); + + " which is different from " + service2.getAuthority() + "."); isDifferent = true; } // compare authoritative if (service1.isAuthoritative() != service2.isAuthoritative()) { - addDifference("Service1 is " - + (service1.isAuthoritative() ? "" : "not ") + addDifference("Service1 is " + (service1.isAuthoritative() ? "" : "not ") + "authoritative while service2 is" + (service2.isAuthoritative() ? "." : " not.")); isDifferent = true; @@ -112,46 +110,34 @@ // compare category if (!service1.getCategory().equals(service2.getCategory())) { addDifference("Service1 has category " + service1.getCategory() - + " which is different from " + service2.getCategory() - + "."); + + " which is different from " + service2.getCategory() + "."); isDifferent = true; } // compare descriptions if (!service1.getDescription().equals(service2.getDescription())) { - addDifference("Service1 has description " - + service1.getDescription() + " which is different from " - + service2.getDescription() + "."); - isDifferent = true; - } - - // compare lsids - if (!service1.getLSID().equals(service2.getLSID())) { - addDifference("Service1 has LSID " - + service1.getLSID() + " which is different from " - + service2.getLSID() + "."); + addDifference("Service1 has description " + service1.getDescription() + + " which is different from " + service2.getDescription() + "."); isDifferent = true; } // compare email if (!service1.getEmailContact().equals(service2.getEmailContact())) { - addDifference("Service1 has contact address " - + service1.getEmailContact() + " which is different from " - + service2.getEmailContact() + "."); + addDifference("Service1 has contact address " + service1.getEmailContact() + + " which is different from " + service2.getEmailContact() + "."); isDifferent = true; } // compare signature url if (!service1.getSignatureURL().equals(service2.getSignatureURL())) { - addDifference("Service1 has signature url " - + service1.getSignatureURL() + " which is different from " - + service2.getSignatureURL() + "."); + addDifference("Service1 has signature url " + service1.getSignatureURL() + + " which is different from " + service2.getSignatureURL() + "."); isDifferent = true; } // compare type if (!service1.getType().equals(service2.getType())) { - addDifference("Service1 has type " + service1.getType() - + " which is different from " + service2.getType() + "."); + addDifference("Service1 has type " + service1.getType() + " which is different from " + + service2.getType() + "."); isDifferent = true; } @@ -203,30 +189,25 @@ MobyPrimaryDataSet set1 = (MobyPrimaryDataSet) data1; MobyPrimaryDataSet set2 = (MobyPrimaryDataSet) data2; - Map collectionInputs1 = getMapFromCollection(set1 - .getElements()); - Map collectionInputs2 = getMapFromCollection(set2 - .getElements()); - for (Iterator collectionInputIt = collectionInputs1 - .keySet().iterator(); collectionInputIt.hasNext();) { + Map collectionInputs1 = getMapFromCollection(set1.getElements()); + Map collectionInputs2 = getMapFromCollection(set2.getElements()); + for (Iterator collectionInputIt = collectionInputs1.keySet().iterator(); collectionInputIt + .hasNext();) { String inputKey = (String) collectionInputIt.next(); if (collectionInputs2.containsKey(inputKey)) { MobyPrimaryDataSimple colData1 = (MobyPrimaryDataSimple) collectionInputs1 .get(inputKey); MobyPrimaryDataSimple colData2 = (MobyPrimaryDataSimple) collectionInputs2 .remove(inputKey); - - + if (colData1.getDataType().getName().equals( colData2.getDataType().getName())) { // check the namespaces if of the same type - Map namespaces1 = getMapFromMobyNamespace(colData1 - .getNamespaces()); - Map namespaces2 = getMapFromMobyNamespace(colData2 - .getNamespaces()); - for (Iterator nsIt = namespaces1.keySet() - .iterator(); nsIt.hasNext();) { + Map namespaces1 = getMapFromMobyNamespace(colData1.getNamespaces()); + Map namespaces2 = getMapFromMobyNamespace(colData2.getNamespaces()); + for (Iterator nsIt = namespaces1.keySet().iterator(); nsIt + .hasNext();) { String nsKey = (String) nsIt.next(); // remove it from namespaces2 if (namespaces2.remove(nsKey) == null) { @@ -240,95 +221,76 @@ } } // now go through what is left in namespaces2 - for (Iterator nsIt = namespaces2.keySet() - .iterator(); nsIt.hasNext();) { + for (Iterator nsIt = namespaces2.keySet().iterator(); nsIt + .hasNext();) { String nsKey = (String) nsIt.next(); // namespae2 was different -> key not in it - addDifference("A collection " - + (isInput ? "input" : "output") + addDifference("A collection " + (isInput ? "input" : "output") + " for service2 had the additional namespace: " + nsKey); isDifferent = true; } } else { // different object types - addDifference("Service1 had an " - + (isInput ? "input" : "output") + addDifference("Service1 had an " + (isInput ? "input" : "output") + " in a collection of type " + colData1.getDataType().getName() + " while service2 had an " - + (isInput ? "input" : "output") - + " of type " + + (isInput ? "input" : "output") + " of type " + colData2.getDataType().getName() - + ". Both had an articlename of " - + inputKey + "."); + + ". Both had an articlename of " + inputKey + "."); isDifferent = true; } } else { addDifference("Service1 had a collection " - + (isInput ? "input" : "output") - + " named " + inputKey + + (isInput ? "input" : "output") + " named " + inputKey + " while service2 did not."); isDifferent = true; } } - for (Iterator collectionInputIt = collectionInputs2 - .keySet().iterator(); collectionInputIt.hasNext();) { - addDifference("Service2 had a collection " - + (isInput ? "input" : "output") + " named " - + (String) collectionInputIt.next() + for (Iterator collectionInputIt = collectionInputs2.keySet().iterator(); collectionInputIt + .hasNext();) { + addDifference("Service2 had a collection " + (isInput ? "input" : "output") + + " named " + (String) collectionInputIt.next() + " while service1 did not."); isDifferent = true; } } else if (data1 instanceof MobyPrimaryDataSimple) { // check for same object type - if (((MobyPrimaryDataSimple) data1).getDataType().getName() - .equals( - ((MobyPrimaryDataSimple) data2) - .getDataType().getName())) { + if (((MobyPrimaryDataSimple) data1).getDataType().getName().equals( + ((MobyPrimaryDataSimple) data2).getDataType().getName())) { // check the namespaces if of the same type Map namespaces1 = getMapFromMobyNamespace(((MobyPrimaryDataSimple) data1) .getNamespaces()); Map namespaces2 = getMapFromMobyNamespace(((MobyPrimaryDataSimple) data2) .getNamespaces()); - //FIXME not parsing correctly - missing namespaces - for (Iterator nsIt = namespaces1.keySet().iterator(); nsIt - .hasNext();) { + for (Iterator nsIt = namespaces1.keySet().iterator(); nsIt.hasNext();) { String nsKey = (String) nsIt.next(); // remove it from namespaces2 if (namespaces2.remove(nsKey) == null) { // namespae2 was different -> key not in it - addDifference("An " - + (isInput ? "input" : "output") - + " for service2 did not have the namespace " - + nsKey + "."); + addDifference("An " + (isInput ? "input" : "output") + + " for service2 did not have the namespace " + nsKey + "."); isDifferent = true; } } // now go through what is left in namespaces2 - for (Iterator nsIt = namespaces2.keySet().iterator(); nsIt - .hasNext();) { + for (Iterator nsIt = namespaces2.keySet().iterator(); nsIt.hasNext();) { String nsKey = (String) nsIt.next(); // namespae2 was different -> key not in it - addDifference("An " - + (isInput ? "input" : "output") - + " for service2 had the additional namespace: " - + nsKey); + addDifference("An " + (isInput ? "input" : "output") + + " for service2 had the additional namespace: " + nsKey); isDifferent = true; } } else { // different object types - addDifference("Service1 had an " - + (isInput ? "input" : "output") + addDifference("Service1 had an " + (isInput ? "input" : "output") + " of type " - + ((MobyPrimaryDataSimple) data1).getDataType() - .getName() - + " while service2 had an " - + (isInput ? "input" : "output") + + ((MobyPrimaryDataSimple) data1).getDataType().getName() + + " while service2 had an " + (isInput ? "input" : "output") + " of type " - + ((MobyPrimaryDataSimple) data2).getDataType() - .getName() + + ((MobyPrimaryDataSimple) data2).getDataType().getName() + ". Both had an articlename of " + key + "."); isDifferent = true; } @@ -337,52 +299,39 @@ MobySecondaryData secondary1 = (MobySecondaryData) data1; MobySecondaryData secondary2 = (MobySecondaryData) data2; - if (secondary1.getDataType().equals( - secondary2.getDataType())) { + if (secondary1.getDataType().equals(secondary2.getDataType())) { // compare maximums - if (secondary1.getMaximumValue() != secondary2 - .getMaximumValue()) { + if (secondary1.getMaximumValue() != secondary2.getMaximumValue()) { addDifference("Service1 had a secondary input maxinmum value " + secondary1.getMaximumValue() + " while service2 had a secondary input maximum value of " + secondary2.getMaximumValue() - + ". Both had an articlename of " - + key - + "."); + + ". Both had an articlename of " + key + "."); isDifferent = true; } // compare minimums - if (secondary1.getMinimumValue() != secondary2 - .getMinimumValue()) { + if (secondary1.getMinimumValue() != secondary2.getMinimumValue()) { addDifference("Service1 had a secondary input mininmum value of " + secondary1.getMinimumValue() + " while service2 had a secondary input minimum value of " + secondary2.getMinimumValue() - + ". Both had an articlename of " - + key - + "."); + + ". Both had an articlename of " + key + "."); isDifferent = true; } // compare defaults - if (!secondary1.getDefaultValue().equals( - secondary2.getDefaultValue())) { + if (!secondary1.getDefaultValue().equals(secondary2.getDefaultValue())) { addDifference("Service1 had a secondary input default value of " + secondary1.getDefaultValue() + " while service2 had a secondary input default value of " + secondary2.getDefaultValue() - + ". Both had an articlename of " - + key - + "."); + + ". Both had an articlename of " + key + "."); isDifferent = true; } // compare allowable values - Map allowable1 = getMapStrings(secondary1 - .getAllowedValues()); - Map allowable2 = getMapStrings(secondary2 - .getAllowedValues()); - for (Iterator nsIt = allowable1.keySet().iterator(); nsIt - .hasNext();) { + Map allowable1 = getMapStrings(secondary1.getAllowedValues()); + Map allowable2 = getMapStrings(secondary2.getAllowedValues()); + for (Iterator nsIt = allowable1.keySet().iterator(); nsIt.hasNext();) { String valueKey = (String) nsIt.next(); // remove it from namespaces2 if (allowable2.remove(valueKey) == null) { @@ -394,8 +343,7 @@ } // now iterate through secondary2 // now go through what is left in namespaces2 - for (Iterator nsIt = allowable2.keySet().iterator(); nsIt - .hasNext();) { + for (Iterator nsIt = allowable2.keySet().iterator(); nsIt.hasNext();) { String valueKey = (String) nsIt.next(); // namespae2 was different -> key not in it addDifference("A secondary input for service2 had the additional allowable value: " @@ -408,8 +356,8 @@ addDifference("Service1 had a secondary input of type " + secondary1.getDataType() + " while service2 had a secondary input of type " - + secondary2.getDataType() - + ". Both had an articlename of " + key + "."); + + secondary2.getDataType() + ". Both had an articlename of " + key + + "."); isDifferent = true; } @@ -419,8 +367,7 @@ } } else { // no -> record difference - addDifference("Service1 had an " - + (isInput ? "input" : "output") + " named " + key + addDifference("Service1 had an " + (isInput ? "input" : "output") + " named " + key + " while service2 did not."); isDifferent = true; @@ -429,9 +376,8 @@ // now look through the second map for any new types // record them for (Iterator it = dataMap2.keySet().iterator(); it.hasNext();) { - addDifference("Service2 had an " + (isInput ? "input" : "output") - + " named " + (String) it.next() - + " while service1 did not."); + addDifference("Service2 had an " + (isInput ? "input" : "output") + " named " + + (String) it.next() + " while service1 did not."); isDifferent = true; } } @@ -482,6 +428,29 @@ return true; } + /** + * PRE: Service1 and service2 are describe the same service instance + * otherwise an exception is raised + * + * @param service1 + * a moby service instance + * @param service2 + * another moby service instance + * @return true if the lsid revisions are different, false otherwise. + * @throws MobyException + * if the services describe different service 'instances' + */ + public boolean areLsidVersionsDifferent(MobyService service1, MobyService service2) + throws MobyException { + if (!service1.getUniqueName().equals(service2.getUniqueName())) + throw new MobyException( + "You cannot LSID revision numbers if the services are not describing the same 'instance'."); + if (!service1.getLSID().equals(service2.getLSID())) { + return true; + } + return false; + } + private Map getMapFromMobyNamespace(MobyNamespace[] datas) { HashMap map = new HashMap(); for (int i = 0; i < datas.length; i++) { @@ -504,7 +473,7 @@ * newline */ private void addDifference(String difference) { - buffer.append("\t" +difference + System.getProperty("line.separator")); + buffer.append("\t" + difference + System.getProperty("line.separator")); } /** =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/15 17:56:26 1.14 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/23 19:10:31 1.15 @@ -62,8 +62,7 @@ Map servicesProcessed = new HashMap(); // create a vector of process services Vector extraServices = new Vector(); - for (Iterator keyIterator = serviceMap.keySet().iterator(); keyIterator - .hasNext();) { + for (Iterator keyIterator = serviceMap.keySet().iterator(); keyIterator.hasNext();) { String key = (String) keyIterator.next(); if (extraServices.contains(key)) { @@ -76,42 +75,35 @@ // process bad signatures once, try to remove the service if (badURLs.containsKey(signatureURL)) { - Log.warning("The signature url, " + signatureURL - + ", has already been" + newline - + " processed and was invalid" + Log.warning("The signature url, " + signatureURL + ", has already been" + + newline + " processed and was invalid" + " for one reason or another."); - removeInvalidSignatureURLServiceFromRegistry( - registryService, central, - "The service has an invalid signature url.", - ((Integer) badURLs.get(signatureURL)).intValue()); + removeInvalidSignatureURLServiceFromRegistry(registryService, central, + "The service has an invalid signature url.", ((Integer) badURLs + .get(signatureURL)).intValue()); continue; } if (signatureURL.trim().equals("")) { if (!ignoreNulls) { - processNullSignatureURLs(registryService, - "Null signature URL.", central); + processNullSignatureURLs(registryService, "Null signature URL.", central); continue; } else { // warn about the null url - Log - .warning("Service, (" - + registryService.getUniqueName() - + "), contains a NULL signature url and" - + newline - + " could have been removed, " - + "but you have chosen to ignore these services."); - processNullSignatureURLs(registryService, - "Null signature URL.", central); + Log.warning("Service, (" + registryService.getUniqueName() + + "), contains a NULL signature url and" + newline + + " could have been removed, " + + "but you have chosen to ignore these services."); + processNullSignatureURLs(registryService, "Null signature URL.", central); continue; } } else { // non null signature url SignatureURLConnection connection = new SignatureURLConnection(); MobyService[] rdfServices = null; - + // only process signature urls once if (signatureURLsProcessed.containsKey(signatureURL)) continue; @@ -119,17 +111,14 @@ signatureURLsProcessed.put(signatureURL, ""); rdfServices = connection.extractServicesFromURL(signatureURL); - + if (rdfServices == null) { // add the url to the bad list so that the hitlist // doesnt grow by the number of services at the service // description location - badURLs.put(signatureURL, connection.getBadUrlMap() - .get(signatureURL)); + badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); // rdf is missing - removeInvalidSignatureURLService( - registryService, - central, + removeInvalidSignatureURLService(registryService, central, "The signature url was missing, or the rdf document was invalid.", connection); continue; @@ -140,19 +129,17 @@ // this would happen if a url contained rdf but not // current rdf - badURLs.put(signatureURL, connection.getBadUrlMap() - .get(signatureURL)); + badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); // no services found in the document - removeInvalidSignatureURLService( - registryService, - central, - "given, " + signatureURL - + ", no service was found called " - + registryService.getUniqueName() + ".", - connection); + removeInvalidSignatureURLService(registryService, central, "given, " + + signatureURL + ", no service was found called " + + registryService.getUniqueName() + ".", connection); continue; } else { for (int i = 0; i < rdfServices.length; i++) { + // TODO compare service LSIDs if revision is + // different, then process service, otherwise ignore + // it boolean rdfInvalid = false; // iterate over the services in the array String rdfKey = rdfServices[i].getAuthority() + "," @@ -160,23 +147,19 @@ MobyServiceComparator comparator = new MobyServiceComparator(); if (key.equals(rdfKey)) { // we have a matching service - if (!comparator - .areInputsOutputsForServiceValid(rdfServices[i])) { + if (!comparator.areInputsOutputsForServiceValid(rdfServices[i])) { Log .warning("The service, " + rdfKey + ", contained in the RDF is not a valid service." + newline + "\tIt may have inputs or outputs that do not conform to the Moby API."); - Log - .info("The service " - + rdfKey - + " was ignored as it was invalid."); + Log.info("The service " + rdfKey + + " was ignored as it was invalid."); rdfInvalid = true; } - if (!comparator - .areInputsOutputsForServiceValid(registryService)) { + if (!comparator.areInputsOutputsForServiceValid(registryService)) { if (!rdfInvalid) { // a valid rdf service will replace the // invalid registry one. @@ -198,8 +181,7 @@ + "Note that a valid version of this service was found in the RDF document."); // do this iff we removed the service if (code == 200) { - addServiceToRegistry( - rdfServices[i], central); + addServiceToRegistry(rdfServices[i], central); } continue; } else { @@ -225,28 +207,40 @@ // if the rdf is not invalid and the services // are different if (!rdfInvalid - && comparator - .areServicesDifferent( - registryService, - rdfServices[i])) { - String differences = comparator - .getDifferences(); - processModifiedServices(central, - rdfServices[i], registryService, - differences); - /* - * Log.info("The service " + rdfKey + " has - * changed." + newline + "Changes are: " + - * newline + comparator.getDifferences()); - * int code = - * removeChangedServiceFromRegistry( - * registryService, central, - * comparator.getDifferences()); // do this - * iff we removed the first service if (code == - * 200) { - * addServiceToRegistry(rdfServices[i], - * central); } - */ + && comparator.areServicesDifferent(registryService, + rdfServices[i])) { + boolean areLSIDsDifferent = false; + try { + areLSIDsDifferent = comparator.areLsidVersionsDifferent( + rdfServices[i], registryService); + } catch (MobyException e) { + // TODO log and skip this service + // because the lsids describe different + // services + Log.exception(this.getClass().getName(), + "processRegistryServices(Map, Central)", e); + Log.severe("The LSIDs describe different services." + + newline + e.getLocalizedMessage()); + Log.info("The service " + rdfServices[i].getUniqueName() + + " and the service " + + registryService.getUniqueName() + + " have lsids that describe different services."); + + } + + if (areLSIDsDifferent) { + String differences = comparator.getDifferences(); + processModifiedServices(central, rdfServices[i], + registryService, differences); + } else { + Log.info("The service " + rdfServices[i].getUniqueName() + + " and the service " + newline + + registryService.getUniqueName() + + " have the same LSID (and revision) " + newline + + "and due to this, the agent chose not " + newline + + "to update the service. Please modify " + newline + + "the LSID revision for your service."); + } continue; } } else { @@ -255,18 +249,15 @@ MobyService existingRegistryService = (MobyService) serviceMap .get(rdfKey); extraServices.add(rdfKey); - if (!comparator - .areInputsOutputsForServiceValid(rdfServices[i])) { + if (!comparator.areInputsOutputsForServiceValid(rdfServices[i])) { Log .warning("The service, " + rdfKey + ", contained in the RDF is not a valid service. " + newline + "\tIt may have inputs or outputs that do not conform to the Moby API."); - Log - .info("The service " - + rdfKey - + " was ignored as it was invalid."); + Log.info("The service " + rdfKey + + " was ignored as it was invalid."); rdfInvalid = true; } if (!comparator @@ -294,8 +285,7 @@ // do this iff we removed the // service if (code == 200) { - addServiceToRegistry( - rdfServices[i], central); + addServiceToRegistry(rdfServices[i], central); } continue; } else { @@ -320,47 +310,64 @@ } if (!rdfInvalid && comparator.areServicesDifferent( - existingRegistryService, - rdfServices[i])) { - String differences = comparator - .getDifferences(); - processModifiedServices(central, - rdfServices[i], - existingRegistryService, - differences); - - /* - * Log.info("The service " + rdfKey + " - * has changed." + newline + "Changes - * are: " + newline + - * comparator.getDifferences()); int - * code = - * removeChangedServiceFromRegistry( - * existingRegistryService, central, - * comparator .getDifferences()); if - * (code == 200) { addServiceToRegistry( - * rdfServices[i], central); } - */ + existingRegistryService, rdfServices[i])) { + + boolean areLSIDsDifferent = false; + try { + areLSIDsDifferent = comparator + .areLsidVersionsDifferent(rdfServices[i], + existingRegistryService); + } catch (MobyException e) { + // TODO log and skip this service + // because the lsids describe + // different services + Log.exception(this.getClass().getName(), + "processRegistryServices(Map, Central)", e); + Log.severe("The LSIDs describe different services." + + newline + e.getLocalizedMessage()); + Log + .info("The service " + + rdfServices[i].getUniqueName() + + " and the service " + + existingRegistryService + .getUniqueName() + + " have lsids that describe different services."); + + } + + if (areLSIDsDifferent) { + String differences = comparator.getDifferences(); + processModifiedServices(central, rdfServices[i], + existingRegistryService, differences); + } else { + Log.info("The service " + + rdfServices[i].getUniqueName() + + " and the service " + newline + + existingRegistryService.getUniqueName() + + " have the same LSID (and revision) " + + newline + + "and due to this, the agent chose not " + + newline + + "to update the service. Please modify " + + newline + + "the LSID revision for your service."); + } continue; } } else { // new service found! - Log.info("New service found. Service: " - + rdfKey); - addNewServiceToRegistry(rdfServices[i], - central); + Log.info("New service found. Service: " + rdfKey); + addNewServiceToRegistry(rdfServices[i], central); } } } // end for loop rdfInvalid now false // check if their were any invalid services in the rdf if (connection.getInvalidServicesFoundInRDF().size() > 0) { - for (Iterator it = connection - .getInvalidServicesFoundInRDF().iterator(); it + for (Iterator it = connection.getInvalidServicesFoundInRDF().iterator(); it .hasNext();) { - removeInvalidServiceFromRegistry((MobyService) it - .next()); + removeInvalidServiceFromRegistry((MobyService) it.next()); } } @@ -394,16 +401,13 @@ registryServices[0].setSignatureURL(url); registryServices = central.findService(registryServices[0]); for (int i = 0; i < registryServices.length; i++) { - foundServices.put(registryServices[i].getUniqueName(), - registryServices[i]); + foundServices.put(registryServices[i].getUniqueName(), registryServices[i]); } } catch (MobyException e) { // - Log.exception(this.getClass().getName(), - "processServicesFromURL(String, Central)", e); - Log - .severe("There was a problem comunicating with the registry. The url: " - + url + " was not processed."); + Log.exception(this.getClass().getName(), "processServicesFromURL(String, Central)", e); + Log.severe("There was a problem comunicating with the registry. The url: " + url + + " was not processed."); return; } @@ -413,37 +417,23 @@ // empty for (Iterator it = foundServices.keySet().iterator(); it.hasNext();) { String uniqueName = (String) it.next(); - MobyService service = (MobyService) foundServices - .get(uniqueName); - removeMissingServiceFromRegistry( - service, - central, - "The RDF document located at: " - + url - + " was unreachable. Removing those services that " - + "were said to be located there."); + MobyService service = (MobyService) foundServices.get(uniqueName); + removeMissingServiceFromRegistry(service, central, "The RDF document located at: " + + url + " was unreachable. Removing those services that " + + "were said to be located there."); } return; } else if (rdfServices.length == 0) { - Log - .warning("Unable to retrieve the services from " - + url - + "." - + newline - + "All services described by that location will be removed."); + Log.warning("Unable to retrieve the services from " + url + "." + newline + + "All services described by that location will be removed."); // iterate over foundServices and remove any services b/c rdf was // empty for (Iterator it = foundServices.keySet().iterator(); it.hasNext();) { String uniqueName = (String) it.next(); - MobyService service = (MobyService) foundServices - .get(uniqueName); - removeMissingServiceFromRegistry( - service, - central, - "The RDF document located at: " - + url - + " was unreachable. Removing those services that " - + "were said to be located there."); + MobyService service = (MobyService) foundServices.get(uniqueName); + removeMissingServiceFromRegistry(service, central, "The RDF document located at: " + + url + " was unreachable. Removing those services that " + + "were said to be located there."); } return; } else { @@ -454,14 +444,11 @@ MobyService rdfService = rdfServices[i]; rdfService.setSignatureURL(url); MobyService registryService = null; - // rdf had extra service if (!foundServices.containsKey(rdfService.getUniqueName())) { - Log - .info("Unable to find a service in the registry that matches (" - + rdfService.getUniqueName() + ")."); - MobyService[] ms = new MobyService[] { new MobyService( - rdfService.getName()) }; + Log.info("Unable to find a service in the registry that matches (" + + rdfService.getUniqueName() + ")."); + MobyService[] ms = new MobyService[] { new MobyService(rdfService.getName()) }; ms[0].setAuthority(rdfService.getAuthority()); try { @@ -469,9 +456,8 @@ } catch (MobyException e) { Log.exception(this.getClass().getName(), "processServicesFromURL(String, Central)", e); - Log - .severe("There was a problem comunicating with " - + "the registry while checking for service existance."); + Log.severe("There was a problem comunicating with " + + "the registry while checking for service existance."); ms = null; } @@ -488,24 +474,21 @@ } // registry and rdf had a similar service - start comparing - Log - .info("Found a service in the registry that matches the one in the RDF ..." - + newline + "Comparing them ..."); - registryService = (MobyService) foundServices.remove(rdfService - .getUniqueName()); + Log.info("Found a service in the registry that matches the one in the RDF ..." + + newline + "Comparing them ..."); + registryService = (MobyService) foundServices.remove(rdfService.getUniqueName()); if (!comparator.areInputsOutputsForServiceValid(rdfService)) { // service in rdf is invalid Log.warning("The service, " + rdfService.getUniqueName() - + ", contained in the RDF is not a valid service." - + newline + "\tIt may have inputs or outputs that" + + ", contained in the RDF is not a valid service." + newline + + "\tIt may have inputs or outputs that" + " do not conform to the Moby API."); Log.info("The service " + rdfService.getUniqueName() + " was ignored as it was invalid."); isRDFValid = false; } - if (!comparator - .areInputsOutputsForServiceValid(registryService)) { + if (!comparator.areInputsOutputsForServiceValid(registryService)) { // service in registry is invalid if (isRDFValid) { // a valid rdf service will replace @@ -540,8 +523,7 @@ + ", is not a valid service. This service was found in the registry." + newline + "\tIt may have inputs or outputs that do not conform to the Moby API." - + newline - + "\tThis service is going to be removed."); + + newline + "\tThis service is going to be removed."); removeInvalidChangedServiceFromRegistry( registryService, central, @@ -552,24 +534,46 @@ } } - if (isRDFValid - && comparator.areServicesDifferent(rdfService, - registryService)) { + if (isRDFValid && comparator.areServicesDifferent(rdfService, registryService)) { + // TODO compare lsid revisions, if different process + // service, otherwise dont! // services differ - remove registry srvc and add rdf svrc - String differences = comparator.getDifferences(); - processModifiedServices(central, rdfService, - registryService, differences); + boolean areLSIDsDifferent = false; + try { + areLSIDsDifferent = comparator.areLsidVersionsDifferent(rdfService, + registryService); + } catch (MobyException e) { + // TODO log and skip this service because the lsids + // describe different services + Log.exception(this.getClass().getName(), + "processRegistryServices(Map, Central)", e); + Log.severe("The LSIDs describe different services." + newline + + e.getLocalizedMessage()); + Log.info("The service " + rdfService.getUniqueName() + " and the service " + + registryService.getUniqueName() + + " have lsids that describe different services."); + + } + if (areLSIDsDifferent) { + String differences = comparator.getDifferences(); + processModifiedServices(central, rdfService, registryService, differences); + } else { + Log.info("The service " + rdfService.getUniqueName() + " and the service " + + newline + registryService.getUniqueName() + + " have the same LSID (and revision) " + newline + + "and due to this, the agent chose not " + newline + + "to update the service. Please modify " + newline + + "the LSID revision for your service."); + } continue; } } // iterate over foundServices and remove any services left for (Iterator it = foundServices.keySet().iterator(); it.hasNext();) { String uniqueName = (String) it.next(); - MobyService service = (MobyService) foundServices - .get(uniqueName); + MobyService service = (MobyService) foundServices.get(uniqueName); removeMissingServiceFromRegistry(service, central, - "Service was not found in the RDF document located at: " - + url); + "Service was not found in the RDF document located at: " + url); } } } @@ -578,14 +582,14 @@ * @param central @param rdfService @param registryService @param * differences */ - private void processModifiedServices(Central central, - MobyService rdfService, MobyService registryService, - String differences) { - Log.info("The service " + rdfService.getUniqueName() + " has changed." - + newline + "Changes are: " + newline + differences); + private void processModifiedServices(Central central, MobyService rdfService, + MobyService registryService, String differences) { + Log.info("The service " + rdfService.getUniqueName() + " has changed." + newline + + "Changes are: " + newline + differences); if (enableServiceUpdates) { - int code = removeChangedServiceFromRegistry(registryService, - central, differences); + // TODO keep track of the revision on the new service - change the + // revision to the one in the document + int code = removeChangedServiceFromRegistry(registryService, central, differences); if (code == 200) { if (addServiceToRegistry(rdfService, central)) { // service was added @@ -608,35 +612,29 @@ } } } else { - Log - .info("The service " - + rdfService.getUniqueName() - + " was found to be modified." - + newline - + "Since you have disabled service updates, the registry was not updated."); + Log.info("The service " + rdfService.getUniqueName() + " was found to be modified." + + newline + + "Since you have disabled service updates, the registry was not updated."); } } - private void processNullSignatureURLs(MobyService service, String string, - Central central) { + private void processNullSignatureURLs(MobyService service, String string, Central central) { // create and optionally save the report Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + string); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnNull) { @@ -646,18 +644,13 @@ // remove service only if we arent ignoring them if (!ignoreNulls) { // remove the null signature url service - Log.info("Service, (" + service.getName() + ", " - + service.getAuthority() + Log.info("Service, (" + service.getName() + ", " + service.getAuthority() + "), contains a NULL signature url and will be removed."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } } @@ -668,24 +661,18 @@ */ private void sendMail(MobyService service, Report report) { if (useSMTP) { - Log.info("Sending the report to " + service.getEmailContact() - + " (SMTP)."); + Log.info("Sending the report to " + service.getEmailContact() + " (SMTP)."); Mailer mailer = new Mailer(); - if (!mailer.sendSMTPMail(Constants.SMTP_SERVER, - Constants.SMTP_LOGIN, Constants.SMTP_PSWD, service - .getEmailContact(), "Agent report regarding: " - + service.getName(), report.getReport(), - Constants.ADMIN_EMAIL)) { - Log - .warning("Agent told to use SMTP mail, but failed. Attempting to use 'mail'"); + if (!mailer.sendSMTPMail(Constants.SMTP_SERVER, Constants.SMTP_LOGIN, + Constants.SMTP_PSWD, service.getEmailContact(), "Agent report regarding: " + + service.getName(), report.getReport(), Constants.ADMIN_EMAIL)) { + Log.warning("Agent told to use SMTP mail, but failed. Attempting to use 'mail'"); } } else { - Log.info("Sending the report to " + service.getEmailContact() - + " ('mail')."); + Log.info("Sending the report to " + service.getEmailContact() + " ('mail')."); Mailer mailer = new Mailer(); - if (!mailer.sendMail(service.getEmailContact(), - "Agent report regarding: " + service.getName(), report - .getReport())) { + if (!mailer.sendMail(service.getEmailContact(), "Agent report regarding: " + + service.getName(), report.getReport())) { Log.warning("Agent failed to send mail using 'mail'"); } } @@ -695,9 +682,8 @@ * adds a service that was modified or registered incorrectly. */ private boolean addServiceToRegistry(MobyService service, Central central) { - Log.info("Agent will attempt to add the Service " + service.getName() - + ", " + service.getAuthority() + " ) " + newline - + "to the registry."); + Log.info("Agent will attempt to add the Service " + service.getName() + ", " + + service.getAuthority() + " ) " + newline + "to the registry."); return registerService(service, central); } @@ -706,9 +692,8 @@ */ private void addNewServiceToRegistry(MobyService service, Central central) { Log.info("A new service was found in an RDF document." + newline - + "\tThe service is called: " + service.getName() - + " under the authority: " + service.getAuthority() + "." - + newline + + "\tThe service is called: " + service.getName() + " under the authority: " + + service.getAuthority() + "." + newline + "Attempting to register the service with mobycentral."); registerService(service, central); @@ -721,41 +706,33 @@ */ private boolean registerService(MobyService service, Central central) { - if (service.getSignatureURL().trim().equals("") - && !Constants.REGISTRY_IGNORE_NULL) { - Log.info("The service, (" + service.getName() + "," - + service.getAuthority() + "), was *not* registered " - + newline + "since it has a NULL signature URL."); + if (service.getSignatureURL().trim().equals("") && !Constants.REGISTRY_IGNORE_NULL) { + Log.info("The service, (" + service.getName() + "," + service.getAuthority() + + "), was *not* registered " + newline + "since it has a NULL signature URL."); return false; } try { central.registerService(service); } catch (MobyException e) { - Log.exception(this.getClass().getName(), - "addNewServiceToRegistry(MobyService)", e); + Log.exception(this.getClass().getName(), "addNewServiceToRegistry(MobyService)", e); Log.severe("Communication with the registry failed." + newline + e.getLocalizedMessage()); - Log.info("service " + service.getName() + ", " - + service.getAuthority() + Log.info("service " + service.getName() + ", " + service.getAuthority() + " has not been added to the registry."); return false; } catch (NoSuccessException e) { - Log.exception(this.getClass().getName(), - "addNewServiceToRegistry(MobyService)", e); + Log.exception(this.getClass().getName(), "addNewServiceToRegistry(MobyService)", e); Log.severe("There was no success with registration." + newline + e.getLocalizedMessage()); - Log.info("service " + service.getName() + ", " - + service.getAuthority() + Log.info("service " + service.getName() + ", " + service.getAuthority() + " has not been added to the registry."); return false; } catch (PendingCurationException e) { - Log.exception(this.getClass().getName(), - "addNewServiceToRegistry(MobyService)", e); - Log.severe("The service may be registered later pending curation." - + newline + e.getLocalizedMessage()); - Log.info("service " + service.getName() + ", " - + service.getAuthority() + Log.exception(this.getClass().getName(), "addNewServiceToRegistry(MobyService)", e); + Log.severe("The service may be registered later pending curation." + newline + + e.getLocalizedMessage()); + Log.info("service " + service.getName() + ", " + service.getAuthority() + " has not *yet* been added to the registry."); return false; } @@ -768,45 +745,38 @@ /* * remove a changed service */ - private int removeChangedServiceFromRegistry(MobyService service, - Central central, String changes) { + private int removeChangedServiceFromRegistry(MobyService service, Central central, + String changes) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, false); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " has been modified."); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, false); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " has been modified."); report.addToReport("\t\tThe following changes have been found:"); report.addToReport(Utils.format(changes, 3)); report.addToReport(""); - report - .addToReport("\t\tNote: Service1 is the service found in the registry, while " - + newline - + "\t\t Service2 is the one found by HTTP getting the signatureURL."); + report.addToReport("\t\tNote: Service1 is the service found in the registry, while " + + newline + "\t\t Service2 is the one found by HTTP getting the signatureURL."); report.addToReport(""); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnChanged) { sendMail(service, report); } - Log.info("Service, (" + service.getName() + ", " - + service.getAuthority() + Log.info("Service, (" + service.getName() + ", " + service.getAuthority() + "), was modified and will be updated."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); return code; } @@ -814,13 +784,14 @@ /* * remove a changed service */ - private int removeInvalidChangedServiceFromRegistry(MobyService service, - Central central, String changes) { + private int removeInvalidChangedServiceFromRegistry(MobyService service, Central central, + String changes) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " has been found to be invalid."); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " has been found to be invalid."); report.addToReport("\t\tThe following changes have been found:"); report.addToReport(Utils.format(changes, 3)); @@ -828,9 +799,8 @@ if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnInvalid) { @@ -839,14 +809,10 @@ Log.info("Attempting to remove service, (" + service.getName() + ", " + service.getAuthority() + ")."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); return code; } @@ -857,15 +823,15 @@ private void removeInvalidServiceFromRegistry(MobyService service) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " has been found to be invalid."); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " has been found to be invalid."); report.addToReport(""); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnInvalid) { sendMail(service, report); @@ -873,16 +839,12 @@ // only remove if we enable deregistration if (enableDeregistration) { - Log.info("Attempting to remove service, (" + service.getName() - + ", " + service.getAuthority() + ")."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + Log.info("Attempting to remove service, (" + service.getName() + ", " + + service.getAuthority() + ")."); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } @@ -892,49 +854,42 @@ /* * remove a bad service (invalid, no signature rdf, etc) */ - private void removeInvalidSignatureURLService(MobyService service, - Central central, String reason, SignatureURLConnection connection) { + private void removeInvalidSignatureURLService(MobyService service, Central central, + String reason, SignatureURLConnection connection) { int count = 0; // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + reason); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (!service.getSignatureURL().equals("")) { - if (connection.getBadUrlMap() - .containsKey(service.getSignatureURL())) { - count = ((Integer) connection.getBadUrlMap().get( - service.getSignatureURL())).intValue(); + if (connection.getBadUrlMap().containsKey(service.getSignatureURL())) { + count = ((Integer) connection.getBadUrlMap().get(service.getSignatureURL())) + .intValue(); } } if (enableDeregistration) { if (count >= errorLimit) { - Log.info("Attempting to remove the service " - + service.getName() + ", " + service.getAuthority() - + "." + newline + "\tRemoved because " + reason); - - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), - service.getAuthority()); + Log.info("Attempting to remove the service " + service.getName() + ", " + + service.getAuthority() + "." + newline + "\tRemoved because " + reason); + + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } if (sendMailOnInvalid) { @@ -948,43 +903,37 @@ * remove a bad service (invalid, no signature rdf, etc). this method is * used when a signature url was already found to contain a bad service. */ - private void removeInvalidSignatureURLServiceFromRegistry( - MobyService service, Central central, String reason, int count) { + private void removeInvalidSignatureURLServiceFromRegistry(MobyService service, Central central, + String reason, int count) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT,true ); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + reason); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (enableDeregistration) { if (count >= errorLimit) { - Log.info("Service " + service.getName() + ", " - + service.getAuthority() + " has been removed." - + newline + "\tRemoved because " + reason + newline + Log.info("Service " + service.getName() + ", " + service.getAuthority() + + " has been removed." + newline + "\tRemoved because " + reason + newline + "The agent has made " + count + " attempts to resolve and correctly parse the" + " service description url."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), - service.getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } if (sendMailOnInvalid) { @@ -998,39 +947,33 @@ * remove a bad service (invalid, no signature rdf, etc). this method is * used when a signature url was already found to contain a bad service. */ - private void removeMissingServiceFromRegistry(MobyService service, - Central central, String reason) { + private void removeMissingServiceFromRegistry(MobyService service, Central central, + String reason) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + reason); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (enableDeregistration) { - Log.info("Service " + service.getName() + ", " - + service.getAuthority() + " has been removed." + newline - + "\tRemoved because " + reason + newline); - - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + Log.info("Service " + service.getName() + ", " + service.getAuthority() + + " has been removed." + newline + "\tRemoved because " + reason + newline); + + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); if (sendMailOnInvalid) { @@ -1044,8 +987,7 @@ boolean bool = false; switch (code) { case 101: { - Log - .warning("Central admin didnt receive an service provider authority"); + Log.warning("Central admin didnt receive an service provider authority"); bool = false; } break; @@ -1065,8 +1007,7 @@ } break; case 404: { - Log - .severe("Oddly enough, the service wasnt found in the registry!?!"); + Log.severe("Oddly enough, the service wasnt found in the registry!?!"); bool = false; } break; @@ -1094,8 +1035,7 @@ } break; case 508: { - Log - .severe("The url and/or uri for the Central Admin service were invalid."); + Log.severe("The url and/or uri for the Central Admin service were invalid."); bool = false; } @@ -1126,55 +1066,44 @@ p = new ServiceInstanceParser(url); rdfServices = p.getMobyServicesFromRDF(); } catch (MobyException e) { - sb - .append("Exception from processServicesFromUrlTEST(String, Central)" - + e.getLocalizedMessage() + newline); - Log.exception(this.getClass().getName(), - "processServicesFromUrlTEST(String, Central)", e); + sb.append("Exception from processServicesFromUrlTEST(String, Central)" + + e.getLocalizedMessage() + newline); + Log.exception(this.getClass().getName(), "processServicesFromUrlTEST(String, Central)", + e); return sb.toString(); } if (p != null) { if (rdfServices == null) { - Log - .warning("Unable to retrieve the services from " + url - + "."); + Log.warning("Unable to retrieve the services from " + url + "."); sb .append("There was a problem extracting the services. Perhaps the rdf is invalid." + newline); return sb.toString(); } else if (rdfServices.length == 0) { if (p.isRDFValid()) { - Log.info("Unable to retrieve any services from " + url - + "." + newline + Log.info("Unable to retrieve any services from " + url + "." + newline + "Most likely cause is that there were none."); - sb.append("Unable to retrieve any services from " + url - + "." + newline + sb.append("Unable to retrieve any services from " + url + "." + newline + "Most likely cause is that there were none."); } else { - Log.info("Unable to retrieve any services from " + url - + "." + newline + "Some of the problems are: " - + Utils.format(p.getErrors(), 2)); - sb.append("Unable to retrieve any services from " + url - + "." + newline + "Some of the problems are: " - + Utils.format(p.getErrors(), 2)); + Log.info("Unable to retrieve any services from " + url + "." + newline + + "Some of the problems are: " + Utils.format(p.getErrors(), 2)); + sb.append("Unable to retrieve any services from " + url + "." + newline + + "Some of the problems are: " + Utils.format(p.getErrors(), 2)); } return sb.toString(); } else { - Log.info("Found the following services in the RDF located at " - + url); - sb.append("Found the following services in the RDF located at " - + url + newline); + Log.info("Found the following services in the RDF located at " + url); + sb.append("Found the following services in the RDF located at " + url + newline); for (int i = 0; i < rdfServices.length; i++) { MobyService serv = rdfServices[i]; MobyServiceComparator comparator = new MobyServiceComparator(); if (!comparator.areInputsOutputsForServiceValid(serv)) { - Log.info(Utils.format("Invalid service found: " - + serv.getUniqueName(), 2)); - sb.append(Utils.format("Invalid service found: " - + serv.getUniqueName(), 2) + Log.info(Utils.format("Invalid service found: " + serv.getUniqueName(), 2)); + sb.append(Utils.format("Invalid service found: " + serv.getUniqueName(), 2) + newline); } else { Log.info(Utils.format(serv, 2)); From kawas at dev.open-bio.org Mon Mar 27 10:01:53 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 10:01:53 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271501.k2RF1rgv018485@dev.open-bio.org> kawas Mon Mar 27 10:01:53 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv18452/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: more specific messages added when logging found services in the rdf moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.17,1.18 From kawas at dev.open-bio.org Mon Mar 27 11:30:49 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 11:30:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271630.k2RGUnYQ019116@dev.open-bio.org> kawas Mon Mar 27 11:30:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv19084/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: log when no changes are found when using a URL moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.18,1.19 From gss at dev.open-bio.org Mon Mar 27 12:16:02 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Mon, 27 Mar 2006 12:16:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271716.k2RHG2tw019738@dev.open-bio.org> gss Mon Mar 27 12:16:02 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/ontologies/core In directory dev.open-bio.org:/tmp/cvs-serv19706 Modified Files: inputURI.n3 Log Message: Fixed a typo s-moby/ref-impl/semanticmoby.org/WebRoot/ontologies/core inputURI.n3,1.1,1.2 From gss at dev.open-bio.org Mon Mar 27 12:54:41 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Mon, 27 Mar 2006 12:54:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271754.k2RHsfOt019951@dev.open-bio.org> gss Mon Mar 27 12:54:41 EST 2006 Update of /home/repository/moby/s-moby/provider/examples/fasta-sequence/build In directory dev.open-bio.org:/tmp/cvs-serv19918/examples/fasta-sequence/build Modified Files: build.xml build.properties.template Log Message: Don't assume war gets deployed to webapps directory s-moby/provider/examples/fasta-sequence/build build.xml,1.3,1.4 build.properties.template,1.1,1.2 From kawas at dev.open-bio.org Mon Mar 27 15:18:43 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 15:18:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272018.k2RKIh19020326@dev.open-bio.org> kawas Mon Mar 27 15:18:43 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv20294/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: when a service is modified, the agent will attempt to remove the old service and add the modified one. The new one may be invalid, so the agent will attempt to revert back to the old one. The agent gives back weird messages and so i have modified them for this scenario. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.19,1.20 From kawas at dev.open-bio.org Mon Mar 27 15:28:50 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 15:28:50 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272028.k2RKSobk020453@dev.open-bio.org> kawas Mon Mar 27 15:28:50 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv20421 Modified Files: service_instance.pm Log Message: fixed the timestamp to include Z or +dddd or -dddd moby-live/Perl/MOBY service_instance.pm,1.40,1.41 From kawas at dev.open-bio.org Mon Mar 27 16:04:25 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 16:04:25 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272104.k2RL4P0g020697@dev.open-bio.org> kawas Mon Mar 27 16:04:25 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv20664/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: when using the -test option and the url isnt valid, a null pointer is returned. Catching that exception. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.20,1.21 From kawas at dev.open-bio.org Mon Mar 27 16:05:47 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 16:05:47 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272105.k2RL5lfa020794@dev.open-bio.org> kawas Mon Mar 27 16:05:47 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv20762/org/biomoby/client Modified Files: CentralImpl.java Log Message: added to the registerService call moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.41,1.42 From senger at dev.open-bio.org Tue Mar 28 06:55:26 2006 From: senger at dev.open-bio.org (Martin Senger) Date: Tue, 28 Mar 2006 06:55:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281155.k2SBtP7g023845@dev.open-bio.org> senger Tue Mar 28 06:55:25 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv23828/docs Modified Files: Dashboard-NOTES.txt index.html Log Message: moby-live/Java/docs Dashboard-NOTES.txt,1.7,1.8 index.html,1.20,1.21 From lxm at dev.open-bio.org Tue Mar 28 12:54:30 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Tue, 28 Mar 2006 12:54:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281754.k2SHsUJQ026210@dev.open-bio.org> lxm Tue Mar 28 12:54:29 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api In directory dev.open-bio.org:/tmp/cvs-serv26178 Modified Files: Log.java Log Message: added changes to log functionality to new repository, current class and method, as well as src file and line number are now prepended to all log messages s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api Log.java,1.3,1.4 From mwilkinson at dev.open-bio.org Tue Mar 28 13:18:33 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 28 Mar 2006 13:18:33 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281818.k2SIIXfh026467@dev.open-bio.org> mwilkinson Tue Mar 28 13:18:33 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv26451/MOBY Modified Files: Central.pm Log Message: findService was not returning the LSID of the service type, as it was supposed to moby-live/Perl/MOBY Central.pm,1.250,1.251 From mwilkinson at dev.open-bio.org Tue Mar 28 13:30:06 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 28 Mar 2006 13:30:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281830.k2SIU6kJ026887@dev.open-bio.org> mwilkinson Tue Mar 28 13:30:06 EST 2006 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv26871/t Modified Files: CommonSubs.t Log Message: service notes test was failing moby-live/Perl/t CommonSubs.t,1.4,1.5 From gordonp at dev.open-bio.org Tue Mar 28 16:11:22 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 28 Mar 2006 16:11:22 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282111.k2SLBM2G011792@dev.open-bio.org> gordonp Tue Mar 28 16:11:22 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv11758 Modified Files: MobyRequest.java MobyRequestEvent.java MobyRequestEventHandler.java Log Message: Updates to simplify secondary input and to handle callbacks moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.16,1.17 MobyRequestEvent.java,1.2,1.3 MobyRequestEventHandler.java,1.1,1.2 From kawas at dev.open-bio.org Tue Mar 28 18:03:16 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:03:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282303.k2SN3Gxd012641@dev.open-bio.org> kawas Tue Mar 28 18:03:16 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv12609/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: LSIDAuthorityMetaData.java Log Message: add the correct logic for determining whether an LSIDs object actually refered to a past object. moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDAuthorityMetaData.java,1.4,1.5 From kawas at dev.open-bio.org Tue Mar 28 18:04:04 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:04:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282304.k2SN4495012678@dev.open-bio.org> kawas Tue Mar 28 18:04:04 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv12646/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: LSIDDataLookup.java Log Message: modified some exception messages to make them more clear. note that they are slightly better, but should be redone later on. moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDDataLookup.java,1.6,1.7 From kawas at dev.open-bio.org Tue Mar 28 18:04:46 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:04:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282304.k2SN4kBc012715@dev.open-bio.org> kawas Tue Mar 28 18:04:46 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv12683/org/biomoby/client/rdf/builder Modified Files: RDFConfigure.java Log Message: fixed the way that it is determined whether objects existed or exist in the ontologies moby-live/Java/src/main/org/biomoby/client/rdf/builder RDFConfigure.java,1.11,1.12 From kawas at dev.open-bio.org Tue Mar 28 18:05:53 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:05:53 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282305.k2SN5rDj012808@dev.open-bio.org> kawas Tue Mar 28 18:05:53 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv12776/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java Log Message: moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.14,1.15 From kawas at dev.open-bio.org Wed Mar 29 14:17:44 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:17:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291917.k2TJHiwr016252@dev.open-bio.org> kawas Wed Mar 29 14:17:44 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv16220/org/biomoby/shared Modified Files: MobyService.java Log Message: added a moby service type object reference as a property of a mobyservice moby-live/Java/src/main/org/biomoby/shared MobyService.java,1.10,1.11 From kawas at dev.open-bio.org Wed Mar 29 14:19:19 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:19:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291919.k2TJJJPV016328@dev.open-bio.org> kawas Wed Mar 29 14:19:19 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv16296/org/biomoby/client Modified Files: CentralImpl.java Log Message: added service type lsid information to the services found in findService. moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.42,1.43 From kawas at dev.open-bio.org Wed Mar 29 14:22:39 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:22:39 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291922.k2TJMdvX016462@dev.open-bio.org> kawas Wed Mar 29 14:22:39 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv16429/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java RDFConfigure.java Log Message: changed the URI reference for service types to LSIDs moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.15,1.16 RDFConfigure.java,1.12,1.13 From kawas at dev.open-bio.org Wed Mar 29 14:23:34 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:23:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291923.k2TJNYD9016499@dev.open-bio.org> kawas Wed Mar 29 14:23:34 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv16467/org/biomoby/shared/extended Modified Files: ServiceInstanceParser.java Log Message: now obtain service types LSIDs moby-live/Java/src/main/org/biomoby/shared/extended ServiceInstanceParser.java,1.12,1.13 From kawas at dev.open-bio.org Wed Mar 29 15:09:46 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 15:09:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292009.k2TK9kxo016735@dev.open-bio.org> kawas Wed Mar 29 15:09:46 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv16702/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: LSIDAuthorityMetaData.java LSIDDataLookup.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDAuthorityMetaData.java,1.5,1.6 LSIDDataLookup.java,1.7,1.8 From kawas at dev.open-bio.org Wed Mar 29 15:09:46 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 15:09:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292009.k2TK9knh016752@dev.open-bio.org> kawas Wed Mar 29 15:09:46 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources In directory dev.open-bio.org:/tmp/cvs-serv16702/org/biomoby/client/ui/graphical/servlet/jresources Modified Files: RESOURCE.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.14,1.15 From kawas at dev.open-bio.org Wed Mar 29 16:13:49 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 16:13:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292113.k2TLDnUi016925@dev.open-bio.org> kawas Wed Mar 29 16:13:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv16893/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.21,1.22 From kawas at dev.open-bio.org Wed Mar 29 16:19:27 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 16:19:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292119.k2TLJRJj016988@dev.open-bio.org> kawas Wed Mar 29 16:19:27 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv16956/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: better null signature url message moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.22,1.23 From gss at dev.open-bio.org Wed Mar 29 18:49:21 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Wed, 29 Mar 2006 18:49:21 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292349.k2TNnL2C019430@dev.open-bio.org> gss Wed Mar 29 18:49:21 EST 2006 Update of /home/repository/moby/s-moby/api/build In directory dev.open-bio.org:/tmp/cvs-serv19398 Modified Files: build.xml Log Message: Added debug flags to target s-moby/api/build build.xml,1.2,1.3 From gss at dev.open-bio.org Wed Mar 29 18:49:56 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Wed, 29 Mar 2006 18:49:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292349.k2TNnuQ7019476@dev.open-bio.org> gss Wed Mar 29 18:49:55 EST 2006 Update of /home/repository/moby/s-moby/provider/build In directory dev.open-bio.org:/tmp/cvs-serv19438 Modified Files: build.xml Log Message: Added debug flags to target s-moby/provider/build build.xml,1.1,1.2 From lxm at dev.open-bio.org Thu Mar 30 12:35:38 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:35:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301735.k2UHZcwx020971@dev.open-bio.org> lxm Thu Mar 30 12:35:38 EST 2006 Update of /home/repository/moby/s-moby/dserver In directory dev.open-bio.org:/tmp/cvs-serv20937/dserver Log Message: Directory /home/repository/moby/s-moby/dserver added to the repository s-moby/dserver - New directory From lxm at dev.open-bio.org Thu Mar 30 12:36:02 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:36:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301736.k2UHa2sB021013@dev.open-bio.org> lxm Thu Mar 30 12:36:02 EST 2006 Update of /home/repository/moby/s-moby/dserver/build In directory dev.open-bio.org:/tmp/cvs-serv20979/build Log Message: Directory /home/repository/moby/s-moby/dserver/build added to the repository s-moby/dserver/build - New directory From lxm at dev.open-bio.org Thu Mar 30 12:37:04 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:37:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301737.k2UHb48a021073@dev.open-bio.org> lxm Thu Mar 30 12:37:04 EST 2006 Update of /home/repository/moby/s-moby/api/src/org/semanticmoby/api In directory dev.open-bio.org:/tmp/cvs-serv21042 Added Files: Log.java Log Message: added logging to the core api s-moby/api/src/org/semanticmoby/api Log.java,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 12:46:36 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:46:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301746.k2UHkaeP021115@dev.open-bio.org> lxm Thu Mar 30 12:46:35 EST 2006 Update of /home/repository/moby/s-moby/dserver/src In directory dev.open-bio.org:/tmp/cvs-serv21081/src Log Message: Directory /home/repository/moby/s-moby/dserver/src added to the repository s-moby/dserver/src - New directory From lxm at dev.open-bio.org Thu Mar 30 12:47:01 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:47:01 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301747.k2UHl1Nf021157@dev.open-bio.org> lxm Thu Mar 30 12:47:01 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org In directory dev.open-bio.org:/tmp/cvs-serv21123/org Log Message: Directory /home/repository/moby/s-moby/dserver/src/org added to the repository s-moby/dserver/src/org - New directory From lxm at dev.open-bio.org Thu Mar 30 12:47:22 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:47:22 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301747.k2UHlMA9021199@dev.open-bio.org> lxm Thu Mar 30 12:47:22 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby In directory dev.open-bio.org:/tmp/cvs-serv21165/semanticmoby Log Message: Directory /home/repository/moby/s-moby/dserver/src/org/semanticmoby added to the repository s-moby/dserver/src/org/semanticmoby - New directory From lxm at dev.open-bio.org Thu Mar 30 12:47:45 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:47:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301747.k2UHljUV021241@dev.open-bio.org> lxm Thu Mar 30 12:47:44 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver In directory dev.open-bio.org:/tmp/cvs-serv21207/dserver Log Message: Directory /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver added to the repository s-moby/dserver/src/org/semanticmoby/dserver - New directory From lxm at dev.open-bio.org Thu Mar 30 12:48:26 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:48:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301748.k2UHmQ3g021283@dev.open-bio.org> lxm Thu Mar 30 12:48:26 EST 2006 Update of /home/repository/moby/s-moby/dclient In directory dev.open-bio.org:/tmp/cvs-serv21249/dclient Log Message: Directory /home/repository/moby/s-moby/dclient added to the repository s-moby/dclient - New directory From lxm at dev.open-bio.org Thu Mar 30 12:48:51 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:48:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301748.k2UHmpFR021325@dev.open-bio.org> lxm Thu Mar 30 12:48:51 EST 2006 Update of /home/repository/moby/s-moby/dclient/build In directory dev.open-bio.org:/tmp/cvs-serv21291/build Log Message: Directory /home/repository/moby/s-moby/dclient/build added to the repository s-moby/dclient/build - New directory From lxm at dev.open-bio.org Thu Mar 30 12:49:16 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:49:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301749.k2UHnGGq021367@dev.open-bio.org> lxm Thu Mar 30 12:49:16 EST 2006 Update of /home/repository/moby/s-moby/dclient/src In directory dev.open-bio.org:/tmp/cvs-serv21333/src Log Message: Directory /home/repository/moby/s-moby/dclient/src added to the repository s-moby/dclient/src - New directory From lxm at dev.open-bio.org Thu Mar 30 12:49:29 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:49:29 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301749.k2UHnTYq021409@dev.open-bio.org> lxm Thu Mar 30 12:49:28 EST 2006 Update of /home/repository/moby/s-moby/dclient/src/org In directory dev.open-bio.org:/tmp/cvs-serv21375/org Log Message: Directory /home/repository/moby/s-moby/dclient/src/org added to the repository s-moby/dclient/src/org - New directory From lxm at dev.open-bio.org Thu Mar 30 12:49:52 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:49:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301749.k2UHnq9m021451@dev.open-bio.org> lxm Thu Mar 30 12:49:52 EST 2006 Update of /home/repository/moby/s-moby/dclient/src/org/semanticmoby In directory dev.open-bio.org:/tmp/cvs-serv21417/semanticmoby Log Message: Directory /home/repository/moby/s-moby/dclient/src/org/semanticmoby added to the repository s-moby/dclient/src/org/semanticmoby - New directory From lxm at dev.open-bio.org Thu Mar 30 12:50:14 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:50:14 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301750.k2UHoEsK021493@dev.open-bio.org> lxm Thu Mar 30 12:50:14 EST 2006 Update of /home/repository/moby/s-moby/dclient/src/org/semanticmoby/dclient In directory dev.open-bio.org:/tmp/cvs-serv21459/dclient Log Message: Directory /home/repository/moby/s-moby/dclient/src/org/semanticmoby/dclient added to the repository s-moby/dclient/src/org/semanticmoby/dclient - New directory From lxm at dev.open-bio.org Thu Mar 30 16:28:56 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 16:28:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302128.k2ULSuBB021862@dev.open-bio.org> lxm Thu Mar 30 16:28:56 EST 2006 Update of /home/repository/moby/s-moby/api In directory dev.open-bio.org:/tmp/cvs-serv21831 Added Files: build.xml Log Message: cleaned up build.xml that operates from the root "api" directory instead of the build directory, this is to comply with general open source practices s-moby/api build.xml,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 16:47:42 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 16:47:42 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302147.k2ULlgs3022006@dev.open-bio.org> lxm Thu Mar 30 16:47:42 EST 2006 Update of /home/repository/moby/s-moby/dserver In directory dev.open-bio.org:/tmp/cvs-serv21974 Added Files: build.xml Log Message: ant build file for the discovery server package, this is designed to be executed from the root "dserver" directory s-moby/dserver build.xml,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 17:10:34 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:10:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302210.k2UMAY0w022172@dev.open-bio.org> lxm Thu Mar 30 17:10:34 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver In directory dev.open-bio.org:/tmp/cvs-serv22141 Added Files: MOBYProperties.java MetadataRetriever.java ResourceRemover.java StorageException.java StorageManager.java Log Message: added first batch of files to new cvs structure for discovery server s-moby/dserver/src/org/semanticmoby/dserver MOBYProperties.java,NONE,1.1 MetadataRetriever.java,NONE,1.1 ResourceRemover.java,NONE,1.1 StorageException.java,NONE,1.1 StorageManager.java,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 17:22:09 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:22:09 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302222.k2UMM9AV022216@dev.open-bio.org> lxm Thu Mar 30 17:22:08 EST 2006 Update of /home/repository/moby/s-moby/dserver/web In directory dev.open-bio.org:/tmp/cvs-serv22182/web Log Message: Directory /home/repository/moby/s-moby/dserver/web added to the repository s-moby/dserver/web - New directory From lxm at dev.open-bio.org Thu Mar 30 17:22:37 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:22:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302222.k2UMMbiQ022258@dev.open-bio.org> lxm Thu Mar 30 17:22:36 EST 2006 Update of /home/repository/moby/s-moby/dserver/web/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv22224/WEB-INF Log Message: Directory /home/repository/moby/s-moby/dserver/web/WEB-INF added to the repository s-moby/dserver/web/WEB-INF - New directory From lxm at dev.open-bio.org Thu Mar 30 17:29:44 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:29:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302229.k2UMTiZ9022382@dev.open-bio.org> lxm Thu Mar 30 17:29:44 EST 2006 Update of /home/repository/moby/s-moby/dserver In directory dev.open-bio.org:/tmp/cvs-serv22350 Modified Files: build.xml Log Message: added the files necessary for the first set of files to build, this includes the web.xml in the web directory s-moby/dserver build.xml,1.1,1.2 From lxm at dev.open-bio.org Thu Mar 30 17:29:44 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:29:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302229.k2UMTiKY022398@dev.open-bio.org> lxm Thu Mar 30 17:29:44 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver In directory dev.open-bio.org:/tmp/cvs-serv22350/src/org/semanticmoby/dserver Added Files: MissingPropertyException.java Log Message: added the files necessary for the first set of files to build, this includes the web.xml in the web directory s-moby/dserver/src/org/semanticmoby/dserver MissingPropertyException.java,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 17:29:44 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:29:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302229.k2UMTiit022414@dev.open-bio.org> lxm Thu Mar 30 17:29:44 EST 2006 Update of /home/repository/moby/s-moby/dserver/web/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv22350/web/WEB-INF Added Files: web.xml Log Message: added the files necessary for the first set of files to build, this includes the web.xml in the web directory s-moby/dserver/web/WEB-INF web.xml,NONE,1.1 From kawas at dev.open-bio.org Fri Mar 31 16:46:38 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 16:46:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312146.k2VLkcHn024401@dev.open-bio.org> kawas Fri Mar 31 16:46:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Data In directory dev.open-bio.org:/tmp/cvs-serv24369/MOBY/Data Modified Files: MobyProvisionInfo.pm Log Message: moby-live/Java/src/Perl/MOBY/Data MobyProvisionInfo.pm,1.3,1.4 From kawas at dev.open-bio.org Fri Mar 31 16:47:31 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 16:47:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312147.k2VLlV4X024474@dev.open-bio.org> kawas Fri Mar 31 16:47:31 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Datatypes In directory dev.open-bio.org:/tmp/cvs-serv24442/MOBY/Datatypes Modified Files: MobyBoolean.pm Log Message: moby-live/Java/src/Perl/MOBY/Datatypes MobyBoolean.pm,1.1,1.2 From kawas at dev.open-bio.org Fri Mar 31 16:49:49 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 16:49:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312149.k2VLnnPV024550@dev.open-bio.org> kawas Fri Mar 31 16:49:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Datatypes In directory dev.open-bio.org:/tmp/cvs-serv24518/MOBY/Datatypes Modified Files: MobyDataType.pm Log Message: moby-live/Java/src/Perl/MOBY/Datatypes MobyDataType.pm,1.1,1.2 From kawas at dev.open-bio.org Fri Mar 31 17:22:23 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 17:22:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312222.k2VMMNGN024616@dev.open-bio.org> kawas Fri Mar 31 17:22:23 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Datatypes In directory dev.open-bio.org:/tmp/cvs-serv24584/MOBY/Datatypes Modified Files: MobyDateTime.pm Log Message: moby-live/Java/src/Perl/MOBY/Datatypes MobyDateTime.pm,1.1,1.2 From mwilkinson at dev.open-bio.org Fri Mar 31 18:07:23 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 31 Mar 2006 18:07:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312307.k2VN7Nji025361@dev.open-bio.org> mwilkinson Fri Mar 31 18:07:23 EST 2006 Update of /home/repository/moby/moby-live/OWL In directory dev.open-bio.org:/tmp/cvs-serv25343/OWL Log Message: Directory /home/repository/moby/moby-live/OWL added to the repository moby-live/OWL - New directory From mwilkinson at dev.open-bio.org Fri Mar 31 18:09:26 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 31 Mar 2006 18:09:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312309.k2VN9QFn025451@dev.open-bio.org> mwilkinson Fri Mar 31 18:09:25 EST 2006 Update of /home/repository/moby/moby-live/OWL In directory dev.open-bio.org:/tmp/cvs-serv25436/OWL Added Files: ServiceDescription.owl ServiceDescriptions.swp Log Message: adding a folder for OWL ontologies, plus the beginnings of the OWL description that our RDF will classify into moby-live/OWL ServiceDescription.owl,NONE,1.1 ServiceDescriptions.swp,NONE,1.1 From senger at pub.open-bio.org Mon Mar 13 10:22:21 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Mon, 13 Mar 2006 05:22:21 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603131022.k2DAML7u020278@pub.open-bio.org> senger Mon Mar 13 05:22:20 EST 2006 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv20258 Modified Files: build.xml Log Message: better quoting of log4j - needed for Windows moby-live/Java build.xml,1.51,1.52 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- /home/repository/moby/moby-live/Java/build.xml 2006/02/21 14:43:10 1.51 +++ /home/repository/moby/moby-live/Java/build.xml 2006/03/13 10:22:20 1.52 @@ -66,7 +66,7 @@ we can create a proper piece of a command-line in log4j.value - that is used in general.filter to update run-scripts --> - + From senger at pub.open-bio.org Mon Mar 13 16:12:32 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Mon, 13 Mar 2006 11:12:32 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603131612.k2DGCW5P021462@pub.open-bio.org> senger Mon Mar 13 11:12:32 EST 2006 Update of /home/repository/moby/moby-live/Java/src/config/templates In directory pub.open-bio.org:/tmp/cvs-serv21443/src/config/templates Modified Files: ServicePISetTemplate.java Log Message: changes in Moses templates of generated skeletons moby-live/Java/src/config/templates ServicePISetTemplate.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java 2005/09/19 08:08:32 1.2 +++ /home/repository/moby/moby-live/Java/src/config/templates/ServicePISetTemplate.java 2006/03/13 16:12:32 1.3 @@ -7,6 +7,12 @@ *************************************************************************/ public @DATATYPE@[] get_ at ESC_ARTICLE_NAME@Set (MobyJob request) throws org.biomoby.shared.MobyException { - return (@DATATYPE@[])request.getDataSet ("@ARTICLE_NAME@", "@DATATYPE@"); + MobyObject[] objs_I_am_sorry_that_this_produces_a_warning = request.getDataSet ("@ARTICLE_NAME@", "@DATATYPE@"); + synchronized (objs_I_am_sorry_that_this_produces_a_warning) { + @DATATYPE@[] result_I_am_sorry_that_this_produces_a_warning = new @DATATYPE@ [objs_I_am_sorry_that_this_produces_a_warning.length]; + for (int i = 0; i < objs_I_am_sorry_that_this_produces_a_warning.length; i++) + result_I_am_sorry_that_this_produces_a_warning[i] = (@DATATYPE@)objs_I_am_sorry_that_this_produces_a_warning[i]; + return result_I_am_sorry_that_this_produces_a_warning; + } } From gss at pub.open-bio.org Mon Mar 13 19:04:58 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Mon, 13 Mar 2006 14:04:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603131904.k2DJ4wYT021852@pub.open-bio.org> gss Mon Mar 13 14:04:58 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv21827/WebRoot Modified Files: search-results.jsp Log Message: Remove explicit import of MOBY vocabulary file; for some reason, Tomcat had problems compiling the page s-moby/ref-impl/semanticmoby.org/WebRoot search-results.jsp,1.8,1.9 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2005/12/04 23:11:49 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2006/03/13 19:04:58 1.9 @@ -3,7 +3,7 @@ <%@ page import="java.util.*" %> <%@ page import="org.semanticmoby.graph.*" %> <%@ page import="org.semanticmoby.ref.tools.*" %> -<%@ page import="org.semanticmoby.vocabulary.MOBY" %> +<%@ page import="org.semanticmoby.vocabulary.*" %> <%@ page errorPage="/error.jsp" %> <%@ include file="/data-header.jsp" %> <% dataBean.setPageTitle("Search Results"); %> From kawas at pub.open-bio.org Tue Mar 14 16:11:44 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 14 Mar 2006 11:11:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141611.k2EGBi3U025733@pub.open-bio.org> kawas Tue Mar 14 11:11:43 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv25707/org/biomoby/registry/definitions/types Modified Files: JNamespacesSqlImpl.java Log Message: new method to retrieve full namespace information, like lsid, contact_email, authority, etc for use (in the RDF) by clients moby-live/Java/src/main/org/biomoby/registry/definitions/types JNamespacesSqlImpl.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.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/registry/definitions/types/JNamespacesSqlImpl.java 2005/08/29 20:19:20 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:11:43 1.2 @@ -22,6 +22,8 @@ */ public final class JNamespacesSqlImpl implements JNamespaceI{ private static final String sql = "SELECT namespace_type, description FROM namespace ORDER BY namespace_type asc"; + + private static final String sql_all = "SELECT namespace_type, description, namespace_lsid, authority, contact_email FROM namespace ORDER BY namespace_type asc"; private final String newline = System.getProperty("line.separator"); @@ -119,7 +121,44 @@ return array; } + /** + * Get all the data in the db regrading namespaces. + * @return + */ + public String[][] getFullNamespacesAsArray() { + /*ensure that the connection isnt null*/ + if (connection == null) + return null; + + ArrayList sb = new ArrayList(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[]{ rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5)}); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + public static void main(String[] args) throws MobyException { - System.out.println(new JNamespacesSqlImpl().getNamespacesAsArray()); + String[][] namespaces =new JNamespacesSqlImpl().getFullNamespacesAsArray(); + for (int i = 0; i < namespaces.length; i++) { + String[] namespace = namespaces[i]; + for (int j = 0; j < namespace.length; j++) { + System.out.print(namespace[j] + " "); + } + System.out.println(); + } } } From kawas at pub.open-bio.org Tue Mar 14 16:23:06 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 14 Mar 2006 11:23:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141623.k2EGN6r2025797@pub.open-bio.org> kawas Tue Mar 14 11:23:06 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv25768/org/biomoby/registry/definitions/types Modified Files: JServicesSqlImpl.java JNamespacesSqlImpl.java Log Message: new method to retrieve full service type information, like lsid, contact_email, authority, etc for use (in the RDF) by registry clients moby-live/Java/src/main/org/biomoby/registry/definitions/types JServicesSqlImpl.java,1.1,1.2 JNamespacesSqlImpl.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.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/registry/definitions/types/JServicesSqlImpl.java 2005/08/29 20:19:20 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java 2006/03/14 16:23:06 1.2 @@ -16,115 +16,175 @@ import org.biomoby.shared.MobyException; /** - * @author Eddie Kawas - * mySQL implementation of JServicesI - *

email me at edward.kawas at gmail.com + * @author Eddie Kawas mySQL implementation of JServicesI + *

+ * email me at edward.kawas at gmail.com */ -public final class JServicesSqlImpl implements JServiceI{ - private static final String sql = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description " - + "FROM service as ot1, service_term2term as rt, service as ot2 " - + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; - - private Connection connection = null; - - private final String newline = System.getProperty("line.separator"); - - /** - * - * @throws MobyException if database driver cannot be found or there is an database access error. - */ - public JServicesSqlImpl() throws MobyException { - try { - // Load the JDBC driver - String driverName = "com.mysql.jdbc.Driver"; - Class.forName(driverName); - // get certain properties from mobycentral.config - Map map = MobyCentralConfig.getMobyService(); - // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");//localhost:3306"; //TODO - make this a property - String mydatabase = (String) map.get("dbname");//"mobyobject"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");//"moby_external"; - String password = (String) map.get("password");//""; - - /* String serverName = "mobycentral.icapture.ubc.ca:3306"; - String mydatabase = "mobyservice"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = "moby_external"; - String password = "";*/ - this.connection = DriverManager.getConnection(url, username, - password); - } catch (ClassNotFoundException e) { - throw new MobyException( - "Could not find database driver. Please ensure that you have the right libraries present"); - } catch (SQLException e) { - e.printStackTrace(); - throw new MobyException("Database access error."); - } - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JServiceI#getServices() - */ - public final String getServices() { - StringBuffer sb = new StringBuffer(); - /*ensure connection is not null*/ - if (connection == null) - return ""; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) + "\t" + rs.getString(2) + "\t" - + rs.getString(3) + "\t" + rs.getString(4) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JServiceI#getServicesAsArray() - */ - public String[][] getServicesAsArray() { - ArrayList sb = new ArrayList(); - /*ensure connection is not null*/ - if (connection == null) - return null; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.add(new String[] {rs.getString(1) , rs.getString(2), rs.getString(3), rs.getString(4)}); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray( array ); - return array; - } - - public static void main(String[] args) throws MobyException { - System.out.println(new JServicesSqlImpl().getServicesAsArray()); - } +public final class JServicesSqlImpl implements JServiceI { + private static final String sql = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description " + + "FROM service as ot1, service_term2term as rt, service as ot2 " + + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; + + private static final String sql_all = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description, ot1.service_lsid, ot1.authority, ot1.contact_email " + + "FROM service as ot1, service_term2term as rt, service as ot2 " + + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; + + private Connection connection = null; + + private final String newline = System.getProperty("line.separator"); + + /** + * + * @throws MobyException + * if database driver cannot be found or there is an database + * access error. + */ + public JServicesSqlImpl() throws MobyException { + try { + // Load the JDBC driver + String driverName = "com.mysql.jdbc.Driver"; + Class.forName(driverName); + // get certain properties from mobycentral.config + Map map = MobyCentralConfig.getMobyService(); + // Create a connection to the database + String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; + // //TODO + // - + // make + // this + // a + // property + String mydatabase = (String) map.get("dbname");// "mobyobject"; + String url = "jdbc:mysql://" + serverName + "/" + mydatabase; + String username = (String) map.get("username");// "moby_external"; + String password = (String) map.get("password");// ""; + + /* + * String serverName = "mobycentral.icapture.ubc.ca:3306"; String + * mydatabase = "mobyservice"; String url = "jdbc:mysql://" + + * serverName + "/" + mydatabase; String username = "moby_external"; + * String password = ""; + */ + this.connection = DriverManager.getConnection(url, username, password); + } catch (ClassNotFoundException e) { + throw new MobyException( + "Could not find database driver. Please ensure that you have the right libraries present"); + } catch (SQLException e) { + e.printStackTrace(); + throw new MobyException("Database access error."); + } + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JServiceI#getServices() + */ + public final String getServices() { + StringBuffer sb = new StringBuffer(); + /* ensure connection is not null */ + if (connection == null) + return ""; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + "\t" + rs.getString(2) + "\t" + rs.getString(3) + "\t" + + rs.getString(4) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JServiceI#getServicesAsArray() + */ + public String[][] getServicesAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), + rs.getString(4) }); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + /** + * Get all the data in the db regrading service types. + * @return an array of String[] objects. The String[] consists of + * {service_type, relationship_type, to_service_type, description, service_lsid, authority, + * contact_email}. Note that relationship_type is the relationship that service_type has + * with to_service_type. + */ + public String[][] getFullServicesAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), + rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7) }); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + public static void main(String[] args) throws MobyException { + String[][] services = new JServicesSqlImpl().getFullServicesAsArray(); + for (int i = 0; i < services.length; i++) { + String[] service = services[i]; + for (int j = 0; j < service.length; j++) { + System.out.print(service[j] + " "); + } + System.out.println(); + } + } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:11:43 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:23:06 1.3 @@ -16,149 +16,165 @@ import org.biomoby.shared.MobyException; /** - * @author Eddie Kawas - * mySQL implementation of JNamespaceI. - *

email me at edward.kawas at gmail.com + * @author Eddie Kawas mySQL implementation of JNamespaceI. + *

+ * email me at edward.kawas at gmail.com */ -public final class JNamespacesSqlImpl implements JNamespaceI{ - private static final String sql = "SELECT namespace_type, description FROM namespace ORDER BY namespace_type asc"; - - private static final String sql_all = "SELECT namespace_type, description, namespace_lsid, authority, contact_email FROM namespace ORDER BY namespace_type asc"; - - private final String newline = System.getProperty("line.separator"); - - private Connection connection = null; - - /** - * - * @throws MobyException if database driver cannot be found or there is an database access error. - */ - public JNamespacesSqlImpl() throws MobyException { - try { - // Load the JDBC driver - String driverName = "com.mysql.jdbc.Driver"; - Class.forName(driverName); - // get certain properties from mobycentral.config - Map map = MobyCentralConfig.getMobyNamespace(); - // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");//localhost:3306"; //TODO - make this a property - String mydatabase = (String) map.get("dbname");//"mobyobject"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");//"moby_external"; - String password = (String) map.get("password");//""; - - /* String serverName = "mobycentral.icapture.ubc.ca:3306"; - String mydatabase = "mobynamespace"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = "moby_external"; - String password = "";*/ - this.connection = DriverManager.getConnection(url, username, - password); - } catch (ClassNotFoundException e) { - throw new MobyException( - "Could not find database driver. Please ensure that you have the right libraries present"); - } catch (SQLException e) { - e.printStackTrace(); - throw new MobyException("Database access error."); - } - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespaces() - */ - public final String getNamespaces() { - /*ensure that the connection isnt null*/ - if (connection == null) - return ""; - - StringBuffer sb = new StringBuffer(); - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) + "\t" + rs.getString(2) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - /* (non-Javadoc) - * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespacesAsArray() - */ - public String[][] getNamespacesAsArray() { - /*ensure that the connection isnt null*/ - if (connection == null) - return null; - - ArrayList sb = new ArrayList(); - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.add(new String[]{ rs.getString(1), rs.getString(2)}); - } - } catch (SQLException e) { - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray(array); - return array; - } - - /** - * Get all the data in the db regrading namespaces. - * @return - */ - public String[][] getFullNamespacesAsArray() { - /*ensure that the connection isnt null*/ - if (connection == null) - return null; - - ArrayList sb = new ArrayList(); - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql_all); - } catch (SQLException ex) { - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.add(new String[]{ rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5)}); - } - } catch (SQLException e) { - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray(array); - return array; - } - - public static void main(String[] args) throws MobyException { - String[][] namespaces =new JNamespacesSqlImpl().getFullNamespacesAsArray(); - for (int i = 0; i < namespaces.length; i++) { - String[] namespace = namespaces[i]; - for (int j = 0; j < namespace.length; j++) { - System.out.print(namespace[j] + " "); +public final class JNamespacesSqlImpl implements JNamespaceI { + private static final String sql = "SELECT namespace_type, description FROM namespace ORDER BY namespace_type asc"; + + private static final String sql_all = "SELECT namespace_type, description, namespace_lsid, authority, contact_email FROM namespace ORDER BY namespace_type asc"; + + private final String newline = System.getProperty("line.separator"); + + private Connection connection = null; + + /** + * + * @throws MobyException + * if database driver cannot be found or there is an database + * access error. + */ + public JNamespacesSqlImpl() throws MobyException { + try { + // Load the JDBC driver + String driverName = "com.mysql.jdbc.Driver"; + Class.forName(driverName); + // get certain properties from mobycentral.config + Map map = MobyCentralConfig.getMobyNamespace(); + // Create a connection to the database + String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; + // //TODO + // - + // make + // this + // a + // property + String mydatabase = (String) map.get("dbname");// "mobyobject"; + String url = "jdbc:mysql://" + serverName + "/" + mydatabase; + String username = (String) map.get("username");// "moby_external"; + String password = (String) map.get("password");// ""; + + /* + * String serverName = "mobycentral.icapture.ubc.ca:3306"; String + * mydatabase = "mobynamespace"; String url = "jdbc:mysql://" + + * serverName + "/" + mydatabase; String username = "moby_external"; + * String password = ""; + */ + this.connection = DriverManager.getConnection(url, username, password); + } catch (ClassNotFoundException e) { + throw new MobyException( + "Could not find database driver. Please ensure that you have the right libraries present"); + } catch (SQLException e) { + e.printStackTrace(); + throw new MobyException("Database access error."); + } + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespaces() + */ + public final String getNamespaces() { + /* ensure that the connection isnt null */ + if (connection == null) + return ""; + + StringBuffer sb = new StringBuffer(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + "\t" + rs.getString(2) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JNamespaceI#getNamespacesAsArray() + */ + public String[][] getNamespacesAsArray() { + /* ensure that the connection isnt null */ + if (connection == null) + return null; + + ArrayList sb = new ArrayList(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + /** + * Get all the data in the db regrading namespaces. + * + * @return an array of String[] objects. The String[] consists of + * {namespace_type, description, namespace_lsid, authority, + * contact_email}. + */ + public String[][] getFullNamespacesAsArray() { + /* ensure that the connection isnt null */ + if (connection == null) + return null; + + ArrayList sb = new ArrayList(); + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), + rs.getString(4), rs.getString(5) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + public static void main(String[] args) throws MobyException { + String[][] namespaces = new JNamespacesSqlImpl().getFullNamespacesAsArray(); + for (int i = 0; i < namespaces.length; i++) { + String[] namespace = namespaces[i]; + for (int j = 0; j < namespace.length; j++) { + System.out.print(namespace[j] + " "); } - System.out.println(); - } - } + System.out.println(); + } + } } From kawas at pub.open-bio.org Tue Mar 14 16:43:23 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 14 Mar 2006 11:43:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141643.k2EGhNrM025854@pub.open-bio.org> kawas Tue Mar 14 11:43:23 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv25829/org/biomoby/shared Modified Files: MobyPrimaryDataSimple.java Log Message: added lsids to the parsed object moby-live/Java/src/main/org/biomoby/shared MobyPrimaryDataSimple.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java 2005/11/06 16:23:50 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java 2006/03/14 16:43:23 1.8 @@ -12,6 +12,8 @@ import java.util.Vector; import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** @@ -63,11 +65,27 @@ for (int i = 0; i < children.getLength(); i++) { String childName = children.item (i).getNodeName(); if (childName.equals ("objectType")) { - if (children.item (i).getFirstChild() != null) - setDataType (new MobyDataType (children.item (i).getFirstChild().getNodeValue())); + if (children.item (i).getFirstChild() != null) { + MobyDataType mdt = new MobyDataType (children.item (i).getFirstChild().getNodeValue()); + NamedNodeMap map = (children.item (i).getAttributes()); + if (map != null) { + Node node = map.getNamedItemNS(children.item(i).getNamespaceURI(),"lsid"); + if (node != null) + mdt.setLSID(node.getNodeValue()); + } + setDataType (mdt); + } } else if (childName.equals ("Namespace")) { - if (children.item (i).getFirstChild() != null) - addNamespace (new MobyNamespace (children.item (i).getFirstChild().getNodeValue())); + if (children.item (i).getFirstChild() != null) { + MobyNamespace namespace = new MobyNamespace (children.item(i).getFirstChild().getNodeValue()); + NamedNodeMap map = (children.item (i).getAttributes()); + if (map != null) { + Node node = map.getNamedItemNS(children.item(i).getNamespaceURI(),"lsid"); + if (node != null) + namespace.setLSID(node.getNodeValue()); + } + addNamespace (namespace); + } } } } From gss at pub.open-bio.org Tue Mar 14 17:52:27 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 12:52:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603141752.k2EHqRN2026055@pub.open-bio.org> gss Tue Mar 14 12:52:26 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF In directory pub.open-bio.org:/tmp/cvs-serv26030/WebRoot/WEB-INF Added Files: log4j.properties Log Message: There are still references to this file in the code base that cause errors when it is missing, so I'm adding it back until the discrepency is resolved s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF log4j.properties,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/log4j.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/log4j.properties 2006/03/02 08:20:42 1.2 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/log4j.properties 2006/03/14 17:52:26 1.3 @@ -14,4 +14,5 @@ log4j.appender.R.layout.ConversionPattern=%d %4c %-5p - %m%n log4j.appender.R.File=smoby.log log4j.appender.R.MaxFileSize=5000KB -log4j.appender.R.MaxBackupIndex=1 \ No newline at end of file +log4j.appender.R.MaxBackupIndex=1 + From senger at pub.open-bio.org Tue Mar 14 23:22:31 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Tue, 14 Mar 2006 18:22:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603142322.k2ENMVUL027754@pub.open-bio.org> senger Tue Mar 14 18:22:31 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv27735/docs Modified Files: Dashboard.html Log Message: moby-live/Java/docs Dashboard.html,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Dashboard.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/docs/Dashboard.html 2006/02/20 08:30:21 1.5 +++ /home/repository/moby/moby-live/Java/docs/Dashboard.html 2006/03/14 23:22:31 1.6 @@ -47,21 +47,25 @@ At the moment, the only way to start Dashboard on your machine is to have a jMoby CVS local copy (how to do -it). Once it is built, type either: +it). Once it is built, type:

 ./build-dev.sh dashboard
 
-or + +Later, you can also use the following (the reason for runing at least +once the above is that it creates a dashboard configuration file - +more about it below): +
 build/run/run-dashboard
 
-On Windows, similarly, either +On Windows, similarly
@@ -69,7 +73,7 @@
 
-or +and
@@ -307,7 +311,7 @@
 
Martin Senger
-Last modified: Mon Feb 20 16:04:41 2006 +Last modified: Tue Mar 14 23:09:09 2006
From gss at pub.open-bio.org Wed Mar 15 00:43:38 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:43:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150043.k2F0hcVM028276@pub.open-bio.org> gss Tue Mar 14 19:43:38 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv28251/src/org/semanticmoby/ref/tools Modified Files: URIInvestigator.java Log Message: Got rid of multithreading; converted to Unix line endings s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools URIInvestigator.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/02 08:54:32 1.16 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/15 00:43:38 1.17 @@ -14,23 +14,12 @@ /** - * This class is used to investigate URLs that potentially contain MOBY graphs. - * Multiple instances can exist, each investigating a different URL. Keeping a - * map of URL->instance mappings in the instances class variable is a simple - * way to prevent multiple instances from investigating the same URL at any one - * time. The static investigate() method adds to this map when it creates - * instances to investigate URLs; the run() method removes its instance once - * it is finished. + * Instances of this class are used to investigate URLs that are believed to + * contain MOBY resource description graphs. */ public class URIInvestigator { /** - * A map associating URLs being investigated with the instances that are - * doing the investigating. - */ - private static Map instances = new HashMap(); - - /** * The URL that is to be investigated for possible inclusion in the * metadata repository. */ @@ -40,82 +29,11 @@ * Create an instance for investingating the given resource URL * @param resourceURL the URL to investigate */ - private URIInvestigator(String resourceURL) { - + public URIInvestigator(String resourceURL) { this.resourceURL = resourceURL; } /** - * Investigate a URL for the possibility that it contains a MOBY graph, - * by creating an instance in which the investigation is to be conducted, - * and calling the instance's start() method. If the URL is already being - * investigated, then this call is a NO-OP. - * @param resourceURL the URL to investigate - */ - public synchronized static void investigate(String resourceURL) { - - synchronized (instances) { - - if (instances.get(resourceURL) != null) { - - if (Log.WARN) Log.warn("Already investigating " + resourceURL); - - return; - } - - URIInvestigator investigator = new URIInvestigator(resourceURL); - instances.put(resourceURL, investigator); - investigator.start(); - } - } - - - /** - * Start running in a separate thread. - */ - private void start() { - - new Thread() { - - public void run() { - - URIInvestigator.this.run(); - } - }.start(); - } - - - /** - * Find out what's at the URL that is being investigated. If doing a GET - * on it returns a MOBY graph, then register the graph in the metadata - * repository. If it does not contain a MOBY graph, then try de-registering - * it from the repository. - */ - private void run() { - - try { - - String repositoryName = - MOBYProperties.getProperty("DB_REPOSITORY_NAME", true); - syncGraph(); - } catch (MissingPropertyException e) { - - e.printStackTrace(); - if (Log.ERROR) Log.error("Missing DB_REPOSITORY_NAME property"); - } finally { - - // Regardless of the results of the URL investigation, remove - // this instance from the static instances map. - // - synchronized (instances) { - - instances.remove(resourceURL); - } - } - } - - - /** * Synchronize the resource URL's MOBY graph (if there is one) with the * graph stored in the metadata repository (if there is one). This involves * doing an HTTP GET on the resource URL; if there is already a graph stored @@ -126,13 +44,13 @@ * modified), then there is nothing to do; if the request returns a 404 * (resource not found), then remove the graph from the database. */ - synchronized private void syncGraph() { + public void investigate() { // The storage manager is used to access the metadata repository StorageManager manager = new StorageManager(); // Find out if the resource is already registered, and if so, when - // was its graph last modified. + // its graph was last modified. Date lastModifiedDate = null; boolean alreadyRegistered = false; @@ -314,19 +232,20 @@ } + /** + * Deregisters the resource being investigated. + * @param manager the StorageManager used to actually do the deregistration + * @param removing if the removing flag is set, a message is written to the + * log stating that the resource has been removed + */ private void deregisterResource(StorageManager manager, boolean removing) { - try { - manager.deregisterResource(resourceURL); - if (removing) { - if(Log.INFO) Log.info("REMOVED : " + resourceURL); } } catch (StorageException e) { - e.printStackTrace(); if (Log.ERROR) Log.error("Unable to de-register resource " + resourceURL); } From gss at pub.open-bio.org Wed Mar 15 00:45:49 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:45:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150045.k2F0jnf8028311@pub.open-bio.org> gss Tue Mar 14 19:45:49 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv28286/src/org/semanticmoby/ref/tools Modified Files: MetadataRetriever.java Log Message: Simplified, fixed several bugs; converted line endings to Unix s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools MetadataRetriever.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MetadataRetriever.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MetadataRetriever.java 2006/01/31 00:30:08 1.4 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MetadataRetriever.java 2006/03/15 00:45:49 1.5 @@ -1,29 +1,22 @@ package org.semanticmoby.ref.tools; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.StringTokenizer; - -import org.semanticmoby.graph.MOBYResource; -import org.semanticmoby.vocabulary.MOBY; - -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.RDFNode; -import com.hp.hpl.jena.rdf.model.Statement; -import com.hp.hpl.jena.rdf.model.StmtIterator; +import java.io.*; +import java.net.*; +import java.util.*; + +import org.semanticmoby.api.*; +import org.semanticmoby.graph.*; +import org.semanticmoby.vocabulary.*; + +import com.hp.hpl.jena.rdf.model.*; /** - * This class is responsible for retrieving a list of words to associate - * with a resource. It traverses the resource graph searching for MOBY - * metadata properties, and builds a set of URLs from the metadata property - * values. For each of the URLs in the resulting set, it then opens an HTTP - * connection to the URL and reads all the words it finds, up to a set - * number of bytes, and adds these words to a set. + * This class is responsible for retrieving a list of words to associate with + * a resource. It traverses the resource graph searching for moby:metadata + * properties, and collects a set of URLs from the property values. For each + * URL in the resulting set, it then opens a connection to the URL and reads + * all the words it finds, up to a set number of bytes, and adds these words + * to a set. */ public class MetadataRetriever { @@ -37,90 +30,84 @@ */ int maxBytes; + /** + * The set of keywords being accumulated + */ private Set keywords = null; + /** + * Creates an instance for retrieving up to some number of bytes + * from moby:metadata URLs associated with a model + * @param model the model containing the moby:metadata statements + * @param maxBytes the maximum number of bytes to retrieve + */ public MetadataRetriever(Model model, int maxBytes) { this.model = model; this.maxBytes = maxBytes; } + /** + * Retrieves, if necessary, and returns the set of keywords + */ public Set getKeywords() { if (keywords == null) { - keywords = retrieveKeywords(); + retrieveKeywords(); } return keywords; } - private Set retrieveKeywords() { + /** + * Retrieves and returns the set of keywords from the moby:metadata + * URL properties in the model + */ + private void retrieveKeywords() { - Set words = new HashSet(); + keywords = new HashSet(); Iterator it = getMetadataURLs().iterator(); int addedSoFar = 0; while (it.hasNext() && addedSoFar < maxBytes) { String url = (String) it.next(); - addedSoFar += addKeywords(words, url, addedSoFar); + addedSoFar += addKeywords(url, addedSoFar); } - return words; } - private int addKeywords(Set words, String urlString, int addedSoFar) { - + /** + * Adds keywords for the given URL string and returns the number of + * bytes added. + */ + private int addKeywords(String urlString, int addedSoFar) { + int added = 0; InputStream stream = null; + int remaining = maxBytes - addedSoFar; try { + // Open a connection to the URL from which keywords are to be read URL url = new URL(urlString); stream = url.openStream(); - - int available = stream.available(); - int allowed = maxBytes - addedSoFar; - - // If reading all that is available would result in some words not - // being read, we might read part of a word. In that case, read - // 100 bytes extra and discard the last word. - int toRead = 0; - boolean discardLastWord; - - if (allowed >= available) { - // The number of bytes allowed to be read is at least as - // many as what is available, so read everything and don't - // discard the last word - toRead = available; - discardLastWord = false; - } else { - // The number of bytes available is greater than the number - // allowed to be read, so read the allowed number plus a - // few extra in order to hopefully get to a token separator, - // but discard the last word read. - toRead = allowed + 20; - discardLastWord = true; - } - - // Read up to toRead bytes into a buffer - byte[] buffer = new byte[toRead]; - stream.read(buffer, 0, toRead); - - // Use a string tokenizer to break the buffer into words - StringTokenizer st = new StringTokenizer(new String(buffer)); - while (st.hasMoreTokens()) { - String word = st.nextToken(); - - // remove all symbols except for letters, _, -, ., ' - word.toLowerCase(); - word.replaceAll("[^a-z:-_.\']", ""); - - // Add the word if either we are not discarding the final - // one, or if this word is not the final one - if ((! discardLastWord) || st.hasMoreTokens()) { - - words.add(word); - added += word.length(); - } + + // Create a buffer for accumulating characters from the stream + StringBuffer sb = new StringBuffer(); + + char ch; + while (((ch = (char) stream.read()) != -1) && (remaining > 0)) { + if (Character.isWhitespace(ch)) { + // If we hit a whitespace character, convert the buffer + // into a lowercase string, add it to the buffer, and + // reset the buffer + keywords.add(sb.toString().toLowerCase()); + sb = new StringBuffer(); + } else { + // Add the character to the buffer + sb.append(ch); + added++; + remaining--; + } } } catch (Throwable t) { - t.printStackTrace(); + Log.error("Error while reading " + urlString + ": " + t.getMessage()); } finally { // Regardless of what happens, try to close the stream if it // was created @@ -128,7 +115,8 @@ try { stream.close(); } catch (Throwable t) { - t.printStackTrace(); + Log.error("Error closing connection to " + + urlString + ": " + t.getMessage()); } } } @@ -153,19 +141,20 @@ // not a literal, so add it inside a try/catch block urls.add(stmt.getString()); } catch (Throwable t) { - t.printStackTrace(); + Log.warn("A moby:metadata property with a " + + "non-string value was found"); } } return urls; } - + /* public static void main(String[] args) throws Throwable { String resourceURL = - "http://www.semanticmoby.org/examples/proxies/gramene-query"; + "http://www.semanticmoby.org/examples/proxies/flybase-genequery"; Model m = ModelFactory.createDefaultModel(); m.read(resourceURL); - MetadataRetriever r = new MetadataRetriever(m, 15); + MetadataRetriever r = new MetadataRetriever(m, 100000); Set keys = r.getKeywords(); for (Iterator it = keys.iterator(); it.hasNext();) { System.out.println(it.next()); From gss at pub.open-bio.org Wed Mar 15 00:51:11 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:51:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150051.k2F0pB4N028369@pub.open-bio.org> gss Tue Mar 14 19:51:11 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv28344/src/org/semanticmoby/ref/servlets Modified Files: PostResourcesServlet.java Log Message: Fixed to use updated URIInvestigator class; convert line endings to Unix s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets PostResourcesServlet.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/02 08:54:32 1.3 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/15 00:51:11 1.4 @@ -36,11 +36,13 @@ for (int i = 0; i < resourceCount; i++) { String resourceURL = request.getParameter("resource-" + (i + 1)); - if (Log.INFO) Log.info("resourceURL = " + resourceURL); + if (Log.DEBUG) Log.debug("resourceURL = " + resourceURL); if (resourceURL != null) { if (!resourceURL.equals("")) { - URIInvestigator.investigate(resourceURL); + URIInvestigator investigator = + new URIInvestigator(resourceURL); + investigator.investigate(); count++; } } From gss at pub.open-bio.org Wed Mar 15 00:52:17 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:52:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150052.k2F0qHO4028402@pub.open-bio.org> gss Tue Mar 14 19:52:17 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv28377/src/org/semanticmoby/ref/servlets Modified Files: ResourceInvestigationServlet.java Log Message: Fixed to use updated URIInvestigator class s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets ResourceInvestigationServlet.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/02 08:54:32 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/15 00:52:17 1.10 @@ -20,7 +20,6 @@ */ public class ResourceInvestigationServlet extends BaseServlet { - /** * Respond to an HTTP GET message */ @@ -54,8 +53,8 @@ e2.printStackTrace(); } } else { - - URIInvestigator.investigate(resourceURL); + URIInvestigator investigator = new URIInvestigator(resourceURL); + investigator.investigate(); dataBean.setUrl(resourceURL); From gss at pub.open-bio.org Wed Mar 15 00:57:38 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Tue, 14 Mar 2006 19:57:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603150057.k2F0vc3p028474@pub.open-bio.org> gss Tue Mar 14 19:57:37 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api In directory pub.open-bio.org:/tmp/cvs-serv28449/src/org/semanticmoby/api Modified Files: Log.java Log Message: Set DEBUG to false for release s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api Log.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/02 08:54:32 1.1 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/15 00:57:37 1.2 @@ -15,7 +15,7 @@ /** * Sets a static final switch, for whether to log debug messages. */ - public static final boolean DEBUG = true; + public static final boolean DEBUG = false; /** * Sets a static final switch, for whether to log info messages. From kawas at pub.open-bio.org Wed Mar 15 16:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMckp032204@pub.open-bio.org> kawas Wed Mar 15 11:22:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/ui/graphical/servlet/jTypes Modified Files: Types.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes Types.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes/Types.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes/Types.java 2006/01/03 19:24:15 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jTypes/Types.java 2006/03/15 16:22:38 1.5 @@ -32,24 +32,43 @@ // super.init(); // try to load environment variables set in context.xml try { - Context c = new InitialContext(); - String MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); - String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); - String MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); - if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { - // set MOBY_CENTRAL_CONFIG - System.setProperty("MOBY_CENTRAL_CONFIG",MOBY_CENTRAL_CONFIG); - } - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - // set MOBY_SERVER - System.setProperty("MOBY_SERVER",MOBY_SERVER); - } - if (MOBY_URI != null && !MOBY_URI.equals("")) { - // set MOBY_URI - System.setProperty("MOBY_URI",MOBY_URI); - } - - } catch (Exception e) {} + Context c = new InitialContext(); + + try { + String MOBY_CENTRAL_CONFIG = null; + MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); + if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { + // set MOBY_CENTRAL_CONFIG + System.out.println("init(setting MOBY_CENTRAL_CONFIG)"); + System.setProperty("MOBY_CENTRAL_CONFIG", MOBY_CENTRAL_CONFIG); + } + + } catch (Exception ex) { + } + try { + String MOBY_SERVER = null; + MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + // set MOBY_SERVER + System.out.println("init(setting MOBY_SERVER)"); + System.setProperty("MOBY_SERVER", MOBY_SERVER); + } + } catch (Exception ex) { + } + + try { + String MOBY_URI = null; + MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); + if (MOBY_URI != null && !MOBY_URI.equals("")) { + // set MOBY_URI + System.out.println("init(setting MOBY_URI)"); + System.setProperty("MOBY_URI", MOBY_URI); + } + } catch (Exception ex) { + } + + } catch (Exception e) { + } } /* (non-Javadoc) From kawas at pub.open-bio.org Wed Mar 15 16:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMctG032185@pub.open-bio.org> kawas Wed Mar 15 11:22:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java RDFConfigure.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.12,1.13 RDFConfigure.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/02/27 22:42:30 1.12 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/03/15 16:22:38 1.13 @@ -335,10 +335,7 @@ MobyData[] secondaryInputs = services[i].getSecondaryInputs(); // consumes MobyData[] outputs = services[i].getPrimaryOutputs(); // produces // start creating the rdf - Resource subject = model.createResource( - "urn:lsid:biomoby.org:serviceinstance:" - + services[i].getAuthority() + "," - + services[i].getName(), + Resource subject = model.createResource(services[i].getLSID(), FetaVocabulary.serviceDescription); subject.addProperty(FetaVocabulary.hasServiceDescriptionLocation, services[i].getSignatureURL()); @@ -396,10 +393,9 @@ .addProperty( ServiceDescriptionPredicates.object_type, model - .createResource("http://biomoby.org/RESOURCES/MOBY-S/Objects#" - + simpleData + .createResource(simpleData .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = simpleData.getNamespaces(); if (namespaces.length > 0) { @@ -412,9 +408,8 @@ parameterNamespace .addProperty( ServiceDescriptionPredicates.namespace_type, - model.createResource(NS - + namespaces[k] - .getName())); + model.createResource(namespaces[k] + .getLSID())); } } hasOperation.addProperty(FetaVocabulary.inputParameter, @@ -442,10 +437,9 @@ parameter .addProperty( ServiceDescriptionPredicates.object_type, - model.createResource(OBJ - + setOfSimpleData[k] + model.createResource(setOfSimpleData[k] .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = setOfSimpleData[k] .getNamespaces(); if (namespaces.length > 0) { @@ -456,9 +450,8 @@ .addProperty( ServiceDescriptionPredicates.namespace_type, model - .createResource(NS - + namespaces[index] - .getName())); + .createResource(namespaces[index] + .getLSID())); } parameter .addProperty( @@ -565,10 +558,9 @@ .addProperty( ServiceDescriptionPredicates.object_type, model - .createResource("http://biomoby.org/RESOURCES/MOBY-S/Objects#" - + simpleData + .createResource(simpleData .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = simpleData.getNamespaces(); if (namespaces.length > 0) { Resource parameterNamespace = model @@ -584,9 +576,8 @@ parameterNamespace .addProperty( ServiceDescriptionPredicates.namespace_type, - model.createResource(NS - + namespaces[k] - .getName())); + model.createResource(namespaces[k] + .getLSID())); } } hasOperation.addProperty( @@ -614,10 +605,9 @@ parameter .addProperty( ServiceDescriptionPredicates.object_type, - model.createResource(OBJ - + setOfSimpleData[k] + model.createResource(setOfSimpleData[k] .getDataType() - .getName())); + .getLSID())); MobyNamespace[] namespaces = setOfSimpleData[k] .getNamespaces(); if (namespaces.length > 0) { @@ -628,9 +618,8 @@ .addProperty( ServiceDescriptionPredicates.namespace_type, model - .createResource(NS - + namespaces[index] - .getName())); + .createResource(namespaces[index] + .getLSID())); } parameter .addProperty( @@ -715,6 +704,98 @@ } return services.length == 1; } + + public final static boolean serviceInstanceExists(String uri, String name, String lsid) { + Central central = null; + MobyService service = null; + MobyService[] services = null; + // initialize central + try { + String registryURL; + String registryNamespace; + Map map = RegistryOS.getEnv(); + if (!map.isEmpty()) { + registryURL = (String) map.get("MOBY_SERVER"); + registryNamespace = (String) map.get("MOBY_URI"); + if (registryURL == null) { + // use default registry, since we dont have a local one + central = new CentralImpl(); + } else if (registryNamespace == null) { + // use default namespace since one isnt defined + central = new CentralImpl(registryURL); + } else { + // use defined url and namespacce + central = new CentralImpl(registryURL, registryNamespace); + } + } else { + // use default registry since we cant determine if local one + // exists + central = new CentralImpl(); + } + } catch (MobyException e) { + return false; + } + // set up the query service + service = new MobyService(name); + service.setAuthority(uri); + // query for the service + try { + services = central.findService(service); + } catch (MobyException e1) { + return false; + } + if (services.length == 1) { + service = services[0]; + return (service.getLSID().equals(lsid)); + } + return false; + } + + public final static String getLatestLSID(String uri, String name, String lsid) { + Central central = null; + MobyService service = null; + MobyService[] services = null; + // initialize central + try { + String registryURL; + String registryNamespace; + Map map = RegistryOS.getEnv(); + if (!map.isEmpty()) { + registryURL = (String) map.get("MOBY_SERVER"); + registryNamespace = (String) map.get("MOBY_URI"); + if (registryURL == null) { + // use default registry, since we dont have a local one + central = new CentralImpl(); + } else if (registryNamespace == null) { + // use default namespace since one isnt defined + central = new CentralImpl(registryURL); + } else { + // use defined url and namespacce + central = new CentralImpl(registryURL, registryNamespace); + } + } else { + // use default registry since we cant determine if local one + // exists + central = new CentralImpl(); + } + } catch (MobyException e) { + return ""; + } + // set up the query service + service = new MobyService(name); + service.setAuthority(uri); + // query for the service + try { + services = central.findService(service); + } catch (MobyException e1) { + return ""; + } + if (services.length == 1) { + service = services[0]; + return (service.getLSID()); + } + return ""; + } /** * @@ -729,11 +810,8 @@ * @throws LSIDException */ public final static void main(String[] args) throws Exception { - Central central = new CentralImpl(); - System.out.println(central.findService(new MobyService( - "aSimpleInputOutputService"))[0]); String str = (findService("bioinfo.icapture.ubc.ca", - "aSimpleInputOutputService", false)); + "parseBlastText", false)); System.out.println(str); // System.out.println(findService("bioinfo.genopole-toulouse.prd.fr",null, // false)); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/02/20 05:51:09 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/15 16:22:38 1.9 @@ -18,20 +18,21 @@ import org.biomoby.shared.Central; import org.biomoby.shared.MobyResourceRef; -import com.hp.hpl.jena.graph.Node; -import com.hp.hpl.jena.rdf.model.Bag; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.NodeIterator; -import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFReader; import com.hp.hpl.jena.rdf.model.RDFWriter; +import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.StmtIterator; +import com.hp.hpl.jena.vocabulary.DC; import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /* * Created on Oct 21, 2004

@@ -43,8 +44,8 @@ * @author Eddie Kawas *

* This class was created to create RDF documents describing BioMoby - * ontologies. This class requires the use of Environment variables in - * order to work correctly. + * ontologies. This class requires the use of Environment variables in + * order to work correctly. *

* For questions, comments, or bugs *

@@ -57,77 +58,78 @@ * Some constants for use in the rdfs */ private static Map URI_MAP = new HashMap(); - static { - boolean __success = false; + static { + boolean __success = false; // attempt 1 - servlet context - try { - Context c = new InitialContext(); - String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - Central central = new CentralImpl(MOBY_SERVER); - MobyResourceRef[] refs = central.getResourceRefs(); - for (int i = 0; i < refs.length; i++) { - String url = refs[i].getResourceLocation().toExternalForm(); - if (url.lastIndexOf("#") < 0) - url = url + "#"; - URI_MAP.put(refs[i].getResourceName(),url); + try { + Context c = new InitialContext(); + String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + Central central = new CentralImpl(MOBY_SERVER); + MobyResourceRef[] refs = central.getResourceRefs(); + for (int i = 0; i < refs.length; i++) { + String url = refs[i].getResourceLocation().toExternalForm(); + if (url.lastIndexOf("#") < 0) + url = url + "#"; + URI_MAP.put(refs[i].getResourceName(), url); } - __success = true; - } - - } catch (Exception e) { - e.printStackTrace(); - } - // attempt 2 - environment variables - if (!__success) { - // maybe try for environment variables - Properties p = MobyProperties.PROPERTIES(); - String MOBY_SERVER = (String) p.get("MOBY_SERVER"); - try { - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - Central central = new CentralImpl(MOBY_SERVER); - MobyResourceRef[] refs = central.getResourceRefs(); - for (int i = 0; i < refs.length; i++) { - String url = refs[i].getResourceLocation().toExternalForm(); - if (url.lastIndexOf("#") < 0) - url = url + "#"; - URI_MAP.put(refs[i].getResourceName(),url); + __success = true; + } + + } catch (Exception e) { + e.printStackTrace(); + } + // attempt 2 - environment variables + if (!__success) { + // maybe try for environment variables + Properties p = MobyProperties.PROPERTIES(); + String MOBY_SERVER = (String) p.get("MOBY_SERVER"); + try { + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + Central central = new CentralImpl(MOBY_SERVER); + MobyResourceRef[] refs = central.getResourceRefs(); + for (int i = 0; i < refs.length; i++) { + String url = refs[i].getResourceLocation().toExternalForm(); + if (url.lastIndexOf("#") < 0) + url = url + "#"; + URI_MAP.put(refs[i].getResourceName(), url); + } + __success = true; } - __success = true; - } - }catch (Exception ex) { - // die here? - ex.printStackTrace(); - } - } - //attempt 3 - default to mobycentral - if (!__success) { - // default to mobycentral - try { - Central central = new CentralImpl(); - MobyResourceRef[] refs = central.getResourceRefs(); - for (int i = 0; i < refs.length; i++) { - String url = refs[i].getResourceLocation().toExternalForm(); - if (url.lastIndexOf("#") < 0) - url = url + "#"; - URI_MAP.put(refs[i].getResourceName(),url); + } catch (Exception ex) { + // die here? + ex.printStackTrace(); + } + } + // attempt 3 - default to mobycentral + if (!__success) { + // default to mobycentral + try { + Central central = new CentralImpl(); + MobyResourceRef[] refs = central.getResourceRefs(); + for (int i = 0; i < refs.length; i++) { + String url = refs[i].getResourceLocation().toExternalForm(); + if (url.lastIndexOf("#") < 0) + url = url + "#"; + URI_MAP.put(refs[i].getResourceName(), url); } - __success = true; - }catch (Exception ex) { - // die here? - ex.printStackTrace(); - } - } + __success = true; + } catch (Exception ex) { + // die here? + ex.printStackTrace(); + } + } } - final public static String URI_OBJECT = (String)URI_MAP.get("Object"); //"http://biomoby.org/RESOURCES/MOBY-S/Objects#"; - final public static String URI_SERVICE = (String)URI_MAP.get("Service"); //"http://biomoby.org/RESOURCES/MOBY-S/Services#"; + final public static String URI_OBJECT = (String) URI_MAP.get("Object"); // "http://biomoby.org/RESOURCES/MOBY-S/Objects#"; - final public static String URI_NAMESPACE = (String)URI_MAP.get("Namespace"); //"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; + final public static String URI_SERVICE = (String) URI_MAP.get("Service"); // "http://biomoby.org/RESOURCES/MOBY-S/Services#"; - final public static String URI_PREDICATE = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; + final public static String URI_NAMESPACE = (String) URI_MAP.get("Namespace"); // "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; - final public static String URI_ServiceINSTANCE = (String)URI_MAP.get("ServiceInstance"); //"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; + final public static String URI_PREDICATE = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; + + final public static String URI_ServiceINSTANCE = (String) URI_MAP.get("ServiceInstance"); // "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; private Model model = null; @@ -160,26 +162,52 @@ *

* * @param myObject - - * the URI of the object in question + * the URI (lsid) of the object in question * @return the rdf representation of the object in question. * @throws IOException */ public final byte[] retrieveObjectRDF(String myObject) throws IOException { - rdf = ModelFactory.createDefaultModel(); - rdf.setNsPrefixes(model.getNsPrefixMap()); - Resource r = model.getResource(myObject); - Resource resource = rdf.createResource(r.getURI()).addProperty( - RDF.type, RDFS.Class); - - // copy resource r's properties - copyResourceAndProperties(r, resource); - // now get the output ready - - FilteredStream aPrintStream = new FilteredStream( - new ByteArrayOutputStream()); - createOutputRDF(aPrintStream); - // System.out.println(aPrintStream.getOutput()); - return aPrintStream.getOutput().getBytes(); + + String latest = getLatestLSID(myObject); + boolean exists = objectExists(myObject) || objectExisted(myObject); + if (exists) + if (latest.equals(myObject)) { + rdf = ModelFactory.createDefaultModel(); + rdf.setNsPrefixes(model.getNsPrefixMap()); + Resource r = model.getResource(myObject); + Resource resource = rdf.createResource(r.getURI()) + .addProperty(RDF.type, RDFS.Class); + + // copy resource r's properties + copyResourceAndProperties(r, resource); + // now get the output ready + + FilteredStream aPrintStream = new FilteredStream(new ByteArrayOutputStream()); + createOutputRDF(aPrintStream); + // System.out.println(aPrintStream.getOutput()); + return aPrintStream.getOutput().getBytes(); + } else { + Model model = ModelFactory.createDefaultModel(); + Resource resource = model.createResource(myObject); + model.add(model.createStatement(resource, RDFS.isDefinedBy, model + .createLiteral(latest))); + model.add(model.createStatement(resource, RDFS.comment, model + .createLiteral("The Namespace/Datatype/ServiceType described by the LSID: " + myObject + + " has since been modified. Please update your lsid."))); + FilteredStream aPrintStream = new FilteredStream(new ByteArrayOutputStream()); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + writer.setProperty("tab", "5"); + writer.write(model, aPrintStream, null); + return aPrintStream.getOutput().getBytes(); + } + else { + return ("" + + "" + "") + .getBytes(); + } + } /* @@ -195,39 +223,45 @@ /* * given the source, the new resource is a copy */ - private final void copyResourceAndProperties(Resource sourceResource, - Resource newResource) { + private final void copyResourceAndProperties(Resource sourceResource, Resource newResource) { // add the properties to the resource in question if (sourceResource.hasProperty(RDFS.comment)) { - String str = sourceResource.getProperty(RDFS.comment).getObject() - .toString(); + String str = sourceResource.getProperty(RDFS.comment).getObject().toString(); if (str.indexOf("~") != -1) str = str.substring(0, str.indexOf("~")); - newResource.addProperty(RDFS.comment, rdf.createLiteral(str, "en")); + newResource.addProperty(RDFS.comment, rdf.createLiteral(str)); } if (sourceResource.hasProperty(RDFS.label)) { - String str = sourceResource.getProperty(RDFS.label).getObject() - .toString(); + String str = sourceResource.getProperty(RDFS.label).getObject().toString(); + if (str.indexOf("~") != -1) + str = str.substring(0, str.indexOf("~")); + newResource.addProperty(RDFS.label, rdf.createLiteral(str)); + } + if (sourceResource.hasProperty(DC.publisher)) { + String str = sourceResource.getProperty(DC.publisher).getObject().toString(); if (str.indexOf("~") != -1) str = str.substring(0, str.indexOf("~")); - newResource.addProperty(RDFS.label, rdf.createLiteral(str, "en")); + newResource.addProperty(DC.publisher, rdf.createLiteral(str)); } - // TODO - add the ofType property if it exists + if (sourceResource.hasProperty(DC.creator)) { + String str = sourceResource.getProperty(RDFS.label).getObject().toString(); + if (str.indexOf("~") != -1) + str = str.substring(0, str.indexOf("~")); + newResource.addProperty(DC.creator, rdf.createLiteral(str)); + } + // add the ofType property if it exists if (sourceResource.hasProperty(Predicates.ofType)) { - String str = sourceResource.getProperty(Predicates.ofType) - .getObject().toString(); + String str = sourceResource.getProperty(Predicates.ofType).getObject().toString(); if (str.indexOf("~") != -1) str = str.substring(0, str.indexOf("~")); newResource.addProperty(Predicates.ofType, str); } if (sourceResource.hasProperty(RDFS.subClassOf)) { - String parent = sourceResource.getProperty(RDFS.subClassOf) - .getObject().asNode().getURI(); - Resource parentResource = rdf.createResource(parent).addProperty( - RDF.type, RDFS.Class); + String parent = sourceResource.getProperty(RDFS.subClassOf).getObject().asNode() + .getURI(); + Resource parentResource = rdf.createResource(parent).addProperty(RDF.type, RDFS.Class); - copyResourceAndProperties(model - .getResource(parentResource.getURI()), parentResource); + copyResourceAndProperties(model.getResource(parentResource.getURI()), parentResource); newResource.addProperty(RDFS.subClassOf, parentResource); } @@ -237,26 +271,22 @@ if (it != null) { while (it.hasNext()) { Statement next = it.nextStatement(); -// Resource subject = next.getSubject(); -// Property predicate = next.getPredicate(); + // Resource subject = next.getSubject(); + // Property predicate = next.getPredicate(); RDFNode object = next.getObject(); -// Node node = object.asNode(); + // Node node = object.asNode(); if (object instanceof Resource) { Resource res = (Resource) object; - String type = res.getProperty(RDF.type).getObject() - .toString(); - String articleName = res - .getProperty(Predicates.articleName).getObject() + String type = res.getProperty(RDF.type).getObject().toString(); + String articleName = res.getProperty(Predicates.articleName).getObject() .toString(); if (articleName.indexOf("~") != -1) - articleName = articleName.substring(0, articleName - .indexOf("~")); + articleName = articleName.substring(0, articleName.indexOf("~")); type = type.substring(type.indexOf("#") + 1); Resource hasa = rdf.createResource( // ModelFactory.createDefaultModel().createResource( rdf.createResource(URI_OBJECT + type)).addProperty( - Predicates.articleName, - rdf.createTypedLiteral(articleName)); + Predicates.articleName, rdf.createTypedLiteral(articleName)); newResource.addProperty(Predicates.hasa, hasa); } else { @@ -271,26 +301,22 @@ if (it != null) { while (it.hasNext()) { Statement next = it.nextStatement(); -// Resource subject = next.getSubject(); -// Property predicate = next.getPredicate(); + // Resource subject = next.getSubject(); + // Property predicate = next.getPredicate(); RDFNode object = next.getObject(); -// Node node = object.asNode(); + // Node node = object.asNode(); if (object instanceof Resource) { Resource res = (Resource) object; - String type = res.getProperty(RDF.type).getObject() - .toString(); - String articleName = res - .getProperty(Predicates.articleName).getObject() + String type = res.getProperty(RDF.type).getObject().toString(); + String articleName = res.getProperty(Predicates.articleName).getObject() .toString(); if (articleName.indexOf("~") != -1) - articleName = articleName.substring(0, articleName - .indexOf("~")); + articleName = articleName.substring(0, articleName.indexOf("~")); type = type.substring(type.indexOf("#") + 1); Resource has = rdf.createResource( // ModelFactory.createDefaultModel().createResource( rdf.createResource(URI_OBJECT + type)).addProperty( - Predicates.articleName, - rdf.createTypedLiteral(articleName)); + Predicates.articleName, rdf.createTypedLiteral(articleName)); newResource.addProperty(Predicates.has, has); } else { @@ -312,204 +338,43 @@ * @return the rdf representation of the service instance. * @throws IOException */ - public final byte[] retrieveServiceInstanceRDF(String myObject) - throws IOException { - String localname = myObject.substring(myObject.indexOf("#") + 1); + public final byte[] retrieveServiceInstanceRDF(String lsid) throws IOException { + LSID theLsid; + try { + theLsid = new LSID(lsid); + } catch (MalformedLSIDException e) { + throw new IOException(e.getLocalizedMessage()); + } + String localname = theLsid.getObject(); String[] details = localname.split(","); - return ServiceInstanceRDF.findService(details[0], details[1], false) - .getBytes(); - - } - - /* - * @param resource - the resource to add the property to @param _bag - the - * bag to add all the properties to @param property - the predicate for the - * adding the bag to the resource - */ - private final void addPropertyToResourceInBag(Resource resource, Bag _bag, - Property property) { - // get all of the objects of uri the - // same as resource with the property we are looking for. - NodeIterator _resource; - _resource = model.listObjectsOfProperty(resource, property); - - // iterator should only have one item - the main bag - while (_resource.hasNext()) { - // create a bag - should be a bag. - Resource _mainBag = (Resource) model.getRDFNode(_resource - .nextNode().asNode()); - - StmtIterator mainBagIterator = _mainBag.listProperties(); - while (mainBagIterator.hasNext()) { - // iterate through the statements for the bag - Statement statement = mainBagIterator.nextStatement(); - Node object = statement.getObject().asNode(); -// Property pred = statement.getPredicate(); - if (object.isBlank()) { - // object is an item in the mainBag - // the item that is a resource - Resource item = statement.getResource(); - // get the statements for the item in the bag - // could be a bag or just a simple -// StmtIterator sit = item.listProperties(); - if (item.hasProperty(RDF.type, Predicates.Simple)) { - // create a simple article - Resource _li = rdf.createResource(); - _li.addProperty(RDF.type, Predicates.Simple); - _li.addProperty(Predicates.object_type, model - .getResource(item.getProperty( - Predicates.object_type).getObject() - .toString())); - if (item.hasProperty(Predicates.articleName)) { - String str = item.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf("~") > 0) - str = str.substring(0, str.indexOf("~")); - _li.addProperty(Predicates.articleName, rdf - .createTypedLiteral(str)); - } - StmtIterator namespaceIt = item - .listProperties(Predicates.namespace_type); - while (namespaceIt.hasNext()) { - _li.addProperty(Predicates.namespace_type, model - .getResource(namespaceIt.nextStatement() - .getObject().toString())); - } - _bag.add(_li); - } - if (item.hasProperty(RDF.type, Predicates.Secondary)) { - // create a secondary article - Resource _li = rdf.createResource(); - _li.addProperty(RDF.type, Predicates.Secondary); - boolean isInt = false; - if (item.hasProperty(Predicates.datatype)) { - String str = item.getProperty(Predicates.datatype) - .getObject().toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - if (str.equalsIgnoreCase("Integer")) - isInt = true; - _li.addProperty(Predicates.datatype, rdf - .createTypedLiteral(str)); - } - if (item.hasProperty(Predicates.articleName)) { - String str = item.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - _li.addProperty(Predicates.articleName, rdf - .createTypedLiteral(str)); - } - if (item.hasProperty(Predicates.default_value)) { - String str = item.getProperty( - Predicates.default_value).getObject() - .toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - _li.addProperty(Predicates.default_value, rdf - .createTypedLiteral(str)); - } - if (item.hasProperty(Predicates.min)) { - String str = item.getProperty(Predicates.min) - .getObject().toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - _li.addProperty(Predicates.min, rdf - .createTypedLiteral(Integer.parseInt(str))); - } - if (item.hasProperty(Predicates.max)) { - String str = item.getProperty(Predicates.max) - .getObject().toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf(":")); - } - _li.addProperty(Predicates.max, rdf - .createTypedLiteral(Integer.parseInt(str))); - } - StmtIterator enumIter = item - .listProperties(Predicates.enumeration); - while (enumIter.hasNext()) { - String str = enumIter.nextStatement().getObject() - .toString(); - if (str.indexOf("~") > 0) { - str = str.substring(0, str.indexOf("~")); - } - if (isInt && !str.equals("")) - _li.addProperty(Predicates.enumeration, rdf - .createTypedLiteral(Integer - .parseInt(str))); - else - _li.addProperty(Predicates.enumeration, rdf - .createTypedLiteral(str)); - } - // add the item to the bag - _bag.add(_li); - } - if (item.hasProperty(RDF.type, Predicates.Collection)) { - // create a collection - Bag collectionBag = rdf.createBag(); - collectionBag.addProperty(RDF.type, - Predicates.Collection); - collectionBag.addProperty(RDFS.subClassOf, RDF.Bag); - if (item.hasProperty(Predicates.articleName)) { - String str = item.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf("~") > 0) - str = str.substring(0, str.indexOf("~")); - collectionBag.addProperty(Predicates.articleName, - str); - } - // Resource collectionResource = - // item.getProperty(MobyResources.Collection).getResource(); - StmtIterator simples = item.listProperties(); - while (simples.hasNext()) { - Statement cStatement = simples.nextStatement(); - if (cStatement.getObject().asNode().isBlank()) { - Resource simple = cStatement.getResource(); - Resource _li = rdf.createResource(); - _li.addProperty(RDF.type, Predicates.Simple); - _li.addProperty(Predicates.object_type, model - .getResource(simple.getProperty( - Predicates.object_type) - .getObject().toString())); - if (simple.hasProperty(Predicates.articleName)) { - String str = simple.getProperty( - Predicates.articleName).getObject() - .toString(); - if (str.indexOf(":") > 0) - str = str - .substring(0, str.indexOf("~")); - _li.addProperty(Predicates.articleName, rdf - .createTypedLiteral(str)); - } - StmtIterator namespaceIt = simple - .listProperties(Predicates.namespace_type); - while (namespaceIt.hasNext()) { - _li.addProperty(Predicates.namespace_type, - model.getResource(namespaceIt - .nextStatement() - .getObject().toString())); - } - collectionBag.add(_li); - } - } - // add the collection to the bag - _bag.add(collectionBag); - } - } + if (ServiceInstanceRDF.serviceInstanceExists(details[0], details[1], lsid)) + return ServiceInstanceRDF.findService(details[0], details[1], false).getBytes(); + else { + if (ServiceInstanceRDF.serviceInstanceExists(details[0], details[1])) { + // return rdf that points to latest + Model model = ModelFactory.createDefaultModel(); + Resource resource = model.createResource(lsid); + model.add(model.createStatement(resource, RDFS.isDefinedBy, model + .createLiteral(ServiceInstanceRDF.getLatestLSID(details[0], details[1], + lsid)))); + model.add(model.createStatement(resource, RDFS.comment, model + .createLiteral("The service described by the LSID: " + lsid + + " has since been modified. Please update your lsid."))); + + FilteredStream aPrintStream = new FilteredStream(new ByteArrayOutputStream()); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + writer.setProperty("tab", "5"); + writer.write(model, aPrintStream, null); + return aPrintStream.getOutput().getBytes(); + } else { + return ("" + + "" + "") + .getBytes(); } - } - // finally add the property to our resource - resource.addProperty(property, _bag); } /** @@ -522,36 +387,70 @@ * otherwise false is returned. * * @param myObject - - * the string to query the RDF model with. + * the string to query the RDF model with (an lsid). * @return - true if myObject exists in the RDF model, false otherwise. */ public final boolean objectExists(String myObject) { NodeIterator rits = model.listObjects(); - System.out.println("Searching for Object " + myObject); while (rits.hasNext()) { RDFNode RDFnode = rits.nextNode(); if (RDFnode == null) { - System.out.println("Search for Object " + myObject + " failed (1)."); return false; } String node = RDFnode.toString(); if (node.indexOf("~") > 0) node = node.substring(0, node.indexOf("~")); - if (node.indexOf(":") > 0) - node = node.substring(0, node.indexOf(":")); if (node.equalsIgnoreCase(myObject)) return true; } - System.out.println("Search for Object " + myObject + " failed (2)."); return false; } + public final boolean objectExisted(String lsid) { + ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); + LSID theLsid = null; + try { + theLsid = new LSID(lsid); + } catch (MalformedLSIDException e) { + System.err.println("Error checking if an object existed " + e.getLocalizedMessage()); + return false; + } + + while (rIter.hasNext()) { + Resource resource = rIter.nextResource(); + if (resource.getLocalName() != null) + if (resource.getLocalName().equals(theLsid.getObject())) + return true; + } + return false; + } + + public final String getLatestLSID(String lsid) { + ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); + LSID theLsid = null; + try { + theLsid = new LSID(lsid); + } catch (MalformedLSIDException e) { + System.err.println("Error obtaining the latest LSID - " + e.getLocalizedMessage()); + return ""; + } + + while (rIter.hasNext()) { + Resource resource = rIter.nextResource(); + if (resource.getLocalName() != null) + if (resource.getLocalName().equals(theLsid.getObject())) + return resource.getURI(); + } + return ""; + } + public static void main(String[] args) throws IOException { RDFConfigure rdfc = new RDFConfigure( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#"); + "http://biomoby.org/RESOURCES/MOBY-S/Services#"); System.out - .println(rdfc.objectExists( - ("SW"))); + .println(new String( + rdfc + .retrieveObjectRDF(("urn:lsid:biomoby.org:servicetype:Analysis")))); } @@ -560,8 +459,7 @@ public FilteredStream(OutputStream aStream) { super(aStream); - sb = new StringBuffer("" - + newline); + sb = new StringBuffer("" + newline); } public void write(byte b[]) throws IOException { From kawas at pub.open-bio.org Wed Mar 15 16:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMcDC032135@pub.open-bio.org> kawas Wed Mar 15 11:22:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/registry/definitions/types Modified Files: JServicesSqlImpl.java JObjectsSqlImpl.java JNamespacesSqlImpl.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/registry/definitions/types JServicesSqlImpl.java,1.2,1.3 JObjectsSqlImpl.java,1.1,1.2 JNamespacesSqlImpl.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java 2006/03/14 16:23:06 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JServicesSqlImpl.java 2006/03/15 16:22:37 1.3 @@ -25,7 +25,7 @@ + "FROM service as ot1, service_term2term as rt, service as ot2 " + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; - private static final String sql_all = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description, ot1.service_lsid, ot1.authority, ot1.contact_email " + private static final String sql_all = "SELECT ot1.service_type, rt.relationship_type, ot2.service_type, ot1.description, ot1.service_lsid, ot1.authority, ot1.contact_email, ot2.service_lsid " + "FROM service as ot1, service_term2term as rt, service as ot2 " + "WHERE ot1.service_id = rt.service1_id and ot2.service_id = rt.service2_id order by ot1.service_type"; @@ -48,12 +48,12 @@ Map map = MobyCentralConfig.getMobyService(); // Create a connection to the database String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; - // //TODO - // - - // make - // this - // a - // property + // //TODO + // - + // make + // this + // a + // property String mydatabase = (String) map.get("dbname");// "mobyobject"; String url = "jdbc:mysql://" + serverName + "/" + mydatabase; String username = (String) map.get("username");// "moby_external"; @@ -143,9 +143,11 @@ /** * Get all the data in the db regrading service types. + * * @return an array of String[] objects. The String[] consists of - * {service_type, relationship_type, to_service_type, description, service_lsid, authority, - * contact_email}. Note that relationship_type is the relationship that service_type has + * {service_type, relationship_type, to_service_type, description, + * service_lsid, authority, contact_email, to_service_type_lsid}. + * Note that relationship_type is the relationship that service_type has * with to_service_type. */ public String[][] getFullServicesAsArray() { @@ -166,7 +168,7 @@ while (rs.next()) { // Get the data from the row using the column index sb.add(new String[] { rs.getString(1), rs.getString(2), rs.getString(3), - rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7) }); + rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7), rs.getString(8) }); } } catch (SQLException e) { // TODO - throw exception - Database access error =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.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/registry/definitions/types/JObjectsSqlImpl.java 2005/08/29 20:19:20 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java 2006/03/15 16:22:37 1.2 @@ -21,179 +21,221 @@ * email me at edward.kawas at gmail.com */ public final class JObjectsSqlImpl implements JObjectsI { - private static final String sql = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " - + "FROM object as ot1, object_term2term as rt, object as ot2 " - + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id " - + "ORDER BY ot1.object_type"; - - private final String newline = System.getProperty("line.separator"); - - private Connection connection = null; - - /** - * - * @throws MobyException - * if database driver cannot be found or there is an database - * access error. - */ - public JObjectsSqlImpl() throws MobyException { - try { - // Load the JDBC driver - String driverName = "com.mysql.jdbc.Driver"; - Class.forName(driverName); - // get certain properties from mobycentral.config - Map map = MobyCentralConfig.getMobyObject(); - // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");//localhost:3306"; - // //TODO - // - make - // this a - // property - String mydatabase = (String) map.get("dbname");//"mobyobject"; - String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");//"moby_external"; - String password = (String) map.get("password");//""; - - /* - * String serverName = "mobycentral.icapture.ubc.ca:3306"; String - * mydatabase = "mobyobject"; String url = "jdbc:mysql://" + - * serverName + "/" + mydatabase; String username = "moby_external"; - * String password = ""; - */ - this.connection = DriverManager.getConnection(url, username, - password); - } catch (ClassNotFoundException e) { - throw new MobyException( - "Could not find database driver. Please ensure that you have the right libraries present"); - } catch (SQLException e) { - e.printStackTrace(); - throw new MobyException("Database access error: " + e.getSQLState()); - } - } - - /* - * (non-Javadoc) - * - * @see org.biomoby.registry.definitions.types.JObjectsI#getObjects() - */ - public final String getObjects() { - StringBuffer sb = new StringBuffer(); - /* ensure connection is not null */ - if (connection == null) - return ""; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) - + "\t" - + rs.getString(2) - + "\t" - + rs.getString(3) - + ((rs.getString(4) == null || rs.getString(4).equals( - "")) ? "\t" : "(" + rs.getString(4) + ")\t") - + rs.getString(5) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - /** - * - * @param name - * the name of the object to get information on - * @return a tab delimited string containing object, object relationship, - * object type that this relationship is with, the articlename (if - * it exists), and description - */ - public final String getObject(String name) { - String _SQL = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " - + "FROM object as ot1, object_term2term as rt, object as ot2 " - + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id and ot1.object_type = '" - + name + "' " + "ORDER BY ot1.object_type"; - StringBuffer sb = new StringBuffer(); - /* ensure connection is not null */ - if (connection == null) - return ""; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(_SQL); - } catch (SQLException ex) { - // TODO - throw exception - Error in sql - return ex.getMessage(); - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb.append(rs.getString(1) - + "\t" - + rs.getString(2) - + "\t" - + rs.getString(3) - + ((rs.getString(4) == null || rs.getString(4).equals( - "")) ? "\t" : "(" + rs.getString(4) + ")\t") - + rs.getString(5) + newline); - } - } catch (SQLException e) { - // TODO - throw exception - Database access error - return e.getMessage(); - } - return sb.toString(); - } - - public static void main(String[] args) throws MobyException { - System.out.println(new JObjectsSqlImpl().getObjectsAsArray()); - } - - /* - * (non-Javadoc) - * - * @see org.biomoby.registry.definitions.types.JObjectsI#getObjectsAsArray() - */ - public String[][] getObjectsAsArray() { - ArrayList sb = new ArrayList(); - /* ensure connection is not null */ - if (connection == null) - return null; - - ResultSet rs = null; - try { - Statement stmt = connection.createStatement(); - rs = stmt.executeQuery(sql); - } catch (SQLException ex) { - return null; - } - try { - while (rs.next()) { - // Get the data from the row using the column index - sb - .add(new String[] { - rs.getString(1), - rs.getString(2), - rs.getString(3), - ((rs.getString(4) == null || - rs.getString(4).equals("")) ? - "" : "(" + rs.getString(4) + ")"), - rs.getString(5) }); - } - } catch (SQLException e) { - return null; - } - String[][] array = new String[sb.size()][]; - sb.toArray(array); - return array; - } + private static final String sql = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " + + "FROM object as ot1, object_term2term as rt, object as ot2 " + + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id " + + "ORDER BY ot1.object_type"; + + private static final String sql_all = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description," + + " ot1.object_lsid, ot1.authority, ot1.contact_email, ot2.object_lsid " + + "FROM object as ot1, object_term2term as rt, object as ot2 " + + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id " + + "ORDER BY ot1.object_type"; + + private final String newline = System.getProperty("line.separator"); + + private Connection connection = null; + + /** + * + * @throws MobyException + * if database driver cannot be found or there is an database + * access error. + */ + public JObjectsSqlImpl() throws MobyException { + try { + // Load the JDBC driver + String driverName = "com.mysql.jdbc.Driver"; + Class.forName(driverName); + // get certain properties from mobycentral.config + Map map = MobyCentralConfig.getMobyObject(); + // Create a connection to the database + String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; + // //TODO + // - make + // this a + // property + String mydatabase = (String) map.get("dbname");// "mobyobject"; + String url = "jdbc:mysql://" + serverName + "/" + mydatabase; + String username = (String) map.get("username");// "moby_external"; + String password = (String) map.get("password");// ""; + + /* + * String serverName = "mobycentral.icapture.ubc.ca:3306"; String + * mydatabase = "mobyobject"; String url = "jdbc:mysql://" + + * serverName + "/" + mydatabase; String username = "moby_external"; + * String password = ""; + */ + this.connection = DriverManager.getConnection(url, username, password); + } catch (ClassNotFoundException e) { + throw new MobyException( + "Could not find database driver. Please ensure that you have the right libraries present"); + } catch (SQLException e) { + e.printStackTrace(); + throw new MobyException("Database access error: " + e.getSQLState()); + } + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JObjectsI#getObjects() + */ + public final String getObjects() { + StringBuffer sb = new StringBuffer(); + /* ensure connection is not null */ + if (connection == null) + return ""; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + + "\t" + + rs.getString(2) + + "\t" + + rs.getString(3) + + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "\t" : "(" + + rs.getString(4) + ")\t") + rs.getString(5) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /** + * + * @param name + * the name of the object to get information on + * @return a tab delimited string containing object, object relationship, + * object type that this relationship is with, the articlename (if + * it exists), and description + */ + public final String getObject(String name) { + String _SQL = "SELECT ot1.object_type, rt.relationship_type, ot2.object_type, rt.object2_articlename, ot1.description " + + "FROM object as ot1, object_term2term as rt, object as ot2 " + + "WHERE ot1.object_id = rt.object1_id and ot2.object_id = rt.object2_id and ot1.object_type = '" + + name + "' " + "ORDER BY ot1.object_type"; + StringBuffer sb = new StringBuffer(); + /* ensure connection is not null */ + if (connection == null) + return ""; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(_SQL); + } catch (SQLException ex) { + // TODO - throw exception - Error in sql + return ex.getMessage(); + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.append(rs.getString(1) + + "\t" + + rs.getString(2) + + "\t" + + rs.getString(3) + + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "\t" : "(" + + rs.getString(4) + ")\t") + rs.getString(5) + newline); + } + } catch (SQLException e) { + // TODO - throw exception - Database access error + return e.getMessage(); + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.biomoby.registry.definitions.types.JObjectsI#getObjectsAsArray() + */ + public String[][] getObjectsAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { + rs.getString(1), + rs.getString(2), + rs.getString(3), + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "" : "(" + + rs.getString(4) + ")"), rs.getString(5) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + + /** + * + * @return + */ + public String[][] getFullObjectsAsArray() { + ArrayList sb = new ArrayList(); + /* ensure connection is not null */ + if (connection == null) + return null; + + ResultSet rs = null; + try { + Statement stmt = connection.createStatement(); + rs = stmt.executeQuery(sql_all); + } catch (SQLException ex) { + return null; + } + try { + while (rs.next()) { + // Get the data from the row using the column index + sb.add(new String[] { + rs.getString(1), + rs.getString(2), + rs.getString(3), + ((rs.getString(4) == null || rs.getString(4).equals("")) ? "" : "(" + + rs.getString(4) + ")"), rs.getString(5), rs.getString(6), + rs.getString(7), rs.getString(8), rs.getString(9) }); + } + } catch (SQLException e) { + return null; + } + String[][] array = new String[sb.size()][]; + sb.toArray(array); + return array; + } + public static void main(String[] args) throws MobyException { + String[][] datatypes = new JObjectsSqlImpl().getFullObjectsAsArray(); + for (int i = 0; i < datatypes.length; i++) { + String[] datatype = datatypes[i]; + for (int j = 0; j < datatype.length; j++) { + System.out.print(datatype[j] + " "); + } + System.out.println(); + } + } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.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/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/14 16:23:06 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JNamespacesSqlImpl.java 2006/03/15 16:22:37 1.4 @@ -43,24 +43,12 @@ // get certain properties from mobycentral.config Map map = MobyCentralConfig.getMobyNamespace(); // Create a connection to the database - String serverName = map.get("url") + ":" + map.get("port");// localhost:3306"; - // //TODO - // - - // make - // this - // a - // property - String mydatabase = (String) map.get("dbname");// "mobyobject"; + String serverName = map.get("url") + ":" + map.get("port"); + String mydatabase = (String) map.get("dbname"); String url = "jdbc:mysql://" + serverName + "/" + mydatabase; - String username = (String) map.get("username");// "moby_external"; - String password = (String) map.get("password");// ""; + String username = (String) map.get("username"); + String password = (String) map.get("password"); - /* - * String serverName = "mobycentral.icapture.ubc.ca:3306"; String - * mydatabase = "mobynamespace"; String url = "jdbc:mysql://" + - * serverName + "/" + mydatabase; String username = "moby_external"; - * String password = ""; - */ this.connection = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException e) { throw new MobyException( From kawas at pub.open-bio.org Wed Mar 15 16:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMc4Q032161@pub.open-bio.org> kawas Wed Mar 15 11:22:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: MobyAuthority.java LSIDAuthorityMetaData.java LSIDDataLookup.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.4,1.5 LSIDAuthorityMetaData.java,1.3,1.4 LSIDDataLookup.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/02/27 23:53:57 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/03/15 16:22:37 1.5 @@ -57,11 +57,9 @@ return new LSIDMetadataPort[] { new SOAPLocation("BioMOBYMetadataSOAPPort", "http://" + properties.getProperty("lsid_domain") + ":" - + properties.getProperty("lsid_port") - + "/authority/metadata"), - new HTTPLocation("BioMOBYMetadataHTTPPort", properties - .getProperty("lsid_domain"), Integer - .parseInt(properties.getProperty("lsid_port")), + + properties.getProperty("lsid_port") + "/authority/metadata"), + new HTTPLocation("BioMOBYMetadataHTTPPort", properties.getProperty("lsid_domain"), + Integer.parseInt(properties.getProperty("lsid_port")), "/authority/metadata") }; } @@ -77,12 +75,9 @@ return new LSIDDataPort[] { new SOAPLocation("BioMOBYDataSOAPPort", "http://" + properties.getProperty("lsid_domain") + ":" - + properties.getProperty("lsid_port") - + "/authority/data"), - new HTTPLocation("BioMOBYDataHTTPPort", properties - .getProperty("lsid_domain"), Integer - .parseInt(properties.getProperty("lsid_port")), - "/authority/data") }; + + properties.getProperty("lsid_port") + "/authority/data"), + new HTTPLocation("BioMOBYDataHTTPPort", properties.getProperty("lsid_domain"), + Integer.parseInt(properties.getProperty("lsid_port")), "/authority/data") }; } /* @@ -90,8 +85,7 @@ * * @see com.ibm.lsid.server.LSIDAuthorityService#getAvailableServices(com.ibm.lsid.server.LSIDRequestContext) */ - public ExpiringResponse getAvailableServices(LSIDRequestContext ctx) - throws LSIDServerException { + public ExpiringResponse getAvailableServices(LSIDRequestContext ctx) throws LSIDServerException { LSID lsid = ctx.getLsid(); String url = ctx.getReqUrl(); try { @@ -109,8 +103,7 @@ return new ExpiringResponse(wsdl.toString(), getExpiration()); } catch (LSIDException e) { throw new LSIDServerException(e, e.getErrorCode(), - "Simple Authority Error in getAvailableOperations(" + lsid - + "): "); + "Simple Authority Error in getAvailableOperations(" + lsid + "): "); } } @@ -119,19 +112,26 @@ * * @see com.ibm.lsid.server.LSIDService#initService(com.ibm.lsid.server.LSIDServiceConfig) */ - public void initService(LSIDServiceConfig config) - throws LSIDServerException { + public void initService(LSIDServiceConfig config) throws LSIDServerException { lookup = new LSIDDataLookup(); try { + Context c = new InitialContext(); - String LSID_SERVER = (String) c - .lookup("java:comp/env/LSID_SERVER"); - String LSID_PORT = (String) c.lookup("java:comp/env/LSID_PORT"); - if (LSID_SERVER != null && !LSID_SERVER.equals("")) { - properties.setProperty("lsid_domain", LSID_SERVER); + try { + String LSID_SERVER = (String) c.lookup("java:comp/env/LSID_SERVER"); + + if (LSID_SERVER != null && !LSID_SERVER.equals("")) { + properties.setProperty("lsid_domain", LSID_SERVER); + } + } catch (Exception ex) { } - if (LSID_PORT != null && !LSID_PORT.equals("")) { - properties.setProperty("lsid_port", LSID_PORT); + + try { + String LSID_PORT = (String) c.lookup("java:comp/env/LSID_PORT"); + if (LSID_PORT != null && !LSID_PORT.equals("")) { + properties.setProperty("lsid_port", LSID_PORT); + } + } catch (Exception ex) { } } catch (Exception e) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.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/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java 2005/08/31 23:57:34 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java 2006/03/15 16:22:37 1.4 @@ -1,10 +1,10 @@ - package org.biomoby.client.ui.graphical.servlet.lsid.authority; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.Date; -import org.biomoby.client.rdf.builder.RDFConfigure; +import org.biomoby.client.rdf.builder.ServiceInstanceRDF; import com.ibm.lsid.MetadataResponse; import com.ibm.lsid.server.LSIDMetadataService; @@ -29,112 +29,113 @@ * email me at edward.kawas at gmail.com */ public class LSIDAuthorityMetaData implements LSIDMetadataService { - private LSIDDataLookup lookup = null; - + private LSIDDataLookup lookup = null; + + public void initService(LSIDServiceConfig cf) throws LSIDServerException { + lookup = new LSIDDataLookup(); + } + + public MetadataResponse getMetadata(LSIDRequestContext req, String[] acceptedFormats) + throws LSIDServerException { + byte[] data = null; + int lsType; + try { + lsType = lookup.lsidType(req.getLsid()); + } catch (LSIDServerException ex) { + ex.printStackTrace(); + lsType = LSIDDataLookup.UNKNOWN; + } + if (lsType == LSIDDataLookup.UNKNOWN) + throw new LSIDServerException(201, "Error in getMetaData: Unknown LSID: " + + req.getLsid()); + + switch (lsType) { + case LSIDDataLookup.NAMESPACE_TYPE: { + /* type is namespace */ + try { + data = lookup.lsidLookup[1].retrieveObjectRDF(req.getLsid().toString()); + + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.OBJECT_CLASS: { + try { + /* type is object */ + data = lookup.lsidLookup[0].retrieveObjectRDF(req.getLsid().toString()); + + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.SERVICE_TYPE: { + /* type is service */ + try { + data = lookup.lsidLookup[2].retrieveObjectRDF(req.getLsid().toString()); + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.SERVICE_RELATION: + case LSIDDataLookup.OBJECT_RELATION: + /* type is relationship */ + { + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + } + break; + case LSIDDataLookup.SERVICE_INSTANCE: + /* type is serviceinstance */ + { + try { + data = lookup.lsidLookup[3].retrieveServiceInstanceRDF(req.getLsid().toString()); + } catch (IOException e) { + throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, + "Could not process RESOURCES."); + } + if (data == null) + throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE, + "No metadata is available"); + + } + break; + case LSIDDataLookup.MOBY_PREDICATE: + /* type is rdfpredicate */{ + // TODO - find the predicate that was requested. + } + break; + default: + throw new LSIDServerException(201, "1. Unknown LSID"); + } + return new MetadataResponse(new ByteArrayInputStream(data), new Date(), + MetadataResponse.RDF_FORMAT); + } + + private String makeFirstUpperCase(String name) { + if (name.length() <= 1) + return name.toUpperCase(); + char[] letters = name.toCharArray(); + letters[0] = Character.toUpperCase(letters[0]); + return new String(letters); + } - public void initService(LSIDServiceConfig cf) throws LSIDServerException { - lookup = new LSIDDataLookup(); - } - - - public MetadataResponse getMetadata(LSIDRequestContext req, - String[] acceptedFormats) throws LSIDServerException { - byte[] data = null; - int lsType; - try { - lsType = lookup.lsidType(req.getLsid()); - } catch (LSIDServerException ex) { - ex.printStackTrace(); - lsType = LSIDDataLookup.UNKNOWN; - } - if (lsType == LSIDDataLookup.UNKNOWN) - throw new LSIDServerException(201, "Error in getMetaData: Unknown LSID: " + req.getLsid()); - - switch (lsType) { - case LSIDDataLookup.NAMESPACE_TYPE: { - /* type is namespace */ - try { - data = lookup.lsidLookup[1].retrieveObjectRDF(RDFConfigure.URI_NAMESPACE+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.OBJECT_CLASS: { - try { - /* type is object */ - data = lookup.lsidLookup[0].retrieveObjectRDF(RDFConfigure.URI_OBJECT+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.SERVICE_TYPE: { - /* type is service */ - try { - data = lookup.lsidLookup[2].retrieveObjectRDF(RDFConfigure.URI_SERVICE+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.SERVICE_RELATION: - case LSIDDataLookup.OBJECT_RELATION: - /* type is relationship */ - { - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - } - break; - case LSIDDataLookup.SERVICE_INSTANCE: - /* type is serviceinstance */ - { - try { - data = lookup.lsidLookup[3].retrieveServiceInstanceRDF(RDFConfigure.URI_ServiceINSTANCE+req.getLsid().getObject()); - } catch (IOException e) { - throw new LSIDServerException(LSIDServerException.INTERNAL_PROCESSING_ERROR, "Could not process RESOURCES."); - } - if (data == null) - throw new LSIDServerException( - LSIDServerException.NO_METADATA_AVAILABLE, - "No metadata is available"); - - } - break; - case LSIDDataLookup.MOBY_PREDICATE: - /* type is rdfpredicate */{ - //TODO - find the predicate that was requested. - } - break; - default: - throw new LSIDServerException(201, "1. Unknown LSID"); - } - return new MetadataResponse(new ByteArrayInputStream(data), new Date(), MetadataResponse.RDF_FORMAT); - } - - private String makeFirstUpperCase(String name) { - if (name.length() <= 1) - return name.toUpperCase(); - char[] letters = name.toCharArray(); - letters[0] = Character.toUpperCase(letters[0]); - return new String(letters); - } - } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.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/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java 2006/02/27 23:51:43 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java 2006/03/15 16:22:37 1.6 @@ -16,6 +16,7 @@ */ package org.biomoby.client.ui.graphical.servlet.lsid.authority; + import java.io.IOException; import java.util.HashMap; import java.util.Properties; @@ -28,197 +29,218 @@ import com.ibm.lsid.server.LSIDServerException; public class LSIDDataLookup { - - public static final int UNKNOWN = -1; - public static final int NAMESPACE_TYPE = 0; + public static final int UNKNOWN = -1; - public static final int OBJECT_CLASS = 1; + public static final int NAMESPACE_TYPE = 0; - public static final int SERVICE_TYPE = 2; + public static final int OBJECT_CLASS = 1; - public static final int SERVICE_RELATION = 3; - - public static final int OBJECT_RELATION = 4; - - public static final int SERVICE_INSTANCE = 5; - - public static final int MOBY_PREDICATE = 6; - - private Properties mobycentral = MobyProperties.SERVICE_INSTANCE_PROPERTIES(); - private Properties mobyobject = MobyProperties.OBJECT_PROPERTIES(); - private Properties mobyservice = MobyProperties.SERVICE_PROPERTIES(); - private Properties mobynamespace = MobyProperties.NAMESPACE_PROPERTIES(); - private Properties mobyrelationship = MobyProperties.RELATIONSHIP_PROPERTIES(); - - /** - * 0 - object - * 1 - namespace - * 2 - service - * 3 - service instance - * - */ - public RDFConfigure lsidLookup[] = {null,null,null,null}; - - - public LSIDDataLookup() { - - } - - /** - * - * @param lsid an lsid to check whether we have 'data' on it or not - * @return true if getData has actual data under the namespace of the lsid. False otherwise. - */ - public boolean isValidDataType (LSID lsid) { - String ns = lsid.getNamespace(); - if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")) || ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) - return true; - return false; - } - - - public int dataLsidType(LSID lsid) { - String ns = lsid.getNamespace(); - String id = lsid.getObject(); - String ver = lsid.getRevision(); - /*if (ver != null || (ver != null && ver.length() != 0)) - return UNKNOWN;*/ - if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { - return LSIDDataLookup.OBJECT_CLASS; - } - if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { - return LSIDDataLookup.SERVICE_INSTANCE; - } - return UNKNOWN; - } - - public int lsidType(LSID lsid) throws LSIDServerException { - String ns = lsid.getNamespace(); - String id = lsid.getObject(); - String ver = lsid.getRevision(); - int result = UNKNOWN; - String authority = lsid.getAuthority().getAuthority(); - - /*if (ver != null || (ver != null && ver.length() != 0)) - return UNKNOWN;*/ - - if (ns.equalsIgnoreCase(mobynamespace.getProperty("lsid_namespace"))) { - //if (lsidLookup[1] == null) { - if (!authority.equals(mobynamespace.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[1] = new RDFConfigure(RDFConfigure.URI_NAMESPACE); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - //} - if (lsidLookup[1].objectExists(lsid.getObject())) - result = NAMESPACE_TYPE; - } - else if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { - //if (lsidLookup[0] == null) { - if (!authority.equals(mobyobject.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[0] = new RDFConfigure(RDFConfigure.URI_OBJECT); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - // } - if (lsidLookup[0].objectExists(lsid.getObject())) - result = OBJECT_CLASS; - } - else if (ns.equalsIgnoreCase(mobyservice.getProperty("lsid_namespace"))) { - // if (lsidLookup[2] == null) { - if (!authority.equals(mobyservice.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[2] = new RDFConfigure(RDFConfigure.URI_SERVICE); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - // } - if (lsidLookup[2].objectExists(lsid.getObject())) - result = SERVICE_TYPE; - } - else if (ns.equalsIgnoreCase("objectrelation")){ - - } - else if (ns.equalsIgnoreCase("servicerelation")) { - - } - else if (ns.equalsIgnoreCase("rdfpredicates")) { - if (isValidPredicate(id)) { - return MOBY_PREDICATE; - } - return UNKNOWN; - - } - else if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { - String str = lsid.getObject(); - // make sure that the service instance is in the form - // domain,serviceInstanceName - // if (lsidLookup[3] == null) { - if (!authority.equals(mobycentral.getProperty("lsid_authority"))) { - throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); - } - try { - lsidLookup[3] = new RDFConfigure(RDFConfigure.URI_ServiceINSTANCE); - } catch (IOException e) { - throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); - } - // } - String[] parsed = str.split(","); - if (parsed.length != 2) - throw new LSIDServerException(LSIDServerException.UNKNOWN_LSID, "Unknown Service Instance LSID. Form should be urn:lsid:biomoby.org:serviceinstance:authorsURI,serviceInstanceName"); - if (ServiceInstanceRDF.serviceInstanceExists(parsed[0],parsed[1])) - result = SERVICE_INSTANCE; - } - else - return UNKNOWN; - - return result; - } - - - /* - * a hash of known predicates. - */ - private final HashMap known_predicates = new HashMap(); - - /* - * method to init the hash of known predicates. - * TODO - add new rdfpredicates here! - */ - private void initHash() { - // add the objects that are valid for the namespace rdfpredicates - known_predicates.put("mobyOntology", "A phrase representing one of the bioMoby ontologies."); - known_predicates.put("mobyontology", "A phrase representing one of the bioMoby ontologies."); - } - /** - * - * PRE:the key is in the known_predicates

- * POST:the value that is mapped to the specific key is returned

- * @param key - a valid key contained in known_predicates. - * @return - the value that is mapped to the the key. - */ - public String getKnownValue(String key) { - return (String) known_predicates.get(key); - } - - /** - * - * PRE:None.

- * POST:If pred is a valid predicate, true is returned, otherwise false is returned

- * @param pred - the predicate to check for - * @return true if pred is a valid predicate, false otherwise. - */ - public boolean isValidPredicate(String pred) { - return known_predicates.containsKey(pred); - } -} + public static final int SERVICE_TYPE = 2; + public static final int SERVICE_RELATION = 3; + + public static final int OBJECT_RELATION = 4; + + public static final int SERVICE_INSTANCE = 5; + + public static final int MOBY_PREDICATE = 6; + + private Properties mobycentral = MobyProperties.SERVICE_INSTANCE_PROPERTIES(); + + private Properties mobyobject = MobyProperties.OBJECT_PROPERTIES(); + + private Properties mobyservice = MobyProperties.SERVICE_PROPERTIES(); + + private Properties mobynamespace = MobyProperties.NAMESPACE_PROPERTIES(); + + private Properties mobyrelationship = MobyProperties.RELATIONSHIP_PROPERTIES(); + + /** + * 0 - object 1 - namespace 2 - service 3 - service instance + * + */ + public RDFConfigure lsidLookup[] = { null, null, null, null }; + + public LSIDDataLookup() { + + } + + /** + * + * @param lsid + * an lsid to check whether we have 'data' on it or not + * @return true if getData has actual data under the namespace of the lsid. + * False otherwise. + */ + public boolean isValidDataType(LSID lsid) { + String ns = lsid.getNamespace(); + if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")) + || ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) + return true; + return false; + } + + public int dataLsidType(LSID lsid) { + String ns = lsid.getNamespace(); + String id = lsid.getObject(); + String ver = lsid.getRevision(); + /* + * if (ver != null || (ver != null && ver.length() != 0)) return + * UNKNOWN; + */ + if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { + return LSIDDataLookup.OBJECT_CLASS; + } + if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { + return LSIDDataLookup.SERVICE_INSTANCE; + } + return UNKNOWN; + } + + public int lsidType(LSID lsid) throws LSIDServerException { + String ns = lsid.getNamespace(); + String id = lsid.getObject(); + String ver = lsid.getRevision(); + int result = UNKNOWN; + String authority = lsid.getAuthority().getAuthority(); + + /* + * if (ver != null || (ver != null && ver.length() != 0)) return + * UNKNOWN; + */ + + if (ns.equalsIgnoreCase(mobynamespace.getProperty("lsid_namespace"))) { + // if (lsidLookup[1] == null) { + if (!authority.equals(mobynamespace.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[1] = new RDFConfigure(RDFConfigure.URI_NAMESPACE); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + if (lsidLookup[1].objectExists(lsid.toString())) + result = NAMESPACE_TYPE; + else if (lsidLookup[1].objectExisted(lsid.getObject())) + result = NAMESPACE_TYPE; + } else if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) { + // if (lsidLookup[0] == null) { + if (!authority.equals(mobyobject.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[0] = new RDFConfigure(RDFConfigure.URI_OBJECT); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + if (lsidLookup[0].objectExists(lsid.toString())) + result = OBJECT_CLASS; + else if (lsidLookup[0].objectExisted(lsid.getObject())) + result = OBJECT_CLASS; + } else if (ns.equalsIgnoreCase(mobyservice.getProperty("lsid_namespace"))) { + // if (lsidLookup[2] == null) { + if (!authority.equals(mobyservice.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[2] = new RDFConfigure(RDFConfigure.URI_SERVICE); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + if (lsidLookup[2].objectExists(lsid.toString())) + result = SERVICE_TYPE; + else if (lsidLookup[2].objectExists(lsid.getObject())) + result = SERVICE_TYPE; + } else if (ns.equalsIgnoreCase("objectrelation")) { + + } else if (ns.equalsIgnoreCase("servicerelation")) { + + } else if (ns.equalsIgnoreCase("rdfpredicates")) { + if (isValidPredicate(id)) { + return MOBY_PREDICATE; + } + return UNKNOWN; + + } else if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) { + String str = lsid.getObject(); + // make sure that the service instance is in the form + // domain,serviceInstanceName + // if (lsidLookup[3] == null) { + if (!authority.equals(mobycentral.getProperty("lsid_authority"))) { + throw new LSIDServerException("Error in lsidType - Unknown LSID: " + lsid.getLsid()); + } + try { + lsidLookup[3] = new RDFConfigure(RDFConfigure.URI_ServiceINSTANCE); + } catch (IOException e) { + throw new LSIDServerException(500, "Server cannot find RESOURCE RDF"); + } + // } + + String[] parsed = str.split(","); + if (parsed.length != 2) + throw new LSIDServerException( + LSIDServerException.UNKNOWN_LSID, + "Unknown Service Instance LSID. Form should be urn:lsid:biomoby.org:serviceinstance:authorsURI,serviceInstanceName:version"); + if (ServiceInstanceRDF.serviceInstanceExists(parsed[0], parsed[1], lsid.toString())) + result = SERVICE_INSTANCE; + else if (ServiceInstanceRDF.serviceInstanceExists(parsed[0], parsed[1])) + result = SERVICE_INSTANCE; + + } else + return UNKNOWN; + + return result; + } + + /* + * a hash of known predicates. + */ + private final HashMap known_predicates = new HashMap(); + + /* + * method to init the hash of known predicates. TODO - add new rdfpredicates + * here! + */ + private void initHash() { + // add the objects that are valid for the namespace rdfpredicates + known_predicates + .put("mobyOntology", "A phrase representing one of the bioMoby ontologies."); + known_predicates + .put("mobyontology", "A phrase representing one of the bioMoby ontologies."); + } + + /** + * + * PRE:the key is in the known_predicates + *

+ * POST:the value that is mapped to the specific key is returned + *

+ * + * @param key - + * a valid key contained in known_predicates. + * @return - the value that is mapped to the the key. + */ + public String getKnownValue(String key) { + return (String) known_predicates.get(key); + } + + /** + * + * PRE:None. + *

+ * POST:If pred is a valid predicate, true is returned, otherwise + * false is returned + *

+ * + * @param pred - + * the predicate to check for + * @return true if pred is a valid predicate, false otherwise. + */ + public boolean isValidPredicate(String pred) { + return known_predicates.containsKey(pred); + } +} From gss at pub.open-bio.org Wed Mar 15 17:41:55 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Wed, 15 Mar 2006 12:41:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151741.k2FHftrE032614@pub.open-bio.org> gss Wed Mar 15 12:41:55 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv32589/src/org/semanticmoby/ref/tools Modified Files: URIInvestigator.java Log Message: Removed constructor and made investigate(url) static synchronized s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools URIInvestigator.java,1.17,1.18 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/15 00:43:38 1.17 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2006/03/15 17:41:55 1.18 @@ -20,20 +20,6 @@ public class URIInvestigator { /** - * The URL that is to be investigated for possible inclusion in the - * metadata repository. - */ - private String resourceURL; - - /** - * Create an instance for investingating the given resource URL - * @param resourceURL the URL to investigate - */ - public URIInvestigator(String resourceURL) { - this.resourceURL = resourceURL; - } - - /** * Synchronize the resource URL's MOBY graph (if there is one) with the * graph stored in the metadata repository (if there is one). This involves * doing an HTTP GET on the resource URL; if there is already a graph stored @@ -44,7 +30,7 @@ * modified), then there is nothing to do; if the request returns a 404 * (resource not found), then remove the graph from the database. */ - public void investigate() { + public static synchronized void investigate(String resourceURL) { // The storage manager is used to access the metadata repository StorageManager manager = new StorageManager(); @@ -156,7 +142,7 @@ if (Log.DEBUG) Log.debug("deregistering resource " + resourceURL); // De-register the resource, printing a removal message if // a resource couldn't be parsed - deregisterResource(manager, resource == null); + deregisterResource(resourceURL, manager, resource == null); if (Log.ERROR) Log.error("Couldn't parse a resource from graph at " + resourceURL); } @@ -201,7 +187,7 @@ if (alreadyRegistered) { - deregisterResource(manager, true); + deregisterResource(resourceURL, manager, true); if(Log.INFO) Log.info("ALREADY REGISTERED : " + resourceURL); } else { @@ -238,7 +224,9 @@ * @param removing if the removing flag is set, a message is written to the * log stating that the resource has been removed */ - private void deregisterResource(StorageManager manager, boolean removing) { + private static void deregisterResource( String resourceURL, + StorageManager manager, + boolean removing ) { try { manager.deregisterResource(resourceURL); if (removing) { From gss at pub.open-bio.org Wed Mar 15 17:42:16 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Wed, 15 Mar 2006 12:42:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151742.k2FHgG7O032656@pub.open-bio.org> gss Wed Mar 15 12:42:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv32627/src/org/semanticmoby/ref/servlets Modified Files: ResourceInvestigationServlet.java PostResourcesServlet.java Log Message: Changed to adapt to URIInvestigator changes s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets ResourceInvestigationServlet.java,1.10,1.11 PostResourcesServlet.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/15 00:52:17 1.10 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/ResourceInvestigationServlet.java 2006/03/15 17:42:16 1.11 @@ -53,8 +53,7 @@ e2.printStackTrace(); } } else { - URIInvestigator investigator = new URIInvestigator(resourceURL); - investigator.investigate(); + URIInvestigator.investigate(resourceURL); dataBean.setUrl(resourceURL); =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/15 00:51:11 1.4 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/PostResourcesServlet.java 2006/03/15 17:42:16 1.5 @@ -40,9 +40,7 @@ if (resourceURL != null) { if (!resourceURL.equals("")) { - URIInvestigator investigator = - new URIInvestigator(resourceURL); - investigator.investigate(); + URIInvestigator.investigate(resourceURL); count++; } } From kawas at pub.open-bio.org Wed Mar 15 17:56:26 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 12:56:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151756.k2FHuQEE032758@pub.open-bio.org> kawas Wed Mar 15 12:56:26 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv32733/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: fixed a crucial bug. For some strange reason a whole block of code was removed in the commit from 1.6 to 1.7. Added it back. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.13,1.14 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/02 17:59:33 1.13 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/15 17:56:26 1.14 @@ -111,13 +111,15 @@ // non null signature url SignatureURLConnection connection = new SignatureURLConnection(); MobyService[] rdfServices = null; - + // only process signature urls once if (signatureURLsProcessed.containsKey(signatureURL)) continue; else signatureURLsProcessed.put(signatureURL, ""); + rdfServices = connection.extractServicesFromURL(signatureURL); + if (rdfServices == null) { // add the url to the bad list so that the hitlist // doesnt grow by the number of services at the service From kawas at pub.open-bio.org Wed Mar 15 17:57:07 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 12:57:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151757.k2FHv7q2000344@pub.open-bio.org> kawas Wed Mar 15 12:57:07 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv319/org/biomoby/registry/rdfagent/verifier Modified Files: MobyServiceComparator.java Log Message: add comparing or lsid for the services moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier MobyServiceComparator.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java 2006/02/20 05:51:10 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java 2006/03/15 17:57:07 1.3 @@ -123,6 +123,14 @@ + service2.getDescription() + "."); isDifferent = true; } + + // compare lsids + if (!service1.getLSID().equals(service2.getLSID())) { + addDifference("Service1 has LSID " + + service1.getLSID() + " which is different from " + + service2.getLSID() + "."); + isDifferent = true; + } // compare email if (!service1.getEmailContact().equals(service2.getEmailContact())) { From kawas at pub.open-bio.org Wed Mar 15 21:18:41 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 16:18:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603152118.k2FLIfTH000899@pub.open-bio.org> kawas Wed Mar 15 16:18:41 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv874/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java Log Message: moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.13,1.14 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/03/15 16:22:38 1.13 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/03/15 21:18:41 1.14 @@ -185,6 +185,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -249,6 +250,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -675,6 +677,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -717,6 +720,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); @@ -763,6 +767,7 @@ if (!map.isEmpty()) { registryURL = (String) map.get("MOBY_SERVER"); registryNamespace = (String) map.get("MOBY_URI"); + System.out.println("Using URL: " + registryURL + " URI: " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralImpl(); From kawas at pub.open-bio.org Wed Mar 15 21:33:02 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 16:33:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603152133.k2FLX2m9001007@pub.open-bio.org> kawas Wed Mar 15 16:33:02 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory pub.open-bio.org:/tmp/cvs-serv982/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: MobyAuthority.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.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/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/03/15 16:22:37 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/03/15 21:33:02 1.6 @@ -124,6 +124,7 @@ properties.setProperty("lsid_domain", LSID_SERVER); } } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); } try { @@ -132,9 +133,39 @@ properties.setProperty("lsid_port", LSID_PORT); } } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); } + try { + String CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); + if (CONFIG != null && !CONFIG.equals("")) { + System.setProperty("MOBY_CENTRAL_CONFIG", CONFIG); + properties.setProperty("MOBY_CENTRAL_CONFIG", CONFIG); + } + } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); + } + try { + String CONFIG = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (CONFIG != null && !CONFIG.equals("")) { + properties.setProperty("MOBY_SERVER", CONFIG); + System.setProperty("MOBY_SERVER", CONFIG); + } + } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); + } + try { + String CONFIG = (String) c.lookup("java:comp/env/MOBY_URI"); + if (CONFIG != null && !CONFIG.equals("")) { + System.setProperty("MOBY_URI", CONFIG); + properties.setProperty("MOBY_URI", CONFIG); + } + } catch (Exception ex) { + System.err.println(ex.getLocalizedMessage()); + } + } catch (Exception e) { + System.err.println(e.getLocalizedMessage()); } } } \ No newline at end of file From lxm at pub.open-bio.org Thu Mar 16 03:37:53 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Wed, 15 Mar 2006 22:37:53 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603160337.k2G3brBb001815@pub.open-bio.org> lxm Wed Mar 15 22:37:53 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies In directory pub.open-bio.org:/tmp/cvs-serv1748 Modified Files: flybase-genequery gramene-query lin ncbi-megablast pubmed sgd-quicksearch tair-mapviewer tair-seqviewer wormbase-query Removed Files: flybase-genequery.n3 gramene-query.n3 ncbi-megablast.n3 pubmed.n3 sgd-quicksearch.n3 tair-mapviewer.n3 tair-seqviewer.n3 wormbase-query.n3 Log Message: made several changes to the formatting of the rdf files for the proxy resources, changed to use the rdf shortcut format, changed to use the xml entity definitions for attribute expansion, changed to use the moby entity as the default xml namespace, these changes should make future maintenance of these files much easier, things (uris) will only need to be changed in one place in the files also, removed the n3 versions of the files as these versions have not been maintained recently and are a few versions behind the rdf files s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies flybase-genequery,1.10,1.11 gramene-query,1.9,1.10 lin,1.4,1.5 ncbi-megablast,1.7,1.8 pubmed,1.8,1.9 sgd-quicksearch,1.9,1.10 tair-mapviewer,1.7,1.8 tair-seqviewer,1.8,1.9 wormbase-query,1.7,1.8 flybase-genequery.n3,1.8,NONE gramene-query.n3,1.7,NONE ncbi-megablast.n3,1.7,NONE pubmed.n3,1.7,NONE sgd-quicksearch.n3,1.8,NONE tair-mapviewer.n3,1.7,NONE tair-seqviewer.n3,1.8,NONE wormbase-query.n3,1.7,NONE =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/flybase-genequery,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/flybase-genequery 2006/02/09 22:37:02 1.10 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/flybase-genequery 2006/03/16 03:37:53 1.11 @@ -1,29 +1,41 @@ - - - - FlyBase Gene Query - Flybase - http://flybase.bio.indiana.edu - FlyBase gene query form at flybase.bio.indiana.edu - http://flybase.bio.indiana.edu/genes/fbgquery.hform - http://www.semanticmoby.org/examples/proxies/flybase-genequery-metadata.txt - - - - - - - - - - - - - + + + + + + + + +]> + + + + + FlyBase Gene Query + http://flybase.bio.indiana.edu/.data/docs/refman/refman-C.html#C3 + Flybase + http://flybase.bio.indiana.edu + FlyBase gene query form at flybase.bio.indiana.edu + http://flybase.bio.indiana.edu/genes/fbgquery.hform + http://www.semanticmoby.org/examples/proxies/flybase-genequery-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/gramene-query,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/gramene-query 2006/02/09 22:37:02 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/gramene-query 2006/03/16 03:37:53 1.10 @@ -1,29 +1,41 @@ - - - - Gramene Query - Gramene - http://www.gramene.org - Cereal grains database query at gramene.org - http://www.gramene.org/ - http://www.semanticmoby.org/examples/proxies/gramene-query-metadata.txt - - - - - - - - - - - - - + + + + + + + + +]> + + + + + Gramene Query + http://www.gramene.org/about/index.html + Gramene + http://www.gramene.org + Cereal grains database query at gramene.org + http://www.gramene.org/ + http://www.semanticmoby.org/examples/proxies/gramene-query-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/02/09 22:37:02 1.4 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/03/16 03:37:53 1.5 @@ -5,40 +5,37 @@ - + ]> + xmlns:proxy = "&proxy;" + xmlns = "&moby;"> + + + Legume Information Network + http://lin.ncgr.org/help/index.html + The Legume Information System + http://www.comparative-legumes.org + A Proxy to the Legume Information Network + http://lin.ncgr.org + http://www.semanticmoby.org/examples/proxies/lin-metadata.txt + + + + + + + + + + - - - Legume Information Network - The Legume Information System - http://www.comparative-legumes.org - A Proxy to the Legume Information Network - http://lin.ncgr.org - http://www.semanticmoby.org/examples/proxies/lin-metadata.txt - - - - - - - - - - - - - - - - + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/ncbi-megablast,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/ncbi-megablast 2005/12/13 23:10:24 1.7 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/ncbi-megablast 2006/03/16 03:37:53 1.8 @@ -1,29 +1,41 @@ - - - - - - - - - - - - - - - NCBI Mega BLAST - NCBI - http://www.ncbi.nlm.nih.gov - NCBI MegaBlast resource provided by NCBI - http://www.ncbi.nlm.nih.gov/BLAST/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORMAT=Semiauto&ALIGNMENTS=50&ALIGNMENT_VIEW=Tabular&CLIENT=web&DATABASE=nr&DESCRIPTIONS=100&ENTREZ_QUERY=%28none%29&EXPECT=10&FILTER=L&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&NCBI_GI=on&PAGE=MegaBlast&SERVICE=plain&SET_DEFAULTS.x=34&SET_DEFAULTS.y=8&SHOW_OVERVIEW=on&END_OF_HTTPGET=Yes&SHOW_LINKOUT=yes&GET_SEQUENCE=yes&PERC_IDENT=None,1,-2 - http://www.semanticmoby.org/examples/proxies/ncbi-megablast-metadata.txt - - + + + + + + + + +]> + + + + + NCBI Mega BLAST + http://www.ncbi.nlm.nih.gov/blast/megablast.shtml + NCBI + http://www.ncbi.nlm.nih.gov + NCBI MegaBlast resource provided by NCBI + http://www.ncbi.nlm.nih.gov/BLAST/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORMAT=Semiauto&ALIGNMENTS=50&ALIGNMENT_VIEW=Tabular&CLIENT=web&DATABASE=nr&DESCRIPTIONS=100&ENTREZ_QUERY=%28none%29&EXPECT=10&FILTER=L&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&NCBI_GI=on&PAGE=MegaBlast&SERVICE=plain&SET_DEFAULTS.x=34&SET_DEFAULTS.y=8&SHOW_OVERVIEW=on&END_OF_HTTPGET=Yes&SHOW_LINKOUT=yes&GET_SEQUENCE=yes&PERC_IDENT=None,1,-2 + http://www.semanticmoby.org/examples/proxies/ncbi-megablast-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/pubmed,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/pubmed 2006/02/09 22:37:02 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/pubmed 2006/03/16 03:37:53 1.9 @@ -1,29 +1,41 @@ - - - - - - - - PubMed - NCBI - http://www.ncbi.nlm.nih.gov - Entrez PubMed resource provided by NCBI - http://www.ncbi.nlm.nih.gov/entrez/query.fcgi? - http://www.semanticmoby.org/examples/proxies/pubmed-metadata.txt - - - - - - - - - + + + + + + + + +]> + + + + + PubMed + http://www.ncbi.nlm.nih.gov/entrez/query/static/overview.html + NCBI + http://www.ncbi.nlm.nih.gov + Entrez PubMed resource provided by NCBI + http://www.ncbi.nlm.nih.gov/entrez/query.fcgi? + http://www.semanticmoby.org/examples/proxies/pubmed-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/sgd-quicksearch,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/sgd-quicksearch 2005/12/14 18:07:11 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/sgd-quicksearch 2006/03/16 03:37:53 1.10 @@ -1,29 +1,41 @@ - - - - - - - - SGD Quick Search - SGD - http://www.yeastgenome.org - Saccharomyces cerevisiae quick search - http://db.yeastgenome.org/cgi-bin/search/quickSearch - http://www.semanticmoby.org/examples/proxies/sgd-quicksearch-metadata.txt - - - - - - - - - + + + + + + + + +]> + + + + + SGD Quick Search + http://www.yeastgenome.org/SearchContents.shtml + SGD + http://www.yeastgenome.org + Saccharomyces cerevisiae quick search + http://db.yeastgenome.org/cgi-bin/search/quickSearch + http://www.semanticmoby.org/examples/proxies/sgd-quicksearch-metadata.txt + + + + + + + + + + + + + + \ No newline at end of file =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2005/12/13 23:10:24 1.7 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2006/03/16 03:37:53 1.8 @@ -1,29 +1,41 @@ - - - - TAIR Map Viewer - TAIR - http://www.arabidopsis.org - Arabidopsis Map Viewer resource provided by TAIR - http://www.arabidopsis.org/servlets/mapper - http://www.semanticmoby.org/examples/proxies/tair-mapviewer-metadata.txt - - - - - - - - - - - - - + + + + + + + + +]> + + + + + TAIR Map Viewer + http://www.arabidopsis.org/mapViewer/help/tairmapa.jsp + TAIR + http://www.arabidopsis.org + Arabidopsis Map Viewer resource provided by TAIR + http://www.arabidopsis.org/servlets/mapper + http://www.semanticmoby.org/examples/proxies/tair-mapviewer-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-seqviewer,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-seqviewer 2005/12/13 23:10:24 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-seqviewer 2006/03/16 03:37:53 1.9 @@ -1,29 +1,41 @@ - - - - - - - - - - - - TAIR Sequence Viewer - TAIR - http://www.arabidopsis.org - Arabidopsis Sequence Viewer resource provided by TAIR - http://www.arabidopsis.org/servlets/sv - http://www.semanticmoby.org/examples/proxies/tair-seqviewer-metadata.txt - - - - - + + + + + + + + +]> + + + + + TAIR Sequence Viewer + http://www.arabidopsis.org/seqViewer/help/sv_intro.jsp + TAIR + http://www.arabidopsis.org + Arabidopsis Sequence Viewer resource provided by TAIR + http://www.arabidopsis.org/servlets/sv + http://www.semanticmoby.org/examples/proxies/tair-seqviewer-metadata.txt + + + + + + + + + + + + + + =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/wormbase-query,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/wormbase-query 2005/12/13 23:10:24 1.7 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/wormbase-query 2006/03/16 03:37:53 1.8 @@ -1,29 +1,41 @@ - - - - - - - - - - - WormBase Query - WormBase - http://www.wormbase.org - C. elegans database query at wormbase.org - http://www.wormbase.org/ - http://www.semanticmoby.org/examples/proxies/wormbase-query-metadata.txt - - - - - - + + + + + + + + +]> + + + + + WormBase Query + http://www.wormbase.org/db/searches/basic + WormBase + http://www.wormbase.org + C. elegans database query at wormbase.org + http://www.wormbase.org/ + http://www.semanticmoby.org/examples/proxies/wormbase-query-metadata.txt + + + + + + + + + + + + + + rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/flybase-genequery.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/gramene-query.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/ncbi-megablast.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/pubmed.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/sgd-quicksearch.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/tair-mapviewer.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/tair-seqviewer.n3,v: No such file or directory rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/RCS/wormbase-query.n3,v: No such file or directory From lxm at pub.open-bio.org Thu Mar 16 04:07:12 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Wed, 15 Mar 2006 23:07:12 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603160407.k2G47CfB001925@pub.open-bio.org> lxm Wed Mar 15 23:07:12 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css In directory pub.open-bio.org:/tmp/cvs-serv1881/css Modified Files: smoby.css Log Message: simple bug fixes, bugs 3310 3313 3314 3315 s-moby/ref-impl/semanticmoby.org/WebRoot/css smoby.css,1.5,1.6 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css/smoby.css,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css/smoby.css 2006/02/16 18:44:19 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/css/smoby.css 2006/03/16 04:07:11 1.6 @@ -1,5 +1,5 @@ -BODY {background: url(/images/pinstripe.gif); font: sans-serif; color: #0033cc;} +BODY {background: url(/images/pinstripe.gif); font-family: sans-serif; color: #0033cc;} FONT.build {color: #dddddd;} From lxm at pub.open-bio.org Thu Mar 16 04:07:12 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Wed, 15 Mar 2006 23:07:12 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603160407.k2G47CiT001906@pub.open-bio.org> lxm Wed Mar 15 23:07:11 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv1881 Modified Files: about.jsp Log Message: simple bug fixes, bugs 3310 3313 3314 3315 s-moby/ref-impl/semanticmoby.org/WebRoot about.jsp,1.5,1.6 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/about.jsp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/about.jsp 2005/11/17 02:53:02 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/about.jsp 2006/03/16 04:07:11 1.6 @@ -21,7 +21,7 @@ - DrgaonDB - The Antirrhinum majus (Snapdragon) Database + DragonDB - The Antirrhinum majus (Snapdragon) Database @@ -97,6 +97,16 @@ + +Please visit us at the + + VPIN Project Website + + +
+
+
+ <%@ include file="/footer.jsp" %> From kawas at pub.open-bio.org Thu Mar 16 15:20:44 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 16 Mar 2006 10:20:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603161520.k2GFKiWU004046@pub.open-bio.org> kawas Thu Mar 16 10:20:44 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared In directory pub.open-bio.org:/tmp/cvs-serv4016/org/biomoby/client/ui/graphical/applets/shared Modified Files: Construct.java MobyTree.java Log Message: abilitiy to use the new rdf or not (i.e. backwards compatible). moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared Construct.java,1.3,1.4 MobyTree.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/Construct.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/ui/graphical/applets/shared/Construct.java 2005/09/30 14:44:58 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/Construct.java 2006/03/16 15:20:44 1.4 @@ -1,5 +1,7 @@ package org.biomoby.client.ui.graphical.applets.shared; +import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; @@ -10,6 +12,7 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.StmtIterator; +import com.ibm.lsid.LSID; /* * @@ -64,10 +67,11 @@ // create an empty model Model model = new ModelMem(); - InputStream in = new URL(url).openStream(); - + InputStream ins = new URL(url).openStream(); + BufferedInputStream in = new BufferedInputStream(ins); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); // read the RDF/XML data - model.read(new InputStreamReader(in), ""); + model.read(reader, ""); StmtIterator iter; Statement stmt; @@ -145,10 +149,24 @@ String sub = stmt.getSubject().getURI(); String obj = stmt.getObject().toString(); - if (sub != null) - sub = sub.substring(sub.indexOf("#") + 1, sub.length()); - if (obj!= null) - obj = obj.substring(obj.indexOf("#") + 1, obj.length()); + if (sub != null) { + if (sub.indexOf("#") > 0) + sub = sub.substring(sub.indexOf("#") + 1, sub.length()); + try { + LSID lsid = new LSID(sub); + sub = lsid.getObject(); + } catch (Exception e) { + } + } + if (obj!= null) { + if (obj.indexOf("#") > 0) + obj = obj.substring(obj.indexOf("#") + 1, obj.length()); + try { + LSID lsid = new LSID(obj); + obj = lsid.getObject(); + } catch (Exception e) { + } + } if (stmt.getPredicate().getURI().indexOf(property) > 0) { //System.out.println(obj); @@ -184,4 +202,9 @@ return homes; } + + public static void main(String[] args) { + Construct c = new Construct("http://biomoby.org/RESOURCES/MOBY-S/Objects"); + System.out.println(c.createHomes("subClassOf")); + } } \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/MobyTree.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/MobyTree.java 2005/10/12 17:57:54 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/shared/MobyTree.java 2006/03/16 15:20:44 1.5 @@ -15,6 +15,8 @@ import javax.swing.JTree; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; @@ -48,7 +50,9 @@ private HashMap hashmap; // will contain the nodes private String rdf = ""; String name = ""; + private boolean done = false; private static final boolean DEBUG = false; + private String last = ""; /** * A moby tree is constructed with the root node labeled as 'name'

* and the material for the tree taken from the RDF located at @@ -77,7 +81,7 @@ * the url rdf. The tree is created by looking for the property property

* @param canEdit - if true then nodes in tree can be edited, otherwise they cannot. * @param rdf - the url of the RDF describing Moby Objects, Services, Service Types, and Namespaces - * @param name - the name of the root node in the tree. + * @param name - the name of the root node in the tree, which is present in the rdf document. * @param property - the property to parse the rdf document and base a tree on */ public MobyTree(boolean canEdit, String rdf, String name, String property) { @@ -106,7 +110,21 @@ tree.setEditable(canEdit); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); - + tree.addTreeSelectionListener(new TreeSelectionListener() { + public void valueChanged(TreeSelectionEvent evt) { + // Get all nodes whose selection status has changed + TreePath[] paths = evt.getPaths(); + // Iterate through all affected nodes + for (int i = 0; i < paths.length; i++) { + if (evt.isAddedPath(i)) { + last = (String)paths[i] + .getLastPathComponent().toString(); + } else { + //TODO necessary? + } + } + } + }); } /* @@ -317,11 +335,12 @@ public void makeObjectTree(String name) { // create nodes with Object root and its children Household h = (Household) hashmap.get(name); - + // TODO catch null pointers here if (DEBUG) System.out.println(h.toString()); fillSubTree(null, h.getChildren(), this); + done = true; } /** @@ -344,9 +363,11 @@ } public void reload(String name) { + done = false; hashmap = new Construct(rdf).createHomes(); makeObjectTree(name); this.refreshTree(name); + done = true; } public void collapseMobyTree() { @@ -354,10 +375,19 @@ tree.collapseRow(0); } + public boolean done(){ + return done; + } + + + public String getLastSelected(){ + return last; + } + public static void main(String[] args) { JFrame frame = new JFrame(); - MobyTree tree = new MobyTree(false, "http://localhost:8080/RESOURCES/MOBY-S/Objects", "Object"); - tree.makeObjectTree("Object"); + MobyTree tree = new MobyTree(false, "http://biomoby.org/RESOURCES/MOBY-S/Objects", "DNASequence", "subClassOf"); + tree.makeObjectTree("DNASequence"); tree.setPreferredSize(new Dimension(400, 400)); // Add button to the frame frame.getContentPane().add(tree, BorderLayout.CENTER); From kawas at pub.open-bio.org Thu Mar 16 18:11:23 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 16 Mar 2006 13:11:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603161811.k2GIBN7w007265@pub.open-bio.org> kawas Thu Mar 16 13:11:23 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv7240/org/biomoby/client/rdf/builder Modified Files: RDFConfigure.java Log Message: replaced predicate RDFS:isDefinedBy to something more appropriate moby-live/Java/src/main/org/biomoby/client/rdf/builder RDFConfigure.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/15 16:22:38 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/16 18:11:23 1.10 @@ -21,6 +21,7 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.NodeIterator; +import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFReader; import com.hp.hpl.jena.rdf.model.RDFWriter; @@ -189,7 +190,11 @@ } else { Model model = ModelFactory.createDefaultModel(); Resource resource = model.createResource(myObject); - model.add(model.createStatement(resource, RDFS.isDefinedBy, model + Map map = model.getNsPrefixMap(); + map.put("lsid","http://lsid.omg.org/predicates#"); + model.setNsPrefixes(map); + Property prop = model.createProperty("http://lsid.omg.org/predicates#latest"); + model.add(model.createStatement(resource, prop, model .createLiteral(latest))); model.add(model.createStatement(resource, RDFS.comment, model .createLiteral("The Namespace/Datatype/ServiceType described by the LSID: " + myObject @@ -354,7 +359,11 @@ // return rdf that points to latest Model model = ModelFactory.createDefaultModel(); Resource resource = model.createResource(lsid); - model.add(model.createStatement(resource, RDFS.isDefinedBy, model + Property prop = model.createProperty("http://lsid.omg.org/predicates#latest"); + Map map = model.getNsPrefixMap(); + map.put("lsid","http://lsid.omg.org/predicates#"); + model.setNsPrefixes(map); + model.add(model.createStatement(resource, prop, model .createLiteral(ServiceInstanceRDF.getLatestLSID(details[0], details[1], lsid)))); model.add(model.createStatement(resource, RDFS.comment, model From gss at pub.open-bio.org Thu Mar 16 21:48:23 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:48:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162148.k2GLmNdD008118@pub.open-bio.org> gss Thu Mar 16 16:48:22 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet In directory pub.open-bio.org:/tmp/cvs-serv8093/src/org/semanticmoby/servlet Modified Files: AbstractMobyServlet.java Log Message: Removed a printStackTrace call s-moby/ref-impl/core/src/org/semanticmoby/servlet AbstractMobyServlet.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java 2006/01/11 10:24:39 1.11 +++ /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/servlet/AbstractMobyServlet.java 2006/03/16 21:48:22 1.12 @@ -72,7 +72,8 @@ /** * A utility method for getting a buffered reader (as returned by * the abstract getDescriptionGraphReader() method) for reading - * from a file. + * from a file. If the reader cannot be instantiated (as is the case + * when the file doesn't exist), then return null. */ protected BufferedReader getFileReader(String fileName) { @@ -81,7 +82,6 @@ new InputStreamReader( getServletContext().getResourceAsStream(fileName))); } catch (Throwable t) { - t.printStackTrace(); return null; } } From gss at pub.open-bio.org Thu Mar 16 21:51:43 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLph1R008305@pub.open-bio.org> gss Thu Mar 16 16:51:43 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis In directory pub.open-bio.org:/tmp/cvs-serv8229/WebRoot/examples/lis Modified Files: GOAnnotatedAccessionForVPINWrapper Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis GOAnnotatedAccessionForVPINWrapper,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis/GOAnnotatedAccessionForVPINWrapper,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis/GOAnnotatedAccessionForVPINWrapper 2006/02/09 22:46:41 1.2 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/lis/GOAnnotatedAccessionForVPINWrapper 2006/03/16 21:51:43 1.3 @@ -5,47 +5,47 @@ - - - + + + ]> + xmlns:ncgr-acc = "&ncgr-acc;" + xmlns = "&moby;"> - - - Wrapper for LIS GO Annotated Transcript Sequence Accessions Service - Wrapper for the LIS service that returns annotated transcript sequences for a given GO id - MOBY - http://www.semanticmoby.org - &moby-ex;lis - http://lin.ncgr.org/services/GOAnnotatedAccessionForVPIN.txt - - - - - - - - - - - - - - - - - - - + + Wrapper for LIS GO Annotated Transcript Sequence Accessions Service + + Wrapper for the LIS service that returns annotated transcript sequences + for a given GO id + + MOBY + http://www.semanticmoby.org + &moby-ex;lis + http://lin.ncgr.org/services/GOAnnotatedAccessionForVPIN.txt + + + + + + + + + + + + + + + + \ No newline at end of file From gss at pub.open-bio.org Thu Mar 16 21:51:45 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLpjWX008360@pub.open-bio.org> gss Thu Mar 16 16:51:45 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary In directory pub.open-bio.org:/tmp/cvs-serv8335/src/org/semanticmoby/vocabulary Modified Files: MOBY.java Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/core/src/org/semanticmoby/vocabulary MOBY.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java 2005/12/13 18:54:32 1.9 +++ /home/repository/moby/s-moby/ref-impl/core/src/org/semanticmoby/vocabulary/MOBY.java 2006/03/16 21:51:45 1.10 @@ -69,7 +69,7 @@ property(getURI(), "metadata"); public static String getURI() { - return "http://www.semanticmoby.org/ontologies/core/"; + return "http://ontologies.ncgr.org/moby/"; } public static String getNsPrefix() { From gss at pub.open-bio.org Thu Mar 16 21:51:43 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLphCp008324@pub.open-bio.org> gss Thu Mar 16 16:51:43 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello In directory pub.open-bio.org:/tmp/cvs-serv8229/WebRoot/examples/hello Modified Files: hello-world.rdf Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello hello-world.rdf,1.10,1.11 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello/hello-world.rdf,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello/hello-world.rdf 2005/12/14 18:07:11 1.10 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/hello/hello-world.rdf 2006/03/16 21:51:43 1.11 @@ -1,31 +1,43 @@ - - - - VPIN Hello World resource - Simple example of a VPIN resource - http://www.semanticmoby.org/examples/hello/display-hello-world - VPIN - http://www.semanticmoby.org - http://www.semanticmoby.org/examples/hello/metadata.txt - - - - - - - - - - - - + + + + + + + + + +]> + + + + + VPIN Hello World resource + Simple example of a VPIN resource + &ex;display-hello-world + VPIN + http://www.semanticmoby.org + http://www.semanticmoby.org/examples/hello/metadata.txt + + + + + + + + + + + + - + + \ No newline at end of file From gss at pub.open-bio.org Thu Mar 16 21:51:43 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 16:51:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162151.k2GLphe0008286@pub.open-bio.org> gss Thu Mar 16 16:51:43 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies In directory pub.open-bio.org:/tmp/cvs-serv8229/WebRoot/examples/proxies Modified Files: lin wormbase-query tair-seqviewer tair-mapviewer flybase-genequery pubmed ncbi-megablast sgd-quicksearch gramene-query Log Message: Changed moby: prefix from http://www.semanticmoby.org/ontologies/core/ to http://ontologies.ncgr.org/moby/ s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies lin,1.5,1.6 wormbase-query,1.8,1.9 tair-seqviewer,1.9,1.10 tair-mapviewer,1.8,1.9 flybase-genequery,1.11,1.12 pubmed,1.9,1.10 ncbi-megablast,1.8,1.9 sgd-quicksearch,1.10,1.11 gramene-query,1.10,1.11 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/03/16 03:37:53 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/lin 2006/03/16 21:51:43 1.6 @@ -6,7 +6,7 @@ - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> - + ]> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/resources In directory pub.open-bio.org:/tmp/cvs-serv8658/resources Added Files: smoby.example.properties Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/resources smoby.example.properties,NONE,1.1 From gss at pub.open-bio.org Thu Mar 16 23:19:44 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 18:19:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162319.k2GNJi2x008718@pub.open-bio.org> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF In directory pub.open-bio.org:/tmp/cvs-serv8658/WebRoot/WEB-INF Removed Files: smoby.example.properties Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF smoby.example.properties,1.5,NONE rcsdiff: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/RCS/smoby.example.properties,v: No such file or directory From gss at pub.open-bio.org Thu Mar 16 23:19:44 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 18:19:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162319.k2GNJiLX008702@pub.open-bio.org> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build In directory pub.open-bio.org:/tmp/cvs-serv8658/build Modified Files: build.xml Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/build build.xml,1.14,1.15 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build/build.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build/build.xml 2006/02/15 06:58:03 1.14 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/build/build.xml 2006/03/16 23:19:44 1.15 @@ -68,23 +68,8 @@ - - - - - The file smoby.properties is missing from the WebRoot/WEB-INF - directory. The file smoby.example.properties should be copied - to smoby.properties, which should then be modified to include - appropriate values for database connections, etc. - - - - + - + From gss at pub.open-bio.org Thu Mar 16 23:19:44 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 18:19:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603162319.k2GNJitm008683@pub.open-bio.org> gss Thu Mar 16 18:19:44 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv8658/src/org/semanticmoby/ref/tools Modified Files: MOBYProperties.java Log Message: Moved smoby.example.properties from WebRoot/WEB-INF to resources s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools MOBYProperties.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/02 08:54:32 1.5 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/16 23:19:44 1.6 @@ -16,7 +16,7 @@ /** * The path to the S-MOBY properties file. */ - private static String PROP_FILE_NAME = "/WEB-INF/smoby.properties"; + private static String PROP_FILE_NAME = "../smoby.properties"; /** * A static Properties object for accessing the properties file. From gss at pub.open-bio.org Fri Mar 17 01:12:19 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1CJRu009245@pub.open-bio.org> gss Thu Mar 16 20:12:19 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv9201/src/org/semanticmoby/ref/servlets Modified Files: BaseServlet.java Added Files: InitServlet.java Log Message: Moved initialization functionality into InitServlet s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets InitServlet.java,NONE,1.1 BaseServlet.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/BaseServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/BaseServlet.java 2006/01/07 01:15:49 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/BaseServlet.java 2006/03/17 01:12:18 1.10 @@ -6,65 +6,24 @@ import javax.servlet.*; import javax.servlet.http.*; -import org.apache.log4j.*; - - /** * A common base class for servlets that are part of the * Semantic MOBY site itself. */ public abstract class BaseServlet extends HttpServlet { - private static boolean log4jInitialized = false; public HttpServletRequest request; public HttpServletResponse response; public DataBean dataBean; /** - * Perform various initialization tasks. - */ - public void init() throws UnavailableException { - - // initialize local variables - ServletContext ctx = getServletContext(); - - // Initialize the MOBYProperties class. - try { - - MOBYProperties.initProps(ctx); - } catch (FileNotFoundException e) { - - e.printStackTrace(); - ctx.log(e, "MOBY properties file was not found"); - throw new UnavailableException(this, e.getMessage()); - } catch (IOException e) { - - e.printStackTrace(); - ctx.log(e, "MOBY properties file could not be read"); - throw new UnavailableException(this, e.getMessage()); - } - - // Initialize log4j - synchronized (BaseServlet.class) { - - if (!log4jInitialized) { - - String path = ctx.getRealPath("/WEB-INF/log4j.properties"); - PropertyConfigurator.configure(path); - log4jInitialized = true; - } - } - } - - - /** * Don't handle a get request, instead just forward the page back to the * index.jsp page. */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - getServletContext().getRequestDispatcher("/index.jsp").forward(request, - response); + getServletContext() + .getRequestDispatcher("/index.jsp") + .forward(request, response); } } From gss at pub.open-bio.org Fri Mar 17 01:12:37 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1Cb6n009300@pub.open-bio.org> gss Thu Mar 16 20:12:37 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF In directory pub.open-bio.org:/tmp/cvs-serv9275/WebRoot/WEB-INF Modified Files: web.xml Log Message: Added entry for InitServlet s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF web.xml,1.12,1.13 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/web.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/web.xml 2006/02/15 07:58:44 1.12 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/WEB-INF/web.xml 2006/03/17 01:12:37 1.13 @@ -2,28 +2,24 @@ - - Object factory for DataBean instances. - bean/DataBeanFactory - org.semanticmoby.ref.tools.DataBean - - - - - Resource reference to a factory for java.sql.Connection - instances that may be used for talking to a particular - database that is configured in the server.xml file. - - - jdbc/Postgres - - - javax.sql.DataSource - - - Container - - + + Object factory for DataBean instances. + bean/DataBeanFactory + org.semanticmoby.ref.tools.DataBean + + + + Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. + jdbc/Postgres + javax.sql.DataSource + Container + + + + InitServlet + 0 + org.semanticmoby.ref.servlets.InitServlet + SqlQueryServlet @@ -145,6 +141,7 @@ + SqlQueryServlet /sql-query-servlet @@ -229,6 +226,10 @@ LISExampleServlet /examples/lis + + InitServlet + /servlet/InitServlet + From gss at pub.open-bio.org Fri Mar 17 01:12:19 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1CJmC009265@pub.open-bio.org> gss Thu Mar 16 20:12:19 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv9201/WebRoot Modified Files: header.jsp Log Message: Moved initialization functionality into InitServlet s-moby/ref-impl/semanticmoby.org/WebRoot header.jsp,1.13,1.14 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/header.jsp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/header.jsp 2006/03/02 08:54:32 1.13 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/header.jsp 2006/03/17 01:12:19 1.14 @@ -1,29 +1,5 @@ <%@ page import="com.hp.hpl.jena.db.impl.DriverRDB"%> <%@ page import="org.semanticmoby.api.*"%> -<% if (!dataBean.wasInitialized()) { %> - - <% ServletContext context = getServletContext(); %> - <% try { - MOBYProperties.initProps(context); - Log.init(context.getRealPath("/smoby-log.html")); %> - - <% System.getProperties().put( - "http.proxySet", - MOBYProperties.getProperty("PROXY_SET", false)); %> - <% System.getProperties().put( - "http.proxyHost", - MOBYProperties.getProperty("PROXY_HOST", false)); %> - <% System.getProperties().put( - "http.proxyPort", - MOBYProperties.getProperty("PROXY_PORT", false)); %> - - <% dataBean.setInitialized(true); %> - - <% } catch (Exception e) { - e.printStackTrace(); - } %> - -<% } %> From gss at pub.open-bio.org Fri Mar 17 01:12:19 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Thu, 16 Mar 2006 20:12:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603170112.k2H1CJef009226@pub.open-bio.org> gss Thu Mar 16 20:12:18 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools In directory pub.open-bio.org:/tmp/cvs-serv9201/src/org/semanticmoby/ref/tools Modified Files: MOBYProperties.java Log Message: Moved initialization functionality into InitServlet s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools MOBYProperties.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/16 23:19:44 1.6 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/MOBYProperties.java 2006/03/17 01:12:18 1.7 @@ -14,9 +14,10 @@ public abstract class MOBYProperties { /** - * The path to the S-MOBY properties file. + * The path to the S-MOBY properties file. It should be located in + * the servlet container's conf/ directory. */ - private static String PROP_FILE_NAME = "../smoby.properties"; + private static String PROP_FILE_NAME = "../../conf/smoby.properties"; /** * A static Properties object for accessing the properties file. @@ -38,12 +39,10 @@ if (required && (value == null)) { - throw new MissingPropertyException(propName, - "Property " + propName + - " not found in " + - PROP_FILE_NAME); + throw new MissingPropertyException( + propName, "Property " + propName + + " not found in " + PROP_FILE_NAME); } - return value; } @@ -58,7 +57,6 @@ */ public static String getProperty(String propName) throws MissingPropertyException { - return getProperty(propName, false); } @@ -69,10 +67,10 @@ * @throws IOException if the file cannot be read */ public static void initProps(ServletContext context) - throws FileNotFoundException, IOException { - - if (props == null) // Only try to read it once - { + throws FileNotFoundException, IOException { + + // Only try to read it once + if (props == null) { props = new Properties(); @@ -80,9 +78,8 @@ if (path == null) { - throw new FileNotFoundException("Properties file \"" + - PROP_FILE_NAME + - "\" not found"); + throw new FileNotFoundException( + "Properties file \"" + PROP_FILE_NAME + "\" not found"); } props.load(new FileInputStream(path)); From lxm at pub.open-bio.org Fri Mar 17 18:44:16 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiGIL011677@pub.open-bio.org> lxm Fri Mar 17 13:44:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot In directory pub.open-bio.org:/tmp/cvs-serv11648/WebRoot Modified Files: footer.jsp search-results.jsp Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/WebRoot footer.jsp,1.8,1.9 search-results.jsp,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/footer.jsp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/footer.jsp 2006/02/16 18:44:19 1.8 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/footer.jsp 2006/03/17 18:44:16 1.9 @@ -73,7 +73,7 @@
-build-2006-2j updated: 02-16-2006 +build-2006-3a updated: 03-21-2006 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2006/03/13 19:04:58 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/search-results.jsp 2006/03/17 18:44:16 1.10 @@ -62,10 +62,11 @@
<% if ((moreInfo != null) && (moreInfo.trim().length() > 0)) { %> - For more information see - - <%= moreInfo %> - + For more information see: +
+ + <%= moreInfo %> + <% } %>

From lxm at pub.open-bio.org Fri Mar 17 18:44:17 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiHlM011736@pub.open-bio.org> lxm Fri Mar 17 13:44:17 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets In directory pub.open-bio.org:/tmp/cvs-serv11648/src/org/semanticmoby/ref/servlets Modified Files: InitServlet.java Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets InitServlet.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/InitServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/InitServlet.java 2006/03/17 01:12:18 1.1 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/servlets/InitServlet.java 2006/03/17 18:44:17 1.2 @@ -28,56 +28,64 @@ * mapping in web.xml. */ public class InitServlet extends HttpServlet { - - /** - * Contains any code that needs to be run when the servlet container - * starts up. - */ - public void init() throws ServletException { - - ServletContext ctx = getServletContext(); - - // Read the smoby.properties file + + /** + * Contains any code that needs to be run when the servlet container + * starts up. + */ + public void init() throws ServletException { + + ServletContext ctx = getServletContext(); + + // Read the smoby.properties file try { + MOBYProperties.initProps(ctx); - } catch (FileNotFoundException e) { + } + + catch (FileNotFoundException e) { + Log.error("MOBY properties file was not found"); throw new ServletException(e); - } catch (IOException e) { - Log.error("MOBY properties file could not be read"); + } + + catch (IOException e) { + + Log.error("MOBY properties file could not be read"); throw new ServletException(e); } - + // Initialize logging String path = ctx.getRealPath("/WEB-INF/log4j.properties"); PropertyConfigurator.configure(path); Log.init(ctx.getRealPath("/smoby-log.html")); - + // Initialize some system properties pertaining to HTTP proxies try { - System.getProperties().put( - "http.proxySet", - MOBYProperties.getProperty("PROXY_SET", false)); - System.getProperties().put( + + System.getProperties().put( + "http.proxySet", + MOBYProperties.getProperty("PROXY_SET", false)); + System.getProperties().put( "http.proxyHost", MOBYProperties.getProperty("PROXY_HOST", false)); - System.getProperties().put( + System.getProperties().put( "http.proxyPort", MOBYProperties.getProperty("PROXY_PORT", false)); + } - Context initCtx = new InitialContext(); - Context envCtx = (Context) initCtx.lookup("java:comp/env"); - DataBean dataBean = (DataBean) envCtx.lookup("bean/DataBeanFactory"); - dataBean.setInitialized(true); - - } catch (Throwable t) { - t.printStackTrace(); + catch (Exception e) { + + e.printStackTrace(); + throw new ServletException(e); } - } - - /** - * Contains any code that needs to be run when the servlet container - * is shut down. - */ - public void destroy() {} + } + + + /** + * Contains any code that needs to be run when the servlet container + * is shut down. + */ + public void destroy() { + } } From lxm at pub.open-bio.org Fri Mar 17 18:44:17 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiHEO011715@pub.open-bio.org> lxm Fri Mar 17 13:44:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api In directory pub.open-bio.org:/tmp/cvs-serv11648/src/org/semanticmoby/api Modified Files: Log.java Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api Log.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/15 00:57:37 1.2 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api/Log.java 2006/03/17 18:44:16 1.3 @@ -43,6 +43,12 @@ private static String fileName = "smoby-log.html"; + static { + + init(); + } + + /** * Initializes the logger. * @param fileName The path/name of the log file to use. From lxm at pub.open-bio.org Fri Mar 17 18:44:17 2006 From: lxm at pub.open-bio.org (Lonny Montoya) Date: Fri, 17 Mar 2006 13:44:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603171844.k2HIiHgX011696@pub.open-bio.org> lxm Fri Mar 17 13:44:16 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies In directory pub.open-bio.org:/tmp/cvs-serv11648/WebRoot/examples/proxies Modified Files: tair-mapviewer Log Message: several small bugfixes, fix to aboutURI of tair-mapviewer, added static block to Log for static initialization, added the next build tag (build-2006-3a) to the footer, reformatted the search results page as the proxy resources now have about URIs to display s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies tair-mapviewer,1.9,1.10 =================================================================== RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2006/03/16 21:51:43 1.9 +++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/examples/proxies/tair-mapviewer 2006/03/17 18:44:16 1.10 @@ -18,7 +18,7 @@ TAIR Map Viewer - http://www.arabidopsis.org/mapViewer/help/tairmapa.jsp + http://www.arabidopsis.org/mapViewer/help/tairmapa.jsp TAIR http://www.arabidopsis.org Arabidopsis Map Viewer resource provided by TAIR From gss at pub.open-bio.org Fri Mar 17 21:53:11 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Fri, 17 Mar 2006 16:53:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603172153.k2HLrBSR012407@pub.open-bio.org> gss Fri Mar 17 16:53:11 EST 2006 Update of /home/repository/moby/s-moby/ref-impl In directory pub.open-bio.org:/tmp/cvs-serv12370/ref-impl Removed Files: cvstag.log Log Message: cvstag.log moved from ref-impl one level up to top s-moby/ref-impl cvstag.log,1.1,NONE rcsdiff: /home/repository/moby/s-moby/ref-impl/RCS/cvstag.log,v: No such file or directory From gss at pub.open-bio.org Fri Mar 17 21:53:11 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Fri, 17 Mar 2006 16:53:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603172153.k2HLrBkQ012391@pub.open-bio.org> gss Fri Mar 17 16:53:11 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv12370 Added Files: cvstag.log Log Message: cvstag.log moved from ref-impl one level up to top s-moby cvstag.log,NONE,1.1 From gss at pub.open-bio.org Fri Mar 17 21:54:08 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Fri, 17 Mar 2006 16:54:08 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603172154.k2HLs8Zj012442@pub.open-bio.org> gss Fri Mar 17 16:54:08 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv12420 Removed Files: README.txt Log Message: Removed unnecessary file s-moby README.txt,1.2,NONE rcsdiff: /home/repository/moby/s-moby/RCS/README.txt,v: No such file or directory From gss at pub.open-bio.org Mon Mar 20 17:01:27 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Mon, 20 Mar 2006 12:01:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603201701.k2KH1Rec030899@pub.open-bio.org> gss Mon Mar 20 12:01:27 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv30872 Modified Files: cvstag.log Log Message: Removed reference to ref-impl directory, since we're tagging everything now s-moby cvstag.log,1.1,1.2 =================================================================== RCS file: /home/repository/moby/s-moby/cvstag.log,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/s-moby/cvstag.log 2006/03/17 21:53:11 1.1 +++ /home/repository/moby/s-moby/cvstag.log 2006/03/20 17:01:27 1.2 @@ -6,6 +6,6 @@ command: "cvs tag ref-impl" Tag Date Description ---------------- ---------- ---------------------------------------------- -smoby_01_00_000 03/17/2006 Re-registration fixed, registration now single - threaded, logging via Log class +------------- ---------- ---------------------------------------------- +build-2006-3a 03/17/2006 Re-registration fixed, registration now single + threaded, logging via Log class From gss at pub.open-bio.org Mon Mar 20 17:06:06 2006 From: gss at pub.open-bio.org (Gary Schiltz) Date: Mon, 20 Mar 2006 12:06:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603201706.k2KH66CO030955@pub.open-bio.org> gss Mon Mar 20 12:06:06 EST 2006 Update of /home/repository/moby/s-moby In directory pub.open-bio.org:/tmp/cvs-serv30930 Modified Files: cvstag.log Log Message: Clarified instructions s-moby cvstag.log,1.2,1.3 =================================================================== RCS file: /home/repository/moby/s-moby/cvstag.log,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/s-moby/cvstag.log 2006/03/20 17:01:27 1.2 +++ /home/repository/moby/s-moby/cvstag.log 2006/03/20 17:06:06 1.3 @@ -1,9 +1,10 @@ This file is to document tagged versions of the CVS heirarchy descending from this directory. The process should be: just before tagging, add an entry to this file that describes the major features of the version being -tagged, and commit this file. Then, set CVSROOT to the value in CVS/Root, -change directory to the directory just above this, and enter the following -command: "cvs tag ref-impl" +tagged, and commit this file. Then, in the directory that contains this +file, enter the following command: + + cvs tag . Tag Date Description ------------- ---------- ---------------------------------------------- From mwilkinson at pub.open-bio.org Wed Mar 22 01:12:02 2006 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue, 21 Mar 2006 20:12:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220112.k2M1C2bd003849@pub.open-bio.org> mwilkinson Tue Mar 21 20:12:02 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv3826/Perl/MOBY Modified Files: Central.pm service_instance.pm Log Message: allow registration of services that include a user-defined LSID. This is required for the agent to properly register services based on service-provider-edited RDF, which must by necessily also have an updated LSID in order to reflect that it is edited moby-live/Perl/MOBY Central.pm,1.248,1.249 service_instance.pm,1.36,1.37 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.248 retrieving revision 1.249 diff -u -r1.248 -r1.249 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/02 17:27:09 1.248 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/22 01:12:02 1.249 @@ -1074,6 +1074,8 @@ moby YourServiceNameHere TypeOntologyTerm + http://path.to/your/signature/RDF.rdf + urn:lsid:biomoby.org:serviceinstance:myservice:version your.URI.here http://URL.to.your/Service.script; your_name at contact.address.com @@ -1215,7 +1217,7 @@ $serviceName, $serviceType, $AuthURI, $contactEmail, $URL, $authoritativeService, $desc, $Category, $INPUTS, - $OUTPUTS, $SECONDARY, $signatureURL + $OUTPUTS, $SECONDARY, $signatureURL, $serviceLSID ) = &_registerServicePayload($payload); @@ -1225,7 +1227,7 @@ # THE IMPLICATION IS THAT THEY ARE ASKING YOU TO VISIT THEIR urL now!!!! if ( defined $signatureURL ) { my $ch = 0; - my $i; + my $i; # first check if any other parameters were filled-in. If so, then the implication is that they want us to register based on the data they have provided foreach $i ( $serviceName, $serviceType, $AuthURI, $contactEmail, $URL, $desc) { if ( defined $i && $i ne "") { @@ -1250,6 +1252,7 @@ } #--------------------------------------------------------------- + $authoritativeService = (defined($authoritativeService) && $authoritativeService) ? 1 : 0; my $error; $error .= "missing serviceName \n" unless defined $serviceName; @@ -1337,6 +1340,7 @@ authoritative => $authoritativeService, description => $desc, signatureURL => $signatureURL, + lsid => $serviceLSID ); return &_error( "Service registration failed for unknown reasons", "" ) if ( !defined $SVC ); @@ -1392,15 +1396,15 @@ my $RDF = _getServiceInstanceRDF(name=>$serviceName, auth=>$AuthURI, url=>$ENV{MOBY_SERVER}, uri=>$ENV{MOBY_URI}); unless ($RDF) { - return &_success( "Registration successful but LSID resolution error", - $SVC->service_instance_id, "" ); + return &_success( "Registration successful but unable to create RDF - please contact your MOBY Central administrator", + $SVC->lsid, "" ); } unless ( $RDF =~ /RDF/ ) { return &_success( - "Registration successful but LSID resolution error $RDF", - $SVC->service_instance_id, "" ); + "Registration successful but RDF is not correctly formatted:\n\n $RDF", + $SVC->lsid, "" ); } - return &_success( "Registration successful", $SVC->service_instance_id, + return &_success( "Registration successful", $SVC->lsid, $RDF ); } @@ -1656,6 +1660,7 @@ &_nodeTextContent( $Object, "authoritativeService" ); my $URL = &_nodeTextContent( $Object, "URL" ); my $signatureURL = &_nodeTextContent( $Object, "signatureURL" ); + my $serviceLSID = &_nodeTextContent( $Object, "serviceLSID" ); my $desc = &_nodeCDATAContent( $Object, "Description" ); my $INPUTS = &_nodeRawContent( $Object, "Input" ); # returns array ref my $OUTPUTS = &_nodeRawContent( $Object, "Output" ); # returns array ref @@ -1665,7 +1670,7 @@ $serviceName, $serviceType, $AuthURI, $contactEmail, $URL, $authoritativeService, $desc, $Category, $INPUTS, - $OUTPUTS, $SECONDARIES, $signatureURL + $OUTPUTS, $SECONDARIES, $signatureURL, $serviceLSID ); } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/02/24 01:21:26 1.36 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 01:12:02 1.37 @@ -230,14 +230,16 @@ #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; - my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; - my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; - $LSID_Auth ||="biomoby.org"; - $LSID_NS ||="serviceinstance"; - my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" - . $self->authority_uri . "," - . $self->servicename.":"."$date"; # LSID with timestamp - $self->lsid($service_lsid); + unless ($self->lsid){ # if we were not passed an lsid by the service creator, we had better make one now + my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; + my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; + $LSID_Auth ||="biomoby.org"; + $LSID_NS ||="serviceinstance"; + my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" + . $self->authority_uri . "," + . $self->servicename.":"."$date"; # LSID with timestamp + $self->lsid($service_lsid); + } my $id = $self->adaptor->insert_service_instance( category => $self->category, servicename => $self->servicename, @@ -248,7 +250,7 @@ authoritative => $self->authoritative, description => $self->description, signatureURL => $self->signatureURL, - lsid => $service_lsid + lsid => $self->lsid ); return undef unless $id; $self->service_instance_id($id); From kawas at pub.open-bio.org Wed Mar 22 01:22:37 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 21 Mar 2006 20:22:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220122.k2M1MbII003932@pub.open-bio.org> kawas Tue Mar 21 20:22:37 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv3907 Modified Files: Central.pm Log Message: a semi-colon was missing moby-live/Perl/MOBY Central.pm,1.249,1.250 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.249 retrieving revision 1.250 diff -u -r1.249 -r1.250 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/22 01:12:02 1.249 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/03/22 01:22:37 1.250 @@ -1240,7 +1240,7 @@ my $path = $conf->{mobycentral}->{rdfagent}; # PRE: $path = complete path to the run-RDFagent.bat or .sh file *AND* the agent is configured correctly $signatureURL =~ s/\s+//g; - my $rez = system("$path -url $signatureURL" ) + my $rez = system("$path -url $signatureURL" ); return &_success( "The RDFagent call was successful.", "","" ) From kawas at pub.open-bio.org Wed Mar 22 02:51:30 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue, 21 Mar 2006 21:51:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220251.k2M2pUgL004201@pub.open-bio.org> kawas Tue Mar 21 21:51:30 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv4175 Modified Files: service_instance.pm Log Message: checking of the lsids that service providers pass in moby-live/Perl/MOBY service_instance.pm,1.37,1.38 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 01:12:02 1.37 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 02:51:30 1.38 @@ -230,7 +230,26 @@ #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; - unless ($self->lsid){ # if we were not passed an lsid by the service creator, we had better make one now + if ($self->lsid){ + # we were passed in an LSID, so lets construct a correct one and append the revision + use LS::ID; + my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; + my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; + $LSID_Auth ||="biomoby.org"; + $LSID_NS ||="serviceinstance"; + my $rev = ""; + my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" + . $self->authority_uri . "," + . $self->servicename.":"; + # create a new lsid + my $lsid = LS::ID->new($self->lsid); + # ensure that the lsid was valid syntacticly + return undef unless $lsid; + $rev = $lsid->_revision; + return undef unless $rev; + $self->lsid($service_lsid . $rev); + } else { + # create an LSID if one wasnt passed in my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; $LSID_Auth ||="biomoby.org"; @@ -238,7 +257,7 @@ my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" . $self->authority_uri . "," . $self->servicename.":"."$date"; # LSID with timestamp - $self->lsid($service_lsid); + $self->lsid($service_lsid); } my $id = $self->adaptor->insert_service_instance( category => $self->category, From senger at pub.open-bio.org Wed Mar 22 07:36:41 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Wed, 22 Mar 2006 02:36:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220736.k2M7afK1004844@pub.open-bio.org> senger Wed Mar 22 02:36:41 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes In directory pub.open-bio.org:/tmp/cvs-serv4787/src/main/org/biomoby/shared/datatypes Modified Files: MapPrimitiveDataTypes.java Log Message: moby-live/Java/src/main/org/biomoby/shared/datatypes MapPrimitiveDataTypes.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java 2005/08/29 13:21:59 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java 2006/03/22 07:36:40 1.3 @@ -10,6 +10,8 @@ import org.biomoby.shared.MobyException; import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; /** * Class containing static mapping between Biomoby primitive data @@ -51,7 +53,26 @@ public Class getClass (String dataTypeName) throws MobyException { String className = (String)type2class.get (dataTypeName); - if (className == null) return null; + if (className == null) { + + // a hack: sometimes the 'dataTypeName' is wrong - it is + // the last piece of a class name (e.g. text_base64) + // instead of a rel data type name (e.g. text-base64) - so + // I try here to find it anyway, but this will go away + // when MobyObject (and all generated datatypes) return + // its data ype name properly... + String classNameEnding = "." + dataTypeName; + for (Iterator it = type2class.entrySet().iterator(); it.hasNext(); ) { + Map.Entry entry = (Map.Entry)it.next(); + String cName = (String)entry.getValue(); + if ( cName.endsWith (classNameEnding) ) { + className = cName; + break; + } + } + if (className == null) + return null; + } try { return Class.forName (className); } catch (Exception e) { From senger at pub.open-bio.org Wed Mar 22 07:36:40 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Wed, 22 Mar 2006 02:36:40 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220736.k2M7aeXx004806@pub.open-bio.org> senger Wed Mar 22 02:36:40 EST 2006 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv4787 Modified Files: build.xml Log Message: moby-live/Java build.xml,1.52,1.53 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- /home/repository/moby/moby-live/Java/build.xml 2006/03/13 10:22:20 1.52 +++ /home/repository/moby/moby-live/Java/build.xml 2006/03/22 07:36:40 1.53 @@ -1509,7 +1509,7 @@ + description="Generate jar files with generated data types and skeletons."> From senger at pub.open-bio.org Wed Mar 22 07:36:41 2006 From: senger at pub.open-bio.org (Martin Senger) Date: Wed, 22 Mar 2006 02:36:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603220736.k2M7afci004825@pub.open-bio.org> senger Wed Mar 22 02:36:40 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/renderers In directory pub.open-bio.org:/tmp/cvs-serv4787/src/main/org/biomoby/service/dashboard/renderers Modified Files: renderers.conf.xml Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard/renderers renderers.conf.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/renderers/renderers.conf.xml,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/renderers/renderers.conf.xml 2006/02/19 18:42:56 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/renderers/renderers.conf.xml 2006/03/22 07:36:40 1.2 @@ -4,6 +4,7 @@ + From mwilkinson at pub.open-bio.org Wed Mar 22 21:38:58 2006 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed, 22 Mar 2006 16:38:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603222138.k2MLcwMN007427@pub.open-bio.org> mwilkinson Wed Mar 22 16:38:58 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv7408/Perl/MOBY Modified Files: service_instance.pm Log Message: dueling code with Eddie. This version validates the structure of an incoming LSID prior to creating the service instance, rather than imposing our structure on the LSID. The only part that is imposed is the timestamp, which we have promised in our RFC will have a particular format. Services that attempt to register with an LSID that is incorrectly formatted will fail - service_instance returns undef, MOBY::Central returns failure registration object. Unfortunately, at the moment service_instance.pm has no way of passing back the REASON for the failure, so it may be a bit cryptic to the person trying to register the service.... moby-live/Perl/MOBY service_instance.pm,1.38,1.39 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 02:51:30 1.38 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 21:38:58 1.39 @@ -182,7 +182,10 @@ } return undef unless $self->authority_uri; return undef unless $self->servicename; - + if( $self->lsid){ + my $l = $self->lsid; # but is LSID valid format? + return undef unless $l =~ m'urn\:lsid\:[^:/?#\.]+(\.[^:/?#\.]+)+\:[^:/?#\.]+\:[^:/?#\.]+\:\d\d\-\d\d\-\d\dT\d\d\-\d\d\-\d\d'; + } if ( $self->test ) { return $self->service_instance_exists } # returns boolean $self->authority( $self->_get_authority() ); # as MOBY::authority object @@ -230,32 +233,16 @@ #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; - if ($self->lsid){ - # we were passed in an LSID, so lets construct a correct one and append the revision - use LS::ID; - my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; - my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; - $LSID_Auth ||="biomoby.org"; - $LSID_NS ||="serviceinstance"; - my $rev = ""; - my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" - . $self->authority_uri . "," - . $self->servicename.":"; - # create a new lsid - my $lsid = LS::ID->new($self->lsid); - # ensure that the lsid was valid syntacticly - return undef unless $lsid; - $rev = $lsid->_revision; - return undef unless $rev; - $self->lsid($service_lsid . $rev); - } else { + unless ($self->lsid){ # create an LSID if one wasnt passed in my $LSID_Auth = $_config->{mobycentral}->{lsid_authority}; my $LSID_NS = $_config->{mobycentral}->{lsid_namespace}; $LSID_Auth ||="biomoby.org"; $LSID_NS ||="serviceinstance"; + +# TODO - # MOBY Central should validate the format of authority uri and servicename when it starts up, sice we are using them to construct LSID's my $service_lsid = "urn:lsid:$LSID_Auth:$LSID_NS:" - . $self->authority_uri . "," + . $self->authority_uri . "," . $self->servicename.":"."$date"; # LSID with timestamp $self->lsid($service_lsid); } From kawas at pub.open-bio.org Thu Mar 23 15:11:42 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 23 Mar 2006 10:11:42 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231511.k2NFBgfn010151@pub.open-bio.org> kawas Thu Mar 23 10:11:42 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory pub.open-bio.org:/tmp/cvs-serv10125/org/biomoby/client/rdf/builder Modified Files: RDFConfigure.java Log Message: moby-live/Java/src/main/org/biomoby/client/rdf/builder RDFConfigure.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.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/rdf/builder/RDFConfigure.java 2006/03/16 18:11:23 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java 2006/03/23 15:11:42 1.11 @@ -333,13 +333,13 @@ /** * - * PRE:myObject is the valid uri for the service instance. + * PRE:lsid is the valid lsid for the service instance. *

* POST:the rdf representing the service instance is returned. *

* - * @param myObject - - * the uri of the service instance + * @param lsid - + * the lsid of the service instance * @return the rdf representation of the service instance. * @throws IOException */ @@ -415,6 +415,11 @@ return false; } + /** + * + * @param lsid the lsid of the object to check existence for + * @return true if the object existed, perhaps under a different LSID revision, false otherwise. + */ public final boolean objectExisted(String lsid) { ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); LSID theLsid = null; @@ -434,6 +439,11 @@ return false; } + /** + * + * @param lsid the LSID to use as a template for finding the latest LSID + * @return the latest lsid or the empty string if one was not found + */ public final String getLatestLSID(String lsid) { ResIterator rIter = model.listSubjectsWithProperty(RDFS.label); LSID theLsid = null; From kawas at pub.open-bio.org Thu Mar 23 15:16:56 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 23 Mar 2006 10:16:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231516.k2NFGuon010204@pub.open-bio.org> kawas Thu Mar 23 10:16:56 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types In directory pub.open-bio.org:/tmp/cvs-serv10179/org/biomoby/registry/definitions/types Modified Files: JObjectsSqlImpl.java Log Message: moby-live/Java/src/main/org/biomoby/registry/definitions/types JObjectsSqlImpl.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java 2006/03/15 16:22:37 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/definitions/types/JObjectsSqlImpl.java 2006/03/23 15:16:56 1.3 @@ -195,7 +195,36 @@ /** * - * @return + * method that returns the various object types, object relationship, object + * type that this relationship is with, the articlename (if it exists), + * description, the objects lsid, the authority of the creator of the + * object, the email address of the creator, and the LSID for the + * relationship this object has with the other object all tab-delimited. + *

+ * PRE:None. + *

+ * POST:A string array containing sub string arrays containing the + * various object types, object relationship, object type that this + * relationship is with, the articlename (if it exists), description, the + * objects lsid, the authority of the creator of the object, the email + * address of the creator, and the LSID for the relationship this object has + * with the other object all tab-delimited + *

+ * Example of the structure that is returned: [[object type, relationship + * type, object type relationship is with, articlename, description of the + * object type, object lsid, authority, email, lsid of the object this + * object has a relationship with]] + *

+ * note that articlename may not be applicable to all relationship + * types + * + * @return A string array, with each item in the array being another string + * array containing the various object types, object relationship, + * object type that this relationship is with, the articlename (if + * it exists), description, the objects lsid, the authority of the + * creator of the object, the email address of the creator, and the + * LSID for the relationship this object has with the other object + * all tab-delimited. */ public String[][] getFullObjectsAsArray() { ArrayList sb = new ArrayList(); @@ -228,6 +257,7 @@ sb.toArray(array); return array; } + public static void main(String[] args) throws MobyException { String[][] datatypes = new JObjectsSqlImpl().getFullObjectsAsArray(); for (int i = 0; i < datatypes.length; i++) { From mwilkinson at pub.open-bio.org Thu Mar 23 18:00:50 2006 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu, 23 Mar 2006 13:00:50 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231800.k2NI0o8U011505@pub.open-bio.org> mwilkinson Thu Mar 23 13:00:50 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv11482/MOBY Modified Files: OntologyServer.pm service_instance.pm Log Message: timestamp format was wrong. four digit year, not two digit year moby-live/Perl/MOBY OntologyServer.pm,1.100,1.101 service_instance.pm,1.39,1.40 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2006/02/21 00:43:36 1.100 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2006/03/23 18:00:50 1.101 @@ -1380,7 +1380,7 @@ my $URI; my ($sec,$min,$hour,$mday,$month,$year, $wday,$yday,$dst) =gmtime(time); -my $date = sprintf ("%02d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); +my $date = sprintf ("%04d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); # $id = lc($id); if ( $self->ontology eq 'object' ) { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/22 21:38:58 1.39 +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm 2006/03/23 18:00:50 1.40 @@ -184,7 +184,7 @@ return undef unless $self->servicename; if( $self->lsid){ my $l = $self->lsid; # but is LSID valid format? - return undef unless $l =~ m'urn\:lsid\:[^:/?#\.]+(\.[^:/?#\.]+)+\:[^:/?#\.]+\:[^:/?#\.]+\:\d\d\-\d\d\-\d\dT\d\d\-\d\d\-\d\d'; + return undef unless $l =~ m'urn\:lsid\:[^:/?#\.]+(\.[^:/?#\.]+)+\:[^:/?#\.]+\:[^:/?#\.]+\:\d\d\d\d-\d\d\-\d\dT\d\d\-\d\d\-\d\d'; } if ( $self->test ) { return $self->service_instance_exists } # returns boolean @@ -229,7 +229,7 @@ ) { # then create it de novo if we have enough information # create a timestamp for the LSID my ($sec,$min,$hour,$mday,$month,$year, $wday,$yday,$dst) =gmtime(time); - my $date = sprintf ("%02d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); + my $date = sprintf ("%04d-%02d-%02dT%02d-%02d-%02dZ",$year+1900,$month+1,$mday,$hour,$min,$sec); #create LSID for service and register it in the DB my $_config ||= MOBY::Config->new; From kawas at pub.open-bio.org Fri Mar 24 17:52:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 12:52:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603241752.k2OHqcHX015350@pub.open-bio.org> kawas Fri Mar 24 12:52:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv15307/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: fixed a bug where the rdf is valid RDF, but doesnt contain a valid service description. This resulted in a null pointer exception. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/23 19:10:31 1.15 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/24 17:52:38 1.16 @@ -77,7 +77,7 @@ if (badURLs.containsKey(signatureURL)) { Log.warning("The signature url, " + signatureURL + ", has already been" + newline + " processed and was invalid" - + " for one reason or another."); + + " for one reason or another." ); removeInvalidSignatureURLServiceFromRegistry(registryService, central, "The service has an invalid signature url.", ((Integer) badURLs @@ -116,7 +116,8 @@ // add the url to the bad list so that the hitlist // doesnt grow by the number of services at the service // description location - badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); + badURLs.put(signatureURL, + (connection.getBadUrlMap().get(signatureURL))); // rdf is missing removeInvalidSignatureURLService(registryService, central, "The signature url was missing, or the rdf document was invalid.", @@ -129,7 +130,8 @@ // this would happen if a url contained rdf but not // current rdf - badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); + badURLs.put(signatureURL, + (connection.getBadUrlMap().get(signatureURL))); // no services found in the document removeInvalidSignatureURLService(registryService, central, "given, " + signatureURL + ", no service was found called " @@ -589,10 +591,12 @@ if (enableServiceUpdates) { // TODO keep track of the revision on the new service - change the // revision to the one in the document - int code = removeChangedServiceFromRegistry(registryService, central, differences); + int code = removeChangedServiceFromRegistry(registryService, central, differences, + rdfService.getEmailContact()); if (code == 200) { if (addServiceToRegistry(rdfService, central)) { // service was added + } else { // service was not added, so replace with old one? if (!addServiceToRegistry(registryService, central)) { @@ -746,7 +750,7 @@ * remove a changed service */ private int removeChangedServiceFromRegistry(MobyService service, Central central, - String changes) { + String changes, String email) { // create and optionally save the report Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, @@ -768,7 +772,9 @@ } if (sendMailOnChanged) { - sendMail(service, report); + MobyService ms = service; + ms.setEmailContact(email); + sendMail(ms, report); } Log.info("Service, (" + service.getName() + ", " + service.getAuthority() From kawas at pub.open-bio.org Fri Mar 24 17:52:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 12:52:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603241752.k2OHqcPL015332@pub.open-bio.org> kawas Fri Mar 24 12:52:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory pub.open-bio.org:/tmp/cvs-serv15307/org/biomoby/registry/rdfagent/util Modified Files: SignatureURLConnection.java Log Message: fixed a bug where the rdf is valid RDF, but doesnt contain a valid service description. This resulted in a null pointer exception. moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/02 03:20:52 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/24 17:52:38 1.9 @@ -187,14 +187,20 @@ Log.severe("There was something wrong with the model: " + newline + e.getLocalizedMessage()); performURLErrorHandling(url, 501); + return new MobyService[]{}; } Log.info("Parsing complete."); if (parser.isRDFValid()) { // RDF was valid and no bad service found + if (services.length == 0) { + performURLErrorHandling(url, 501); + return services; + } if (services != null) return services; } else { + Log.info("RDF contained some invalid services."); // RDF was found to contain bad services // process the bad ones and return the good ones. String errors = parser.getErrors(); @@ -218,6 +224,10 @@ } } } + if (services.length == 0) { + performURLErrorHandling(url, 501); + return services; + } if (services != null) return services; } @@ -270,7 +280,11 @@ central = new CentralDataAccessImpl(); int count = central.getErrorCountForURL(url); if (count == 0) { - central.insertErrorCountForURL(url, code); + if (central.insertErrorCountForURL(url, code)) { + Log.info("Error count for " + url + " was inserted! The count is 1."); + } else { + Log.warning("Error count for " + url + " was not inserted! Make sure that the DB parameters are correct!"); + } } else { if ((++count) >= Constants.REGISTRY_DEREGISTER_COUNT) { central.deleteErrorCountForURL(url); From kawas at pub.open-bio.org Fri Mar 24 18:16:57 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 13:16:57 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603241816.k2OIGv5o015427@pub.open-bio.org> kawas Fri Mar 24 13:16:56 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory pub.open-bio.org:/tmp/cvs-serv15402/org/biomoby/registry/rdfagent/util Modified Files: SignatureURLConnection.java Log Message: the service_validation table wasnt updated properly. In cases where there was a file at the signatureURL, the table removed the entry for the url even though the file contained in valid 'stuff' in it. moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/24 17:52:38 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/03/24 18:16:56 1.10 @@ -92,31 +92,31 @@ urlConnection.disconnect(); Log.info("Closing the url connection."); - if (Constants.REGISTRY_ENABLE_DEREGISTER) { - // remove the url from the hit list if necessary and if - // deregistration is enabled - CentralDataAccess central = null; - try { - central = new CentralDataAccessImpl(); - int count = central.getErrorCountForURL(url); - if (count != 0) { - Log.info("Attempting to remove " + url - + " from the 'hit list'."); - if (central.deleteErrorCountForURL(url)) { - Log.info("Removal success!"); - } else { - Log.info("Removal failed."); - } - } - if (central != null) - central.cleanup(); - } catch (MobyException e) { - Log.exception(this.getClass().getName(), - "getRdfFromURL(String)", e); - Log.severe(e.getLocalizedMessage()); - code = 417; - } - } +// if (Constants.REGISTRY_ENABLE_DEREGISTER) { +// // remove the url from the hit list if necessary and if +// // deregistration is enabled +// CentralDataAccess central = null; +// try { +// central = new CentralDataAccessImpl(); +// int count = central.getErrorCountForURL(url); +// if (count != 0) { +// Log.info("Attempting to remove " + url +// + " from the 'hit list'."); +// if (central.deleteErrorCountForURL(url)) { +// Log.info("Removal success!"); +// } else { +// Log.info("Removal failed."); +// } +// } +// if (central != null) +// central.cleanup(); +// } catch (MobyException e) { +// Log.exception(this.getClass().getName(), +// "getRdfFromURL(String)", e); +// Log.severe(e.getLocalizedMessage()); +// code = 417; +// } +// } Log.info("Got an RDF model."); if (code == 200 || code == 202) return model; @@ -194,11 +194,15 @@ if (parser.isRDFValid()) { // RDF was valid and no bad service found if (services.length == 0) { + // there was nothing in the document performURLErrorHandling(url, 501); return services; } - if (services != null) + if (services != null) { + // RDF document was ok after all, so remove url from hitlist + removeFromHitlist(url); return services; + } } else { Log.info("RDF contained some invalid services."); // RDF was found to contain bad services @@ -225,11 +229,15 @@ } } if (services.length == 0) { + // there was nothing in the document performURLErrorHandling(url, 501); return services; } - if (services != null) + if (services != null) { + // RDF document was ok after all, so remove url from hitlist + removeFromHitlist(url); return services; + } } } return new MobyService[] {}; @@ -239,6 +247,36 @@ * */ + /** + * @param url + */ + private void removeFromHitlist(String url) { + if (Constants.REGISTRY_ENABLE_DEREGISTER) { + // remove the url from the hit list if necessary and if + // deregistration is enabled + CentralDataAccess central = null; + try { + central = new CentralDataAccessImpl(); + int count = central.getErrorCountForURL(url); + if (count != 0) { + Log.info("Attempting to remove " + url + + " from the 'hit list'."); + if (central.deleteErrorCountForURL(url)) { + Log.info("Removal success!"); + } else { + Log.info("Removal failed."); + } + } + if (central != null) + central.cleanup(); + } catch (MobyException e) { + Log.exception(this.getClass().getName(), + "getRdfFromURL(String)", e); + Log.severe(e.getLocalizedMessage()); + } + } + } + private void performURLErrorHandling(String url, int code) { if (code == 400) { Log From kawas at pub.open-bio.org Sat Mar 25 00:35:27 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Fri, 24 Mar 2006 19:35:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603250035.k2P0ZRft016265@pub.open-bio.org> kawas Fri Mar 24 19:35:27 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv16240/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: in cases where the revision on the LSIDs are not different but there were modifications, it would be nice to know what the changes were. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/24 17:52:38 1.16 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/25 00:35:27 1.17 @@ -226,7 +226,7 @@ Log.info("The service " + rdfServices[i].getUniqueName() + " and the service " + registryService.getUniqueName() - + " have lsids that describe different services."); + + " have lsids that describe different services." + newline + "The differences found were: "+newline + comparator.getDifferences()); } @@ -352,7 +352,7 @@ + newline + "to update the service. Please modify " + newline - + "the LSID revision for your service."); + + "the LSID revision for your service." + newline + "The differences found were: "+newline + comparator.getDifferences()); } continue; } @@ -565,7 +565,7 @@ + " have the same LSID (and revision) " + newline + "and due to this, the agent chose not " + newline + "to update the service. Please modify " + newline - + "the LSID revision for your service."); + + "the LSID revision for your service." + newline + "The differences found were: "+newline + comparator.getDifferences()); } continue; } From kawas at pub.open-bio.org Wed Mar 15 16:22:38 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 11:22:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151622.k2FGMcLu032225@pub.open-bio.org> kawas Wed Mar 15 11:22:38 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources In directory pub.open-bio.org:/tmp/cvs-serv32102/org/biomoby/client/ui/graphical/servlet/jresources Modified Files: RESOURCE.java Log Message: updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.13,1.14 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/01/03 19:24:15 1.13 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/03/15 16:22:38 1.14 @@ -19,17 +19,15 @@ import javax.servlet.http.HttpServletResponse; import org.biomoby.client.CentralDigestImpl; +import org.biomoby.client.CentralImpl; import org.biomoby.client.rdf.builder.ServiceInstanceRDF; import org.biomoby.client.rdf.vocabulary.Predicates; -import org.biomoby.client.rdf.vocabulary.XMLTypes; import org.biomoby.registry.definitions.types.JNamespacesSqlImpl; import org.biomoby.registry.definitions.types.JObjectsSqlImpl; import org.biomoby.registry.definitions.types.JServicesSqlImpl; -import org.biomoby.registry.properties.RegistryOS; +import org.biomoby.shared.Central; import org.biomoby.shared.CentralDigest; import org.biomoby.shared.MobyException; -import org.biomoby.shared.MobyNamespace; -import org.biomoby.shared.MobyPrimaryDataSimple; import org.biomoby.shared.MobyService; import org.w3c.rdf.model.ModelException; @@ -51,336 +49,352 @@ /** * * @author Eddie Kawas - *

This class was created to replace the old perl RESOURCES script. Using this - * class provides access to the RDF documents describing the object, service type, - * services, namespace and predicate ontologies. - *

if you have any questions, please email me at ed.kawas at gmail.com - * + *

+ * This class was created to replace the old perl RESOURCES script. + * Using this class provides access to the RDF documents describing the + * object, service type, services, namespace and predicate ontologies. + *

+ * if you have any questions, please email me at ed.kawas at gmail.com + * */ public class RESOURCE extends HttpServlet { - /** - * - */ - private static final long serialVersionUID = 1L; - - private static final String Four0FourError = "" - + "" - + "" - + "Apache Tomcat - Error report

HTTP Status 404 - Resource not found


type Status report

message The requested resource was not found.

description The requested resource () is not available.


 

"; - - - private static final String OBJ = "http://biomoby.org/RESOURCES/MOBY-S/Objects#"; - - private static final String SRV = "http://biomoby.org/RESOURCES/MOBY-S/Services#"; - - private static final String NS = "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; - - private static final String MP = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; - - private static final String SI = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; - - private static boolean RUN_MAIN = false; - - /* - * (non-Javadoc) - * - * @see javax.servlet.GenericServlet#init() - */ - public final void init() throws ServletException { - // super.init(); - // try to load environment variables set in context.xml - try { - Context c = new InitialContext(); - String MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); - String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); - String MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); - if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { - // set MOBY_CENTRAL_CONFIG - System.setProperty("MOBY_CENTRAL_CONFIG",MOBY_CENTRAL_CONFIG); - } - if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { - // set MOBY_SERVER - System.setProperty("MOBY_SERVER",MOBY_SERVER); - } - if (MOBY_URI != null && !MOBY_URI.equals("")) { - // set MOBY_URI - System.setProperty("MOBY_URI",MOBY_URI); - } - - } catch (Exception e) {} - } - - protected final void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - PrintWriter out = response.getWriter(); - String path = request.getPathInfo(); - Pattern p = Pattern.compile("/MOBY\\-S/(\\S+)"); - Matcher m = p.matcher(path); - if (path == null || !m.matches()) { - out - .println(" not MOBY-S

not MOBY-S

"); - return; - } else { - String ontology = m.group(1); - if (ontology.equals("Objects") || ontology.equals("Namespaces") - || ontology.equals("ServiceInstances") - || ontology.equals("FULL") || ontology.equals("Predicates") - || ontology.equals("Services")|| ontology.equals("ServiceDescription")) { - // generate rdf - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - if (ontology.equals("Objects")) { - try { - model = getObjects(model); - } catch (MobyException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get Objects"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Objects"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("Namespaces")) { - try { - model = getNamespaces(model); - } catch (MobyException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get Namespaces"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Namespaces"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("Services")) { - try { - model = getServices(model); - } catch (MobyException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get Services"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Service"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("ServiceInstances")) { - try { - model = getServiceInstances(model); - } catch (Exception e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get ServiceInstances"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=ServiceInstances"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } else if (ontology.equals("Predicates")) { - String s = getPredicates(); - - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=Predicates"); - out.write(s); - out.close(); - return; - } else if (ontology.equals("ServiceDescription")) { - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=ServiceDescription"); - out.write(serviceDescriptionVocabulary); - out.close(); - return; - } else if (ontology.equals("FULL")) { - try { - model = getAll(model); - } catch (Exception e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Could not get All"); - e.printStackTrace(); - return; - } - if (model == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST, - "Cound not create model"); - return; - } - response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", - "attachment;filename=All"); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "true"); - writer.write(model, out, null); - return; - } - } else { - // response.sendError(HttpServletResponse.SC_NOT_FOUND); - out.println(RESOURCE.Four0FourError); - return; - } - } - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model a model that we can add statements to. - * @return an rdf model that contains all of the moby objects. - * @throws MobyException - */ - public final Model getAll(Model model) throws Exception { - model = getObjects(model); - model = getServices(model); - model = getNamespaces(model); - // add the predicates to the model - RDFReader reader = model.getReader(); - reader.read(model, new ByteArrayInputStream(getPredicates().getBytes()), null); - try { - model = getServiceInstances(model); - } catch (ModelException e) { - e.printStackTrace(); - return null; - } - return model; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @return - * @throws ModelException - */ - private final Model getServiceInstances(Model model) throws Exception { - if (RUN_MAIN) { - createNsMap(model); - } - CentralDigest central = null; - MobyService[] services = null; - try { - // TODO should i make this more general by adding a parameter for the endpoint? - String registryURL; + /** + * + */ + private static final long serialVersionUID = 1L; + + private static final String Four0FourError = "" + + "" + + "" + + "Apache Tomcat - Error report

HTTP Status 404 - Resource not found


type Status report

message The requested resource was not found.

description The requested resource () is not available.


 

"; + + private static final String OBJ = "http://biomoby.org/RESOURCES/MOBY-S/Objects#"; + + private static final String SRV = "http://biomoby.org/RESOURCES/MOBY-S/Services#"; + + private static final String NS = "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"; + + private static final String MP = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#"; + + private static final String SI = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; + + private static boolean RUN_MAIN = false; + + /* + * (non-Javadoc) + * + * @see javax.servlet.GenericServlet#init() + */ + public final void init() throws ServletException { + // super.init(); + // try to load environment variables set in context.xml + System.out.println("init(setting environment variables)"); + try { + Context c = new InitialContext(); + + try { + String MOBY_CENTRAL_CONFIG = null; + MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG"); + if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) { + // set MOBY_CENTRAL_CONFIG + System.out.println("init(setting MOBY_CENTRAL_CONFIG)"); + System.setProperty("MOBY_CENTRAL_CONFIG", MOBY_CENTRAL_CONFIG); + } + + } catch (Exception ex) { + } + try { + String MOBY_SERVER = null; + MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER"); + if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) { + // set MOBY_SERVER + System.out.println("init(setting MOBY_SERVER)"); + System.setProperty("MOBY_SERVER", MOBY_SERVER); + } + } catch (Exception ex) { + } + + try { + String MOBY_URI = null; + MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI"); + if (MOBY_URI != null && !MOBY_URI.equals("")) { + // set MOBY_URI + System.out.println("init(setting MOBY_URI)"); + System.setProperty("MOBY_URI", MOBY_URI); + } + } catch (Exception ex) { + } + + } catch (Exception e) { + } + } + + protected final void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + PrintWriter out = response.getWriter(); + String path = request.getPathInfo(); + Pattern p = Pattern.compile("/MOBY\\-S/(\\S+)"); + Matcher m = p.matcher(path); + if (path == null || !m.matches()) { + out + .println(" not MOBY-S

not MOBY-S

"); + return; + } else { + String ontology = m.group(1); + if (ontology.equals("Objects") || ontology.equals("Namespaces") + || ontology.equals("ServiceInstances") || ontology.equals("FULL") + || ontology.equals("Predicates") || ontology.equals("Services") + || ontology.equals("ServiceDescription")) { + // generate rdf + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + if (ontology.equals("Objects")) { + try { + model = getObjects(model); + } catch (MobyException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get Objects"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Objects"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("Namespaces")) { + try { + model = getNamespaces(model); + } catch (MobyException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get Namespaces"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Namespaces"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("Services")) { + try { + model = getServices(model); + } catch (MobyException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get Services"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Service"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("ServiceInstances")) { + try { + model = getServiceInstances(model); + } catch (Exception e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Could not get ServiceInstances"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", + "attachment;filename=ServiceInstances"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } else if (ontology.equals("Predicates")) { + String s = getPredicates(); + + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=Predicates"); + out.write(s); + out.close(); + return; + } else if (ontology.equals("ServiceDescription")) { + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", + "attachment;filename=ServiceDescription"); + out.write(serviceDescriptionVocabulary); + out.close(); + return; + } else if (ontology.equals("FULL")) { + try { + model = getAll(model); + } catch (Exception e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Could not get All"); + e.printStackTrace(); + return; + } + if (model == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Cound not create model"); + return; + } + response.setContentType("application/rdf+xml"); + response.setHeader("Content-Disposition", "attachment;filename=All"); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "true"); + writer.write(model, out, null); + return; + } + } else { + // response.sendError(HttpServletResponse.SC_NOT_FOUND); + out.println(RESOURCE.Four0FourError); + return; + } + } + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * a model that we can add statements to. + * @return an rdf model that contains all of the moby objects. + * @throws MobyException + */ + public final Model getAll(Model model) throws Exception { + model = getObjects(model); + model = getServices(model); + model = getNamespaces(model); + // add the predicates to the model + RDFReader reader = model.getReader(); + reader.read(model, new ByteArrayInputStream(getPredicates().getBytes()), null); + try { + model = getServiceInstances(model); + } catch (ModelException e) { + e.printStackTrace(); + return null; + } + return model; + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @return + * @throws ModelException + */ + private final Model getServiceInstances(Model model) throws Exception { + if (RUN_MAIN) { + createNsMap(model); + } + + CentralDigest central = null; + MobyService[] services = null; + try { + String registryURL; String registryNamespace; - Map map = RegistryOS.getEnv(); - if (!map.isEmpty()) { - registryURL = (String) map.get("MOBY_SERVER"); - registryNamespace = (String) map.get("MOBY_URI"); + if (!System.getProperties().isEmpty()) { + registryURL = System.getProperty("MOBY_SERVER"); + registryNamespace = System.getProperty("MOBY_URI"); + System.out.println("System vars: " + registryURL + ", " + registryNamespace); if (registryURL == null) { // use default registry, since we dont have a local one central = new CentralDigestImpl(); @@ -389,723 +403,763 @@ central = new CentralDigestImpl(registryURL); } else { // use defined url and namespacce - central = new CentralDigestImpl(registryURL, - registryNamespace); + central = new CentralDigestImpl(registryURL, registryNamespace); } } else { - // use default registry since we cant determine if local one exists + // use default registry since we cant determine if local one + // exists central = new CentralDigestImpl(); } - services = central.getServices(); - } catch (MobyException e) { - e.printStackTrace(); - } - if (central == null || services == null) - throw new MobyException( - "Could not retrieve useful information from CentralDigestImpl().getServices(String)"); - return ServiceInstanceRDF.createRDFModel(model, services); - } - - private final Resource createSimpleDataItem(Model model, - MobyPrimaryDataSimple simpleData, Resource _li) { - _li.addProperty(RDF.type, Predicates.Simple); - _li.addProperty(Predicates.object_type, model.createResource(OBJ - + simpleData.getDataType().getName())); - if (!simpleData.getName().equals("")) - _li.addProperty(Predicates.articleName, model - .createTypedLiteral(simpleData.getName())); - MobyNamespace[] ns = null; - if ((ns = simpleData.getNamespaces()) != null) { - for (int k = 0; k < ns.length; k++) { - MobyNamespace mns = ns[k]; - _li.addProperty(Predicates.namespace_type, model - .createResource(NS + mns.getName())); - // .addProperty(RDF.type, RDFS.Class)); - } - } - return _li; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @return - * @throws MobyException - */ - private final Model getServices(Model model) throws MobyException { - - String[][] str = getTypes("Services"); - if (str.equals("")) { - return null; - } - if (RUN_MAIN) { - createNsMap(model); - } - Resource subject = _addClassResource(model, SRV, "Service", - "a base Service class, never instantiated"); - model.add(model.createStatement(subject, RDF.type, RDFS.Class)); - for (int i = 0; i < str.length; i++) { - String[] _line = str[i]; - String sub = _line[0]; - String pred = _line[1]; - String obj = _line[2]; - String def = _line[3]; - Matcher m; - m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - Resource _subject = _addClassResource(model, SRV, sub, def); - _addSubClass(model, _subject, SRV, obj); - } - } - return model; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @return - * @throws MobyException - */ - private final Model getNamespaces(Model model) throws MobyException { - String[][] str = getTypes("Namespaces"); - if (str == null) { - return null; - } - if (RUN_MAIN) { - createNsMap(model); - } - Resource subject = _addClassResource(model, NS, "Namespace", - "a base Namespace identifier, never instantiated"); - model.add(model.createStatement(subject, RDF.type, RDFS.Class)); - for (int x = 0; x < str.length; x++) { - String[] _line = str[x]; - String sub = _line[0]; - String def = ""; - if (_line.length > 1) - def = _line[1]; - Resource _subject = _addClassResource(model, NS, sub, def); - _addSubClass(model, _subject, NS, "Namespace"); - } - return model; - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @throws MobyException - */ - private final Model getObjects(Model model) throws MobyException { - String[][] str = getTypes("Objects"); - if (str == null) { - return null; - } - // add mobyPred prefix to model - if (RUN_MAIN) { - createNsMap(model); - } - // create the base object type "class" - Resource subject = _addClassResource(model, OBJ, "Object", - "a base object class consisting of a namespace and an identifier"); - model.add(model.createStatement(subject, DC.publisher, model - .createLiteral("www.illuminae.com", "en"))); - model.add(model.createStatement(subject, DC.creator, model - .createLiteral("markw at illuminae.com", "en"))); - - //model.add(model.createStatement(subject, RDFS.subClassOf, Predicates.DataComponent)); - for (int x = 0; x < str.length; x++) { - String[] _line = str[x]; - String sub, pred, obj, def, articlename = ""; - sub = _line[0]; - pred = _line[1]; - obj = _line[2]; - articlename = _line[3]; - def = _line[4]; - Matcher m; - if (articlename.indexOf("(") >= 0) - articlename = articlename.substring(articlename.indexOf("(")+1, articlename.indexOf(")")); - - Resource _subject = _addClassResource(model, OBJ, sub, def); - - m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - // System.out.println("is " +pred); - _addSubClass(model, _subject, OBJ, obj); - } - m = Pattern.compile(".*:hasa$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - // System.out.println("hasa " +pred); - Resource bnode = model.createResource(model.getProperty(OBJ - + obj)); - _addHasaHas(model, bnode, _subject, Predicates.hasa, OBJ, obj, - articlename); - } - m = Pattern.compile(".*:has$", Pattern.CASE_INSENSITIVE).matcher( - pred); - if (m.matches()) { - // System.out.println("has " + pred); - Resource bnode = model.createResource(model.getProperty(OBJ - + obj)); - _addHasaHas(model, bnode, _subject, Predicates.has, OBJ, obj, - articlename); - } - } - return model; - } - - private final void createNsMap(Model model) { - Map map = model.getNsPrefixMap(); - map.put("moby", Predicates.getURI()); - map.put("mobyObject", OBJ); - map.put("serviceInstances", SI); - map.put("mobyNamespace", NS); - map.put("mobyService", SRV); - model.setNsPrefixes(map); - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @param _resource - * @param subject - * @param mp2 - * @param string - * @param obj2 - * @param obj3 - * @param articlename - */ - private final void _addHasaHas(Model model, Resource bnode, - Resource subject, Property prop, String objNS, String object, - String articlename) { - Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); - Matcher m = p.matcher(object); - object = (m.matches() ? m.group(1) : object); - Resource resource = model.createResource(objNS + object); - model.add(model.createStatement(subject, prop, bnode)); - model.add(model.createStatement(bnode, Predicates.articleName, model - .createLiteral(articlename, "en"))); - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @param mp2 - * @param bnode - * @param string - * @param articlename - */ - private final void _addClassLiteral(Model model, String pns, - Resource subject, String predicate, String value) { - - } - - /** - * PRE: - *

- * POST: - *

- * - * @param model - * @param subject - * @param obj2 - * @param obj3 - */ - private final void _addSubClass(Model model, Resource subject, - String objNS, String object) { - Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); - Matcher m = p.matcher(object); - object = (m.matches() ? m.group(1) : object); - Resource resource = model.createResource(objNS + object); - model.add(model.createStatement(subject, RDFS.subClassOf, resource)); - } - - private final Resource _addClassResource(Model model, String ns, - String thing, String def) { - Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); - Matcher m = p.matcher(thing); - String label = (m.matches() ? m.group(1) : thing); - Resource resource = model.createResource(ns + thing); - //addOfTypeProperty(model, resource, thing); - model.add(model.createStatement(resource, RDF.type, RDFS.Class)); - model.add(model.createStatement(resource, RDFS.label, model - .createLiteral(label, "en"))); - model.add(model.createStatement(resource, RDFS.comment, model - .createLiteral(def, "en"))); - return resource; - } - - /** - * @param model - * @param resource - * @param thing - */ - private void addOfTypeProperty(Model model, Resource resource, String name) { - // make sure that we declare the ns for the datatype - Map map = model.getNsPrefixMap(); - if (!map.containsValue(XMLTypes.getURI())) { - map.put(XMLTypes.getPrefix(), XMLTypes.getURI()); - } - model.setNsPrefixes(map); - if (name.equalsIgnoreCase("string")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_STRING)); - } else if (name.equalsIgnoreCase("integer")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_INTEGER)); - } else if (name.equalsIgnoreCase("float")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_FLOAT)); - } else if (name.equalsIgnoreCase("datatime")) { - model.add(model.createStatement(resource, Predicates.ofType, - XMLTypes.XSD_DATE_TIME)); - } - } - - private final String[][] getTypes(String type) throws MobyException { - if (type.equalsIgnoreCase("objects")) { - try { - return new JObjectsSqlImpl().getObjectsAsArray(); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (type.equalsIgnoreCase("services")) { - try { - return new JServicesSqlImpl().getServicesAsArray(); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (type.equalsIgnoreCase("namespaces")) { - try { - return new JNamespacesSqlImpl().getNamespacesAsArray(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return null; - } - - /* - * - */ - private String getURL(String url) { - StringBuffer sb = new StringBuffer(); - try { - URL _url = new URL(url); - BufferedReader in = new BufferedReader(new InputStreamReader(_url - .openStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) - sb.append(inputLine + "\n"); - in.close(); - } catch (Exception e) { - e.printStackTrace(); - System.err.println("Could not retrieve contents of URL."); - } - return sb.toString(); - } - - protected final void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.GenericServlet#getServletInfo() - */ - public final String getServletInfo() { - return "jRESOURCE - JAVA implementation of the old /RESOURCES/ perl script by Edward Kawas"; - } - - private final String getObjects() throws MobyException { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - model = getObjects(model); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - private final String getNamespaces() throws MobyException { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - model = getNamespaces(model); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - private final String getServices() throws MobyException { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - model = getServices(model); - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - private final String getServiceInstances() { - Model model = ModelFactory.createDefaultModel(); - createNsMap(model); - try { - model = getServiceInstances(model); - } catch (Exception e) { - e.printStackTrace(); - return ""; - } - RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); - writer.setProperty("showXmlDeclaration", "false"); - StringWriter out = new StringWriter(); - writer.write(model, out, null); - return out.getBuffer().toString(); - } - - /** - * - * @param str - * @return an RDF document describing the ontology represented by str. - * @throws MobyException - */ - public final String getRESOURCES(String str) throws MobyException { - String name = ""; - if (str.lastIndexOf("/") > 0) { - // this is a url - name = str.substring(str.lastIndexOf("/") + 1); - } else - name = str; - - if (name.equalsIgnoreCase("Objects")) { - return getObjects(); - } else if (name.equalsIgnoreCase("Services")) { - return getServices(); - } else if (name.equalsIgnoreCase("ServiceInstances")) { - return getServiceInstances(); - } else if (name.equalsIgnoreCase("Namespaces")) { - return getNamespaces(); - } else if (name.equalsIgnoreCase("Predicates")) { - return getPredicates(); - } - - return ""; - } - - private String getPredicates() { - StringBuffer buffer = new StringBuffer(); - buffer.append( - "" + System.getProperty("line.separator") + ""); - // add the predicates here - buffer.append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "The BioMoby Predicates Vocabulary (moby)", - "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the moby namespace.")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#hasa", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "hasa","The subject contains exactly one object.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#has", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "has","The subject contains one or more object.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "articleName","Uses a non-controlled vocabulary to describe the intended semantic relationship between the Subject node, and the node in which the Subject is associated through a HAS or HASA relationship.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#componentName", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "componentName","The subject is known to be named object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#namespace_type", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "namespace_type","The subject resource is applicable under the object namespace.", - "http://www.w3.org/2000/01/rdf-schema#Class", //TODO - namespace? - "http://www.w3.org/2000/01/rdf-schema#Resource")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#object_type", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "object_type","The subject resource is a resource object.", - "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", - "http://www.w3.org/2000/01/rdf-schema#Resource")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#consumes", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "consumes","The subject container takes as input object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#produces", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "produces","The subject container produces as output object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#performs_task", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "performs_task","The subject performs the task of the object resource.", - "http://www.w3.org/2000/01/rdf-schema#Class", //TODO servicetype? - "http://www.w3.org/2000/01/rdf-schema#Resource")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#default_value", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "default_value","The subject has a default value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#min", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "min","The subject has a minimum value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#max", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "max","The subject has a maximum value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#enum", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "enum","The subject may assume the value of object.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#datatype", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "datatype","Idiomatic property used for structured values.", - "http://www.w3.org/2001/XMLSchema#type", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#signatureURL", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "signatureURL","Object is a URL that contains information on the subject.", - "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#", //TODO - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#authoritative", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "authoritative","The object states whether the subject is authoritative.", - "http://www.w3.org/2000/01/rdf-schema#Class", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#ofType", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "ofType","The subject is of primitive type object.", - "http://www.w3.org/2000/01/rdf-schema#Class", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleInputData", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "sampleInputData","Object is a sample of valid input that subject can handle.", - "http://www.w3.org/2000/01/rdf-schema#Property", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleOutputData", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "sampleOutputData","Object is a sample of valid output created by running the subject.", - "http://www.w3.org/2000/01/rdf-schema#Property", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#approvedBy", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "approvedBy","The subject has been approved by object.", - "http://www.w3.org/2000/01/rdf-schema#Property", - "http://www.w3.org/2000/01/rdf-schema#Literal")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Simple", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "Simple","A class representing a simple input or output.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "Secondary","A class representing a secondary input.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Collection", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "Collection","A container for objects representing Simples.", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "mobyThing","NOT SURE", - "http://www.w3.org/2000/01/rdf-schema#Class")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "MobyMessageComponent","NOT SURE", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "DataComponent","NOT SURE", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); - - buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#StructuralComponent", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", - "StructuralComponent","NOT SURE", - "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); - - - // end the addition of predicates here - buffer.append( - "" + System.getProperty("line.separator") + "" + - ""); - return buffer.toString(); - } - - private String createPropertyBlock(String about, String definedBy, - String label, String comment, String domain, String range) { - String s = - "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - " " + label + "" + System.getProperty("line.separator") + "" + - " " + comment + "" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - "" + System.getProperty("line.separator") + ""; - return s; - } - - private String createClassBlock(String about, String definedBy, - String label, String comment, String subClassOf) { - String s = - "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - " "+ label +"" + System.getProperty("line.separator") + "" + - " "+ comment +"" + System.getProperty("line.separator") + "" + - " " + System.getProperty("line.separator") + "" + - "" + System.getProperty("line.separator") + ""; - return s; - } - - private String createDescriptionBlock(String about, String[] seeAlsos) { - if (seeAlsos == null) - return "" + System.getProperty("line.separator") + ""; - StringBuffer sb = new StringBuffer(); - sb.append(" " + System.getProperty("line.separator") + ""); - for (int x = 0; x < seeAlsos.length; x++) { - sb.append(" " + System.getProperty("line.separator") + ""); - } - sb.append("" + System.getProperty("line.separator") + ""); - return sb.toString(); - } - - private String createOntologyBlock(String about, String title, - String description) { - String s ="" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + " " + title + "" + System.getProperty("line.separator") + "" - + " " + description + "" + System.getProperty("line.separator") + "" - + "" + System.getProperty("line.separator") + ""; - return s; - } - - private String createEscapedComment(String comment) { - String s = "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + ""; - return s; - } - - public static void main(String[] args) throws Exception { - System.out.println(new RESOURCE().getRESOURCES("ServiceInstances")); - } - - private final String serviceDescriptionVocabulary = "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "]>" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - " " + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - "" + System.getProperty("line.separator") + - ""; + services = central.getServices(); + } catch (MobyException e) { + e.printStackTrace(); + } + if (central == null || services == null) + throw new MobyException( + "Could not retrieve useful information from CentralDigestImpl().getServices(String)"); + return ServiceInstanceRDF.createRDFModel(model, services); + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @return + * @throws MobyException + */ + private final Model getServices(Model model) throws MobyException { + + String[][] str = getTypes("Services"); + if (str.equals("")) { + return null; + } + if (RUN_MAIN) { + createNsMap(model); + } + Resource subject = _addClassResource(model, "Service", + "urn:lsid:biomoby.org:servicetype:Service:2001-09-21T16-00-00Z", + "a base Service class, never instantiated", "openinformatics.com", + "markw at illuminae.com"); + model.add(model.createStatement(subject, RDF.type, RDFS.Class)); + for (int i = 0; i < str.length; i++) { + String[] _line = str[i]; + String sub, pred, obj, def, lsid, authority, email, obj_lsid; + if (_line.length > 7) { + sub = _line[0]; + pred = _line[1]; + obj = _line[2]; + def = _line[3]; + lsid = _line[4]; + authority = _line[5]; + email = _line[6]; + obj_lsid = _line[7]; + } else { + continue; + } + Matcher m; + m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // service types only have isa relationships and every service + // type has a parent, except the base service Service + Resource _subject = _addClassResource(model, sub, lsid, def, authority, email); + _addSubClass(model, _subject, obj_lsid); + } + } + return model; + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @return + * @throws MobyException + */ + private final Model getNamespaces(Model model) throws MobyException { + String[][] str = getTypes("Namespaces"); + if (str == null) { + return null; + } + if (RUN_MAIN) { + createNsMap(model); + } + Resource subject = _addClassResource(model, "Namespace", NS + "Namespace", + "a base Namespace identifier, never instantiated", null, null); + model.add(model.createStatement(subject, RDF.type, RDFS.Class)); + for (int x = 0; x < str.length; x++) { + String[] _line = str[x]; + String sub = _line[0]; + String def = ""; + String lsid = ""; + String authority = ""; + String email = ""; + if (_line.length > 4) { + def = _line[1]; + lsid = _line[2]; + authority = _line[3]; + email = _line[4]; + } else { + continue; + } + Resource _subject = _addClassResource(model, sub, lsid, def, authority, email); + _addSubClass(model, _subject, NS + "Namespace"); + } + return model; + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @throws MobyException + */ + private final Model getObjects(Model model) throws MobyException { + String[][] str = getTypes("Objects"); + if (str == null) { + return null; + } + // add mobyPred prefix to model + if (RUN_MAIN) { + createNsMap(model); + } + // create the base object type "class" + Resource subject = _addClassResource(model, "Object", + "urn:lsid:biomoby.org:objectclass:Object", + "a base object class consisting of a namespace and an identifier", + "openinformatics.com", "jason at openinformatics.com"); + + for (int x = 0; x < str.length; x++) { + String[] _line = str[x]; + String sub = "", pred = "", obj = "", def = "", articlename = "", lsid = "", authority = "", email = "", obj_lsid = ""; + Matcher m; + if (_line.length > 8) { + sub = _line[0]; + pred = _line[1]; + obj = _line[2]; + articlename = _line[3]; + def = _line[4]; + lsid = _line[5]; + authority = _line[6]; + email = _line[7]; + obj_lsid = _line[8]; + + if (articlename.indexOf("(") >= 0) + articlename = articlename.substring(articlename.indexOf("(") + 1, articlename + .indexOf(")")); + + } else { + continue; + } + Resource _subject = _addClassResource(model, sub, lsid, def, authority, email); + + m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // System.out.println("is " +pred); + _addSubClass(model, _subject, obj_lsid); + } + m = Pattern.compile(".*:hasa$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // System.out.println("hasa " +pred); + Resource bnode = model.createResource(model.getProperty(OBJ + obj)); + _addHasaHas(model, bnode, _subject, Predicates.hasa, OBJ, obj, articlename); + } + m = Pattern.compile(".*:has$", Pattern.CASE_INSENSITIVE).matcher(pred); + if (m.matches()) { + // System.out.println("has " + pred); + Resource bnode = model.createResource(model.getProperty(OBJ + obj)); + _addHasaHas(model, bnode, _subject, Predicates.has, OBJ, obj, articlename); + } + } + return model; + } + + private final void createNsMap(Model model) { + Map map = model.getNsPrefixMap(); + map.put("moby", Predicates.getURI()); + map.put("mobyObject", OBJ); + map.put("serviceInstances", SI); + map.put("mobyNamespace", NS); + map.put("mobyService", SRV); + model.setNsPrefixes(map); + } + + /** + * PRE: + *

+ * POST: + *

+ * + * @param model + * @param _resource + * @param subject + * @param mp2 + * @param string + * @param obj2 + * @param obj3 + * @param articlename + */ + private final void _addHasaHas(Model model, Resource bnode, Resource subject, Property prop, + String objNS, String object, String articlename) { + Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$"); + Matcher m = p.matcher(object); + object = (m.matches() ? m.group(1) : object); + Resource resource = model.createResource(objNS + object); + model.add(model.createStatement(subject, prop, bnode)); + model.add(model.createStatement(bnode, Predicates.articleName, model.createLiteral( + articlename, "en"))); + } + + private final void _addSubClass(Model model, Resource subject, String lsid) { + Resource resource = model.createResource(lsid); + model.add(model.createStatement(subject, RDFS.subClassOf, resource)); + } + + /* + * TODO + */ + private final Resource _addClassResource(Model model, String label, String lsid, String def, + String authority, String email) { + Resource resource = model.createResource(lsid); + // addOfTypeProperty(model, resource, thing); + model.add(model.createStatement(resource, RDF.type, RDFS.Class)); + model.add(model.createStatement(resource, RDFS.label, model.createLiteral(label))); + model.add(model.createStatement(resource, RDFS.comment, model.createLiteral(def, "en"))); + // add email and authority + if (email != null && !email.equals("")) + model.add(model.createStatement(resource, DC.creator, model.createLiteral(email))); + if (authority != null && !authority.equals("")) + model + .add(model.createStatement(resource, DC.publisher, model + .createLiteral(authority))); + return resource; + } + + private final String[][] getTypes(String type) throws MobyException { + if (type.equalsIgnoreCase("objects")) { + try { + return new JObjectsSqlImpl().getFullObjectsAsArray(); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (type.equalsIgnoreCase("services")) { + try { + return new JServicesSqlImpl().getFullServicesAsArray(); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (type.equalsIgnoreCase("namespaces")) { + try { + return new JNamespacesSqlImpl().getFullNamespacesAsArray(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /* + * + */ + private String getURL(String url) { + StringBuffer sb = new StringBuffer(); + try { + URL _url = new URL(url); + BufferedReader in = new BufferedReader(new InputStreamReader(_url.openStream())); + String inputLine; + while ((inputLine = in.readLine()) != null) + sb.append(inputLine + "\n"); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("Could not retrieve contents of URL."); + } + return sb.toString(); + } + + protected final void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.GenericServlet#getServletInfo() + */ + public final String getServletInfo() { + return "jRESOURCE - JAVA implementation of the old /RESOURCES/ perl script by Edward Kawas"; + } + + private final String getObjects() throws MobyException { + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + model = getObjects(model); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + private final String getNamespaces() throws MobyException { + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + model = getNamespaces(model); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + private final String getServices() throws MobyException { + Model model = ModelFactory.createDefaultModel(); + createNsMap(model); + model = getServices(model); + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + private final String getServiceInstances() { + Model model = ModelFactory.createDefaultModel(); + try { + model = getServiceInstances(model); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + StringWriter out = new StringWriter(); + writer.write(model, out, null); + return out.getBuffer().toString(); + } + + /** + * + * @param str + * @return an RDF document describing the ontology represented by str. + * @throws MobyException + */ + public final String getRESOURCES(String str) throws MobyException { + String name = ""; + if (str.lastIndexOf("/") > 0) { + // this is a url + name = str.substring(str.lastIndexOf("/") + 1); + } else + name = str; + + if (name.equalsIgnoreCase("Objects")) { + return getObjects(); + } else if (name.equalsIgnoreCase("Services")) { + return getServices(); + } else if (name.equalsIgnoreCase("ServiceInstances")) { + return getServiceInstances(); + } else if (name.equalsIgnoreCase("Namespaces")) { + return getNamespaces(); + } else if (name.equalsIgnoreCase("Predicates")) { + return getPredicates(); + } + + return ""; + } + + private String getPredicates() { + StringBuffer buffer = new StringBuffer(); + buffer + .append("" + + System.getProperty("line.separator") + ""); + // add the predicates here + buffer + .append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#", + "The BioMoby Predicates Vocabulary (moby)", + "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the moby namespace.")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#hasa", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "hasa", + "The subject contains exactly one object.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#has", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "has", + "The subject contains one or more object.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object")); + + buffer + .append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", + "articleName", + "Uses a non-controlled vocabulary to describe the intended semantic relationship between the Subject node, and the node in which the Subject is associated through a HAS or HASA relationship.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#componentName", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "componentName", + "The subject is known to be named object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#namespace_type", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "namespace_type", + "The subject resource is applicable under the object namespace.", + "http://www.w3.org/2000/01/rdf-schema#Class", // TODO - + // namespace? + "http://www.w3.org/2000/01/rdf-schema#Resource")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#object_type", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "object_type", + "The subject resource is a resource object.", + "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object", + "http://www.w3.org/2000/01/rdf-schema#Resource")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#consumes", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "consumes", + "The subject container takes as input object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#produces", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "produces", + "The subject container produces as output object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#performs_task", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "performs_task", + "The subject performs the task of the object resource.", + "http://www.w3.org/2000/01/rdf-schema#Class", // TODO + // servicetype? + "http://www.w3.org/2000/01/rdf-schema#Resource")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#default_value", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "default_value", + "The subject has a default value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#min", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "min", + "The subject has a minimum value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#max", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "max", + "The subject has a maximum value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#enum", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "enum", + "The subject may assume the value of object.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#datatype", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "datatype", + "Idiomatic property used for structured values.", + "http://www.w3.org/2001/XMLSchema#type", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#signatureURL", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "signatureURL", + "Object is a URL that contains information on the subject.", + "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#", // TODO + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#authoritative", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "authoritative", + "The object states whether the subject is authoritative.", + "http://www.w3.org/2000/01/rdf-schema#Class", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#ofType", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "ofType", + "The subject is of primitive type object.", + "http://www.w3.org/2000/01/rdf-schema#Class", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleInputData", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "sampleInputData", + "Object is a sample of valid input that subject can handle.", + "http://www.w3.org/2000/01/rdf-schema#Property", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleOutputData", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "sampleOutputData", + "Object is a sample of valid output created by running the subject.", + "http://www.w3.org/2000/01/rdf-schema#Property", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createPropertyBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#approvedBy", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "approvedBy", + "The subject has been approved by object.", + "http://www.w3.org/2000/01/rdf-schema#Property", + "http://www.w3.org/2000/01/rdf-schema#Literal")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Simple", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "Simple", + "A class representing a simple input or output.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "Secondary", + "A class representing a secondary input.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Collection", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "Collection", + "A container for objects representing Simples.", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent")); + + buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "mobyThing", "NOT SURE", + "http://www.w3.org/2000/01/rdf-schema#Class")); + + buffer.append(createClassBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "MobyMessageComponent", + "NOT SURE", "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing")); + + buffer.append(createClassBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "DataComponent", "NOT SURE", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); + + buffer.append(createClassBlock( + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#StructuralComponent", + "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "StructuralComponent", + "NOT SURE", "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent")); + + // end the addition of predicates here + buffer.append("" + System.getProperty("line.separator") + "" + ""); + return buffer.toString(); + } + + private String createPropertyBlock(String about, String definedBy, String label, + String comment, String domain, String range) { + String s = "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + " " + label + + "" + System.getProperty("line.separator") + "" + " " + + comment + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + " " + System.getProperty("line.separator") + "" + "" + + System.getProperty("line.separator") + ""; + return s; + } + + private String createClassBlock(String about, String definedBy, String label, String comment, + String subClassOf) { + String s = "" + System.getProperty("line.separator") + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + " " + label + + "" + System.getProperty("line.separator") + "" + " " + + comment + "" + System.getProperty("line.separator") + "" + + " " + + System.getProperty("line.separator") + "" + "" + + System.getProperty("line.separator") + ""; + return s; + } + + private String createDescriptionBlock(String about, String[] seeAlsos) { + if (seeAlsos == null) + return "" + System.getProperty("line.separator") + ""; + StringBuffer sb = new StringBuffer(); + sb.append(" " + + System.getProperty("line.separator") + ""); + for (int x = 0; x < seeAlsos.length; x++) { + sb.append(" " + + System.getProperty("line.separator") + ""); + } + sb.append("" + System.getProperty("line.separator") + ""); + return sb.toString(); + } + + private String createOntologyBlock(String about, String title, String description) { + String s = "" + System.getProperty("line.separator") + "" + + System.getProperty("line.separator") + "" + " " + title + + "" + System.getProperty("line.separator") + "" + " " + + description + "" + System.getProperty("line.separator") + "" + + "" + System.getProperty("line.separator") + ""; + return s; + } + + private String createEscapedComment(String comment) { + String s = "" + System.getProperty("line.separator") + "" + + System.getProperty("line.separator") + ""; + return s; + } + + public static void main(String[] args) throws Exception { + CentralDigest central = new CentralDigestImpl( + "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl"); + MobyService[] services = central.getServices(); + + Model m = ServiceInstanceRDF.createRDFModel(ModelFactory.createDefaultModel(), services); + RDFWriter writer = m.getWriter("RDF/XML-ABBREV"); + writer.setProperty("showXmlDeclaration", "false"); + writer.setProperty("tab", "5"); + writer.write(m, System.out, null); + } + + private final String serviceDescriptionVocabulary = "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "]>" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + " " + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + + "" + + System.getProperty("line.separator") + ""; } \ No newline at end of file From kawas at pub.open-bio.org Wed Mar 15 17:28:15 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 12:28:15 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603151728.k2FHSFCN032473@pub.open-bio.org> kawas Wed Mar 15 12:28:15 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory pub.open-bio.org:/tmp/cvs-serv32436/org/biomoby/shared/extended Modified Files: NamespaceParser.java DataTypeParser.java ServiceInstanceParser.java ServiceTypeParser.java Log Message: Added support for LSIDs with versioning information. moby-live/Java/src/main/org/biomoby/shared/extended NamespaceParser.java,1.4,1.5 DataTypeParser.java,1.3,1.4 ServiceInstanceParser.java,1.10,1.11 ServiceTypeParser.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2006/02/16 18:28:15 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2006/03/15 17:28:15 1.5 @@ -17,6 +17,8 @@ import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -156,8 +158,15 @@ while (iterator.hasNext()) { Resource resource = iterator.nextResource(); // extract the name of the namespace - String name = resource.getLocalName(); + LSID lsid = null; + try { + lsid = new LSID(resource.getURI()); + } catch (MalformedLSIDException e) { + throw new MobyException("Expected an LSID as a URI, instead got " + resource.getURI()+ " " + e.getLocalizedMessage()); + } + String name = lsid.getObject(); MobyNamespace namespace = new MobyNamespace(name); + namespace.setLSID(lsid.getLsid()); // extract the comment (a literal in the document) String description = resource.getProperty(RDFS.comment).getLiteral().getString(); namespace.setDescription(description); @@ -191,7 +200,7 @@ public static void main(String[] args) throws MobyException { // show how to use this class - NamespaceParser p = new NamespaceParser("http://biomoby.org/RESOURCES/MOBY-S/Namespaces"); + NamespaceParser p = new NamespaceParser("http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/Namespaces"); MobyNamespace[] namespaces = p.getMobyNamespacesFromRDF(); for (int i = 0; i < namespaces.length; i++) { System.out.println(namespaces[i]); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.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/shared/extended/DataTypeParser.java 2006/02/16 18:28:15 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2006/03/15 17:28:15 1.4 @@ -22,6 +22,8 @@ import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -157,20 +159,28 @@ Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); reader.read(model, new StringReader(getRdfAsString()), null); - // TODO start querying the model and creating Data Type objects ResIterator iterator = model.listSubjects(); while (iterator.hasNext()) { Resource resource = iterator.nextResource(); - String name = resource.getLocalName(); - if (name == null) + + if (resource.getLocalName() == null) continue; + + LSID lsid = null; + try { + lsid = new LSID(resource.getURI()); + } catch (MalformedLSIDException e) { + throw new MobyException("Expected an LSID as a URI, instead got " + resource.getURI()+ " " + e.getLocalizedMessage()); + } + String name = lsid.getObject(); String parent = null; if (resource.hasProperty(RDFS.subClassOf)) { - parent = ((Resource)resource.getProperty(RDFS.subClassOf).getObject()).getLocalName(); + parent = ((Resource)resource.getProperty(RDFS.subClassOf).getObject()).getURI(); } String description = resource.getProperty(RDFS.comment).getLiteral().getString(); // create the base datatype without container relationships MobyDataType datatype = new MobyDataType(name); + datatype.setLSID(lsid.getLsid()); datatype.setComment(description); datatype.setParentNames((parent == null ? new String[0] : new String[]{parent})); // now add the container relationships @@ -216,7 +226,7 @@ return sb.toString(); } public static void main(String[] args) throws MobyException { - DataTypeParser d = new DataTypeParser("http://biomoby.org/RESOURCES/MOBY-S/Objects"); + DataTypeParser d = new DataTypeParser("http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/Objects"); MobyDataType[] types = d.getMobyDataTypesFromRDF(); for (int i = 0; i < types.length; i++) { System.out.println(types[i]); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.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/shared/extended/ServiceInstanceParser.java 2006/02/27 22:46:45 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/03/15 17:28:15 1.11 @@ -42,25 +42,25 @@ * An example of how to use this class is below: * *


- *          import org.biomoby.shared.MobyService;
- *          import org.biomoby.shared.Utils;
- *          import org.biomoby.shared.extended.ServiceInstanceParser;
- *          
- *          ...
- *                
- *                     ServiceInstanceParser p = new ServiceInstanceParser(
- *    				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
- *    		MobyService[] services = p.getMobyServicesFromRDF();
- *    		if (!p.isRDFValid()) {
- *    			System.out.println("One or more services in the RDF were invalid");
- *    			System.out.println("The errors are the following:");
- *    			System.out.println(Utils.format(p.getErrors(),2));
- *    			
- *     		}
- *    		System.out.println("The valid services are:");
- *    		for (int i = 0; i < services.length; i++) {
- *    			System.out.println((services[i]));
- *    		}
+ *            import org.biomoby.shared.MobyService;
+ *            import org.biomoby.shared.Utils;
+ *            import org.biomoby.shared.extended.ServiceInstanceParser;
+ *            
+ *            ...
+ *                  
+ *                       ServiceInstanceParser p = new ServiceInstanceParser(
+ *      				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
+ *      		MobyService[] services = p.getMobyServicesFromRDF();
+ *      		if (!p.isRDFValid()) {
+ *      			System.out.println("One or more services in the RDF were invalid");
+ *      			System.out.println("The errors are the following:");
+ *      			System.out.println(Utils.format(p.getErrors(),2));
+ *      			
+ *       		}
+ *      		System.out.println("The valid services are:");
+ *      		for (int i = 0; i < services.length; i++) {
+ *      			System.out.println((services[i]));
+ *      		}
  * 
* *

@@ -206,7 +206,8 @@ name = resource.getProperty(FetaVocabulary.hasServiceNameText) .getObject().toString(); MobyService service = new MobyService(name); - + // set the lsid + service.setLSID(resource.getURI()); // get the signatureURL String signatureURL = ""; if (resource @@ -300,326 +301,357 @@ Map outputCollectionMap = new HashMap(); // is the current service bad? while (inputs.hasNext()) { - + Resource parameter = (Resource) inputs.nextStatement() .getObject(); - if (parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().getProperty(RDF.type).getObject() - .toString().endsWith("simpleParameter")) { - // we have a simple - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " + service.getName() - + " was missing an object type}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - currentlyBad = true; - success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " + service.getName() - + " was missing an article name}"); - errors.append(newline); - continue; - } - - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " + service.getName() - + " was missing a non empty article name}"); - errors.append(newline); - continue; - } - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); + if (!parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().hasProperty(RDF.type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " did not have a parameter type of type RDF:type}"); + errors.append(newline); + continue; + } else { + if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("simpleParameter")) { + // we have a simple + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " was missing an object type}"); + errors.append(newline); + continue; } - } - MobyPrimaryDataSimple primaryInput = new MobyPrimaryDataSimple(); - primaryInput.setDataType(new MobyDataType(datatype)); - primaryInput.setName(articlename); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryInput.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + currentlyBad = true; + success = false; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " was missing an article name}"); + errors.append(newline); + continue; } - } - service.addInput(primaryInput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("collectionParameter")) { - // we have a collection - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - currentlyBad = true; - success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() - + " was missing an object type.}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection for service " - + service.getName() - + " was missing an article name.}"); - errors.append(newline); - continue; - } - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() - + " was missing a non empty article name.}"); - errors.append(newline); - continue; - } - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Input for service " + + service.getName() + + " was missing a non empty article name}"); + errors.append(newline); + continue; } - } - - MobyPrimaryDataSet collection = null; - if (inputCollectionMap.containsKey(articlename)) { - collection = (MobyPrimaryDataSet) inputCollectionMap - .get(articlename); - } else - collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple input = new MobyPrimaryDataSimple( - ""); - input.setDataType(new MobyDataType(datatype)); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - input.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + MobyPrimaryDataSimple primaryInput = new MobyPrimaryDataSimple(); + primaryInput + .setDataType(new MobyDataType(datatype)); + primaryInput.setName(articlename); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + primaryInput + .addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } + } + service.addInput(primaryInput); + } else if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("collectionParameter")) { + // we have a collection + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + currentlyBad = true; + success = false; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection input for service " + + service.getName() + + " was missing an object type.}"); + errors.append(newline); + continue; } - } - collection.addElement(input); - inputCollectionMap.put(articlename, collection); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("secondaryParameter")) { - // we have a secondary - if (!parameter - .hasProperty(ServiceDescriptionPredicates.datatype)) { - currentlyBad = true; - success = false; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing moby datatype" - + " (one of String, Float, Integer, DateTime).}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing an article name.}"); - errors.append(newline); - continue; - } - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.datatype) - .getLiteral().getValue().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype - .substring(datatype.indexOf("#") + 1); - if (datatype.indexOf(":") > 0) - datatype = datatype - .substring(datatype.indexOf(":") + 1); - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getLiteral().getValue().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing a non empty article name.}"); - errors.append(newline); - continue; - } - - // create the datatype - MobySecondaryData secondary = new MobySecondaryData( - articlename); - secondary.setDataType(datatype); - - if (parameter - .hasProperty(FetaVocabulary.hasDefaultValue)) { - secondary.setDefaultValue(parameter.getProperty( - FetaVocabulary.hasDefaultValue) - .getLiteral().getValue().toString()); - } - // process the description - if (parameter - .hasProperty(ServiceDescriptionPredicates.secondary_description)) { - secondary.setDescription(parameter.getProperty( - ServiceDescriptionPredicates.secondary_description) - .getLiteral().getValue().toString()); - } - - if (parameter - .hasProperty(ServiceDescriptionPredicates.max)) { - try { - secondary - .setMaximumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.max) - .getLiteral() - .getValue().toString())); - } catch (NumberFormatException e) { + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection for service " + + service.getName() + + " was missing an article name.}"); + errors.append(newline); + continue; + } + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { success = false; currentlyBad = true; errors .append(service.getName() + "," + service.getAuthority() - + "{Invalid maximum value for secondary input.}"); + + "{Collection input for service " + + service.getName() + + " was missing a non empty article name.}"); errors.append(newline); continue; } - } - if (parameter - .hasProperty(ServiceDescriptionPredicates.min)) { - try { - secondary - .setMinimumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.min) - .getLiteral() - .getValue().toString())); - } catch (NumberFormatException e) { + + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + + MobyPrimaryDataSet collection = null; + if (inputCollectionMap.containsKey(articlename)) { + collection = (MobyPrimaryDataSet) inputCollectionMap + .get(articlename); + } else + collection = new MobyPrimaryDataSet(articlename); + MobyPrimaryDataSimple input = new MobyPrimaryDataSimple( + ""); + input.setDataType(new MobyDataType(datatype)); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + input.addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } + } + collection.addElement(input); + inputCollectionMap.put(articlename, collection); + } else if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("secondaryParameter")) { + // we have a secondary + if (!parameter + .hasProperty(ServiceDescriptionPredicates.datatype)) { + currentlyBad = true; + success = false; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid secondary input found. Missing moby datatype" + + " (one of String, Float, Integer, DateTime).}"); + errors.append(newline); + continue; + } + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; errors .append(service.getName() + "," + service.getAuthority() - + "{Invalid minimum value for secondary input.}"); + + "{Invalid secondary input found. Missing an article name.}"); errors.append(newline); continue; } - } - if (parameter - .hasProperty(ServiceDescriptionPredicates.enumeration)) { - StmtIterator enumerations = parameter - .listProperties(ServiceDescriptionPredicates.enumeration); - while (enumerations.hasNext()) { - secondary.addAllowedValue(enumerations - .nextStatement().getLiteral() - .getValue().toString()); + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.datatype) + .getLiteral().getValue().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .indexOf("#") + 1); + if (datatype.indexOf(":") > 0) + datatype = datatype.substring(datatype + .indexOf(":") + 1); + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getLiteral().getValue().toString(); + if (articlename.equals("")) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid secondary input found. Missing a non empty article name.}"); + errors.append(newline); + continue; } + + // create the datatype + MobySecondaryData secondary = new MobySecondaryData( + articlename); + secondary.setDataType(datatype); + + if (parameter + .hasProperty(FetaVocabulary.hasDefaultValue)) { + secondary.setDefaultValue(parameter + .getProperty( + FetaVocabulary.hasDefaultValue) + .getLiteral().getValue().toString()); + } + // process the description + if (parameter + .hasProperty(ServiceDescriptionPredicates.secondary_description)) { + secondary + .setDescription(parameter + .getProperty( + ServiceDescriptionPredicates.secondary_description) + .getLiteral().getValue() + .toString()); + } + + if (parameter + .hasProperty(ServiceDescriptionPredicates.max)) { + try { + secondary + .setMaximumValue(Integer + .parseInt(parameter + .getProperty( + ServiceDescriptionPredicates.max) + .getLiteral() + .getValue() + .toString())); + } catch (NumberFormatException e) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid maximum value for secondary input.}"); + errors.append(newline); + continue; + } + } + if (parameter + .hasProperty(ServiceDescriptionPredicates.min)) { + try { + secondary + .setMinimumValue(Integer + .parseInt(parameter + .getProperty( + ServiceDescriptionPredicates.min) + .getLiteral() + .getValue() + .toString())); + } catch (NumberFormatException e) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Invalid minimum value for secondary input.}"); + errors.append(newline); + continue; + } + } + if (parameter + .hasProperty(ServiceDescriptionPredicates.enumeration)) { + StmtIterator enumerations = parameter + .listProperties(ServiceDescriptionPredicates.enumeration); + while (enumerations.hasNext()) { + secondary.addAllowedValue(enumerations + .nextStatement().getLiteral() + .getValue().toString()); + } + } + service.addInput(secondary); + } else { + // everything else is ignored. } - service.addInput(secondary); - } else { - // everything else is ignored. } } @@ -628,182 +660,211 @@ while (outputs.hasNext()) { Resource parameter = (Resource) outputs.nextStatement() .getObject(); - if (parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().getProperty(RDF.type).getObject() - .toString().endsWith("simpleParameter")) { - // we have a simple - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - currentlyBad = true; - success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() - + " was missing an object type.}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() - + " was missing an article name}"); - errors.append(newline); - continue; - } - - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - // throw new MobyException("Output for service " + - // service.getName() + " was missing a non empty - // article name"); - } - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); + if (!parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().hasProperty(RDF.type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Output for service " + + service.getName() + + " did not have a parameter type of type RDF:type}"); + errors.append(newline); + continue; + } else { + if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("simpleParameter")) { + // we have a simple + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + currentlyBad = true; + success = false; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Output for service " + + service.getName() + + " was missing an object type.}"); + errors.append(newline); + continue; } - } - MobyPrimaryDataSimple primaryOutput = new MobyPrimaryDataSimple(); - primaryOutput.setDataType(new MobyDataType(datatype)); - primaryOutput.setName(articlename); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryOutput.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Output for service " + + service.getName() + + " was missing an article name}"); + errors.append(newline); + continue; } - } - service.addOutput(primaryOutput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("collectionParameter")) { - // we have a collection - // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," +service.getAuthority()+ "{Collection Output for service " - + service.getName() - + " was missing an object type.}"); - errors.append(newline); - continue; - } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," +service.getAuthority()+ "{Collection for service " - + service.getName() - + " was missing an article name.}"); - errors.append(newline); - continue; - } - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); - - // extract the article name - String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); - if (articlename.equals("")) { - success = false; - currentlyBad = true; - errors.append(service.getName() + "," +service.getAuthority()+ "{Collection output for service " - + service.getName() - + " was missing a non empty article name.}"); - errors.append(newline); - continue; - } + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { + // throw new MobyException("Output for service " + // + + // service.getName() + " was missing a non empty + // article name"); + } + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + MobyPrimaryDataSimple primaryOutput = new MobyPrimaryDataSimple(); + primaryOutput + .setDataType(new MobyDataType(datatype)); + primaryOutput.setName(articlename); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + primaryOutput + .addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } + } + service.addOutput(primaryOutput); + } else if (parameter.getProperty( + FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString() + .endsWith("collectionParameter")) { + // we have a collection + // make sure that object type and article name exist + if (!parameter + .hasProperty(ServiceDescriptionPredicates.object_type)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection Output for service " + + service.getName() + + " was missing an object type.}"); + errors.append(newline); + continue; + } + if (!parameter + .hasProperty(FetaVocabulary.hasParameterNameText)) { + success = false; + currentlyBad = true; + errors.append(service.getName() + "," + + service.getAuthority() + + "{Collection for service " + + service.getName() + + " was missing an article name.}"); + errors.append(newline); + continue; + } + // name + String datatype = parameter.getProperty( + ServiceDescriptionPredicates.object_type) + .getObject().toString(); + if (datatype.indexOf("#") > 0) + datatype = datatype.substring(datatype + .lastIndexOf("#") + 1); + // if (datatype.indexOf(":") > 0) + // datatype = datatype.substring(datatype + // .lastIndexOf(":") + 1); + + // extract the article name + String articlename = parameter.getProperty( + FetaVocabulary.hasParameterNameText) + .getObject().toString(); + if (articlename.equals("")) { + success = false; + currentlyBad = true; + errors + .append(service.getName() + + "," + + service.getAuthority() + + "{Collection output for service " + + service.getName() + + " was missing a non empty article name.}"); + errors.append(newline); + continue; - // check for namespaces - ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); - StmtIterator namespaceIterator = namespaceResource - .listProperties(ServiceDescriptionPredicates.namespace_type); - while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject().toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace.substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); - namespaces.add(namespace); } - } - MobyPrimaryDataSet collection = null; - if (outputCollectionMap.containsKey(articlename)) { - collection = (MobyPrimaryDataSet) outputCollectionMap - .get(articlename); - } else - collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple output = new MobyPrimaryDataSimple( - ""); - output.setDataType(new MobyDataType(datatype)); - if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - output.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + // check for namespaces + ArrayList namespaces = new ArrayList(); + if (parameter + .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter + .getProperty( + ServiceDescriptionPredicates.inNamespaces) + .getObject(); + StmtIterator namespaceIterator = namespaceResource + .listProperties(ServiceDescriptionPredicates.namespace_type); + while (namespaceIterator.hasNext()) { + String namespace = namespaceIterator + .nextStatement().getObject() + .toString(); + if (namespace.indexOf("#") > 0) + namespace = namespace + .substring(namespace + .lastIndexOf("#") + 1); + // if (namespace.indexOf(":") > 0) + // namespace = namespace.substring(namespace + // .lastIndexOf(":") + 1); + namespaces.add(namespace); + } + } + + MobyPrimaryDataSet collection = null; + if (outputCollectionMap.containsKey(articlename)) { + collection = (MobyPrimaryDataSet) outputCollectionMap + .get(articlename); + } else + collection = new MobyPrimaryDataSet(articlename); + MobyPrimaryDataSimple output = new MobyPrimaryDataSimple( + ""); + output.setDataType(new MobyDataType(datatype)); + if (!namespaces.isEmpty()) { + for (Iterator nsIterator = namespaces + .iterator(); nsIterator.hasNext();) { + output.addNamespace(new MobyNamespace( + (String) nsIterator.next())); + } } + collection.addElement(output); + outputCollectionMap.put(articlename, collection); } - collection.addElement(output); - outputCollectionMap.put(articlename, collection); } } @@ -940,7 +1001,7 @@ MalformedURLException, IOException { // show how to use this class ServiceInstanceParser p = new ServiceInstanceParser( - "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances"); + "http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/ServiceInstances"); MobyService[] services = p.getMobyServicesFromRDF(); if (!p.isRDFValid()) { System.out.println("One or more services in the RDF were invalid"); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2006/02/16 18:28:15 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2006/03/15 17:28:15 1.5 @@ -17,6 +17,8 @@ import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDFS; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -154,8 +156,15 @@ ResIterator iterator = model.listSubjects(); while (iterator.hasNext()) { Resource resource = iterator.nextResource(); - String name = resource.getLocalName(); + LSID lsid = null; + try { + lsid = new LSID(resource.getURI()); + } catch (MalformedLSIDException e) { + throw new MobyException("Expected an LSID as a URI, instead got " + resource.getURI()+ " " + e.getLocalizedMessage()); + } + String name = lsid.getObject(); MobyServiceType servicetype = new MobyServiceType(name); + servicetype.setLSID(lsid.getLsid()); if (!resource.hasProperty(RDFS.subClassOf)) { continue; } @@ -192,7 +201,7 @@ } public static void main(String[] args) throws MobyException { - ServiceTypeParser p = new ServiceTypeParser("http://biomoby.org/RESOURCES/MOBY-S/Services"); + ServiceTypeParser p = new ServiceTypeParser("http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/Services"); MobyServiceType[] types = p.getMobyServiceTypesFromRDF(); for (int i = 0; i < types.length; i++) { System.out.println(types[i]); From kawas at pub.open-bio.org Wed Mar 15 20:23:47 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed, 15 Mar 2006 15:23:47 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603152023.k2FKNlfc000748@pub.open-bio.org> kawas Wed Mar 15 15:23:47 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory pub.open-bio.org:/tmp/cvs-serv718/org/biomoby/shared/extended Modified Files: ServiceInstanceParser.java Log Message: stripped lsids from inputs/outputs and namespaces so that these parsed services can be registered into mobycentral. moby-live/Java/src/main/org/biomoby/shared/extended ServiceInstanceParser.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/03/15 17:28:15 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/03/15 20:23:47 1.12 @@ -33,6 +33,8 @@ import com.hp.hpl.jena.shared.JenaException; import com.hp.hpl.jena.vocabulary.DC; import com.hp.hpl.jena.vocabulary.RDF; +import com.ibm.lsid.LSID; +import com.ibm.lsid.MalformedLSIDException; /** * @@ -42,25 +44,25 @@ * An example of how to use this class is below: * *


- *            import org.biomoby.shared.MobyService;
- *            import org.biomoby.shared.Utils;
- *            import org.biomoby.shared.extended.ServiceInstanceParser;
- *            
- *            ...
- *                  
- *                       ServiceInstanceParser p = new ServiceInstanceParser(
- *      				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
- *      		MobyService[] services = p.getMobyServicesFromRDF();
- *      		if (!p.isRDFValid()) {
- *      			System.out.println("One or more services in the RDF were invalid");
- *      			System.out.println("The errors are the following:");
- *      			System.out.println(Utils.format(p.getErrors(),2));
- *      			
+ *             import org.biomoby.shared.MobyService;
+ *             import org.biomoby.shared.Utils;
+ *             import org.biomoby.shared.extended.ServiceInstanceParser;
+ *             
+ *             ...
+ *                   
+ *                        ServiceInstanceParser p = new ServiceInstanceParser(
+ *       				"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
+ *       		MobyService[] services = p.getMobyServicesFromRDF();
+ *       		if (!p.isRDFValid()) {
+ *       			System.out.println("One or more services in the RDF were invalid");
+ *       			System.out.println("The errors are the following:");
+ *       			System.out.println(Utils.format(p.getErrors(),2));
+ *       			
+ *        		}
+ *       		System.out.println("The valid services are:");
+ *       		for (int i = 0; i < services.length; i++) {
+ *       			System.out.println((services[i]));
  *       		}
- *      		System.out.println("The valid services are:");
- *      		for (int i = 0; i < services.length; i++) {
- *      			System.out.println((services[i]));
- *      		}
  * 
* *

@@ -126,8 +128,7 @@ this.url = url; else { this.url = null; - throw new MobyException("Invalid url specified by " - + url.toExternalForm() + "."); + throw new MobyException("Invalid url specified by " + url.toExternalForm() + "."); } this.parsedOkay = false; errors = new StringBuffer(); @@ -173,8 +174,7 @@ * @throws MobyException * if there is a parsing error */ - public MobyService[] getMobyServicesFromRDF(Model model) - throws MobyException { + public MobyService[] getMobyServicesFromRDF(Model model) throws MobyException { // clear out any old information ArrayList list = new ArrayList(); if (model != null) { @@ -196,40 +196,34 @@ this.errors = new StringBuffer(); boolean success = true; - ResIterator rIterator = model - .listSubjectsWithProperty(FetaVocabulary.hasServiceNameText); + ResIterator rIterator = model.listSubjectsWithProperty(FetaVocabulary.hasServiceNameText); while (rIterator.hasNext()) { boolean currentlyBad = false; Resource resource = rIterator.nextResource(); String name = ""; if (resource.hasProperty(FetaVocabulary.hasServiceNameText)) - name = resource.getProperty(FetaVocabulary.hasServiceNameText) - .getObject().toString(); + name = resource.getProperty(FetaVocabulary.hasServiceNameText).getObject() + .toString(); MobyService service = new MobyService(name); // set the lsid service.setLSID(resource.getURI()); // get the signatureURL String signatureURL = ""; - if (resource - .hasProperty(FetaVocabulary.hasServiceDescriptionLocation)) - signatureURL = resource.getProperty( - FetaVocabulary.hasServiceDescriptionLocation) + if (resource.hasProperty(FetaVocabulary.hasServiceDescriptionLocation)) + signatureURL = resource.getProperty(FetaVocabulary.hasServiceDescriptionLocation) .getObject().toString(); service.setSignatureURL(signatureURL); // set the service type if (resource.hasProperty(FetaVocabulary.hasOperation)) { - Resource hoResource = resource.getProperty( - FetaVocabulary.hasOperation).getResource(); + Resource hoResource = resource.getProperty(FetaVocabulary.hasOperation) + .getResource(); if (hoResource.hasProperty(FetaVocabulary.performsTask)) { - Resource ptResource = hoResource.getProperty( - FetaVocabulary.performsTask).getResource(); - StmtIterator stmtIterator = ptResource - .listProperties(RDF.type); + Resource ptResource = hoResource.getProperty(FetaVocabulary.performsTask) + .getResource(); + StmtIterator stmtIterator = ptResource.listProperties(RDF.type); while (stmtIterator.hasNext()) { - RDFNode typeNode = stmtIterator.nextStatement() - .getObject(); - if (!typeNode.toString().equals( - FetaVocabulary.operationTask.toString())) { + RDFNode typeNode = stmtIterator.nextStatement().getObject(); + if (!typeNode.toString().equals(FetaVocabulary.operationTask.toString())) { String serviceType = typeNode.toString(); String[] parsedServiceType = serviceType.split("#"); if (parsedServiceType.length == 2) @@ -244,29 +238,26 @@ // set the category if (resource.hasProperty(DC.format)) { - String category = resource.getProperty(DC.format).getObject() - .toString(); + String category = resource.getProperty(DC.format).getObject().toString(); service.setCategory(category); } // set the authority, email address and authoritative values if (resource.hasProperty(FetaVocabulary.providedBy)) { - Resource org = (Resource) resource.getProperty( - FetaVocabulary.providedBy).getObject(); + Resource org = (Resource) resource.getProperty(FetaVocabulary.providedBy) + .getObject(); if (org.hasProperty(DC.publisher)) { - String authorityURI = org.getProperty(DC.publisher) - .getObject().toString(); + String authorityURI = org.getProperty(DC.publisher).getObject().toString(); service.setAuthority(authorityURI); } if (org.hasProperty(DC.creator)) { - String email = org.getProperty(DC.creator).getObject() - .toString(); + String email = org.getProperty(DC.creator).getObject().toString(); service.setEmailContact(email); } if (org.hasProperty(ServiceDescriptionPredicates.authoritative)) { String authoritative = org.getProperty( - ServiceDescriptionPredicates.authoritative) - .getObject().toString().trim(); + ServiceDescriptionPredicates.authoritative).getObject().toString() + .trim(); if (authoritative.equalsIgnoreCase("true")) service.setAuthoritative(true); else @@ -276,222 +267,205 @@ // set the url for the service if (resource.hasProperty(FetaVocabulary.locationURI)) { - String serviceUrl = resource.getProperty( - FetaVocabulary.locationURI).getObject().toString(); + String serviceUrl = resource.getProperty(FetaVocabulary.locationURI).getObject() + .toString(); service.setURL(serviceUrl); } // set the description if (resource.hasProperty(FetaVocabulary.hasServiceDescriptionText)) { - String description = resource.getProperty( - FetaVocabulary.hasServiceDescriptionText).getObject() - .toString(); + String description = resource.getProperty(FetaVocabulary.hasServiceDescriptionText) + .getObject().toString(); service.setDescription(description); } // process in/outputs - StmtIterator arguements = resource - .listProperties(FetaVocabulary.hasOperation); + StmtIterator arguements = resource.listProperties(FetaVocabulary.hasOperation); while (arguements.hasNext()) { Statement s = arguements.nextStatement(); Resource r = (Resource) s.getObject(); - StmtIterator inputs = r - .listProperties(FetaVocabulary.inputParameter); + StmtIterator inputs = r.listProperties(FetaVocabulary.inputParameter); // collections to be added at the end the current scope Map inputCollectionMap = new HashMap(); Map outputCollectionMap = new HashMap(); // is the current service bad? while (inputs.hasNext()) { - Resource parameter = (Resource) inputs.nextStatement() - .getObject(); - if (!parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().hasProperty(RDF.type)) { + Resource parameter = (Resource) inputs.nextStatement().getObject(); + if (!parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .hasProperty(RDF.type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + " did not have a parameter type of type RDF:type}"); errors.append(newline); continue; } else { - if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("simpleParameter")) { + if (parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString().endsWith( + "simpleParameter")) { // we have a simple // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + " was missing an object type}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { currentlyBad = true; success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + " was missing an article name}"); errors.append(newline); continue; } - // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the input simple parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Input for service " - + service.getName() - + " was missing a non empty article name}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Input for service " + service.getName() + + " was missing a non empty article name}"); errors.append(newline); continue; } // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the input parameters' namespace LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); namespaces.add(namespace); } } MobyPrimaryDataSimple primaryInput = new MobyPrimaryDataSimple(); - primaryInput - .setDataType(new MobyDataType(datatype)); + primaryInput.setDataType(new MobyDataType(datatype)); primaryInput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - primaryInput - .addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + primaryInput.addNamespace(new MobyNamespace((String) nsIterator + .next())); } } service.addInput(primaryInput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() + } else if (parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().getProperty(RDF.type).getObject().toString() .endsWith("collectionParameter")) { // we have a collection // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { currentlyBad = true; success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection input for service " + service.getName() + " was missing an object type.}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection for service " + service.getName() + " was missing an article name.}"); errors.append(newline); continue; } // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the collection input parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Collection input for service " - + service.getName() - + " was missing a non empty article name.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection input for service " + service.getName() + + " was missing a non empty article name.}"); errors.append(newline); continue; } // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); namespaces.add(namespace); } } @@ -502,38 +476,32 @@ .get(articlename); } else collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple input = new MobyPrimaryDataSimple( - ""); + MobyPrimaryDataSimple input = new MobyPrimaryDataSimple(""); input.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - input.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + input + .addNamespace(new MobyNamespace((String) nsIterator + .next())); } } collection.addElement(input); inputCollectionMap.put(articlename, collection); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() + } else if (parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().getProperty(RDF.type).getObject().toString() .endsWith("secondaryParameter")) { // we have a secondary - if (!parameter - .hasProperty(ServiceDescriptionPredicates.datatype)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.datatype)) { currentlyBad = true; success = false; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid secondary input found. Missing moby datatype" - + " (one of String, Float, Integer, DateTime).}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Invalid secondary input found. Missing moby datatype" + + " (one of String, Float, Integer, DateTime).}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; errors @@ -545,18 +513,16 @@ continue; } String datatype = parameter.getProperty( - ServiceDescriptionPredicates.datatype) - .getLiteral().getValue().toString(); + ServiceDescriptionPredicates.datatype).getLiteral().getValue() + .toString(); if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .indexOf("#") + 1); + datatype = datatype.substring(datatype.indexOf("#") + 1); if (datatype.indexOf(":") > 0) - datatype = datatype.substring(datatype - .indexOf(":") + 1); + datatype = datatype.substring(datatype.indexOf(":") + 1); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getLiteral().getValue().toString(); + FetaVocabulary.hasParameterNameText).getLiteral().getValue() + .toString(); if (articlename.equals("")) { success = false; currentlyBad = true; @@ -570,82 +536,56 @@ } // create the datatype - MobySecondaryData secondary = new MobySecondaryData( - articlename); + MobySecondaryData secondary = new MobySecondaryData(articlename); secondary.setDataType(datatype); - if (parameter - .hasProperty(FetaVocabulary.hasDefaultValue)) { - secondary.setDefaultValue(parameter - .getProperty( - FetaVocabulary.hasDefaultValue) - .getLiteral().getValue().toString()); + if (parameter.hasProperty(FetaVocabulary.hasDefaultValue)) { + secondary.setDefaultValue(parameter.getProperty( + FetaVocabulary.hasDefaultValue).getLiteral().getValue() + .toString()); } // process the description if (parameter .hasProperty(ServiceDescriptionPredicates.secondary_description)) { - secondary - .setDescription(parameter - .getProperty( - ServiceDescriptionPredicates.secondary_description) - .getLiteral().getValue() - .toString()); + secondary.setDescription(parameter.getProperty( + ServiceDescriptionPredicates.secondary_description) + .getLiteral().getValue().toString()); } - if (parameter - .hasProperty(ServiceDescriptionPredicates.max)) { + if (parameter.hasProperty(ServiceDescriptionPredicates.max)) { try { - secondary - .setMaximumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.max) - .getLiteral() - .getValue() - .toString())); + secondary.setMaximumValue(Integer.parseInt(parameter + .getProperty(ServiceDescriptionPredicates.max) + .getLiteral().getValue().toString())); } catch (NumberFormatException e) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid maximum value for secondary input.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Invalid maximum value for secondary input.}"); errors.append(newline); continue; } } - if (parameter - .hasProperty(ServiceDescriptionPredicates.min)) { + if (parameter.hasProperty(ServiceDescriptionPredicates.min)) { try { - secondary - .setMinimumValue(Integer - .parseInt(parameter - .getProperty( - ServiceDescriptionPredicates.min) - .getLiteral() - .getValue() - .toString())); + secondary.setMinimumValue(Integer.parseInt(parameter + .getProperty(ServiceDescriptionPredicates.min) + .getLiteral().getValue().toString())); } catch (NumberFormatException e) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Invalid minimum value for secondary input.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Invalid minimum value for secondary input.}"); errors.append(newline); continue; } } - if (parameter - .hasProperty(ServiceDescriptionPredicates.enumeration)) { + if (parameter.hasProperty(ServiceDescriptionPredicates.enumeration)) { StmtIterator enumerations = parameter .listProperties(ServiceDescriptionPredicates.enumeration); while (enumerations.hasNext()) { - secondary.addAllowedValue(enumerations - .nextStatement().getLiteral() - .getValue().toString()); + secondary.addAllowedValue(enumerations.nextStatement() + .getLiteral().getValue().toString()); } } service.addInput(secondary); @@ -655,69 +595,62 @@ } } - StmtIterator outputs = r - .listProperties(FetaVocabulary.outputParameter); + StmtIterator outputs = r.listProperties(FetaVocabulary.outputParameter); while (outputs.hasNext()) { - Resource parameter = (Resource) outputs.nextStatement() - .getObject(); - if (!parameter.getProperty(FetaVocabulary.hasParameterType) - .getResource().hasProperty(RDF.type)) { + Resource parameter = (Resource) outputs.nextStatement().getObject(); + if (!parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .hasProperty(RDF.type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Output for service " + service.getName() + " did not have a parameter type of type RDF:type}"); errors.append(newline); continue; } else { - if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() - .endsWith("simpleParameter")) { + if (parameter.getProperty(FetaVocabulary.hasParameterType).getResource() + .getProperty(RDF.type).getObject().toString().endsWith( + "simpleParameter")) { // we have a simple // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { currentlyBad = true; success = false; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Output for service " + service.getName() + " was missing an object type.}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Output for service " + service.getName() + " was missing an article name}"); errors.append(newline); continue; } // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the output simple parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { // throw new MobyException("Output for service " // + @@ -726,96 +659,91 @@ } // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); + namespaces.add(namespace); } } MobyPrimaryDataSimple primaryOutput = new MobyPrimaryDataSimple(); - primaryOutput - .setDataType(new MobyDataType(datatype)); + primaryOutput.setDataType(new MobyDataType(datatype)); primaryOutput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - primaryOutput - .addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + primaryOutput.addNamespace(new MobyNamespace( + (String) nsIterator.next())); } } service.addOutput(primaryOutput); - } else if (parameter.getProperty( - FetaVocabulary.hasParameterType).getResource() - .getProperty(RDF.type).getObject().toString() + } else if (parameter.getProperty(FetaVocabulary.hasParameterType) + .getResource().getProperty(RDF.type).getObject().toString() .endsWith("collectionParameter")) { // we have a collection // make sure that object type and article name exist - if (!parameter - .hasProperty(ServiceDescriptionPredicates.object_type)) { + if (!parameter.hasProperty(ServiceDescriptionPredicates.object_type)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection Output for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection Output for service " + service.getName() + " was missing an object type.}"); errors.append(newline); continue; } - if (!parameter - .hasProperty(FetaVocabulary.hasParameterNameText)) { + if (!parameter.hasProperty(FetaVocabulary.hasParameterNameText)) { success = false; currentlyBad = true; - errors.append(service.getName() + "," - + service.getAuthority() - + "{Collection for service " - + service.getName() + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection for service " + service.getName() + " was missing an article name.}"); errors.append(newline); continue; } // name - String datatype = parameter.getProperty( - ServiceDescriptionPredicates.object_type) - .getObject().toString(); - if (datatype.indexOf("#") > 0) - datatype = datatype.substring(datatype - .lastIndexOf("#") + 1); - // if (datatype.indexOf(":") > 0) - // datatype = datatype.substring(datatype - // .lastIndexOf(":") + 1); + LSID lsid = null; + try { + lsid = new LSID(parameter.getProperty( + ServiceDescriptionPredicates.object_type).getObject() + .toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the output collection parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String datatype = lsid.getObject(); // extract the article name String articlename = parameter.getProperty( - FetaVocabulary.hasParameterNameText) - .getObject().toString(); + FetaVocabulary.hasParameterNameText).getObject().toString(); if (articlename.equals("")) { success = false; currentlyBad = true; - errors - .append(service.getName() - + "," - + service.getAuthority() - + "{Collection output for service " - + service.getName() - + " was missing a non empty article name.}"); + errors.append(service.getName() + "," + service.getAuthority() + + "{Collection output for service " + service.getName() + + " was missing a non empty article name.}"); errors.append(newline); continue; @@ -823,25 +751,27 @@ // check for namespaces ArrayList namespaces = new ArrayList(); - if (parameter - .hasProperty(ServiceDescriptionPredicates.inNamespaces)) { - Resource namespaceResource = (Resource) parameter - .getProperty( - ServiceDescriptionPredicates.inNamespaces) - .getObject(); + if (parameter.hasProperty(ServiceDescriptionPredicates.inNamespaces)) { + Resource namespaceResource = (Resource) parameter.getProperty( + ServiceDescriptionPredicates.inNamespaces).getObject(); StmtIterator namespaceIterator = namespaceResource .listProperties(ServiceDescriptionPredicates.namespace_type); while (namespaceIterator.hasNext()) { - String namespace = namespaceIterator - .nextStatement().getObject() - .toString(); - if (namespace.indexOf("#") > 0) - namespace = namespace - .substring(namespace - .lastIndexOf("#") + 1); - // if (namespace.indexOf(":") > 0) - // namespace = namespace.substring(namespace - // .lastIndexOf(":") + 1); + + LSID nsLSID = null; + try { + nsLSID = new LSID(namespaceIterator.nextStatement() + .getObject().toString()); + } catch (MalformedLSIDException e) { + errors + .append("There was a problem extracting the parameters' LSID " + + e.getLocalizedMessage()); + currentlyBad = true; + success = false; + continue; + } + + String namespace = nsLSID.getObject(); namespaces.add(namespace); } } @@ -852,14 +782,13 @@ .get(articlename); } else collection = new MobyPrimaryDataSet(articlename); - MobyPrimaryDataSimple output = new MobyPrimaryDataSimple( - ""); + MobyPrimaryDataSimple output = new MobyPrimaryDataSimple(""); output.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces - .iterator(); nsIterator.hasNext();) { - output.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (Iterator nsIterator = namespaces.iterator(); nsIterator + .hasNext();) { + output.addNamespace(new MobyNamespace((String) nsIterator + .next())); } } collection.addElement(output); @@ -875,8 +804,8 @@ .get((String) it.next())); } for (it = outputCollectionMap.keySet().iterator(); it.hasNext();) { - service.addOutput((MobyPrimaryDataSet) outputCollectionMap - .get((String) it.next())); + service.addOutput((MobyPrimaryDataSet) outputCollectionMap.get((String) it + .next())); } } if (!currentlyBad) @@ -893,8 +822,7 @@ * @throws MobyException * if there are any parsing errors */ - public MobyService[] getMobyServicesFromRDF(String rdf) - throws MobyException { + public MobyService[] getMobyServicesFromRDF(String rdf) throws MobyException { // lets start parsing ArrayList list = new ArrayList(); @@ -924,8 +852,7 @@ this.url = url; else { this.url = null; - throw new MobyException("Invalid url specified by " - + url.toExternalForm() + "."); + throw new MobyException("Invalid url specified by " + url.toExternalForm() + "."); } } @@ -997,11 +924,10 @@ return errors.toString(); } - public static void main(String[] args) throws MobyException, - MalformedURLException, IOException { + public static void main(String[] args) throws MobyException, MalformedURLException, IOException { // show how to use this class ServiceInstanceParser p = new ServiceInstanceParser( - "http://bioinfo.icapture.ubc.ca:8090/RESOURCES/MOBY-S/ServiceInstances"); + "http://bioinfo.icapture.ubc.ca/ekawas/services/parseBlastText.rdf"); MobyService[] services = p.getMobyServicesFromRDF(); if (!p.isRDFValid()) { System.out.println("One or more services in the RDF were invalid"); From kawas at pub.open-bio.org Thu Mar 23 19:10:32 2006 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu, 23 Mar 2006 14:10:32 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603231910.k2NJAWaf011717@pub.open-bio.org> kawas Thu Mar 23 14:10:31 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv11688/org/biomoby/registry/rdfagent/verifier Modified Files: MobyServiceComparator.java Processor.java Log Message: updated the agent so that if a modified service doesnt have an updated revision, then the agent will not update the service. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier MobyServiceComparator.java,1.3,1.4 Processor.java,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.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/registry/rdfagent/verifier/MobyServiceComparator.java 2006/03/15 17:57:07 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/MobyServiceComparator.java 2006/03/23 19:10:31 1.4 @@ -5,6 +5,7 @@ import java.util.Map; import org.biomoby.shared.MobyData; +import org.biomoby.shared.MobyException; import org.biomoby.shared.MobyNamespace; import org.biomoby.shared.MobyPrimaryDataSet; import org.biomoby.shared.MobyPrimaryDataSimple; @@ -21,25 +22,25 @@ * *

  * 
- *  		// create 2 services and do stuff with them
- *  		MobyService service1 = new MobyService();
- *  		MobyService service2 = new MobyService();
- * 
- *  		...
- * 
- *  		// now use the MobyServiceComparator class 
- *  		MobyServiceComparator c = new MobyServiceComparator();
- *  		if (c.areServicesDifferent(service1, service2)) {
- *  			// print out the differences
- *  			System.out.println(c.getDifferences());
- *  		} else {
- *  			System.out.println("The 2 services are identical");
- *  		}
+ *   		// create 2 services and do stuff with them
+ *   		MobyService service1 = new MobyService();
+ *   		MobyService service2 = new MobyService();
+ *  
+ *   		...
  *  
- *  		// lets check if the inputs and outputs for service 1 are valid
- *  		if (c.areInputsOutputsForServiceValid(service1)) {
- *  			System.out.println("The inputs/outputs are valid!");
- *  		}
+ *   		// now use the MobyServiceComparator class 
+ *   		MobyServiceComparator c = new MobyServiceComparator();
+ *   		if (c.areServicesDifferent(service1, service2)) {
+ *   			// print out the differences
+ *   			System.out.println(c.getDifferences());
+ *   		} else {
+ *   			System.out.println("The 2 services are identical");
+ *   		}
+ *   
+ *   		// lets check if the inputs and outputs for service 1 are valid
+ *   		if (c.areInputsOutputsForServiceValid(service1)) {
+ *   			System.out.println("The inputs/outputs are valid!");
+ *   		}
  * 
  * 
* @@ -53,7 +54,7 @@ /** * Constructor - * + * */ public MobyServiceComparator() { init(); @@ -73,8 +74,7 @@ * @return true if the service signatures are not equal, false otherwise. * For services that are null, true is always returned. */ - public boolean areServicesDifferent(MobyService service1, - MobyService service2) { + public boolean areServicesDifferent(MobyService service1, MobyService service2) { init(); if (service1 == null || service2 == null) return true; @@ -87,23 +87,21 @@ // compare the name - usually different if using this class stand // alone if (!service1.getName().equals(service2.getName())) { - addDifference("Service1 has name " + service1.getName() - + " which is different from " + service2.getName() + "."); + addDifference("Service1 has name " + service1.getName() + " which is different from " + + service2.getName() + "."); isDifferent = true; } // compare authorities if (!service1.getAuthority().equals(service2.getAuthority())) { addDifference("Service1 has authority " + service1.getAuthority() - + " which is different from " + service2.getAuthority() - + "."); + + " which is different from " + service2.getAuthority() + "."); isDifferent = true; } // compare authoritative if (service1.isAuthoritative() != service2.isAuthoritative()) { - addDifference("Service1 is " - + (service1.isAuthoritative() ? "" : "not ") + addDifference("Service1 is " + (service1.isAuthoritative() ? "" : "not ") + "authoritative while service2 is" + (service2.isAuthoritative() ? "." : " not.")); isDifferent = true; @@ -112,46 +110,34 @@ // compare category if (!service1.getCategory().equals(service2.getCategory())) { addDifference("Service1 has category " + service1.getCategory() - + " which is different from " + service2.getCategory() - + "."); + + " which is different from " + service2.getCategory() + "."); isDifferent = true; } // compare descriptions if (!service1.getDescription().equals(service2.getDescription())) { - addDifference("Service1 has description " - + service1.getDescription() + " which is different from " - + service2.getDescription() + "."); - isDifferent = true; - } - - // compare lsids - if (!service1.getLSID().equals(service2.getLSID())) { - addDifference("Service1 has LSID " - + service1.getLSID() + " which is different from " - + service2.getLSID() + "."); + addDifference("Service1 has description " + service1.getDescription() + + " which is different from " + service2.getDescription() + "."); isDifferent = true; } // compare email if (!service1.getEmailContact().equals(service2.getEmailContact())) { - addDifference("Service1 has contact address " - + service1.getEmailContact() + " which is different from " - + service2.getEmailContact() + "."); + addDifference("Service1 has contact address " + service1.getEmailContact() + + " which is different from " + service2.getEmailContact() + "."); isDifferent = true; } // compare signature url if (!service1.getSignatureURL().equals(service2.getSignatureURL())) { - addDifference("Service1 has signature url " - + service1.getSignatureURL() + " which is different from " - + service2.getSignatureURL() + "."); + addDifference("Service1 has signature url " + service1.getSignatureURL() + + " which is different from " + service2.getSignatureURL() + "."); isDifferent = true; } // compare type if (!service1.getType().equals(service2.getType())) { - addDifference("Service1 has type " + service1.getType() - + " which is different from " + service2.getType() + "."); + addDifference("Service1 has type " + service1.getType() + " which is different from " + + service2.getType() + "."); isDifferent = true; } @@ -203,30 +189,25 @@ MobyPrimaryDataSet set1 = (MobyPrimaryDataSet) data1; MobyPrimaryDataSet set2 = (MobyPrimaryDataSet) data2; - Map collectionInputs1 = getMapFromCollection(set1 - .getElements()); - Map collectionInputs2 = getMapFromCollection(set2 - .getElements()); - for (Iterator collectionInputIt = collectionInputs1 - .keySet().iterator(); collectionInputIt.hasNext();) { + Map collectionInputs1 = getMapFromCollection(set1.getElements()); + Map collectionInputs2 = getMapFromCollection(set2.getElements()); + for (Iterator collectionInputIt = collectionInputs1.keySet().iterator(); collectionInputIt + .hasNext();) { String inputKey = (String) collectionInputIt.next(); if (collectionInputs2.containsKey(inputKey)) { MobyPrimaryDataSimple colData1 = (MobyPrimaryDataSimple) collectionInputs1 .get(inputKey); MobyPrimaryDataSimple colData2 = (MobyPrimaryDataSimple) collectionInputs2 .remove(inputKey); - - + if (colData1.getDataType().getName().equals( colData2.getDataType().getName())) { // check the namespaces if of the same type - Map namespaces1 = getMapFromMobyNamespace(colData1 - .getNamespaces()); - Map namespaces2 = getMapFromMobyNamespace(colData2 - .getNamespaces()); - for (Iterator nsIt = namespaces1.keySet() - .iterator(); nsIt.hasNext();) { + Map namespaces1 = getMapFromMobyNamespace(colData1.getNamespaces()); + Map namespaces2 = getMapFromMobyNamespace(colData2.getNamespaces()); + for (Iterator nsIt = namespaces1.keySet().iterator(); nsIt + .hasNext();) { String nsKey = (String) nsIt.next(); // remove it from namespaces2 if (namespaces2.remove(nsKey) == null) { @@ -240,95 +221,76 @@ } } // now go through what is left in namespaces2 - for (Iterator nsIt = namespaces2.keySet() - .iterator(); nsIt.hasNext();) { + for (Iterator nsIt = namespaces2.keySet().iterator(); nsIt + .hasNext();) { String nsKey = (String) nsIt.next(); // namespae2 was different -> key not in it - addDifference("A collection " - + (isInput ? "input" : "output") + addDifference("A collection " + (isInput ? "input" : "output") + " for service2 had the additional namespace: " + nsKey); isDifferent = true; } } else { // different object types - addDifference("Service1 had an " - + (isInput ? "input" : "output") + addDifference("Service1 had an " + (isInput ? "input" : "output") + " in a collection of type " + colData1.getDataType().getName() + " while service2 had an " - + (isInput ? "input" : "output") - + " of type " + + (isInput ? "input" : "output") + " of type " + colData2.getDataType().getName() - + ". Both had an articlename of " - + inputKey + "."); + + ". Both had an articlename of " + inputKey + "."); isDifferent = true; } } else { addDifference("Service1 had a collection " - + (isInput ? "input" : "output") - + " named " + inputKey + + (isInput ? "input" : "output") + " named " + inputKey + " while service2 did not."); isDifferent = true; } } - for (Iterator collectionInputIt = collectionInputs2 - .keySet().iterator(); collectionInputIt.hasNext();) { - addDifference("Service2 had a collection " - + (isInput ? "input" : "output") + " named " - + (String) collectionInputIt.next() + for (Iterator collectionInputIt = collectionInputs2.keySet().iterator(); collectionInputIt + .hasNext();) { + addDifference("Service2 had a collection " + (isInput ? "input" : "output") + + " named " + (String) collectionInputIt.next() + " while service1 did not."); isDifferent = true; } } else if (data1 instanceof MobyPrimaryDataSimple) { // check for same object type - if (((MobyPrimaryDataSimple) data1).getDataType().getName() - .equals( - ((MobyPrimaryDataSimple) data2) - .getDataType().getName())) { + if (((MobyPrimaryDataSimple) data1).getDataType().getName().equals( + ((MobyPrimaryDataSimple) data2).getDataType().getName())) { // check the namespaces if of the same type Map namespaces1 = getMapFromMobyNamespace(((MobyPrimaryDataSimple) data1) .getNamespaces()); Map namespaces2 = getMapFromMobyNamespace(((MobyPrimaryDataSimple) data2) .getNamespaces()); - //FIXME not parsing correctly - missing namespaces - for (Iterator nsIt = namespaces1.keySet().iterator(); nsIt - .hasNext();) { + for (Iterator nsIt = namespaces1.keySet().iterator(); nsIt.hasNext();) { String nsKey = (String) nsIt.next(); // remove it from namespaces2 if (namespaces2.remove(nsKey) == null) { // namespae2 was different -> key not in it - addDifference("An " - + (isInput ? "input" : "output") - + " for service2 did not have the namespace " - + nsKey + "."); + addDifference("An " + (isInput ? "input" : "output") + + " for service2 did not have the namespace " + nsKey + "."); isDifferent = true; } } // now go through what is left in namespaces2 - for (Iterator nsIt = namespaces2.keySet().iterator(); nsIt - .hasNext();) { + for (Iterator nsIt = namespaces2.keySet().iterator(); nsIt.hasNext();) { String nsKey = (String) nsIt.next(); // namespae2 was different -> key not in it - addDifference("An " - + (isInput ? "input" : "output") - + " for service2 had the additional namespace: " - + nsKey); + addDifference("An " + (isInput ? "input" : "output") + + " for service2 had the additional namespace: " + nsKey); isDifferent = true; } } else { // different object types - addDifference("Service1 had an " - + (isInput ? "input" : "output") + addDifference("Service1 had an " + (isInput ? "input" : "output") + " of type " - + ((MobyPrimaryDataSimple) data1).getDataType() - .getName() - + " while service2 had an " - + (isInput ? "input" : "output") + + ((MobyPrimaryDataSimple) data1).getDataType().getName() + + " while service2 had an " + (isInput ? "input" : "output") + " of type " - + ((MobyPrimaryDataSimple) data2).getDataType() - .getName() + + ((MobyPrimaryDataSimple) data2).getDataType().getName() + ". Both had an articlename of " + key + "."); isDifferent = true; } @@ -337,52 +299,39 @@ MobySecondaryData secondary1 = (MobySecondaryData) data1; MobySecondaryData secondary2 = (MobySecondaryData) data2; - if (secondary1.getDataType().equals( - secondary2.getDataType())) { + if (secondary1.getDataType().equals(secondary2.getDataType())) { // compare maximums - if (secondary1.getMaximumValue() != secondary2 - .getMaximumValue()) { + if (secondary1.getMaximumValue() != secondary2.getMaximumValue()) { addDifference("Service1 had a secondary input maxinmum value " + secondary1.getMaximumValue() + " while service2 had a secondary input maximum value of " + secondary2.getMaximumValue() - + ". Both had an articlename of " - + key - + "."); + + ". Both had an articlename of " + key + "."); isDifferent = true; } // compare minimums - if (secondary1.getMinimumValue() != secondary2 - .getMinimumValue()) { + if (secondary1.getMinimumValue() != secondary2.getMinimumValue()) { addDifference("Service1 had a secondary input mininmum value of " + secondary1.getMinimumValue() + " while service2 had a secondary input minimum value of " + secondary2.getMinimumValue() - + ". Both had an articlename of " - + key - + "."); + + ". Both had an articlename of " + key + "."); isDifferent = true; } // compare defaults - if (!secondary1.getDefaultValue().equals( - secondary2.getDefaultValue())) { + if (!secondary1.getDefaultValue().equals(secondary2.getDefaultValue())) { addDifference("Service1 had a secondary input default value of " + secondary1.getDefaultValue() + " while service2 had a secondary input default value of " + secondary2.getDefaultValue() - + ". Both had an articlename of " - + key - + "."); + + ". Both had an articlename of " + key + "."); isDifferent = true; } // compare allowable values - Map allowable1 = getMapStrings(secondary1 - .getAllowedValues()); - Map allowable2 = getMapStrings(secondary2 - .getAllowedValues()); - for (Iterator nsIt = allowable1.keySet().iterator(); nsIt - .hasNext();) { + Map allowable1 = getMapStrings(secondary1.getAllowedValues()); + Map allowable2 = getMapStrings(secondary2.getAllowedValues()); + for (Iterator nsIt = allowable1.keySet().iterator(); nsIt.hasNext();) { String valueKey = (String) nsIt.next(); // remove it from namespaces2 if (allowable2.remove(valueKey) == null) { @@ -394,8 +343,7 @@ } // now iterate through secondary2 // now go through what is left in namespaces2 - for (Iterator nsIt = allowable2.keySet().iterator(); nsIt - .hasNext();) { + for (Iterator nsIt = allowable2.keySet().iterator(); nsIt.hasNext();) { String valueKey = (String) nsIt.next(); // namespae2 was different -> key not in it addDifference("A secondary input for service2 had the additional allowable value: " @@ -408,8 +356,8 @@ addDifference("Service1 had a secondary input of type " + secondary1.getDataType() + " while service2 had a secondary input of type " - + secondary2.getDataType() - + ". Both had an articlename of " + key + "."); + + secondary2.getDataType() + ". Both had an articlename of " + key + + "."); isDifferent = true; } @@ -419,8 +367,7 @@ } } else { // no -> record difference - addDifference("Service1 had an " - + (isInput ? "input" : "output") + " named " + key + addDifference("Service1 had an " + (isInput ? "input" : "output") + " named " + key + " while service2 did not."); isDifferent = true; @@ -429,9 +376,8 @@ // now look through the second map for any new types // record them for (Iterator it = dataMap2.keySet().iterator(); it.hasNext();) { - addDifference("Service2 had an " + (isInput ? "input" : "output") - + " named " + (String) it.next() - + " while service1 did not."); + addDifference("Service2 had an " + (isInput ? "input" : "output") + " named " + + (String) it.next() + " while service1 did not."); isDifferent = true; } } @@ -482,6 +428,29 @@ return true; } + /** + * PRE: Service1 and service2 are describe the same service instance + * otherwise an exception is raised + * + * @param service1 + * a moby service instance + * @param service2 + * another moby service instance + * @return true if the lsid revisions are different, false otherwise. + * @throws MobyException + * if the services describe different service 'instances' + */ + public boolean areLsidVersionsDifferent(MobyService service1, MobyService service2) + throws MobyException { + if (!service1.getUniqueName().equals(service2.getUniqueName())) + throw new MobyException( + "You cannot LSID revision numbers if the services are not describing the same 'instance'."); + if (!service1.getLSID().equals(service2.getLSID())) { + return true; + } + return false; + } + private Map getMapFromMobyNamespace(MobyNamespace[] datas) { HashMap map = new HashMap(); for (int i = 0; i < datas.length; i++) { @@ -504,7 +473,7 @@ * newline */ private void addDifference(String difference) { - buffer.append("\t" +difference + System.getProperty("line.separator")); + buffer.append("\t" + difference + System.getProperty("line.separator")); } /** =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/15 17:56:26 1.14 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/03/23 19:10:31 1.15 @@ -62,8 +62,7 @@ Map servicesProcessed = new HashMap(); // create a vector of process services Vector extraServices = new Vector(); - for (Iterator keyIterator = serviceMap.keySet().iterator(); keyIterator - .hasNext();) { + for (Iterator keyIterator = serviceMap.keySet().iterator(); keyIterator.hasNext();) { String key = (String) keyIterator.next(); if (extraServices.contains(key)) { @@ -76,42 +75,35 @@ // process bad signatures once, try to remove the service if (badURLs.containsKey(signatureURL)) { - Log.warning("The signature url, " + signatureURL - + ", has already been" + newline - + " processed and was invalid" + Log.warning("The signature url, " + signatureURL + ", has already been" + + newline + " processed and was invalid" + " for one reason or another."); - removeInvalidSignatureURLServiceFromRegistry( - registryService, central, - "The service has an invalid signature url.", - ((Integer) badURLs.get(signatureURL)).intValue()); + removeInvalidSignatureURLServiceFromRegistry(registryService, central, + "The service has an invalid signature url.", ((Integer) badURLs + .get(signatureURL)).intValue()); continue; } if (signatureURL.trim().equals("")) { if (!ignoreNulls) { - processNullSignatureURLs(registryService, - "Null signature URL.", central); + processNullSignatureURLs(registryService, "Null signature URL.", central); continue; } else { // warn about the null url - Log - .warning("Service, (" - + registryService.getUniqueName() - + "), contains a NULL signature url and" - + newline - + " could have been removed, " - + "but you have chosen to ignore these services."); - processNullSignatureURLs(registryService, - "Null signature URL.", central); + Log.warning("Service, (" + registryService.getUniqueName() + + "), contains a NULL signature url and" + newline + + " could have been removed, " + + "but you have chosen to ignore these services."); + processNullSignatureURLs(registryService, "Null signature URL.", central); continue; } } else { // non null signature url SignatureURLConnection connection = new SignatureURLConnection(); MobyService[] rdfServices = null; - + // only process signature urls once if (signatureURLsProcessed.containsKey(signatureURL)) continue; @@ -119,17 +111,14 @@ signatureURLsProcessed.put(signatureURL, ""); rdfServices = connection.extractServicesFromURL(signatureURL); - + if (rdfServices == null) { // add the url to the bad list so that the hitlist // doesnt grow by the number of services at the service // description location - badURLs.put(signatureURL, connection.getBadUrlMap() - .get(signatureURL)); + badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); // rdf is missing - removeInvalidSignatureURLService( - registryService, - central, + removeInvalidSignatureURLService(registryService, central, "The signature url was missing, or the rdf document was invalid.", connection); continue; @@ -140,19 +129,17 @@ // this would happen if a url contained rdf but not // current rdf - badURLs.put(signatureURL, connection.getBadUrlMap() - .get(signatureURL)); + badURLs.put(signatureURL, connection.getBadUrlMap().get(signatureURL)); // no services found in the document - removeInvalidSignatureURLService( - registryService, - central, - "given, " + signatureURL - + ", no service was found called " - + registryService.getUniqueName() + ".", - connection); + removeInvalidSignatureURLService(registryService, central, "given, " + + signatureURL + ", no service was found called " + + registryService.getUniqueName() + ".", connection); continue; } else { for (int i = 0; i < rdfServices.length; i++) { + // TODO compare service LSIDs if revision is + // different, then process service, otherwise ignore + // it boolean rdfInvalid = false; // iterate over the services in the array String rdfKey = rdfServices[i].getAuthority() + "," @@ -160,23 +147,19 @@ MobyServiceComparator comparator = new MobyServiceComparator(); if (key.equals(rdfKey)) { // we have a matching service - if (!comparator - .areInputsOutputsForServiceValid(rdfServices[i])) { + if (!comparator.areInputsOutputsForServiceValid(rdfServices[i])) { Log .warning("The service, " + rdfKey + ", contained in the RDF is not a valid service." + newline + "\tIt may have inputs or outputs that do not conform to the Moby API."); - Log - .info("The service " - + rdfKey - + " was ignored as it was invalid."); + Log.info("The service " + rdfKey + + " was ignored as it was invalid."); rdfInvalid = true; } - if (!comparator - .areInputsOutputsForServiceValid(registryService)) { + if (!comparator.areInputsOutputsForServiceValid(registryService)) { if (!rdfInvalid) { // a valid rdf service will replace the // invalid registry one. @@ -198,8 +181,7 @@ + "Note that a valid version of this service was found in the RDF document."); // do this iff we removed the service if (code == 200) { - addServiceToRegistry( - rdfServices[i], central); + addServiceToRegistry(rdfServices[i], central); } continue; } else { @@ -225,28 +207,40 @@ // if the rdf is not invalid and the services // are different if (!rdfInvalid - && comparator - .areServicesDifferent( - registryService, - rdfServices[i])) { - String differences = comparator - .getDifferences(); - processModifiedServices(central, - rdfServices[i], registryService, - differences); - /* - * Log.info("The service " + rdfKey + " has - * changed." + newline + "Changes are: " + - * newline + comparator.getDifferences()); - * int code = - * removeChangedServiceFromRegistry( - * registryService, central, - * comparator.getDifferences()); // do this - * iff we removed the first service if (code == - * 200) { - * addServiceToRegistry(rdfServices[i], - * central); } - */ + && comparator.areServicesDifferent(registryService, + rdfServices[i])) { + boolean areLSIDsDifferent = false; + try { + areLSIDsDifferent = comparator.areLsidVersionsDifferent( + rdfServices[i], registryService); + } catch (MobyException e) { + // TODO log and skip this service + // because the lsids describe different + // services + Log.exception(this.getClass().getName(), + "processRegistryServices(Map, Central)", e); + Log.severe("The LSIDs describe different services." + + newline + e.getLocalizedMessage()); + Log.info("The service " + rdfServices[i].getUniqueName() + + " and the service " + + registryService.getUniqueName() + + " have lsids that describe different services."); + + } + + if (areLSIDsDifferent) { + String differences = comparator.getDifferences(); + processModifiedServices(central, rdfServices[i], + registryService, differences); + } else { + Log.info("The service " + rdfServices[i].getUniqueName() + + " and the service " + newline + + registryService.getUniqueName() + + " have the same LSID (and revision) " + newline + + "and due to this, the agent chose not " + newline + + "to update the service. Please modify " + newline + + "the LSID revision for your service."); + } continue; } } else { @@ -255,18 +249,15 @@ MobyService existingRegistryService = (MobyService) serviceMap .get(rdfKey); extraServices.add(rdfKey); - if (!comparator - .areInputsOutputsForServiceValid(rdfServices[i])) { + if (!comparator.areInputsOutputsForServiceValid(rdfServices[i])) { Log .warning("The service, " + rdfKey + ", contained in the RDF is not a valid service. " + newline + "\tIt may have inputs or outputs that do not conform to the Moby API."); - Log - .info("The service " - + rdfKey - + " was ignored as it was invalid."); + Log.info("The service " + rdfKey + + " was ignored as it was invalid."); rdfInvalid = true; } if (!comparator @@ -294,8 +285,7 @@ // do this iff we removed the // service if (code == 200) { - addServiceToRegistry( - rdfServices[i], central); + addServiceToRegistry(rdfServices[i], central); } continue; } else { @@ -320,47 +310,64 @@ } if (!rdfInvalid && comparator.areServicesDifferent( - existingRegistryService, - rdfServices[i])) { - String differences = comparator - .getDifferences(); - processModifiedServices(central, - rdfServices[i], - existingRegistryService, - differences); - - /* - * Log.info("The service " + rdfKey + " - * has changed." + newline + "Changes - * are: " + newline + - * comparator.getDifferences()); int - * code = - * removeChangedServiceFromRegistry( - * existingRegistryService, central, - * comparator .getDifferences()); if - * (code == 200) { addServiceToRegistry( - * rdfServices[i], central); } - */ + existingRegistryService, rdfServices[i])) { + + boolean areLSIDsDifferent = false; + try { + areLSIDsDifferent = comparator + .areLsidVersionsDifferent(rdfServices[i], + existingRegistryService); + } catch (MobyException e) { + // TODO log and skip this service + // because the lsids describe + // different services + Log.exception(this.getClass().getName(), + "processRegistryServices(Map, Central)", e); + Log.severe("The LSIDs describe different services." + + newline + e.getLocalizedMessage()); + Log + .info("The service " + + rdfServices[i].getUniqueName() + + " and the service " + + existingRegistryService + .getUniqueName() + + " have lsids that describe different services."); + + } + + if (areLSIDsDifferent) { + String differences = comparator.getDifferences(); + processModifiedServices(central, rdfServices[i], + existingRegistryService, differences); + } else { + Log.info("The service " + + rdfServices[i].getUniqueName() + + " and the service " + newline + + existingRegistryService.getUniqueName() + + " have the same LSID (and revision) " + + newline + + "and due to this, the agent chose not " + + newline + + "to update the service. Please modify " + + newline + + "the LSID revision for your service."); + } continue; } } else { // new service found! - Log.info("New service found. Service: " - + rdfKey); - addNewServiceToRegistry(rdfServices[i], - central); + Log.info("New service found. Service: " + rdfKey); + addNewServiceToRegistry(rdfServices[i], central); } } } // end for loop rdfInvalid now false // check if their were any invalid services in the rdf if (connection.getInvalidServicesFoundInRDF().size() > 0) { - for (Iterator it = connection - .getInvalidServicesFoundInRDF().iterator(); it + for (Iterator it = connection.getInvalidServicesFoundInRDF().iterator(); it .hasNext();) { - removeInvalidServiceFromRegistry((MobyService) it - .next()); + removeInvalidServiceFromRegistry((MobyService) it.next()); } } @@ -394,16 +401,13 @@ registryServices[0].setSignatureURL(url); registryServices = central.findService(registryServices[0]); for (int i = 0; i < registryServices.length; i++) { - foundServices.put(registryServices[i].getUniqueName(), - registryServices[i]); + foundServices.put(registryServices[i].getUniqueName(), registryServices[i]); } } catch (MobyException e) { // - Log.exception(this.getClass().getName(), - "processServicesFromURL(String, Central)", e); - Log - .severe("There was a problem comunicating with the registry. The url: " - + url + " was not processed."); + Log.exception(this.getClass().getName(), "processServicesFromURL(String, Central)", e); + Log.severe("There was a problem comunicating with the registry. The url: " + url + + " was not processed."); return; } @@ -413,37 +417,23 @@ // empty for (Iterator it = foundServices.keySet().iterator(); it.hasNext();) { String uniqueName = (String) it.next(); - MobyService service = (MobyService) foundServices - .get(uniqueName); - removeMissingServiceFromRegistry( - service, - central, - "The RDF document located at: " - + url - + " was unreachable. Removing those services that " - + "were said to be located there."); + MobyService service = (MobyService) foundServices.get(uniqueName); + removeMissingServiceFromRegistry(service, central, "The RDF document located at: " + + url + " was unreachable. Removing those services that " + + "were said to be located there."); } return; } else if (rdfServices.length == 0) { - Log - .warning("Unable to retrieve the services from " - + url - + "." - + newline - + "All services described by that location will be removed."); + Log.warning("Unable to retrieve the services from " + url + "." + newline + + "All services described by that location will be removed."); // iterate over foundServices and remove any services b/c rdf was // empty for (Iterator it = foundServices.keySet().iterator(); it.hasNext();) { String uniqueName = (String) it.next(); - MobyService service = (MobyService) foundServices - .get(uniqueName); - removeMissingServiceFromRegistry( - service, - central, - "The RDF document located at: " - + url - + " was unreachable. Removing those services that " - + "were said to be located there."); + MobyService service = (MobyService) foundServices.get(uniqueName); + removeMissingServiceFromRegistry(service, central, "The RDF document located at: " + + url + " was unreachable. Removing those services that " + + "were said to be located there."); } return; } else { @@ -454,14 +444,11 @@ MobyService rdfService = rdfServices[i]; rdfService.setSignatureURL(url); MobyService registryService = null; - // rdf had extra service if (!foundServices.containsKey(rdfService.getUniqueName())) { - Log - .info("Unable to find a service in the registry that matches (" - + rdfService.getUniqueName() + ")."); - MobyService[] ms = new MobyService[] { new MobyService( - rdfService.getName()) }; + Log.info("Unable to find a service in the registry that matches (" + + rdfService.getUniqueName() + ")."); + MobyService[] ms = new MobyService[] { new MobyService(rdfService.getName()) }; ms[0].setAuthority(rdfService.getAuthority()); try { @@ -469,9 +456,8 @@ } catch (MobyException e) { Log.exception(this.getClass().getName(), "processServicesFromURL(String, Central)", e); - Log - .severe("There was a problem comunicating with " - + "the registry while checking for service existance."); + Log.severe("There was a problem comunicating with " + + "the registry while checking for service existance."); ms = null; } @@ -488,24 +474,21 @@ } // registry and rdf had a similar service - start comparing - Log - .info("Found a service in the registry that matches the one in the RDF ..." - + newline + "Comparing them ..."); - registryService = (MobyService) foundServices.remove(rdfService - .getUniqueName()); + Log.info("Found a service in the registry that matches the one in the RDF ..." + + newline + "Comparing them ..."); + registryService = (MobyService) foundServices.remove(rdfService.getUniqueName()); if (!comparator.areInputsOutputsForServiceValid(rdfService)) { // service in rdf is invalid Log.warning("The service, " + rdfService.getUniqueName() - + ", contained in the RDF is not a valid service." - + newline + "\tIt may have inputs or outputs that" + + ", contained in the RDF is not a valid service." + newline + + "\tIt may have inputs or outputs that" + " do not conform to the Moby API."); Log.info("The service " + rdfService.getUniqueName() + " was ignored as it was invalid."); isRDFValid = false; } - if (!comparator - .areInputsOutputsForServiceValid(registryService)) { + if (!comparator.areInputsOutputsForServiceValid(registryService)) { // service in registry is invalid if (isRDFValid) { // a valid rdf service will replace @@ -540,8 +523,7 @@ + ", is not a valid service. This service was found in the registry." + newline + "\tIt may have inputs or outputs that do not conform to the Moby API." - + newline - + "\tThis service is going to be removed."); + + newline + "\tThis service is going to be removed."); removeInvalidChangedServiceFromRegistry( registryService, central, @@ -552,24 +534,46 @@ } } - if (isRDFValid - && comparator.areServicesDifferent(rdfService, - registryService)) { + if (isRDFValid && comparator.areServicesDifferent(rdfService, registryService)) { + // TODO compare lsid revisions, if different process + // service, otherwise dont! // services differ - remove registry srvc and add rdf svrc - String differences = comparator.getDifferences(); - processModifiedServices(central, rdfService, - registryService, differences); + boolean areLSIDsDifferent = false; + try { + areLSIDsDifferent = comparator.areLsidVersionsDifferent(rdfService, + registryService); + } catch (MobyException e) { + // TODO log and skip this service because the lsids + // describe different services + Log.exception(this.getClass().getName(), + "processRegistryServices(Map, Central)", e); + Log.severe("The LSIDs describe different services." + newline + + e.getLocalizedMessage()); + Log.info("The service " + rdfService.getUniqueName() + " and the service " + + registryService.getUniqueName() + + " have lsids that describe different services."); + + } + if (areLSIDsDifferent) { + String differences = comparator.getDifferences(); + processModifiedServices(central, rdfService, registryService, differences); + } else { + Log.info("The service " + rdfService.getUniqueName() + " and the service " + + newline + registryService.getUniqueName() + + " have the same LSID (and revision) " + newline + + "and due to this, the agent chose not " + newline + + "to update the service. Please modify " + newline + + "the LSID revision for your service."); + } continue; } } // iterate over foundServices and remove any services left for (Iterator it = foundServices.keySet().iterator(); it.hasNext();) { String uniqueName = (String) it.next(); - MobyService service = (MobyService) foundServices - .get(uniqueName); + MobyService service = (MobyService) foundServices.get(uniqueName); removeMissingServiceFromRegistry(service, central, - "Service was not found in the RDF document located at: " - + url); + "Service was not found in the RDF document located at: " + url); } } } @@ -578,14 +582,14 @@ * @param central @param rdfService @param registryService @param * differences */ - private void processModifiedServices(Central central, - MobyService rdfService, MobyService registryService, - String differences) { - Log.info("The service " + rdfService.getUniqueName() + " has changed." - + newline + "Changes are: " + newline + differences); + private void processModifiedServices(Central central, MobyService rdfService, + MobyService registryService, String differences) { + Log.info("The service " + rdfService.getUniqueName() + " has changed." + newline + + "Changes are: " + newline + differences); if (enableServiceUpdates) { - int code = removeChangedServiceFromRegistry(registryService, - central, differences); + // TODO keep track of the revision on the new service - change the + // revision to the one in the document + int code = removeChangedServiceFromRegistry(registryService, central, differences); if (code == 200) { if (addServiceToRegistry(rdfService, central)) { // service was added @@ -608,35 +612,29 @@ } } } else { - Log - .info("The service " - + rdfService.getUniqueName() - + " was found to be modified." - + newline - + "Since you have disabled service updates, the registry was not updated."); + Log.info("The service " + rdfService.getUniqueName() + " was found to be modified." + + newline + + "Since you have disabled service updates, the registry was not updated."); } } - private void processNullSignatureURLs(MobyService service, String string, - Central central) { + private void processNullSignatureURLs(MobyService service, String string, Central central) { // create and optionally save the report Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + string); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnNull) { @@ -646,18 +644,13 @@ // remove service only if we arent ignoring them if (!ignoreNulls) { // remove the null signature url service - Log.info("Service, (" + service.getName() + ", " - + service.getAuthority() + Log.info("Service, (" + service.getName() + ", " + service.getAuthority() + "), contains a NULL signature url and will be removed."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } } @@ -668,24 +661,18 @@ */ private void sendMail(MobyService service, Report report) { if (useSMTP) { - Log.info("Sending the report to " + service.getEmailContact() - + " (SMTP)."); + Log.info("Sending the report to " + service.getEmailContact() + " (SMTP)."); Mailer mailer = new Mailer(); - if (!mailer.sendSMTPMail(Constants.SMTP_SERVER, - Constants.SMTP_LOGIN, Constants.SMTP_PSWD, service - .getEmailContact(), "Agent report regarding: " - + service.getName(), report.getReport(), - Constants.ADMIN_EMAIL)) { - Log - .warning("Agent told to use SMTP mail, but failed. Attempting to use 'mail'"); + if (!mailer.sendSMTPMail(Constants.SMTP_SERVER, Constants.SMTP_LOGIN, + Constants.SMTP_PSWD, service.getEmailContact(), "Agent report regarding: " + + service.getName(), report.getReport(), Constants.ADMIN_EMAIL)) { + Log.warning("Agent told to use SMTP mail, but failed. Attempting to use 'mail'"); } } else { - Log.info("Sending the report to " + service.getEmailContact() - + " ('mail')."); + Log.info("Sending the report to " + service.getEmailContact() + " ('mail')."); Mailer mailer = new Mailer(); - if (!mailer.sendMail(service.getEmailContact(), - "Agent report regarding: " + service.getName(), report - .getReport())) { + if (!mailer.sendMail(service.getEmailContact(), "Agent report regarding: " + + service.getName(), report.getReport())) { Log.warning("Agent failed to send mail using 'mail'"); } } @@ -695,9 +682,8 @@ * adds a service that was modified or registered incorrectly. */ private boolean addServiceToRegistry(MobyService service, Central central) { - Log.info("Agent will attempt to add the Service " + service.getName() - + ", " + service.getAuthority() + " ) " + newline - + "to the registry."); + Log.info("Agent will attempt to add the Service " + service.getName() + ", " + + service.getAuthority() + " ) " + newline + "to the registry."); return registerService(service, central); } @@ -706,9 +692,8 @@ */ private void addNewServiceToRegistry(MobyService service, Central central) { Log.info("A new service was found in an RDF document." + newline - + "\tThe service is called: " + service.getName() - + " under the authority: " + service.getAuthority() + "." - + newline + + "\tThe service is called: " + service.getName() + " under the authority: " + + service.getAuthority() + "." + newline + "Attempting to register the service with mobycentral."); registerService(service, central); @@ -721,41 +706,33 @@ */ private boolean registerService(MobyService service, Central central) { - if (service.getSignatureURL().trim().equals("") - && !Constants.REGISTRY_IGNORE_NULL) { - Log.info("The service, (" + service.getName() + "," - + service.getAuthority() + "), was *not* registered " - + newline + "since it has a NULL signature URL."); + if (service.getSignatureURL().trim().equals("") && !Constants.REGISTRY_IGNORE_NULL) { + Log.info("The service, (" + service.getName() + "," + service.getAuthority() + + "), was *not* registered " + newline + "since it has a NULL signature URL."); return false; } try { central.registerService(service); } catch (MobyException e) { - Log.exception(this.getClass().getName(), - "addNewServiceToRegistry(MobyService)", e); + Log.exception(this.getClass().getName(), "addNewServiceToRegistry(MobyService)", e); Log.severe("Communication with the registry failed." + newline + e.getLocalizedMessage()); - Log.info("service " + service.getName() + ", " - + service.getAuthority() + Log.info("service " + service.getName() + ", " + service.getAuthority() + " has not been added to the registry."); return false; } catch (NoSuccessException e) { - Log.exception(this.getClass().getName(), - "addNewServiceToRegistry(MobyService)", e); + Log.exception(this.getClass().getName(), "addNewServiceToRegistry(MobyService)", e); Log.severe("There was no success with registration." + newline + e.getLocalizedMessage()); - Log.info("service " + service.getName() + ", " - + service.getAuthority() + Log.info("service " + service.getName() + ", " + service.getAuthority() + " has not been added to the registry."); return false; } catch (PendingCurationException e) { - Log.exception(this.getClass().getName(), - "addNewServiceToRegistry(MobyService)", e); - Log.severe("The service may be registered later pending curation." - + newline + e.getLocalizedMessage()); - Log.info("service " + service.getName() + ", " - + service.getAuthority() + Log.exception(this.getClass().getName(), "addNewServiceToRegistry(MobyService)", e); + Log.severe("The service may be registered later pending curation." + newline + + e.getLocalizedMessage()); + Log.info("service " + service.getName() + ", " + service.getAuthority() + " has not *yet* been added to the registry."); return false; } @@ -768,45 +745,38 @@ /* * remove a changed service */ - private int removeChangedServiceFromRegistry(MobyService service, - Central central, String changes) { + private int removeChangedServiceFromRegistry(MobyService service, Central central, + String changes) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, false); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " has been modified."); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, false); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " has been modified."); report.addToReport("\t\tThe following changes have been found:"); report.addToReport(Utils.format(changes, 3)); report.addToReport(""); - report - .addToReport("\t\tNote: Service1 is the service found in the registry, while " - + newline - + "\t\t Service2 is the one found by HTTP getting the signatureURL."); + report.addToReport("\t\tNote: Service1 is the service found in the registry, while " + + newline + "\t\t Service2 is the one found by HTTP getting the signatureURL."); report.addToReport(""); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnChanged) { sendMail(service, report); } - Log.info("Service, (" + service.getName() + ", " - + service.getAuthority() + Log.info("Service, (" + service.getName() + ", " + service.getAuthority() + "), was modified and will be updated."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); return code; } @@ -814,13 +784,14 @@ /* * remove a changed service */ - private int removeInvalidChangedServiceFromRegistry(MobyService service, - Central central, String changes) { + private int removeInvalidChangedServiceFromRegistry(MobyService service, Central central, + String changes) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " has been found to be invalid."); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " has been found to be invalid."); report.addToReport("\t\tThe following changes have been found:"); report.addToReport(Utils.format(changes, 3)); @@ -828,9 +799,8 @@ if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnInvalid) { @@ -839,14 +809,10 @@ Log.info("Attempting to remove service, (" + service.getName() + ", " + service.getAuthority() + ")."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); return code; } @@ -857,15 +823,15 @@ private void removeInvalidServiceFromRegistry(MobyService service) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " has been found to be invalid."); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " has been found to be invalid."); report.addToReport(""); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (sendMailOnInvalid) { sendMail(service, report); @@ -873,16 +839,12 @@ // only remove if we enable deregistration if (enableDeregistration) { - Log.info("Attempting to remove service, (" + service.getName() - + ", " + service.getAuthority() + ")."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + Log.info("Attempting to remove service, (" + service.getName() + ", " + + service.getAuthority() + ")."); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } @@ -892,49 +854,42 @@ /* * remove a bad service (invalid, no signature rdf, etc) */ - private void removeInvalidSignatureURLService(MobyService service, - Central central, String reason, SignatureURLConnection connection) { + private void removeInvalidSignatureURLService(MobyService service, Central central, + String reason, SignatureURLConnection connection) { int count = 0; // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + reason); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (!service.getSignatureURL().equals("")) { - if (connection.getBadUrlMap() - .containsKey(service.getSignatureURL())) { - count = ((Integer) connection.getBadUrlMap().get( - service.getSignatureURL())).intValue(); + if (connection.getBadUrlMap().containsKey(service.getSignatureURL())) { + count = ((Integer) connection.getBadUrlMap().get(service.getSignatureURL())) + .intValue(); } } if (enableDeregistration) { if (count >= errorLimit) { - Log.info("Attempting to remove the service " - + service.getName() + ", " + service.getAuthority() - + "." + newline + "\tRemoved because " + reason); - - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), - service.getAuthority()); + Log.info("Attempting to remove the service " + service.getName() + ", " + + service.getAuthority() + "." + newline + "\tRemoved because " + reason); + + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } if (sendMailOnInvalid) { @@ -948,43 +903,37 @@ * remove a bad service (invalid, no signature rdf, etc). this method is * used when a signature url was already found to contain a bad service. */ - private void removeInvalidSignatureURLServiceFromRegistry( - MobyService service, Central central, String reason, int count) { + private void removeInvalidSignatureURLServiceFromRegistry(MobyService service, Central central, + String reason, int count) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT,true ); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + reason); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (enableDeregistration) { if (count >= errorLimit) { - Log.info("Service " + service.getName() + ", " - + service.getAuthority() + " has been removed." - + newline + "\tRemoved because " + reason + newline + Log.info("Service " + service.getName() + ", " + service.getAuthority() + + " has been removed." + newline + "\tRemoved because " + reason + newline + "The agent has made " + count + " attempts to resolve and correctly parse the" + " service description url."); - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), - service.getAuthority()); + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); } if (sendMailOnInvalid) { @@ -998,39 +947,33 @@ * remove a bad service (invalid, no signature rdf, etc). this method is * used when a signature url was already found to contain a bad service. */ - private void removeMissingServiceFromRegistry(MobyService service, - Central central, String reason) { + private void removeMissingServiceFromRegistry(MobyService service, Central central, + String reason) { // create and optionally save the report - Report report = new Report(Constants.ADMIN_NAME,Constants.ADMIN_EMAIL, Constants.REGISTRY_REMOVAL_ENDPOINT, true); - report.addToReport("\tThe service: " + service.getAuthority() + "," - + service.getName() + " generated the following error:"); + Report report = new Report(Constants.ADMIN_NAME, Constants.ADMIN_EMAIL, + Constants.REGISTRY_REMOVAL_ENDPOINT, true); + report.addToReport("\tThe service: " + service.getAuthority() + "," + service.getName() + + " generated the following error:"); report.addToReport("\t\t" + reason); - String rdf = ServiceInstanceRDF.findService(service.getAuthority(), - service.getName(), central.getRegistryEndpoint(), central - .getRegistryNamespace()); + String rdf = ServiceInstanceRDF.findService(service.getAuthority(), service.getName(), + central.getRegistryEndpoint(), central.getRegistryNamespace()); report.addToReport(""); report.addToReport("Your service had the following RDF document:"); report.addToReport(rdf); if (Constants.REPORT_ENABLE) { Log.info("Saving the report"); - report.saveReport(Constants.REPORT_DIRECTORY, service - .getAuthority() - + "_" + service.getName() + ".rtf"); + report.saveReport(Constants.REPORT_DIRECTORY, service.getAuthority() + "_" + + service.getName() + ".rtf"); } if (enableDeregistration) { - Log.info("Service " + service.getName() + ", " - + service.getAuthority() + " has been removed." + newline - + "\tRemoved because " + reason + newline); - - CentralAdmin centralAdmin = new CentralAdmin( - Constants.REGISTRY_REMOVAL_ENDPOINT, - Constants.REGISTRY_REMOVAL_URI, - Constants.REGISTRY_REMOVAL_USERNAME, - Constants.REGISTRY_REMOVAL_PASSWORD, - Constants.REGISTRY_KEYPHRASE); - int code = centralAdmin.deleteService(service.getName(), service - .getAuthority()); + Log.info("Service " + service.getName() + ", " + service.getAuthority() + + " has been removed." + newline + "\tRemoved because " + reason + newline); + + CentralAdmin centralAdmin = new CentralAdmin(Constants.REGISTRY_REMOVAL_ENDPOINT, + Constants.REGISTRY_REMOVAL_URI, Constants.REGISTRY_REMOVAL_USERNAME, + Constants.REGISTRY_REMOVAL_PASSWORD, Constants.REGISTRY_KEYPHRASE); + int code = centralAdmin.deleteService(service.getName(), service.getAuthority()); processCentralAdminCode(code); if (sendMailOnInvalid) { @@ -1044,8 +987,7 @@ boolean bool = false; switch (code) { case 101: { - Log - .warning("Central admin didnt receive an service provider authority"); + Log.warning("Central admin didnt receive an service provider authority"); bool = false; } break; @@ -1065,8 +1007,7 @@ } break; case 404: { - Log - .severe("Oddly enough, the service wasnt found in the registry!?!"); + Log.severe("Oddly enough, the service wasnt found in the registry!?!"); bool = false; } break; @@ -1094,8 +1035,7 @@ } break; case 508: { - Log - .severe("The url and/or uri for the Central Admin service were invalid."); + Log.severe("The url and/or uri for the Central Admin service were invalid."); bool = false; } @@ -1126,55 +1066,44 @@ p = new ServiceInstanceParser(url); rdfServices = p.getMobyServicesFromRDF(); } catch (MobyException e) { - sb - .append("Exception from processServicesFromUrlTEST(String, Central)" - + e.getLocalizedMessage() + newline); - Log.exception(this.getClass().getName(), - "processServicesFromUrlTEST(String, Central)", e); + sb.append("Exception from processServicesFromUrlTEST(String, Central)" + + e.getLocalizedMessage() + newline); + Log.exception(this.getClass().getName(), "processServicesFromUrlTEST(String, Central)", + e); return sb.toString(); } if (p != null) { if (rdfServices == null) { - Log - .warning("Unable to retrieve the services from " + url - + "."); + Log.warning("Unable to retrieve the services from " + url + "."); sb .append("There was a problem extracting the services. Perhaps the rdf is invalid." + newline); return sb.toString(); } else if (rdfServices.length == 0) { if (p.isRDFValid()) { - Log.info("Unable to retrieve any services from " + url - + "." + newline + Log.info("Unable to retrieve any services from " + url + "." + newline + "Most likely cause is that there were none."); - sb.append("Unable to retrieve any services from " + url - + "." + newline + sb.append("Unable to retrieve any services from " + url + "." + newline + "Most likely cause is that there were none."); } else { - Log.info("Unable to retrieve any services from " + url - + "." + newline + "Some of the problems are: " - + Utils.format(p.getErrors(), 2)); - sb.append("Unable to retrieve any services from " + url - + "." + newline + "Some of the problems are: " - + Utils.format(p.getErrors(), 2)); + Log.info("Unable to retrieve any services from " + url + "." + newline + + "Some of the problems are: " + Utils.format(p.getErrors(), 2)); + sb.append("Unable to retrieve any services from " + url + "." + newline + + "Some of the problems are: " + Utils.format(p.getErrors(), 2)); } return sb.toString(); } else { - Log.info("Found the following services in the RDF located at " - + url); - sb.append("Found the following services in the RDF located at " - + url + newline); + Log.info("Found the following services in the RDF located at " + url); + sb.append("Found the following services in the RDF located at " + url + newline); for (int i = 0; i < rdfServices.length; i++) { MobyService serv = rdfServices[i]; MobyServiceComparator comparator = new MobyServiceComparator(); if (!comparator.areInputsOutputsForServiceValid(serv)) { - Log.info(Utils.format("Invalid service found: " - + serv.getUniqueName(), 2)); - sb.append(Utils.format("Invalid service found: " - + serv.getUniqueName(), 2) + Log.info(Utils.format("Invalid service found: " + serv.getUniqueName(), 2)); + sb.append(Utils.format("Invalid service found: " + serv.getUniqueName(), 2) + newline); } else { Log.info(Utils.format(serv, 2)); From kawas at dev.open-bio.org Mon Mar 27 15:01:53 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 10:01:53 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271501.k2RF1rgv018485@dev.open-bio.org> kawas Mon Mar 27 10:01:53 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv18452/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: more specific messages added when logging found services in the rdf moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.17,1.18 From kawas at dev.open-bio.org Mon Mar 27 16:30:49 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 11:30:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271630.k2RGUnYQ019116@dev.open-bio.org> kawas Mon Mar 27 11:30:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv19084/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: log when no changes are found when using a URL moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.18,1.19 From gss at dev.open-bio.org Mon Mar 27 17:16:02 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Mon, 27 Mar 2006 12:16:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271716.k2RHG2tw019738@dev.open-bio.org> gss Mon Mar 27 12:16:02 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/WebRoot/ontologies/core In directory dev.open-bio.org:/tmp/cvs-serv19706 Modified Files: inputURI.n3 Log Message: Fixed a typo s-moby/ref-impl/semanticmoby.org/WebRoot/ontologies/core inputURI.n3,1.1,1.2 From gss at dev.open-bio.org Mon Mar 27 17:54:41 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Mon, 27 Mar 2006 12:54:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603271754.k2RHsfOt019951@dev.open-bio.org> gss Mon Mar 27 12:54:41 EST 2006 Update of /home/repository/moby/s-moby/provider/examples/fasta-sequence/build In directory dev.open-bio.org:/tmp/cvs-serv19918/examples/fasta-sequence/build Modified Files: build.xml build.properties.template Log Message: Don't assume war gets deployed to webapps directory s-moby/provider/examples/fasta-sequence/build build.xml,1.3,1.4 build.properties.template,1.1,1.2 From kawas at dev.open-bio.org Mon Mar 27 20:18:43 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 15:18:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272018.k2RKIh19020326@dev.open-bio.org> kawas Mon Mar 27 15:18:43 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv20294/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: when a service is modified, the agent will attempt to remove the old service and add the modified one. The new one may be invalid, so the agent will attempt to revert back to the old one. The agent gives back weird messages and so i have modified them for this scenario. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.19,1.20 From kawas at dev.open-bio.org Mon Mar 27 20:28:50 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 15:28:50 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272028.k2RKSobk020453@dev.open-bio.org> kawas Mon Mar 27 15:28:50 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv20421 Modified Files: service_instance.pm Log Message: fixed the timestamp to include Z or +dddd or -dddd moby-live/Perl/MOBY service_instance.pm,1.40,1.41 From kawas at dev.open-bio.org Mon Mar 27 21:04:25 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 16:04:25 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272104.k2RL4P0g020697@dev.open-bio.org> kawas Mon Mar 27 16:04:25 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv20664/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: when using the -test option and the url isnt valid, a null pointer is returned. Catching that exception. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.20,1.21 From kawas at dev.open-bio.org Mon Mar 27 21:05:47 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 27 Mar 2006 16:05:47 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603272105.k2RL5lfa020794@dev.open-bio.org> kawas Mon Mar 27 16:05:47 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv20762/org/biomoby/client Modified Files: CentralImpl.java Log Message: added to the registerService call moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.41,1.42 From senger at dev.open-bio.org Tue Mar 28 11:55:26 2006 From: senger at dev.open-bio.org (Martin Senger) Date: Tue, 28 Mar 2006 06:55:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281155.k2SBtP7g023845@dev.open-bio.org> senger Tue Mar 28 06:55:25 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv23828/docs Modified Files: Dashboard-NOTES.txt index.html Log Message: moby-live/Java/docs Dashboard-NOTES.txt,1.7,1.8 index.html,1.20,1.21 From lxm at dev.open-bio.org Tue Mar 28 17:54:30 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Tue, 28 Mar 2006 12:54:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281754.k2SHsUJQ026210@dev.open-bio.org> lxm Tue Mar 28 12:54:29 EST 2006 Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api In directory dev.open-bio.org:/tmp/cvs-serv26178 Modified Files: Log.java Log Message: added changes to log functionality to new repository, current class and method, as well as src file and line number are now prepended to all log messages s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/api Log.java,1.3,1.4 From mwilkinson at dev.open-bio.org Tue Mar 28 18:18:33 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 28 Mar 2006 13:18:33 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281818.k2SIIXfh026467@dev.open-bio.org> mwilkinson Tue Mar 28 13:18:33 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv26451/MOBY Modified Files: Central.pm Log Message: findService was not returning the LSID of the service type, as it was supposed to moby-live/Perl/MOBY Central.pm,1.250,1.251 From mwilkinson at dev.open-bio.org Tue Mar 28 18:30:06 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 28 Mar 2006 13:30:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603281830.k2SIU6kJ026887@dev.open-bio.org> mwilkinson Tue Mar 28 13:30:06 EST 2006 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv26871/t Modified Files: CommonSubs.t Log Message: service notes test was failing moby-live/Perl/t CommonSubs.t,1.4,1.5 From gordonp at dev.open-bio.org Tue Mar 28 21:11:22 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 28 Mar 2006 16:11:22 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282111.k2SLBM2G011792@dev.open-bio.org> gordonp Tue Mar 28 16:11:22 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv11758 Modified Files: MobyRequest.java MobyRequestEvent.java MobyRequestEventHandler.java Log Message: Updates to simplify secondary input and to handle callbacks moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.16,1.17 MobyRequestEvent.java,1.2,1.3 MobyRequestEventHandler.java,1.1,1.2 From kawas at dev.open-bio.org Tue Mar 28 23:03:16 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:03:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282303.k2SN3Gxd012641@dev.open-bio.org> kawas Tue Mar 28 18:03:16 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv12609/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: LSIDAuthorityMetaData.java Log Message: add the correct logic for determining whether an LSIDs object actually refered to a past object. moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDAuthorityMetaData.java,1.4,1.5 From kawas at dev.open-bio.org Tue Mar 28 23:04:04 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:04:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282304.k2SN4495012678@dev.open-bio.org> kawas Tue Mar 28 18:04:04 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv12646/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: LSIDDataLookup.java Log Message: modified some exception messages to make them more clear. note that they are slightly better, but should be redone later on. moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDDataLookup.java,1.6,1.7 From kawas at dev.open-bio.org Tue Mar 28 23:04:46 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:04:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282304.k2SN4kBc012715@dev.open-bio.org> kawas Tue Mar 28 18:04:46 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv12683/org/biomoby/client/rdf/builder Modified Files: RDFConfigure.java Log Message: fixed the way that it is determined whether objects existed or exist in the ontologies moby-live/Java/src/main/org/biomoby/client/rdf/builder RDFConfigure.java,1.11,1.12 From kawas at dev.open-bio.org Tue Mar 28 23:05:53 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 28 Mar 2006 18:05:53 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603282305.k2SN5rDj012808@dev.open-bio.org> kawas Tue Mar 28 18:05:53 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv12776/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java Log Message: moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.14,1.15 From kawas at dev.open-bio.org Wed Mar 29 19:17:44 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:17:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291917.k2TJHiwr016252@dev.open-bio.org> kawas Wed Mar 29 14:17:44 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv16220/org/biomoby/shared Modified Files: MobyService.java Log Message: added a moby service type object reference as a property of a mobyservice moby-live/Java/src/main/org/biomoby/shared MobyService.java,1.10,1.11 From kawas at dev.open-bio.org Wed Mar 29 19:19:19 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:19:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291919.k2TJJJPV016328@dev.open-bio.org> kawas Wed Mar 29 14:19:19 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv16296/org/biomoby/client Modified Files: CentralImpl.java Log Message: added service type lsid information to the services found in findService. moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.42,1.43 From kawas at dev.open-bio.org Wed Mar 29 19:22:39 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:22:39 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291922.k2TJMdvX016462@dev.open-bio.org> kawas Wed Mar 29 14:22:39 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv16429/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java RDFConfigure.java Log Message: changed the URI reference for service types to LSIDs moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.15,1.16 RDFConfigure.java,1.12,1.13 From kawas at dev.open-bio.org Wed Mar 29 19:23:34 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 14:23:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603291923.k2TJNYD9016499@dev.open-bio.org> kawas Wed Mar 29 14:23:34 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv16467/org/biomoby/shared/extended Modified Files: ServiceInstanceParser.java Log Message: now obtain service types LSIDs moby-live/Java/src/main/org/biomoby/shared/extended ServiceInstanceParser.java,1.12,1.13 From kawas at dev.open-bio.org Wed Mar 29 20:09:46 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 15:09:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292009.k2TK9kxo016735@dev.open-bio.org> kawas Wed Mar 29 15:09:46 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv16702/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: LSIDAuthorityMetaData.java LSIDDataLookup.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDAuthorityMetaData.java,1.5,1.6 LSIDDataLookup.java,1.7,1.8 From kawas at dev.open-bio.org Wed Mar 29 20:09:46 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 15:09:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292009.k2TK9knh016752@dev.open-bio.org> kawas Wed Mar 29 15:09:46 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources In directory dev.open-bio.org:/tmp/cvs-serv16702/org/biomoby/client/ui/graphical/servlet/jresources Modified Files: RESOURCE.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.14,1.15 From kawas at dev.open-bio.org Wed Mar 29 21:13:49 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 16:13:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292113.k2TLDnUi016925@dev.open-bio.org> kawas Wed Mar 29 16:13:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv16893/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.21,1.22 From kawas at dev.open-bio.org Wed Mar 29 21:19:27 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 29 Mar 2006 16:19:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292119.k2TLJRJj016988@dev.open-bio.org> kawas Wed Mar 29 16:19:27 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv16956/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Log Message: better null signature url message moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.22,1.23 From gss at dev.open-bio.org Wed Mar 29 23:49:21 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Wed, 29 Mar 2006 18:49:21 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292349.k2TNnL2C019430@dev.open-bio.org> gss Wed Mar 29 18:49:21 EST 2006 Update of /home/repository/moby/s-moby/api/build In directory dev.open-bio.org:/tmp/cvs-serv19398 Modified Files: build.xml Log Message: Added debug flags to target s-moby/api/build build.xml,1.2,1.3 From gss at dev.open-bio.org Wed Mar 29 23:49:56 2006 From: gss at dev.open-bio.org (Gary Schiltz) Date: Wed, 29 Mar 2006 18:49:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603292349.k2TNnuQ7019476@dev.open-bio.org> gss Wed Mar 29 18:49:55 EST 2006 Update of /home/repository/moby/s-moby/provider/build In directory dev.open-bio.org:/tmp/cvs-serv19438 Modified Files: build.xml Log Message: Added debug flags to target s-moby/provider/build build.xml,1.1,1.2 From lxm at dev.open-bio.org Thu Mar 30 17:35:38 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:35:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301735.k2UHZcwx020971@dev.open-bio.org> lxm Thu Mar 30 12:35:38 EST 2006 Update of /home/repository/moby/s-moby/dserver In directory dev.open-bio.org:/tmp/cvs-serv20937/dserver Log Message: Directory /home/repository/moby/s-moby/dserver added to the repository s-moby/dserver - New directory From lxm at dev.open-bio.org Thu Mar 30 17:36:02 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:36:02 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301736.k2UHa2sB021013@dev.open-bio.org> lxm Thu Mar 30 12:36:02 EST 2006 Update of /home/repository/moby/s-moby/dserver/build In directory dev.open-bio.org:/tmp/cvs-serv20979/build Log Message: Directory /home/repository/moby/s-moby/dserver/build added to the repository s-moby/dserver/build - New directory From lxm at dev.open-bio.org Thu Mar 30 17:37:04 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:37:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301737.k2UHb48a021073@dev.open-bio.org> lxm Thu Mar 30 12:37:04 EST 2006 Update of /home/repository/moby/s-moby/api/src/org/semanticmoby/api In directory dev.open-bio.org:/tmp/cvs-serv21042 Added Files: Log.java Log Message: added logging to the core api s-moby/api/src/org/semanticmoby/api Log.java,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 17:46:36 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:46:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301746.k2UHkaeP021115@dev.open-bio.org> lxm Thu Mar 30 12:46:35 EST 2006 Update of /home/repository/moby/s-moby/dserver/src In directory dev.open-bio.org:/tmp/cvs-serv21081/src Log Message: Directory /home/repository/moby/s-moby/dserver/src added to the repository s-moby/dserver/src - New directory From lxm at dev.open-bio.org Thu Mar 30 17:47:01 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:47:01 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301747.k2UHl1Nf021157@dev.open-bio.org> lxm Thu Mar 30 12:47:01 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org In directory dev.open-bio.org:/tmp/cvs-serv21123/org Log Message: Directory /home/repository/moby/s-moby/dserver/src/org added to the repository s-moby/dserver/src/org - New directory From lxm at dev.open-bio.org Thu Mar 30 17:47:22 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:47:22 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301747.k2UHlMA9021199@dev.open-bio.org> lxm Thu Mar 30 12:47:22 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby In directory dev.open-bio.org:/tmp/cvs-serv21165/semanticmoby Log Message: Directory /home/repository/moby/s-moby/dserver/src/org/semanticmoby added to the repository s-moby/dserver/src/org/semanticmoby - New directory From lxm at dev.open-bio.org Thu Mar 30 17:47:45 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:47:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301747.k2UHljUV021241@dev.open-bio.org> lxm Thu Mar 30 12:47:44 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver In directory dev.open-bio.org:/tmp/cvs-serv21207/dserver Log Message: Directory /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver added to the repository s-moby/dserver/src/org/semanticmoby/dserver - New directory From lxm at dev.open-bio.org Thu Mar 30 17:48:26 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:48:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301748.k2UHmQ3g021283@dev.open-bio.org> lxm Thu Mar 30 12:48:26 EST 2006 Update of /home/repository/moby/s-moby/dclient In directory dev.open-bio.org:/tmp/cvs-serv21249/dclient Log Message: Directory /home/repository/moby/s-moby/dclient added to the repository s-moby/dclient - New directory From lxm at dev.open-bio.org Thu Mar 30 17:48:51 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:48:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301748.k2UHmpFR021325@dev.open-bio.org> lxm Thu Mar 30 12:48:51 EST 2006 Update of /home/repository/moby/s-moby/dclient/build In directory dev.open-bio.org:/tmp/cvs-serv21291/build Log Message: Directory /home/repository/moby/s-moby/dclient/build added to the repository s-moby/dclient/build - New directory From lxm at dev.open-bio.org Thu Mar 30 17:49:16 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:49:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301749.k2UHnGGq021367@dev.open-bio.org> lxm Thu Mar 30 12:49:16 EST 2006 Update of /home/repository/moby/s-moby/dclient/src In directory dev.open-bio.org:/tmp/cvs-serv21333/src Log Message: Directory /home/repository/moby/s-moby/dclient/src added to the repository s-moby/dclient/src - New directory From lxm at dev.open-bio.org Thu Mar 30 17:49:29 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:49:29 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301749.k2UHnTYq021409@dev.open-bio.org> lxm Thu Mar 30 12:49:28 EST 2006 Update of /home/repository/moby/s-moby/dclient/src/org In directory dev.open-bio.org:/tmp/cvs-serv21375/org Log Message: Directory /home/repository/moby/s-moby/dclient/src/org added to the repository s-moby/dclient/src/org - New directory From lxm at dev.open-bio.org Thu Mar 30 17:49:52 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:49:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301749.k2UHnq9m021451@dev.open-bio.org> lxm Thu Mar 30 12:49:52 EST 2006 Update of /home/repository/moby/s-moby/dclient/src/org/semanticmoby In directory dev.open-bio.org:/tmp/cvs-serv21417/semanticmoby Log Message: Directory /home/repository/moby/s-moby/dclient/src/org/semanticmoby added to the repository s-moby/dclient/src/org/semanticmoby - New directory From lxm at dev.open-bio.org Thu Mar 30 17:50:14 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 12:50:14 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603301750.k2UHoEsK021493@dev.open-bio.org> lxm Thu Mar 30 12:50:14 EST 2006 Update of /home/repository/moby/s-moby/dclient/src/org/semanticmoby/dclient In directory dev.open-bio.org:/tmp/cvs-serv21459/dclient Log Message: Directory /home/repository/moby/s-moby/dclient/src/org/semanticmoby/dclient added to the repository s-moby/dclient/src/org/semanticmoby/dclient - New directory From lxm at dev.open-bio.org Thu Mar 30 21:28:56 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 16:28:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302128.k2ULSuBB021862@dev.open-bio.org> lxm Thu Mar 30 16:28:56 EST 2006 Update of /home/repository/moby/s-moby/api In directory dev.open-bio.org:/tmp/cvs-serv21831 Added Files: build.xml Log Message: cleaned up build.xml that operates from the root "api" directory instead of the build directory, this is to comply with general open source practices s-moby/api build.xml,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 21:47:42 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 16:47:42 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302147.k2ULlgs3022006@dev.open-bio.org> lxm Thu Mar 30 16:47:42 EST 2006 Update of /home/repository/moby/s-moby/dserver In directory dev.open-bio.org:/tmp/cvs-serv21974 Added Files: build.xml Log Message: ant build file for the discovery server package, this is designed to be executed from the root "dserver" directory s-moby/dserver build.xml,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 22:10:34 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:10:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302210.k2UMAY0w022172@dev.open-bio.org> lxm Thu Mar 30 17:10:34 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver In directory dev.open-bio.org:/tmp/cvs-serv22141 Added Files: MOBYProperties.java MetadataRetriever.java ResourceRemover.java StorageException.java StorageManager.java Log Message: added first batch of files to new cvs structure for discovery server s-moby/dserver/src/org/semanticmoby/dserver MOBYProperties.java,NONE,1.1 MetadataRetriever.java,NONE,1.1 ResourceRemover.java,NONE,1.1 StorageException.java,NONE,1.1 StorageManager.java,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 22:22:09 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:22:09 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302222.k2UMM9AV022216@dev.open-bio.org> lxm Thu Mar 30 17:22:08 EST 2006 Update of /home/repository/moby/s-moby/dserver/web In directory dev.open-bio.org:/tmp/cvs-serv22182/web Log Message: Directory /home/repository/moby/s-moby/dserver/web added to the repository s-moby/dserver/web - New directory From lxm at dev.open-bio.org Thu Mar 30 22:22:37 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:22:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302222.k2UMMbiQ022258@dev.open-bio.org> lxm Thu Mar 30 17:22:36 EST 2006 Update of /home/repository/moby/s-moby/dserver/web/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv22224/WEB-INF Log Message: Directory /home/repository/moby/s-moby/dserver/web/WEB-INF added to the repository s-moby/dserver/web/WEB-INF - New directory From lxm at dev.open-bio.org Thu Mar 30 22:29:44 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:29:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302229.k2UMTiZ9022382@dev.open-bio.org> lxm Thu Mar 30 17:29:44 EST 2006 Update of /home/repository/moby/s-moby/dserver In directory dev.open-bio.org:/tmp/cvs-serv22350 Modified Files: build.xml Log Message: added the files necessary for the first set of files to build, this includes the web.xml in the web directory s-moby/dserver build.xml,1.1,1.2 From lxm at dev.open-bio.org Thu Mar 30 22:29:44 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:29:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302229.k2UMTiKY022398@dev.open-bio.org> lxm Thu Mar 30 17:29:44 EST 2006 Update of /home/repository/moby/s-moby/dserver/src/org/semanticmoby/dserver In directory dev.open-bio.org:/tmp/cvs-serv22350/src/org/semanticmoby/dserver Added Files: MissingPropertyException.java Log Message: added the files necessary for the first set of files to build, this includes the web.xml in the web directory s-moby/dserver/src/org/semanticmoby/dserver MissingPropertyException.java,NONE,1.1 From lxm at dev.open-bio.org Thu Mar 30 22:29:44 2006 From: lxm at dev.open-bio.org (Lonny Montoya) Date: Thu, 30 Mar 2006 17:29:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603302229.k2UMTiit022414@dev.open-bio.org> lxm Thu Mar 30 17:29:44 EST 2006 Update of /home/repository/moby/s-moby/dserver/web/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv22350/web/WEB-INF Added Files: web.xml Log Message: added the files necessary for the first set of files to build, this includes the web.xml in the web directory s-moby/dserver/web/WEB-INF web.xml,NONE,1.1 From kawas at dev.open-bio.org Fri Mar 31 21:46:38 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 16:46:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312146.k2VLkcHn024401@dev.open-bio.org> kawas Fri Mar 31 16:46:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Data In directory dev.open-bio.org:/tmp/cvs-serv24369/MOBY/Data Modified Files: MobyProvisionInfo.pm Log Message: moby-live/Java/src/Perl/MOBY/Data MobyProvisionInfo.pm,1.3,1.4 From kawas at dev.open-bio.org Fri Mar 31 21:47:31 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 16:47:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312147.k2VLlV4X024474@dev.open-bio.org> kawas Fri Mar 31 16:47:31 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Datatypes In directory dev.open-bio.org:/tmp/cvs-serv24442/MOBY/Datatypes Modified Files: MobyBoolean.pm Log Message: moby-live/Java/src/Perl/MOBY/Datatypes MobyBoolean.pm,1.1,1.2 From kawas at dev.open-bio.org Fri Mar 31 21:49:49 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 16:49:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312149.k2VLnnPV024550@dev.open-bio.org> kawas Fri Mar 31 16:49:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Datatypes In directory dev.open-bio.org:/tmp/cvs-serv24518/MOBY/Datatypes Modified Files: MobyDataType.pm Log Message: moby-live/Java/src/Perl/MOBY/Datatypes MobyDataType.pm,1.1,1.2 From kawas at dev.open-bio.org Fri Mar 31 22:22:23 2006 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 31 Mar 2006 17:22:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312222.k2VMMNGN024616@dev.open-bio.org> kawas Fri Mar 31 17:22:23 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOBY/Datatypes In directory dev.open-bio.org:/tmp/cvs-serv24584/MOBY/Datatypes Modified Files: MobyDateTime.pm Log Message: moby-live/Java/src/Perl/MOBY/Datatypes MobyDateTime.pm,1.1,1.2 From mwilkinson at dev.open-bio.org Fri Mar 31 23:07:23 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 31 Mar 2006 18:07:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312307.k2VN7Nji025361@dev.open-bio.org> mwilkinson Fri Mar 31 18:07:23 EST 2006 Update of /home/repository/moby/moby-live/OWL In directory dev.open-bio.org:/tmp/cvs-serv25343/OWL Log Message: Directory /home/repository/moby/moby-live/OWL added to the repository moby-live/OWL - New directory From mwilkinson at dev.open-bio.org Fri Mar 31 23:09:26 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 31 Mar 2006 18:09:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200603312309.k2VN9QFn025451@dev.open-bio.org> mwilkinson Fri Mar 31 18:09:25 EST 2006 Update of /home/repository/moby/moby-live/OWL In directory dev.open-bio.org:/tmp/cvs-serv25436/OWL Added Files: ServiceDescription.owl ServiceDescriptions.swp Log Message: adding a folder for OWL ontologies, plus the beginnings of the OWL description that our RDF will classify into moby-live/OWL ServiceDescription.owl,NONE,1.1 ServiceDescriptions.swp,NONE,1.1