From senger at pub.open-bio.org Thu Apr 1 11:41:03 2004
From: senger at pub.open-bio.org (senger@ebi.ac.uk)
Date: Thu Apr 1 11:33:37 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404011641.i31Gf3t6006392@pub.open-bio.org>
senger
Thu Apr 1 11:41:03 EST 2004
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory pub.open-bio.org:/tmp/cvs-serv6373/src/Clients
Modified Files:
MobyGraphs.java
Log Message:
moby-live/Java/src/Clients MobyGraphs.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java 2003/11/25 13:18:10 1.3
+++ /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java 2004/04/01 16:41:03 1.4
@@ -179,13 +179,18 @@
}
edges = FilterServices.filter (edges, authorities, serviceNames, depth);
- String[] pathEnds = cmd.getParam ("-path", 2);
- if (pathEnds.length == 2)
+ if (cmd.hasParam ("-path")) {
+ String[] pathEnds = cmd.getParam ("-path", 2);
+ if (pathEnds[0] == null || pathEnds[1] == null) {
+ System.err.println ("Missing value for parameter '-path'. It should be followed by two service names.");
+ System.exit (1);
+ }
edges = FilterServices.pathes (edges, pathEnds[0], pathEnds[1]);
- if (edges == null) {
- System.err.println ("No connection found between '" +
- pathEnds[0] + "' and '" + pathEnds[1] + "'");
- System.exit(1);
+ if (edges == null) {
+ System.err.println ("No connection found between '" +
+ pathEnds[0] + "' and '" + pathEnds[1] + "'");
+ System.exit(1);
+ }
}
// create a graph (in whatever format)
From senger at pub.open-bio.org Thu Apr 1 11:41:03 2004
From: senger at pub.open-bio.org (senger@ebi.ac.uk)
Date: Thu Apr 1 11:33:37 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404011641.i31Gf3Vp006415@pub.open-bio.org>
senger
Thu Apr 1 11:41:03 EST 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv6373/src/main/org/biomoby/client
Modified Files:
CentralImpl.java ServiceConnections.java
Log Message:
moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.7,1.8 ServiceConnections.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.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/client/CentralImpl.java 2004/03/09 00:20:13 1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2004/04/01 16:41:03 1.8
@@ -587,8 +587,12 @@
NodeList children = elem.getChildNodes();
for (int j = 0; j < children.getLength(); j++) {
if (children.item (j).getNodeName().equals ("Description")) {
- results.put (elem.getAttribute ("name"),
- children.item (j).getFirstChild().getNodeValue());
+ String desc;
+ if (children.item (j).getFirstChild() == null)
+ desc = "";
+ else
+ desc = children.item (j).getFirstChild().getNodeValue();
+ results.put (elem.getAttribute ("name"), desc);
break;
}
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.java 2003/10/17 13:13:34 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.java 2004/04/01 16:41:03 1.2
@@ -69,7 +69,7 @@
Hashtable dataTypesTable = new Hashtable();
for (int i = 0; i < dataTypes.length; i++) {
MobyDataType dataType = dataTypes[i];
- dataTypesTable.put (dataType.getName().toLowerCase(), dataType);
+ dataTypesTable.put (Utils.pureName (dataType.getName()).toLowerCase(), dataType);
}
// here we are going to build the resulting edges
@@ -117,12 +117,13 @@
// ...find the data type of this output
String dataTypeName = output.getDataType().getName();
MobyDataType dataType =
- (MobyDataType)dataTypesTable.get (dataTypeName.toLowerCase());
+ (MobyDataType)dataTypesTable.get (Utils.pureName (dataTypeName).toLowerCase());
if (dataType == null) {
// this means that there is something wrong with the Moby central registration
System.err.println ("Service " + name +
" has an unknown output data type '" +
Utils.pureName (dataTypeName) + "'");
+ System.err.println ("\tLSID: " + dataTypeName);
continue;
}
@@ -239,10 +240,11 @@
String connector = null;
MobyDataType outputType =
- (MobyDataType)dataTypes.get (output.getDataType().getName().toLowerCase());
-
- String outputName = outputType.getName();
- String inputName = input.getDataType().getName();
+ (MobyDataType)dataTypes.get (Utils.pureName (output.getDataType().getName()).toLowerCase());
+ if (outputType == null) // strange...
+ return null;
+ String outputName = Utils.pureName (outputType.getName());
+ String inputName = Utils.pureName (input.getDataType().getName());
if (outputName.equals (inputName))
connector = outputName;
@@ -275,7 +277,9 @@
if (inputName.equals (parents[i]))
return true;
MobyDataType outputType =
- (MobyDataType)dataTypes.get (parents[i].toLowerCase());
+ (MobyDataType)dataTypes.get (Utils.pureName (parents[i]).toLowerCase());
+ if (outputType == null) // strange?
+ return false;
if (findMatchInParents (outputType.getParentNames(), inputName, dataTypes))
return true;
}
From gordonp at pub.open-bio.org Thu Apr 1 12:30:08 2004
From: gordonp at pub.open-bio.org (Paul Gordon)
Date: Thu Apr 1 12:36:53 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404011730.i31HU8PW006626@pub.open-bio.org>
gordonp
Thu Apr 1 12:30:08 EST 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv6601
Modified Files:
CentralImpl.java
Log Message:
Implements response caching, and uses JAXP DocumentBuilder to harness a XML parser in a more platform independent way
moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.8,1.9
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.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/CentralImpl.java 2004/04/01 16:41:03 1.8
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2004/04/01 17:30:08 1.9
@@ -61,11 +61,12 @@
public class CentralImpl
implements Central {
-
+ private Hashtable cache; // To not call MOBY Central everytime the same method is called
private URL endpoint;
private String uri;
- private ParserWrapper parser;
+ private javax.xml.parsers.DocumentBuilder docBuilder;
private boolean debug = false;
+ private boolean useCache = true;
/** Default location (endpoint) of a Moby registry. */
// public static final String DEFAULT_ENDPOINT = "http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl";
@@ -118,8 +119,18 @@
}
this.uri = namespace;
- // instantiate a DOM parser
- parser = Utils.getDOMParser();
+ // This method should work on almost all platforms to get an XML parser instance
+ try {
+ javax.xml.parsers.DocumentBuilderFactory dbf =
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ docBuilder = dbf.newDocumentBuilder();
+ } catch (Exception e) {
+ throw new MobyException ("Could not configure an XML parser: " + e);
+ }
+
+ cache = new Hashtable();
+ useCache = true;
}
/*************************************************************************
@@ -192,8 +203,11 @@
String id = "", success = "0", message = "";
// parse returned XML
- Document document = parser.parse (new StringReader (xml));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(xml));}
+ catch(Exception e){throw new MobyException(e.toString());}
Element root = document.getDocumentElement();
+
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
if (children.item (i).getNodeType() != Node.ELEMENT_NODE)
@@ -403,8 +417,11 @@
*************************************************************************/
protected MobyService[] extractServices (String xml)
throws MobyException {
+
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(xml));}
+ catch(Exception e){throw new MobyException(e.toString());}
- Document document = parser.parse (new StringReader (xml));
NodeList list = document.getElementsByTagName ("Service");
MobyService[] results = new MobyService [list.getLength()];
for (int i = 0; i < list.getLength(); i++) {
@@ -491,18 +508,31 @@
*************************************************************************/
public Map getServiceNames()
throws MobyException {
+
+ // First, check to se if we have the values cached from a previous call
+ // in this instance
+ if(useCache && cache.containsKey("retrieveServiceNames"))
+ return (Map) cache.get("retrieveServiceNames");
+
String result = (String)doCall ("retrieveServiceNames",
new Object[] {});
// parse returned XML
Map results = new HashMap();
- Document document = parser.parse (new StringReader (result));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
NodeList list = document.getElementsByTagName ("serviceName");
for (int i = 0; i < list.getLength(); i++) {
Element elem = (Element)list.item (i);
results.put (elem.getAttribute ("name"),
elem.getAttribute ("authURI"));
}
+
+ // Add this data to the cache in case we get called again
+ if(useCache)
+ cache.put("retrieveServiceNames", results);
return results;
}
@@ -516,15 +546,27 @@
*************************************************************************/
public String[] getProviders()
throws MobyException {
+
+ // First, see if we have the values cached from a previous call in this instance
+ if(useCache && cache.containsKey("retrieveServiceProviders"))
+ return (String[]) cache.get("retrieveServiceProviders");
+
String result = (String)doCall ("retrieveServiceProviders",
new Object[] {});
// parse returned XML
- Document document = parser.parse (new StringReader (result));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
NodeList list = document.getElementsByTagName ("serviceProvider");
String[] results = new String [list.getLength()];
for (int i = 0; i < list.getLength(); i++)
results[i] = ((Element)list.item (i)).getAttribute ("name");
+
+ // Add this data to the cache in case we get called again
+ if(useCache)
+ cache.put("retrieveServiceProviders", results);
return results;
}
@@ -541,12 +583,19 @@
*************************************************************************/
public Map getServiceTypes()
throws MobyException {
+ // First, see if we have the values cached from a previous call in this instance
+ if(useCache && cache.containsKey("retrieveServiceTypes"))
+ return (Map) cache.get("retrieveServiceTypes");
+
String result = (String)doCall ("retrieveServiceTypes",
new Object[] {});
// parse returned XML
Map results = new HashMap();
- Document document = parser.parse (new StringReader (result));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
NodeList list = document.getElementsByTagName ("serviceType");
for (int i = 0; i < list.getLength(); i++) {
Element elem = (Element)list.item (i);
@@ -559,6 +608,10 @@
}
}
}
+
+ // Add this data to the cache in case we get called again
+ if(useCache)
+ cache.put("retrieveServiceTypes", results);
return results;
}
@@ -575,28 +628,43 @@
*************************************************************************/
public Map getNamespaces()
throws MobyException {
+
+ // First, see if we have the values cached from a previous call in this instance
+ if(useCache && cache.containsKey("retrieveNamespaces"))
+ return (Map) cache.get("retrieveNamespaces");
+
String result = (String)doCall ("retrieveNamespaces",
new Object[] {});
// parse returned XML
Map results = new HashMap();
- Document document = parser.parse (new StringReader (result));
- NodeList list = document.getElementsByTagName ("Namespace");
- for (int i = 0; i < list.getLength(); i++) {
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
+ NodeList list = document.getDocumentElement().getElementsByTagName ("Namespace");
+ if(list == null || list.getLength() == 0){
+ throw new MobyException("Could not find Namespace children of response root node " +
+ document.getDocumentElement());
+ }
+ int length = list.getLength();
+ for (int i = 0; i < length; i++) {
Element elem = (Element)list.item (i);
- NodeList children = elem.getChildNodes();
- for (int j = 0; j < children.getLength(); j++) {
- if (children.item (j).getNodeName().equals ("Description")) {
- String desc;
- if (children.item (j).getFirstChild() == null)
- desc = "";
- else
- desc = children.item (j).getFirstChild().getNodeValue();
- results.put (elem.getAttribute ("name"), desc);
- break;
- }
+ NodeList children = elem.getElementsByTagName("Description");
+ if(children.item(0).hasChildNodes()){
+ children.item(0).normalize();
+ results.put (elem.getAttribute ("name"),
+ children.item(0).getFirstChild().getNodeValue());
+ }
+ else{
+ // No description provided
+ results.put (elem.getAttribute ("name"), "");
}
}
+
+ // Add this data to the cache in case we get called again
+ if(useCache)
+ cache.put("retrieveNamespaces", results);
return results;
}
@@ -613,12 +681,19 @@
*************************************************************************/
public Map getDataTypeNames()
throws MobyException {
+ // First, see if we have the values cached from a previous call in this instance
+ if(useCache && cache.containsKey("retrieveObjectNames"))
+ return (Map) cache.get("retrieveObjectNames");
+
String result = (String)doCall ("retrieveObjectNames",
new Object[] {});
// parse returned XML
Map results = new HashMap();
- Document document = parser.parse (new StringReader (result));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
NodeList list = document.getElementsByTagName ("Object");
for (int i = 0; i < list.getLength(); i++) {
Element elem = (Element)list.item (i);
@@ -631,6 +706,9 @@
}
}
}
+
+ if(useCache)
+ cache.put("retrieveObjectNames", results);
return results;
}
@@ -655,6 +733,11 @@
*************************************************************************/
public MobyDataType getDataType (String dataTypeName)
throws MobyException, NoSuccessException {
+
+ // See if we've already retrieved the DataType and cached it
+ if(cache.containsKey("retrieveObjectDefinition"+dataTypeName))
+ return (MobyDataType) cache.get("retrieveObjectDefinition"+dataTypeName);
+
String result =
(String)doCall ("retrieveObjectDefinition",
new Object[] {
@@ -664,7 +747,10 @@
});
// parse returned XML
- Document document = parser.parse (new StringReader (result));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
NodeList list = document.getElementsByTagName ("retrieveObjectDefinition");
if (list == null || list.getLength() == 0)
throw new NoSuccessException ("Data Type name was not founnd.",
@@ -717,6 +803,7 @@
}
}
}
+ cache.put("retrieveObjectDefinition"+dataTypeName, data);
return data;
}
@@ -778,6 +865,11 @@
*************************************************************************/
public String getServiceWSDL (String serviceName, String authority)
throws MobyException, NoSuccessException {
+ // See if we've already retrieved the DataType and cached it
+ String cacheKey = "getServiceWSDL" + serviceName + ":" + authority;
+ if(cache.containsKey(cacheKey))
+ return (String) cache.get(cacheKey);
+
String result =
(String)doCall ("retrieveService",
new Object[] {
@@ -787,12 +879,17 @@
});
// parse returned XML
- Document document = parser.parse (new StringReader (result));
+ Document document = null;
+ try{document=docBuilder.parse(new StringBufferInputStream(result));}
+ catch(Exception e){throw new MobyException(e.toString());}
+
Element service = document.getDocumentElement();
Node wsdl = service.getFirstChild();
if (wsdl == null)
throw new NoSuccessException ("Service not found OR WSDL is not available.",
serviceName + " (" + authority + ")");
+ if(useCache)
+ cache.put(cacheKey, wsdl.getNodeValue());
return wsdl.getNodeValue();
}
@@ -1051,14 +1148,20 @@
if (pattern == null)
pattern = new MobyService ("dummy");
- String result =
- (String)doCall ("findService",
- new Object[] {
+ String[] query = new String[] {
"
** * The all not yet existing directories (for example the last - * 'cache' diorectory) will be created for you. + * 'cache' directory) will be created for you. */cache/ *
* * 'rootURLName' is used by method {@link #getURL} to return back @@ -75,7 +78,11 @@ static final char CLEAR_CHAR = '_'; /************************************************************************** * It creates an 'id' in the form: - * rootName / semanticType / prop1_prop2_... (time).syntaxType + * rootName / semanticType / { prop1_prop2_... } (time).syntaxType + * + * The part between { and } (inclusive) will be replaced by a + * unique shorter string in order to create a reasonably long real + * file name. **************************************************************************/ public String createId (String rootName, String semanticType, String syntaxType, @@ -94,10 +101,13 @@ ps[++i] = it.next().toString(); } Arrays.sort (ps); + buf.append ("{"); for (int i = 0; i < ps.length; i++) { buf.append (CLEAR_CHAR); - buf.append (clean (ps[i].toString())); +// buf.append (clean (ps[i].toString())); + buf.append (ps[i].toString()); } + buf.append ("}"); buf.append ("(" + lastModified + ")"); buf.append ("."); buf.append (clean (syntaxType)); @@ -235,6 +245,20 @@ * dir (as set in a constructor). **************************************************************************/ protected String getRelativeFilename (String id) { - return fileSeparator + startingDir + fileSeparator + id; + String fileName = (String)index.get (id); + if (fileName == null) { + int posFrom = id.indexOf ("{"); + int posTo = id.indexOf ("}"); + StringBuffer buf = new StringBuffer(); + buf.append (fileSeparator); + buf.append (startingDir); + buf.append (fileSeparator); + buf.append (id.substring (0, posFrom)); + buf.append (clean (new java.rmi.server.UID().toString())); + buf.append (id.substring (posTo+1)); + fileName = new String (buf); + index.put (id, fileName); + } + return fileName; } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.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/GraphsServlet.java 2003/11/25 13:18:10 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java 2004/04/01 21:03:42 1.5 @@ -491,7 +491,7 @@ h.gen (TD, radios[0]) + h.gen (TD, - "Show all services and all connections")) + + "Show all services and all connections " + h.gen (EM, "(very long and big)"))) + h.gen (TR, h.gen (TD, new String[] { VALIGN, "top" }, radios[1]) + =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java 2003/11/08 00:27:24 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java 2004/04/01 21:03:42 1.2 @@ -40,11 +40,11 @@ * * * The not existing directories (for example the last 'cache' - * diorectory) will be created for you. + * directory) will be created for you. * * The 'contextPath' is a path (relative to the servlet context) * where the cached files will be created (actually starting from - * here, because they may be created ina deeper directory + * here, because they may be created in a deeper directory * structure. Usually you get it in the calling servlet from the * request by method request.getContextPath(). The 'contextPath' * starts with a "/" character but does not end with a "/" From mwilkinson at pub.open-bio.org Thu Apr 1 16:23:48 2004 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu Apr 1 16:16:19 2004 Subject: [MOBY-guts] biomoby commit Message-ID: <200404012123.i31LNmaC007236@pub.open-bio.org> mwilkinson Thu Apr 1 16:23:47 EST 2004 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv7213/MOBY/Client Modified Files: Service.html Service.pm Log Message: update the execute method to allow multiple inputs to a single invocation. Documentation updated. Fixed bug of articleName attribute being attached to the wrong XML element moby-live/Perl/MOBY/Client Service.html,1.3,1.4 Service.pm,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html 2003/08/06 14:31:21 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html 2004/04/01 21:23:47 1.4 @@ -2,7 +2,7 @@
+ $Service->execute(XMLinputlist => [ + [ + 'input1', '<Object namespace="blah" id="123"/>', + 'input2', '<Object namespace="blah" id="234"/>', + ] + ]); + This would cause a single invocation of a service requiring + two input parameters named "input1" and "input2"
@@ -122,72 +110,6 @@ } /************************************************************************* - * Find and return an instance of a DOM parser wrapper. A parser - * wrapper is a class allowing a uniform access to DOM parsers - - * because it defines a way how a Document is created and returned - * (see details in interface - * org.biomoby.shared.dom.ParseWrappers, or in samples in - * the distribution of Apache Xerces-2 where this is all taken - * from). - *
- * - * The DOM parser wrapper class name is taken from, in this order: - *
- * - * This is based on the samples shown int the Apache Xerces-2 distribution. - * See more details there. This implementation differ from those samples - * in few not too crucial details: - *
- * @param parserClassName is a class to be instatiated (unless there is - * a Java property {@link #PROP_PARSER_WRAPPER}) - * @return an instance of a DOM parser wrapper - * @throws MobyException if unable to instantiate specified DOM parser - *************************************************************************/ - public static ParserWrapper getDOMParser (String parserClassName) - throws MobyException { - - // which parser do we want - String name = System.getProperty (PROP_PARSER_WRAPPER); - if (name != null) - parserClassName = name; - if (parserClassName == null) - parserClassName = DEFAULT_PARSER_WRAPPER; - - // create parser - try { - return (ParserWrapper)Class.forName (parserClassName).newInstance(); - } - catch (Exception e) { - throw new MobyException ("Unable to instantiate parser (" + parserClassName +")"); - } - } - - /************************************************************************* - * Find and return an instance of a DOM parser wrapper. - * It does the same as method {@link #getDOMParser(String)} except that it - * does not get any parser class name in the parameter. - *
- *
- * @return an instance of a DOM parser wrapper
- * @see #getDOMParser(String)
- * @throws MobyException if unable to instantiate the specified DOM parser
- *************************************************************************/
- public static ParserWrapper getDOMParser()
- throws MobyException {
- return getDOMParser (null);
- }
-
- /*************************************************************************
* Return just the last part of the LSID identifier. An example of
* an LSID identifier as used by and returned from the Moby
* registry is urn:lsid:biomoby.org:objectclass:object.
From gordonp at pub.open-bio.org Fri Apr 2 11:40:23 2004
From: gordonp at pub.open-bio.org (Paul Gordon)
Date: Fri Apr 2 11:32:55 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404021640.i32GeNlC013362@pub.open-bio.org>
gordonp
Fri Apr 2 11:40:23 EST 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv13318/src/main/org/biomoby/client
Modified Files:
CentralImpl.java
Log Message:
Revised documentation, interfaces and classes pertaining to XML parsing and server cache to reflect new parsing and caching schemes
moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.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/CentralImpl.java 2004/04/01 23:24:26 1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2004/04/02 16:40:23 1.11
@@ -8,7 +8,6 @@
package org.biomoby.client;
import org.biomoby.shared.*;
-import org.biomoby.shared.dom.*;
import org.apache.axis.client.*;
import org.apache.axis.*;
From mwilkinson at pub.open-bio.org Sun Apr 4 14:53:14 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Sun Apr 4 14:45:27 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404041853.i34IrECT029372@pub.open-bio.org>
mwilkinson
Sun Apr 4 14:53:13 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv29353/MOBY
Modified Files:
Central.pm
Log Message:
bug in the registration object - it should return LSID's in the 'id' tag. I think it now does this properly
moby-live/Perl/MOBY Central.pm,1.123,1.124
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/01/15 16:04:54 1.123
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 18:53:13 1.124
@@ -2887,7 +2887,7 @@
my $reg = &Registration({
success => 0,
message => "$message",
- registration_id => "$id",
+ id => "$id",
});
return $reg;
}
@@ -2897,7 +2897,7 @@
my $reg = &Registration({
success => 1,
message => "$message",
- registration_id => "$id",
+ id => "$id",
});
return $reg;
}
From mwilkinson at pub.open-bio.org Sun Apr 4 15:08:41 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Sun Apr 4 15:00:57 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404041908.i34J8fLj029465@pub.open-bio.org>
mwilkinson
Sun Apr 4 15:08:41 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv29446/MOBY
Modified Files:
Central.pm
Log Message:
bug in the registration object - it should return LSID's in the 'id' tag. I think it now does this properly
moby-live/Perl/MOBY Central.pm,1.124,1.125
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 18:53:13 1.124
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 19:08:41 1.125
@@ -109,7 +109,7 @@
sub Registration {
my ( $details) = @_;
- my $id = $details->{registration_id};
+ my $id = $details->{id};
my $success = $details->{success};
my $message = $details->{message};
From mwilkinson at pub.open-bio.org Wed Apr 14 15:56:59 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Wed Apr 14 15:48:08 2004
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404141956.i3EJuxi2013404@pub.open-bio.org>
mwilkinson
Wed Apr 14 15:56:59 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv13353/Perl/MOBY/Client
Modified Files:
Central.pm CollectionArticle.pm ServiceInstance.pm
SimpleArticle.pm
Log Message:
CommonSubs now includes support for services that use Secondary Parameter's. I am also almost finished writing an OO-interface for building/deconstructing MOBY objects, so that people don't have to learn the XML::DOM API. This is incomplete and untested yet, so don't shoot me if it doesn't work. See the docs for CommonSubs 'complexServiceInputParser' for details on how to manage services that use multiple inputs and/or secondary parameters. As soon as I get this OO interface working I will create an equivalent subroutine that parses the input into objects (but I wont remove this routine, so it wont break you servies if you use it)
moby-live/Perl/MOBY/Client Central.pm,1.73,1.74 CollectionArticle.pm,1.6,1.7 ServiceInstance.pm,1.10,1.11 SimpleArticle.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2004/03/26 16:10:40 1.73
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2004/04/14 19:56:59 1.74
@@ -1487,7 +1487,19 @@
}
}
}
-
+ my @SECONDARIES;
+ my $secs = $Service->getElementsByTagName("secondaryArticles"); # there should only be one, but... who knows what
+ for my $in(0..$secs->getLength-1){
+ my $current = $secs->item($in);
+
+ foreach my $param($current->getChildNodes){ # child nodes will be "Parameter" tag names
+ next unless $param->getNodeType == ELEMENT_NODE && $param->getTagName eq "Parameter";
+ my $THIS;
+ $THIS = MOBY::Client::SecondaryArticle->new(XML_DOM => $param);
+ push @SECONDARIES, $THIS;
+ }
+ }
+
my $Instance = MOBY::Client::ServiceInstance->new(
authority => $AuthURI,
authoritative => $authoritative,
@@ -1498,6 +1510,7 @@
category => $cat,
input => \@INPUTS,
output => \@OUTPUTS,
+ secondary => \@SECONDARIES,
description => $Description,
registry => $Registry,
XML => $Service->toString,
@@ -1597,7 +1610,7 @@
#
my ($self, $xml) = @_;
my $Parser = new XML::DOM::Parser;
-
+ #print STDERR $xml;
my $doc = $Parser->parse($xml);
my $Object = $doc->getDocumentElement();
my $obj = $Object->getTagName;
@@ -1608,7 +1621,8 @@
my $reg = MOBY::Client::Registration->new(
success => $success,
message => $message,
- registration_id => $id,);
+ registration_id => $id,
+ id => $id);
return $reg;
}
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/12/02 00:23:23 1.6
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2004/04/14 19:56:59 1.7
@@ -19,9 +19,42 @@
=head1 DESCRIPTION
-This describes the Collection articles from the findService Response of MOBY Central
-(i.e. the description of the service), it DOES NOT create collection articles
-as provided by a service provider (i.e. simple articles containing data)
+This describes the Collection articles from either the findService Response of MOBY Central
+(i.e. the description of the service), or Collection articles
+as provided in a service invocation or response message
+(i.e. simple articles containing data)
+
+Basically it parses the following part of a findService response:
+
+
@@ -61,57 +68,55 @@
MOBY Services
+
-
not written yet
The following is a generalized architecture for *all* -BioMOBY services showing how to parse incoming messages...
+BioMOBY services showing how to parse incoming messages +using the subroutines provided in CommonSubssub myServiceName { - my ($caller, $message) = @_; # get the incoming MOBY query XML-
- my @queries = getInputs($message); # returns XML::DOM nodes - my $MOBY_RESPONSE = ""; # set empty response - - foreach my $query(@queries){-
- my $queryID = getInputID($query); # get the queryID attribute of the queryInput - - my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query - foreach my $input(@input_articles){ # input is a listref-
- my ($articleName, $article) = @{$input}; # get the named article - - my $simple = isSimpleArticle($article); # articles may be simple or collection - my $collection = isCollectionArticle($article);-
- if ($collection){-
- # do something wtih the collection... - # for example... - my @simples = getCollectedSimples($article); - # blah blah blah... - - } elsif ($simple){ - # maybe you just need the ID of the incoming query: - my ($id) = getSimpleArticleIDs('NCBI_gi', $article); # if you need the ID-
- # or maybe you are going to do something with the content? - # for example, this will get the array of text lines - # for the moby:String object with the articleName 'SequenceString' - # that is in this $article - my @sequence = getNodeContentWithArticle($article, "String", "SequenceString");-
- # DO YOUR ANALYSIS HERE - my $result = ""; #whatever you analysis says - - $MOBY_RESPONSE .= simpleResponse($result, "outputArticlename", $queryID); + my ($caller, $data) = @_; + my $MOBY_RESPONSE; # holds the response raw XML + + # genericServiceInputParser + # unpacks incoming message into an array of arrarefs. + # Each element of the array is a queryInput block, or a mobyData block + # the arrayref has the following structure: + # [SIMPLE, $queryID, $simple] + # the first element is a constant "SIMPLE" or "COLLECTION" + # the second element is the queryID (required for enumerating the responses) + # the third element is the XML::DOM for the Simple or Collection block + my (@inputs)= genericServiceInputParser($data); + # or fail properly with an empty response + return SOAP::Data->type('base64' => responseHeader("my.authURI.com") . responseFooter()) unless (scalar(@inputs)); + + # you only need to do this if you are intending to be namespace aware + # some services might not care what namespace the data is in, so long + # as there is data... + my @validNS_LSID = validateNamespaces("NCBI_gi"); # returns LSID's for each human-readable+
+ foreach (@inputs){ + my ($articleType, $qID, $input) = @{$_}; + unless (($articleType == SIMPLE) && ($input)){ + # in this example, we are only accepting SIMPLE types as input + # so write back an empty response block and move on to the next + $MOBY_RESPONSE .= simpleResponse("", "", $qID) ; + next; + } else { + # now take the namespace and ID from our input article + # (see pod docs for other possibilities) + my $namespace = getSimpleArticleNamespaceURI($input); # get namespace + my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) + + # here is where you do whatever manipulation you need to do + # for your particular service. + # you will be building an XML document into $MOBY_RESPONSE } - } - } - return responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter; + } + return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter)); }
@@ -119,45 +124,62 @@
A COMPLETE EXAMPLE OF AN EASY MOBY SERVICE
This is a service that:
-CONSUMES: Object in the NCBI_Acc namespace -EXECUTES: Retrieval -PRODUCES: GenericSequence (in the NCBI_Acc namespace)
- use Bio::Perl; - + CONSUMES: base Object in the GO namespace + EXECUTES: Retrieval + PRODUCES: GO_Term (in the GO namespace)+
# this subroutine is called from your dispatch_with line - # in your SOAP daemon - - sub myServiceName { - my ($caller, $message) = @_; # get the incoming MOBY query XML+ # in your SOAP daemon
- my @queries = getInputs($message); # returns XML::DOM nodes - my $MOBY_RESPONSE = ""; # set empty response - - foreach my $query(@queries){-
- my $queryID = getInputID($query); # get the queryID attribute of the queryInput - - my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query - foreach my $input(@input_articles){ # input is a listref - my ($articleName, $article) = @{$input}; # get the named article - next unless isSimpleArticle($article); # I only allow simple inputs in my service signature - my ($id) = getSimpleArticleIDs('NCBI_Acc', $article); # if you need the ID - my $seq; - eval {$seq = get_sequence('genbank',$id);} # suppress bioperl error messages - my $response = ""; - if ($seq){ - $length = length($seq); - $response = "<GenericSequence namespace='NCBI_Acc' id='$id'> - <Integer namespace='' id='' articleName='Length'>$length</Integer> - <String namespace='' id='' articleName='SequenceString'>$seq</String> - </GenericSequence>"; - } - $MOBY_RESPONSE .= simpleResponse($response, '', $queryID); + sub getGoTerm { + my ($caller, $message) = @_; + my $MOBY_RESPONSE; + my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...) + return SOAP::Data->type('base64' => responseHeader('my.authURI.com') . responseFooter()) unless (scalar(@inputs));+
+ my @validNS = validateNamespaces("GO"); # ONLY do this if you are intending to be namespace aware!+
+ my $dbh = _connectToGoDatabase(); + return SOAP::Data->type('base64' => responseHeader('my.authURI.com') . responseFooter()) unless $dbh; + my $sth = $dbh->prepare(q{ + select name, term_definition + from term, term_definition + where term.id = term_definition.term_id + and acc=?});+
+ foreach (@inputs){ + my ($articleType, $ID, $input) = @{$_}; + unless ($articleType == SIMPLE){ + $MOBY_RESPONSE .= simpleResponse("", "", $ID); + next; + } else { + my $ns = getSimpleArticleNamespaceURI($input); + (($MOBY_RESPONSE .= simpleResponse("", "", $ID)) && (next)) + unless validateThisNamespace($ns, @validNS); # only do this if you are truly validating namespaces + my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef; + unless (defined($accession)){ + $MOBY_RESPONSE .= simpleResponse("", "", $ID); + next; + } + unless ($accession =~/^GO:/){ + $accession = "GO:$accession"; # we still haven't decided on whether id's should include the prefix... + } + $sth->execute($accession); + my ($term, $def) = $sth->fetchrow_array; + if ($term){ + $MOBY_RESPONSE .= simpleResponse(" + <moby:GO_Term namespace='GO' id='$accession'> + <moby:String namespace='' id='' articleName='Term'>$term</moby:String> + <moby:String namespace='' id='' articleName='Definition'>$def</moby:String> + </moby:GO_Term>", "GO_Term_From_ID", $ID) + } else { + $MOBY_RESPONSE .= simpleResponse("", "", $ID) + } } - } - } - return responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter; + } + + return SOAP::Data->type('base64' => (responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter)); }
@@ -166,7 +188,8 @@
CommonSubs are used to do various manipulations of MOBY Messages. It is useful both Client and Service side to construct and parse MOBY Messages, and ensure that the message structure is valid as per the API.
-It DOES NOT connect to MOBY Central for any of its functions.
+It DOES NOT connect to MOBY Central for any of its functions, though it does +contact the ontology server, so it will require a network connection.
+
+ name : genericServiceInputParser + function : For the MOST SIMPLE SERVICES that take single Simple or Collection inputs + and no Secondaries this routine takes the MOBY message and + breaks the objects out of it in a useful way + usage : my @inputs = genericServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : @inputs - the structure of @inputs is a list of listrefs. + Each listref has three components: + 1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3) + 2. queryID (undef for Secondary parameters) + 3. $data - the data takes several forms + a. $article XML::DOM node for Simples + <queryInput...>...</queryInput> + b. \@article XML:DOM nodes for Collections + c. $secondary XML::DOM node+
+
++ name : complexServiceInputParser + function : For more complex services taht have multiple articles for each input + and/or accept parameters, this routine will take a MOBY message and + extract the Simple/Collection/Parameter objects out of it in a + useful way. + usage : my $inputs = complexServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : $inputs is a hashref with the following structure: + + $inputs->{$queryID} = [ [TYPE, $DOM], [TYPE, $DOM], [TYPE, $DOM] ] + + Simples ------------------------ + + for example, the input message: + + <queryInput queryID = '1'> + <Simple articleName='name1'> + <Object namespace=blah id=blah/> + </Simple> + <Parameter articleName='cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+ will become: + (note that SIMPLE, COLLECTION, and SECONDARY are exported constants from this module) + + $inputs->{1} = [ [SIMPLE, $DOM_name1], + [SECONDARY, $DOM_cutoff] + ]+
+ Please see the XML::DOM pod documentation for information about how + to parse XML DOM objects. + + + Collections -------------------- + + With inputs that have collections these are presented as a + listref of Simple article DOM's. So for the following message: + + <queryInput> + <Collection articleName='name1'> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + </Collection> + <Parameter articleName='cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+ will become + + $inputs->{1} = [ [COLLECTION, [$DOM, $DOM] ], + [SECONDARY, $DOM_cutoff] + ]+
+ Please see the XML::DOM pod documentation for information about how + to parse XML DOM objects.+
+
++ name : getArticles + function : get the Simple/Collection/Parameter articles for a single queryInput + or queryResponse node + usage : @articles = getArticles($XML) + args : raw XML or XML::DOM of a queryInput, mobyData, or queryResponse block (e.g. from getInputs) + returns : a list of listrefs; each listref is one component of the queryInput. + a single queryInput/Response may consist of one or more named or unnamed + simple, collection, or parameter articles. + The listref structure is thus [name, $ARTICLE_DOM]: + + e.g.: @articles = ['name1', $SIMPLE_DOM]+
+ generated from the following sample XML:+
+ <queryInput> + <Simple articleName='name1'> + <Object namespace=blah id=blah/> + </Simple> + </queryInput> + + or : @articles = ['name1', $COLL_DOM], ['paramname1', $PARAM_DOM]+
+ generated from the following sample XML:+
+ <queryInput> + <Collection articleName='name1'> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + </Collection> + <Parameter articleName='e value cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+
++ name : DO NOT USE! + function : to take a MOBY message and break the objects out of it. This is identical + to the subroutine above, except that it returns the data as + Objects rather than XML::DOM nodes + usage : my @inputs = genericServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : @inputs - the structure of @inputs is a list of listrefs. + Each listref has three components: + 1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3) + 2. queryID (undef for Secondary parameters) + 3. $data - either MOBY::Client::SimpleArticle, CollectionArticle, or SecondaryArticle+
+
name : getSimpleArticleIDs @@ -243,12 +410,16 @@responseHeader
- name : responseHeader($auth) - function : print the XML string of a MOBY response header - usage : return responseHeader('illuminae.com') . $DATA . responseFooter; - args : a string representing the service providers authority URI - caveat : will soon be expanded to include service provision info - and additional namespace declarations + name : responseHeader + function : print the XML string of a MOBY response header +/- serviceNotes + usage : responseHeader('illuminae.com') + responseHeader( + -authority => 'illuminae.com', + -note => 'here is some data from the service provider') + args : a string representing the service providers authority URI, + OR a set of named arguments with the authority and the + service provision notes. + caveat : notes : returns everything required up to the response articles themselves. i.e. something like: <?xml version='1.0' encoding='UTF-8'?> @@ -274,8 +445,8 @@ function : get the queryInput block(s) as XML::DOM nodes usage : @queryInputs = getInputArticles($XML) args : the raw XML of a <MOBY> query, or an XML::DOM document - returns : a list of XML::DOM::Node's, each is a queryInput. - Note : Remember that queryInputs are numbered! This is what you + returns : a list of XML::DOM::Node's, each is a queryInput or mobyData block. + Note : Remember that these blocks are enumerated! This is what you pass as the third argument to the simpleResponse or collectionResponse subroutine to associate the numbered input to the numbered response@@ -285,40 +456,23 @@ name : getInputID function : get the value of the queryID element usage : @queryInputs = getInputID($XML) - args : the raw XML or XML::DOM of a <queryInput> block + args : the raw XML or XML::DOM of a queryInput or mobyData block (e.g. from getInputs) returns : integer, or '' - Note : queryInputs and queryResponses are coordinately enumerated! + Note : Inputs and Responses are coordinately enumerated! The integer you get here is what you pass as the third argument to the simpleResponse or collectionResponse subroutine to associate the numbered input to the numbered response
-
- name : getArticles + name : DO NOT USE!! function : get the Simple/Collection articles for a single queryInput - or queryResponse node + or queryResponse node, rethrning them as SimpleArticle, + SecondaryArticle, or ServiceInstance objects usage : @articles = getArticles($XML) - args : raw XML or XML::DOM of a moby:queryInput or a moby:queryResponse block - returns : a list of listrefs; each listref is one component of the queryInput. - a single queryInput/Responsemay consist of one or more named or unnamed - simple or collection articles. The listref structure is thus [name, $ARTICLE]: - - e.g.: @articles = ['name1', $SIMPLE_DOM] - or : @articles = ['name1', $COLLECTION_DOM], ['name2', $SIMPLE_DOM]...-
- the former is generated from the following sample XML:-
- <queryInput> - <Simple articleName='name1'> - <Object namespace=blah id=blah/> - </Simple> - </queryInput> - <queryInput> - <Simple articleName='name1'> - <Object namespace=blah id=blah/> - </Simple> - </queryInput>+ args : raw XML or XML::DOM of a moby:queryInput, moby:queryResponse block + returns :
@@ -379,6 +533,25 @@ returns : boolean
+
+ name : isSecondaryArticle + function : tests XML (text) or an XML DOM node to see if it represents a Secondary article + usage : if (isSecondaryArticle($node)){do something to it} + input : an XML::DOM node, an XML::DOM::Document or straight XML + returns : boolean+
+
++ name : extractRawContent + function : pass me an article (Simple, or Collection) and I'll give you the + content AS A STRING - i.e. the raw XML of the contained MOBY Object(s) + usage : extractRawContent($simple) + input : the one element of the output from getArticles + returns : string+
+
name : getNodeContentWithArticle @@ -396,16 +569,16 @@ For example, in the following XML: ... ... - <moby:Query> - <queryInput> + <moby:mobyContent> + <moby:mobyData> <Simple> <Sequence namespace=blah id=blah> <Integer namespace='' id='' articleName="Length">3</Integer> <String namespace='' id='' articleName="SequenceString">ATG</String> </Sequence> </Simple> - </queryInput> - </moby:Query> + </moby:mobyData> + </moby:mobyContent> ... ... @@ -422,16 +595,6 @@ }
-
- name : extractRawContent - function : pass me an article (Simple, or Collection) and I'll give you the - content AS A STRING - i.e. the raw XML of the contained MOBY Object(s) - usage : extractRawContent($simple) - input : the one element of the output from getArticles - returns : string-
-
name : validateNamespaces @@ -462,6 +625,15 @@ an array-ref of Simple article XML::DOM::Node's
+
+ name : getServiceNotes + function : to get the content of the Service Notes block of the MOBY message + usage : getServiceNotes($message) + args : $message is either the XML::DOM of the MOBY message, or plain XML + returns : String content of the ServiceNotes block of the MOBY Message+
+
name : getCrossReferences @@ -496,8 +668,78 @@ args : $CENTRAL - your MOBY::Client::Central object $queryTerm - the object type I am interested in \@termlist - the list of object types that I know about - returns : an ontology term as a scalar, or undef if there - is no parent of this node in the nodelist+ returns : an ontology term and LSID as a scalar, or undef if there + is no parent of this node in the nodelist. + (note that it will only return the term if you give it + term names in the @termList. If you give it + LSID's in the termList, then both the parameters + returned will be LSID's - it doesn't back-translate...) +
+
++ Usage : $object->_rearrange( array_ref, list_of_arguments) + Purpose : Rearranges named parameters to requested order. + Example : $self->_rearrange([qw(SEQUENCE ID DESC)],@param); + : Where @param = (-sequence => $s, + : -desc => $d, + : -id => $i); + Returns : @params - an array of parameters in the requested order. + : The above example would return ($s, $i, $d). + : Unspecified parameters will return undef. For example, if + : @param = (-sequence => $s); + : the above _rearrange call would return ($s, undef, undef) + Argument : $order : a reference to an array which describes the desired + : order of the named parameters. + : @param : an array of parameters, either as a list (in + : which case the function simply returns the list), + : or as an associative array with hyphenated tags + : (in which case the function sorts the values + : according to @{$order} and returns that new array.) + : The tags can be upper, lower, or mixed case + : but they must start with a hyphen (at least the + : first one should be hyphenated.) + Source : This function was taken from CGI.pm, written by Dr. Lincoln + : Stein, and adapted for use in Bio::Seq by Richard Resnick and + : then adapted for use in Bio::Root::Object.pm by Steve Chervitz, + : then migrated into Bio::Root::RootI.pm by Ewan Birney. + Comments : + : Uppercase tags are the norm, + : (SAC) + : This method may not be appropriate for method calls that are + : within in an inner loop if efficiency is a concern. + : + : Parameters can be specified using any of these formats: + : @param = (-name=>'me', -color=>'blue'); + : @param = (-NAME=>'me', -COLOR=>'blue'); + : @param = (-Name=>'me', -Color=>'blue'); + : @param = ('me', 'blue'); + : A leading hyphenated argument is used by this function to + : indicate that named parameters are being used. + : Therefore, the ('me', 'blue') list will be returned as-is. + : + : Note that Perl will confuse unquoted, hyphenated tags as + : function calls if there is a function of the same name + : in the current namespace: + : -name => 'foo' is interpreted as -&name => 'foo' + : + : For ultimate safety, put single quotes around the tag: + : ('-name'=>'me', '-color' =>'blue'); + : This can be a bit cumbersome and I find not as readable + : as using all uppercase, which is also fairly safe: + : (-NAME=>'me', -COLOR =>'blue'); + : + : Personal note (SAC): I have found all uppercase tags to + : be more managable: it involves less single-quoting, + : the key names stand out better, and there are no method naming + : conflicts. + : The drawbacks are that it's not as easy to type as lowercase, + : and lots of uppercase can be hard to read. + : + : Regardless of the style, it greatly helps to line + : the parameters up vertically for long/complex lists. + +=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2004/04/14 19:56:59 1.44 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2004/04/14 20:10:35 1.45 @@ -8,7 +8,9 @@ =cut -=head1 Client Side Paradigm +=head2 Client Side Paradigm + +not written yet =cut @@ -51,7 +53,7 @@ # now take the namespace and ID from our input article # (see pod docs for other possibilities) my $namespace = getSimpleArticleNamespaceURI($input); # get namespace - my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) + my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) # here is where you do whatever manipulation you need to do # for your particular service. @@ -70,9 +72,9 @@ This is a service that: -CONSUMES: base Object in the GO namespace -EXECUTES: Retrieval -PRODUCES: GO_Term (in the GO namespace) + CONSUMES: base Object in the GO namespace + EXECUTES: Retrieval + PRODUCES: GO_Term (in the GO namespace) # this subroutine is called from your dispatch_with line @@ -101,28 +103,28 @@ $MOBY_RESPONSE .= simpleResponse("", "", $ID); next; } else { - my $ns = getSimpleArticleNamespaceURI($input); - (($MOBY_RESPONSE .= simpleResponse("", "", $ID)) && (next)) - unless validateThisNamespace($ns, @validNS); # only do this if you are truly validating namespaces - my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef; - unless (defined($accession)){ - $MOBY_RESPONSE .= simpleResponse("", "", $ID); - next; - } - unless ($accession =~/^GO:/){ - $accession = "GO:$accession"; # we still haven't decided on whether id's should include the prefix... - } - $sth->execute($accession); - my ($term, $def) = $sth->fetchrow_array; - if ($term){ - $MOBY_RESPONSE .= simpleResponse(" -
MOBY::Client::CollectionArticle - a small object describing a MOBY Collection input or output
+MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central
experimental - please do not use in your code
This describes the Collection articles from either the findService Response of MOBY Central +(i.e. the description of the service), or Collection articles +as provided in a service invocation or response message +(i.e. simple articles containing data)
+Basically it parses the following part of a findService response:
++ <Collection articleName="foo"> + <Simple> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> + </Simple> + <Simple> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> + </Simple> + </Collection>+
OR it parses the following part of a service invocation or response message:
++ <Collection articleName="foo"> + <Simple> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> + </Simple> + <Simple> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> + </Simple> + </Collection>+
The articleName is retrieved with ->articleName +The contained Simples are retrieved as MOBY::Client::SimpleArticle objects +using the ->Simples method call.
Mark Wilkinson (markw at illuminae dot com)
+
+ Title : XML + Usage : $SA = $SA->XML($XML) + Function : set/reset all parameters for this object from the XML + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) XML fragment from and including <Simple>...</Simple>+
+
++ Title : XML_DOM + Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) + Function : set/reset all parameters for this object from the XML::DOM node for <Simple> + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM+
+
Title : isSimple @@ -100,7 +157,7 @@ get both Simple and Collection objects in your Input and output lists, it is good to be able to test what you have in-hand) - Returns : 1 (true)+ Returns : 0 (false)
+
++ Title : isSecondary + Usage : $boolean = $IN->isSecondary() + Function : is this a SecondaryArticle type? + (yes, I know this is obvious) + Returns : 0 (true)=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html 2003/11/01 18:05:55 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html 2004/04/15 14:38:22 1.8 @@ -2,7 +2,7 @@
- Title : output - Usage : $output = $Service->output($args) + Title : input + Usage : $input = $Service->input($args) Args : (optional) listref of SimpleArticle and/or CollectionArticle objects - Function : get/set output + Function : get/set input Returns : listref of MOBY::Client::SimpleArticle and/or MOBY::Client::CollectionArticle objects
=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html 2003/07/01 15:00:47 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html 2004/04/15 14:38:22 1.2 @@ -1,8 +1,8 @@
-
MOBY::Client::SimpleArticle - a small object describing a MOBY Simple input/output article
+MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central
experimental - please do not use in your code
This describes the Simple articles from either the findService Response of MOBY Central +(i.e. the description of the service), or Simple articles +as provided in a service invocation or response message +(i.e. simple articles containing data)
+Basically it parses the following part of a findService response:
+<Simple articleName='foo'> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> +</Simple>
+OR it parses the following part of a service invocation or response message:
+<Simple articleName='foo'> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> +</Simple>
+The articleName is retrieved with ->articleName
+The namespace(s)
are retrieved with ->namespaces
+The objectType is retrieved with ->objectType
+the id (if instantiated) is retrieved with ->id
Mark Wilkinson (markw at illuminae dot com)
+
+ Title : XML + Usage : $SA = $SA->XML($XML) + Function : set/reset all parameters for this object from the XML + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) XML fragment from and including <Simple>...</Simple>+
+
++ Title : XML_DOM + Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) + Function : set/reset all parameters for this object from the XML::DOM node for <Simple> + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM+
+
Title : addNamespace @@ -124,6 +165,15 @@ Input and output lists, it is good to be able to test what you have in-hand) Returns : 0 for false+
+
++ Title : isSecondary + Usage : $boolean = $IN->isSecondary() + Function : is this a SecondaryArticle type? + (yes, I know this is obvious) + Returns : 0 (true)From mwilkinson at pub.open-bio.org Thu Apr 15 10:38:22 2004 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu Apr 15 10:29:26 2004 Subject: [MOBY-guts] biomoby commit Message-ID: <200404151438.i3FEcMdP016323@pub.open-bio.org> mwilkinson Thu Apr 15 10:38:22 EDT 2004 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16304 Modified Files: Central.html Log Message: updating all documentation that has gone out of sync with the code moby-live/Perl/MOBY Central.html,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/12/02 01:08:24 1.12 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html 2004/04/15 14:38:22 1.13 @@ -2,7 +2,7 @@
Input XML :
@@ -215,7 +215,7 @@There are two forms of Primary articles:
An example of the use of each of these might be another BLAST service, where you provide the sequences that make up the Blast database as well as the sequence to Blast against it. The sequences used to construct the database might be passed as a Collection input article containing multiple Sequence Objects, while the sequence to Blast against it would be a Simple input article consisting of a single Sequence Object.
There is currently only one form of Secondary article:
** * The all not yet existing directories (for example the last - * 'cache' diorectory) will be created for you. + * 'cache' directory) will be created for you. */cache/ *
* * 'rootURLName' is used by method {@link #getURL} to return back @@ -75,7 +78,11 @@ static final char CLEAR_CHAR = '_'; /************************************************************************** * It creates an 'id' in the form: - * rootName / semanticType / prop1_prop2_... (time).syntaxType + * rootName / semanticType / { prop1_prop2_... } (time).syntaxType + * + * The part between { and } (inclusive) will be replaced by a + * unique shorter string in order to create a reasonably long real + * file name. **************************************************************************/ public String createId (String rootName, String semanticType, String syntaxType, @@ -94,10 +101,13 @@ ps[++i] = it.next().toString(); } Arrays.sort (ps); + buf.append ("{"); for (int i = 0; i < ps.length; i++) { buf.append (CLEAR_CHAR); - buf.append (clean (ps[i].toString())); +// buf.append (clean (ps[i].toString())); + buf.append (ps[i].toString()); } + buf.append ("}"); buf.append ("(" + lastModified + ")"); buf.append ("."); buf.append (clean (syntaxType)); @@ -235,6 +245,20 @@ * dir (as set in a constructor). **************************************************************************/ protected String getRelativeFilename (String id) { - return fileSeparator + startingDir + fileSeparator + id; + String fileName = (String)index.get (id); + if (fileName == null) { + int posFrom = id.indexOf ("{"); + int posTo = id.indexOf ("}"); + StringBuffer buf = new StringBuffer(); + buf.append (fileSeparator); + buf.append (startingDir); + buf.append (fileSeparator); + buf.append (id.substring (0, posFrom)); + buf.append (clean (new java.rmi.server.UID().toString())); + buf.append (id.substring (posTo+1)); + fileName = new String (buf); + index.put (id, fileName); + } + return fileName; } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.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/GraphsServlet.java 2003/11/25 13:18:10 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java 2004/04/01 21:03:42 1.5 @@ -491,7 +491,7 @@ h.gen (TD, radios[0]) + h.gen (TD, - "Show all services and all connections")) + + "Show all services and all connections " + h.gen (EM, "(very long and big)"))) + h.gen (TR, h.gen (TD, new String[] { VALIGN, "top" }, radios[1]) + =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java 2003/11/08 00:27:24 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java 2004/04/01 21:03:42 1.2 @@ -40,11 +40,11 @@ * * * The not existing directories (for example the last 'cache' - * diorectory) will be created for you. + * directory) will be created for you. * * The 'contextPath' is a path (relative to the servlet context) * where the cached files will be created (actually starting from - * here, because they may be created ina deeper directory + * here, because they may be created in a deeper directory * structure. Usually you get it in the calling servlet from the * request by method request.getContextPath(). The 'contextPath' * starts with a "/" character but does not end with a "/" From mwilkinson at pub.open-bio.org Thu Apr 1 16:23:48 2004 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu, 1 Apr 2004 16:23:48 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200404012123.i31LNmaC007236@pub.open-bio.org> mwilkinson Thu Apr 1 16:23:47 EST 2004 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv7213/MOBY/Client Modified Files: Service.html Service.pm Log Message: update the execute method to allow multiple inputs to a single invocation. Documentation updated. Fixed bug of articleName attribute being attached to the wrong XML element moby-live/Perl/MOBY/Client Service.html,1.3,1.4 Service.pm,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html 2003/08/06 14:31:21 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html 2004/04/01 21:23:47 1.4 @@ -2,7 +2,7 @@
+ $Service->execute(XMLinputlist => [ + [ + 'input1', '<Object namespace="blah" id="123"/>', + 'input2', '<Object namespace="blah" id="234"/>', + ] + ]); + This would cause a single invocation of a service requiring + two input parameters named "input1" and "input2"
@@ -122,72 +110,6 @@ } /************************************************************************* - * Find and return an instance of a DOM parser wrapper. A parser - * wrapper is a class allowing a uniform access to DOM parsers - - * because it defines a way how a Document is created and returned - * (see details in interface - * org.biomoby.shared.dom.ParseWrappers, or in samples in - * the distribution of Apache Xerces-2 where this is all taken - * from). - *
- * - * The DOM parser wrapper class name is taken from, in this order: - *
- * - * This is based on the samples shown int the Apache Xerces-2 distribution. - * See more details there. This implementation differ from those samples - * in few not too crucial details: - *
- * @param parserClassName is a class to be instatiated (unless there is - * a Java property {@link #PROP_PARSER_WRAPPER}) - * @return an instance of a DOM parser wrapper - * @throws MobyException if unable to instantiate specified DOM parser - *************************************************************************/ - public static ParserWrapper getDOMParser (String parserClassName) - throws MobyException { - - // which parser do we want - String name = System.getProperty (PROP_PARSER_WRAPPER); - if (name != null) - parserClassName = name; - if (parserClassName == null) - parserClassName = DEFAULT_PARSER_WRAPPER; - - // create parser - try { - return (ParserWrapper)Class.forName (parserClassName).newInstance(); - } - catch (Exception e) { - throw new MobyException ("Unable to instantiate parser (" + parserClassName +")"); - } - } - - /************************************************************************* - * Find and return an instance of a DOM parser wrapper. - * It does the same as method {@link #getDOMParser(String)} except that it - * does not get any parser class name in the parameter. - *
- *
- * @return an instance of a DOM parser wrapper
- * @see #getDOMParser(String)
- * @throws MobyException if unable to instantiate the specified DOM parser
- *************************************************************************/
- public static ParserWrapper getDOMParser()
- throws MobyException {
- return getDOMParser (null);
- }
-
- /*************************************************************************
* Return just the last part of the LSID identifier. An example of
* an LSID identifier as used by and returned from the Moby
* registry is urn:lsid:biomoby.org:objectclass:object.
From gordonp at pub.open-bio.org Fri Apr 2 11:40:23 2004
From: gordonp at pub.open-bio.org (Paul Gordon)
Date: Fri, 2 Apr 2004 11:40:23 -0500
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404021640.i32GeNlC013362@pub.open-bio.org>
gordonp
Fri Apr 2 11:40:23 EST 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv13318/src/main/org/biomoby/client
Modified Files:
CentralImpl.java
Log Message:
Revised documentation, interfaces and classes pertaining to XML parsing and server cache to reflect new parsing and caching schemes
moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.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/CentralImpl.java 2004/04/01 23:24:26 1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2004/04/02 16:40:23 1.11
@@ -8,7 +8,6 @@
package org.biomoby.client;
import org.biomoby.shared.*;
-import org.biomoby.shared.dom.*;
import org.apache.axis.client.*;
import org.apache.axis.*;
From mwilkinson at pub.open-bio.org Sun Apr 4 14:53:14 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Sun, 4 Apr 2004 14:53:14 -0400
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404041853.i34IrECT029372@pub.open-bio.org>
mwilkinson
Sun Apr 4 14:53:13 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv29353/MOBY
Modified Files:
Central.pm
Log Message:
bug in the registration object - it should return LSID's in the 'id' tag. I think it now does this properly
moby-live/Perl/MOBY Central.pm,1.123,1.124
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/01/15 16:04:54 1.123
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 18:53:13 1.124
@@ -2887,7 +2887,7 @@
my $reg = &Registration({
success => 0,
message => "$message",
- registration_id => "$id",
+ id => "$id",
});
return $reg;
}
@@ -2897,7 +2897,7 @@
my $reg = &Registration({
success => 1,
message => "$message",
- registration_id => "$id",
+ id => "$id",
});
return $reg;
}
From mwilkinson at pub.open-bio.org Sun Apr 4 15:08:41 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Sun, 4 Apr 2004 15:08:41 -0400
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404041908.i34J8fLj029465@pub.open-bio.org>
mwilkinson
Sun Apr 4 15:08:41 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv29446/MOBY
Modified Files:
Central.pm
Log Message:
bug in the registration object - it should return LSID's in the 'id' tag. I think it now does this properly
moby-live/Perl/MOBY Central.pm,1.124,1.125
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 18:53:13 1.124
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 19:08:41 1.125
@@ -109,7 +109,7 @@
sub Registration {
my ( $details) = @_;
- my $id = $details->{registration_id};
+ my $id = $details->{id};
my $success = $details->{success};
my $message = $details->{message};
From mwilkinson at pub.open-bio.org Wed Apr 14 15:56:59 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Wed, 14 Apr 2004 15:56:59 -0400
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404141956.i3EJuxi2013404@pub.open-bio.org>
mwilkinson
Wed Apr 14 15:56:59 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv13353/Perl/MOBY/Client
Modified Files:
Central.pm CollectionArticle.pm ServiceInstance.pm
SimpleArticle.pm
Log Message:
CommonSubs now includes support for services that use Secondary Parameter's. I am also almost finished writing an OO-interface for building/deconstructing MOBY objects, so that people don't have to learn the XML::DOM API. This is incomplete and untested yet, so don't shoot me if it doesn't work. See the docs for CommonSubs 'complexServiceInputParser' for details on how to manage services that use multiple inputs and/or secondary parameters. As soon as I get this OO interface working I will create an equivalent subroutine that parses the input into objects (but I wont remove this routine, so it wont break you servies if you use it)
moby-live/Perl/MOBY/Client Central.pm,1.73,1.74 CollectionArticle.pm,1.6,1.7 ServiceInstance.pm,1.10,1.11 SimpleArticle.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2004/03/26 16:10:40 1.73
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2004/04/14 19:56:59 1.74
@@ -1487,7 +1487,19 @@
}
}
}
-
+ my @SECONDARIES;
+ my $secs = $Service->getElementsByTagName("secondaryArticles"); # there should only be one, but... who knows what
+ for my $in(0..$secs->getLength-1){
+ my $current = $secs->item($in);
+
+ foreach my $param($current->getChildNodes){ # child nodes will be "Parameter" tag names
+ next unless $param->getNodeType == ELEMENT_NODE && $param->getTagName eq "Parameter";
+ my $THIS;
+ $THIS = MOBY::Client::SecondaryArticle->new(XML_DOM => $param);
+ push @SECONDARIES, $THIS;
+ }
+ }
+
my $Instance = MOBY::Client::ServiceInstance->new(
authority => $AuthURI,
authoritative => $authoritative,
@@ -1498,6 +1510,7 @@
category => $cat,
input => \@INPUTS,
output => \@OUTPUTS,
+ secondary => \@SECONDARIES,
description => $Description,
registry => $Registry,
XML => $Service->toString,
@@ -1597,7 +1610,7 @@
#
my ($self, $xml) = @_;
my $Parser = new XML::DOM::Parser;
-
+ #print STDERR $xml;
my $doc = $Parser->parse($xml);
my $Object = $doc->getDocumentElement();
my $obj = $Object->getTagName;
@@ -1608,7 +1621,8 @@
my $reg = MOBY::Client::Registration->new(
success => $success,
message => $message,
- registration_id => $id,);
+ registration_id => $id,
+ id => $id);
return $reg;
}
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/12/02 00:23:23 1.6
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2004/04/14 19:56:59 1.7
@@ -19,9 +19,42 @@
=head1 DESCRIPTION
-This describes the Collection articles from the findService Response of MOBY Central
-(i.e. the description of the service), it DOES NOT create collection articles
-as provided by a service provider (i.e. simple articles containing data)
+This describes the Collection articles from either the findService Response of MOBY Central
+(i.e. the description of the service), or Collection articles
+as provided in a service invocation or response message
+(i.e. simple articles containing data)
+
+Basically it parses the following part of a findService response:
+
+
@@ -61,57 +68,55 @@
MOBY Services
+
-
not written yet
The following is a generalized architecture for *all* -BioMOBY services showing how to parse incoming messages...
+BioMOBY services showing how to parse incoming messages +using the subroutines provided in CommonSubssub myServiceName { - my ($caller, $message) = @_; # get the incoming MOBY query XML-
- my @queries = getInputs($message); # returns XML::DOM nodes - my $MOBY_RESPONSE = ""; # set empty response - - foreach my $query(@queries){-
- my $queryID = getInputID($query); # get the queryID attribute of the queryInput - - my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query - foreach my $input(@input_articles){ # input is a listref-
- my ($articleName, $article) = @{$input}; # get the named article - - my $simple = isSimpleArticle($article); # articles may be simple or collection - my $collection = isCollectionArticle($article);-
- if ($collection){-
- # do something wtih the collection... - # for example... - my @simples = getCollectedSimples($article); - # blah blah blah... - - } elsif ($simple){ - # maybe you just need the ID of the incoming query: - my ($id) = getSimpleArticleIDs('NCBI_gi', $article); # if you need the ID-
- # or maybe you are going to do something with the content? - # for example, this will get the array of text lines - # for the moby:String object with the articleName 'SequenceString' - # that is in this $article - my @sequence = getNodeContentWithArticle($article, "String", "SequenceString");-
- # DO YOUR ANALYSIS HERE - my $result = ""; #whatever you analysis says - - $MOBY_RESPONSE .= simpleResponse($result, "outputArticlename", $queryID); + my ($caller, $data) = @_; + my $MOBY_RESPONSE; # holds the response raw XML + + # genericServiceInputParser + # unpacks incoming message into an array of arrarefs. + # Each element of the array is a queryInput block, or a mobyData block + # the arrayref has the following structure: + # [SIMPLE, $queryID, $simple] + # the first element is a constant "SIMPLE" or "COLLECTION" + # the second element is the queryID (required for enumerating the responses) + # the third element is the XML::DOM for the Simple or Collection block + my (@inputs)= genericServiceInputParser($data); + # or fail properly with an empty response + return SOAP::Data->type('base64' => responseHeader("my.authURI.com") . responseFooter()) unless (scalar(@inputs)); + + # you only need to do this if you are intending to be namespace aware + # some services might not care what namespace the data is in, so long + # as there is data... + my @validNS_LSID = validateNamespaces("NCBI_gi"); # returns LSID's for each human-readable+
+ foreach (@inputs){ + my ($articleType, $qID, $input) = @{$_}; + unless (($articleType == SIMPLE) && ($input)){ + # in this example, we are only accepting SIMPLE types as input + # so write back an empty response block and move on to the next + $MOBY_RESPONSE .= simpleResponse("", "", $qID) ; + next; + } else { + # now take the namespace and ID from our input article + # (see pod docs for other possibilities) + my $namespace = getSimpleArticleNamespaceURI($input); # get namespace + my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) + + # here is where you do whatever manipulation you need to do + # for your particular service. + # you will be building an XML document into $MOBY_RESPONSE } - } - } - return responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter; + } + return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter)); }
@@ -119,45 +124,62 @@
A COMPLETE EXAMPLE OF AN EASY MOBY SERVICE
This is a service that:
-CONSUMES: Object in the NCBI_Acc namespace -EXECUTES: Retrieval -PRODUCES: GenericSequence (in the NCBI_Acc namespace)
- use Bio::Perl; - + CONSUMES: base Object in the GO namespace + EXECUTES: Retrieval + PRODUCES: GO_Term (in the GO namespace)+
# this subroutine is called from your dispatch_with line - # in your SOAP daemon - - sub myServiceName { - my ($caller, $message) = @_; # get the incoming MOBY query XML+ # in your SOAP daemon
- my @queries = getInputs($message); # returns XML::DOM nodes - my $MOBY_RESPONSE = ""; # set empty response - - foreach my $query(@queries){-
- my $queryID = getInputID($query); # get the queryID attribute of the queryInput - - my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query - foreach my $input(@input_articles){ # input is a listref - my ($articleName, $article) = @{$input}; # get the named article - next unless isSimpleArticle($article); # I only allow simple inputs in my service signature - my ($id) = getSimpleArticleIDs('NCBI_Acc', $article); # if you need the ID - my $seq; - eval {$seq = get_sequence('genbank',$id);} # suppress bioperl error messages - my $response = ""; - if ($seq){ - $length = length($seq); - $response = "<GenericSequence namespace='NCBI_Acc' id='$id'> - <Integer namespace='' id='' articleName='Length'>$length</Integer> - <String namespace='' id='' articleName='SequenceString'>$seq</String> - </GenericSequence>"; - } - $MOBY_RESPONSE .= simpleResponse($response, '', $queryID); + sub getGoTerm { + my ($caller, $message) = @_; + my $MOBY_RESPONSE; + my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...) + return SOAP::Data->type('base64' => responseHeader('my.authURI.com') . responseFooter()) unless (scalar(@inputs));+
+ my @validNS = validateNamespaces("GO"); # ONLY do this if you are intending to be namespace aware!+
+ my $dbh = _connectToGoDatabase(); + return SOAP::Data->type('base64' => responseHeader('my.authURI.com') . responseFooter()) unless $dbh; + my $sth = $dbh->prepare(q{ + select name, term_definition + from term, term_definition + where term.id = term_definition.term_id + and acc=?});+
+ foreach (@inputs){ + my ($articleType, $ID, $input) = @{$_}; + unless ($articleType == SIMPLE){ + $MOBY_RESPONSE .= simpleResponse("", "", $ID); + next; + } else { + my $ns = getSimpleArticleNamespaceURI($input); + (($MOBY_RESPONSE .= simpleResponse("", "", $ID)) && (next)) + unless validateThisNamespace($ns, @validNS); # only do this if you are truly validating namespaces + my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef; + unless (defined($accession)){ + $MOBY_RESPONSE .= simpleResponse("", "", $ID); + next; + } + unless ($accession =~/^GO:/){ + $accession = "GO:$accession"; # we still haven't decided on whether id's should include the prefix... + } + $sth->execute($accession); + my ($term, $def) = $sth->fetchrow_array; + if ($term){ + $MOBY_RESPONSE .= simpleResponse(" + <moby:GO_Term namespace='GO' id='$accession'> + <moby:String namespace='' id='' articleName='Term'>$term</moby:String> + <moby:String namespace='' id='' articleName='Definition'>$def</moby:String> + </moby:GO_Term>", "GO_Term_From_ID", $ID) + } else { + $MOBY_RESPONSE .= simpleResponse("", "", $ID) + } } - } - } - return responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter; + } + + return SOAP::Data->type('base64' => (responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter)); }
@@ -166,7 +188,8 @@
CommonSubs are used to do various manipulations of MOBY Messages. It is useful both Client and Service side to construct and parse MOBY Messages, and ensure that the message structure is valid as per the API.
-It DOES NOT connect to MOBY Central for any of its functions.
+It DOES NOT connect to MOBY Central for any of its functions, though it does +contact the ontology server, so it will require a network connection.
+
+ name : genericServiceInputParser + function : For the MOST SIMPLE SERVICES that take single Simple or Collection inputs + and no Secondaries this routine takes the MOBY message and + breaks the objects out of it in a useful way + usage : my @inputs = genericServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : @inputs - the structure of @inputs is a list of listrefs. + Each listref has three components: + 1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3) + 2. queryID (undef for Secondary parameters) + 3. $data - the data takes several forms + a. $article XML::DOM node for Simples + <queryInput...>...</queryInput> + b. \@article XML:DOM nodes for Collections + c. $secondary XML::DOM node+
+
++ name : complexServiceInputParser + function : For more complex services taht have multiple articles for each input + and/or accept parameters, this routine will take a MOBY message and + extract the Simple/Collection/Parameter objects out of it in a + useful way. + usage : my $inputs = complexServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : $inputs is a hashref with the following structure: + + $inputs->{$queryID} = [ [TYPE, $DOM], [TYPE, $DOM], [TYPE, $DOM] ] + + Simples ------------------------ + + for example, the input message: + + <queryInput queryID = '1'> + <Simple articleName='name1'> + <Object namespace=blah id=blah/> + </Simple> + <Parameter articleName='cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+ will become: + (note that SIMPLE, COLLECTION, and SECONDARY are exported constants from this module) + + $inputs->{1} = [ [SIMPLE, $DOM_name1], + [SECONDARY, $DOM_cutoff] + ]+
+ Please see the XML::DOM pod documentation for information about how + to parse XML DOM objects. + + + Collections -------------------- + + With inputs that have collections these are presented as a + listref of Simple article DOM's. So for the following message: + + <queryInput> + <Collection articleName='name1'> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + </Collection> + <Parameter articleName='cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+ will become + + $inputs->{1} = [ [COLLECTION, [$DOM, $DOM] ], + [SECONDARY, $DOM_cutoff] + ]+
+ Please see the XML::DOM pod documentation for information about how + to parse XML DOM objects.+
+
++ name : getArticles + function : get the Simple/Collection/Parameter articles for a single queryInput + or queryResponse node + usage : @articles = getArticles($XML) + args : raw XML or XML::DOM of a queryInput, mobyData, or queryResponse block (e.g. from getInputs) + returns : a list of listrefs; each listref is one component of the queryInput. + a single queryInput/Response may consist of one or more named or unnamed + simple, collection, or parameter articles. + The listref structure is thus [name, $ARTICLE_DOM]: + + e.g.: @articles = ['name1', $SIMPLE_DOM]+
+ generated from the following sample XML:+
+ <queryInput> + <Simple articleName='name1'> + <Object namespace=blah id=blah/> + </Simple> + </queryInput> + + or : @articles = ['name1', $COLL_DOM], ['paramname1', $PARAM_DOM]+
+ generated from the following sample XML:+
+ <queryInput> + <Collection articleName='name1'> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + </Collection> + <Parameter articleName='e value cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+
++ name : DO NOT USE! + function : to take a MOBY message and break the objects out of it. This is identical + to the subroutine above, except that it returns the data as + Objects rather than XML::DOM nodes + usage : my @inputs = genericServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : @inputs - the structure of @inputs is a list of listrefs. + Each listref has three components: + 1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3) + 2. queryID (undef for Secondary parameters) + 3. $data - either MOBY::Client::SimpleArticle, CollectionArticle, or SecondaryArticle+
+
name : getSimpleArticleIDs @@ -243,12 +410,16 @@responseHeader
- name : responseHeader($auth) - function : print the XML string of a MOBY response header - usage : return responseHeader('illuminae.com') . $DATA . responseFooter; - args : a string representing the service providers authority URI - caveat : will soon be expanded to include service provision info - and additional namespace declarations + name : responseHeader + function : print the XML string of a MOBY response header +/- serviceNotes + usage : responseHeader('illuminae.com') + responseHeader( + -authority => 'illuminae.com', + -note => 'here is some data from the service provider') + args : a string representing the service providers authority URI, + OR a set of named arguments with the authority and the + service provision notes. + caveat : notes : returns everything required up to the response articles themselves. i.e. something like: <?xml version='1.0' encoding='UTF-8'?> @@ -274,8 +445,8 @@ function : get the queryInput block(s) as XML::DOM nodes usage : @queryInputs = getInputArticles($XML) args : the raw XML of a <MOBY> query, or an XML::DOM document - returns : a list of XML::DOM::Node's, each is a queryInput. - Note : Remember that queryInputs are numbered! This is what you + returns : a list of XML::DOM::Node's, each is a queryInput or mobyData block. + Note : Remember that these blocks are enumerated! This is what you pass as the third argument to the simpleResponse or collectionResponse subroutine to associate the numbered input to the numbered response@@ -285,40 +456,23 @@ name : getInputID function : get the value of the queryID element usage : @queryInputs = getInputID($XML) - args : the raw XML or XML::DOM of a <queryInput> block + args : the raw XML or XML::DOM of a queryInput or mobyData block (e.g. from getInputs) returns : integer, or '' - Note : queryInputs and queryResponses are coordinately enumerated! + Note : Inputs and Responses are coordinately enumerated! The integer you get here is what you pass as the third argument to the simpleResponse or collectionResponse subroutine to associate the numbered input to the numbered response
-
- name : getArticles + name : DO NOT USE!! function : get the Simple/Collection articles for a single queryInput - or queryResponse node + or queryResponse node, rethrning them as SimpleArticle, + SecondaryArticle, or ServiceInstance objects usage : @articles = getArticles($XML) - args : raw XML or XML::DOM of a moby:queryInput or a moby:queryResponse block - returns : a list of listrefs; each listref is one component of the queryInput. - a single queryInput/Responsemay consist of one or more named or unnamed - simple or collection articles. The listref structure is thus [name, $ARTICLE]: - - e.g.: @articles = ['name1', $SIMPLE_DOM] - or : @articles = ['name1', $COLLECTION_DOM], ['name2', $SIMPLE_DOM]...-
- the former is generated from the following sample XML:-
- <queryInput> - <Simple articleName='name1'> - <Object namespace=blah id=blah/> - </Simple> - </queryInput> - <queryInput> - <Simple articleName='name1'> - <Object namespace=blah id=blah/> - </Simple> - </queryInput>+ args : raw XML or XML::DOM of a moby:queryInput, moby:queryResponse block + returns :
@@ -379,6 +533,25 @@ returns : boolean
+
+ name : isSecondaryArticle + function : tests XML (text) or an XML DOM node to see if it represents a Secondary article + usage : if (isSecondaryArticle($node)){do something to it} + input : an XML::DOM node, an XML::DOM::Document or straight XML + returns : boolean+
+
++ name : extractRawContent + function : pass me an article (Simple, or Collection) and I'll give you the + content AS A STRING - i.e. the raw XML of the contained MOBY Object(s) + usage : extractRawContent($simple) + input : the one element of the output from getArticles + returns : string+
+
name : getNodeContentWithArticle @@ -396,16 +569,16 @@ For example, in the following XML: ... ... - <moby:Query> - <queryInput> + <moby:mobyContent> + <moby:mobyData> <Simple> <Sequence namespace=blah id=blah> <Integer namespace='' id='' articleName="Length">3</Integer> <String namespace='' id='' articleName="SequenceString">ATG</String> </Sequence> </Simple> - </queryInput> - </moby:Query> + </moby:mobyData> + </moby:mobyContent> ... ... @@ -422,16 +595,6 @@ }
-
- name : extractRawContent - function : pass me an article (Simple, or Collection) and I'll give you the - content AS A STRING - i.e. the raw XML of the contained MOBY Object(s) - usage : extractRawContent($simple) - input : the one element of the output from getArticles - returns : string-
-
name : validateNamespaces @@ -462,6 +625,15 @@ an array-ref of Simple article XML::DOM::Node's
+
+ name : getServiceNotes + function : to get the content of the Service Notes block of the MOBY message + usage : getServiceNotes($message) + args : $message is either the XML::DOM of the MOBY message, or plain XML + returns : String content of the ServiceNotes block of the MOBY Message+
+
name : getCrossReferences @@ -496,8 +668,78 @@ args : $CENTRAL - your MOBY::Client::Central object $queryTerm - the object type I am interested in \@termlist - the list of object types that I know about - returns : an ontology term as a scalar, or undef if there - is no parent of this node in the nodelist+ returns : an ontology term and LSID as a scalar, or undef if there + is no parent of this node in the nodelist. + (note that it will only return the term if you give it + term names in the @termList. If you give it + LSID's in the termList, then both the parameters + returned will be LSID's - it doesn't back-translate...) +
+
++ Usage : $object->_rearrange( array_ref, list_of_arguments) + Purpose : Rearranges named parameters to requested order. + Example : $self->_rearrange([qw(SEQUENCE ID DESC)], at param); + : Where @param = (-sequence => $s, + : -desc => $d, + : -id => $i); + Returns : @params - an array of parameters in the requested order. + : The above example would return ($s, $i, $d). + : Unspecified parameters will return undef. For example, if + : @param = (-sequence => $s); + : the above _rearrange call would return ($s, undef, undef) + Argument : $order : a reference to an array which describes the desired + : order of the named parameters. + : @param : an array of parameters, either as a list (in + : which case the function simply returns the list), + : or as an associative array with hyphenated tags + : (in which case the function sorts the values + : according to @{$order} and returns that new array.) + : The tags can be upper, lower, or mixed case + : but they must start with a hyphen (at least the + : first one should be hyphenated.) + Source : This function was taken from CGI.pm, written by Dr. Lincoln + : Stein, and adapted for use in Bio::Seq by Richard Resnick and + : then adapted for use in Bio::Root::Object.pm by Steve Chervitz, + : then migrated into Bio::Root::RootI.pm by Ewan Birney. + Comments : + : Uppercase tags are the norm, + : (SAC) + : This method may not be appropriate for method calls that are + : within in an inner loop if efficiency is a concern. + : + : Parameters can be specified using any of these formats: + : @param = (-name=>'me', -color=>'blue'); + : @param = (-NAME=>'me', -COLOR=>'blue'); + : @param = (-Name=>'me', -Color=>'blue'); + : @param = ('me', 'blue'); + : A leading hyphenated argument is used by this function to + : indicate that named parameters are being used. + : Therefore, the ('me', 'blue') list will be returned as-is. + : + : Note that Perl will confuse unquoted, hyphenated tags as + : function calls if there is a function of the same name + : in the current namespace: + : -name => 'foo' is interpreted as -&name => 'foo' + : + : For ultimate safety, put single quotes around the tag: + : ('-name'=>'me', '-color' =>'blue'); + : This can be a bit cumbersome and I find not as readable + : as using all uppercase, which is also fairly safe: + : (-NAME=>'me', -COLOR =>'blue'); + : + : Personal note (SAC): I have found all uppercase tags to + : be more managable: it involves less single-quoting, + : the key names stand out better, and there are no method naming + : conflicts. + : The drawbacks are that it's not as easy to type as lowercase, + : and lots of uppercase can be hard to read. + : + : Regardless of the style, it greatly helps to line + : the parameters up vertically for long/complex lists. + +=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2004/04/14 19:56:59 1.44 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2004/04/14 20:10:35 1.45 @@ -8,7 +8,9 @@ =cut -=head1 Client Side Paradigm +=head2 Client Side Paradigm + +not written yet =cut @@ -51,7 +53,7 @@ # now take the namespace and ID from our input article # (see pod docs for other possibilities) my $namespace = getSimpleArticleNamespaceURI($input); # get namespace - my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) + my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) # here is where you do whatever manipulation you need to do # for your particular service. @@ -70,9 +72,9 @@ This is a service that: -CONSUMES: base Object in the GO namespace -EXECUTES: Retrieval -PRODUCES: GO_Term (in the GO namespace) + CONSUMES: base Object in the GO namespace + EXECUTES: Retrieval + PRODUCES: GO_Term (in the GO namespace) # this subroutine is called from your dispatch_with line @@ -101,28 +103,28 @@ $MOBY_RESPONSE .= simpleResponse("", "", $ID); next; } else { - my $ns = getSimpleArticleNamespaceURI($input); - (($MOBY_RESPONSE .= simpleResponse("", "", $ID)) && (next)) - unless validateThisNamespace($ns, @validNS); # only do this if you are truly validating namespaces - my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef; - unless (defined($accession)){ - $MOBY_RESPONSE .= simpleResponse("", "", $ID); - next; - } - unless ($accession =~/^GO:/){ - $accession = "GO:$accession"; # we still haven't decided on whether id's should include the prefix... - } - $sth->execute($accession); - my ($term, $def) = $sth->fetchrow_array; - if ($term){ - $MOBY_RESPONSE .= simpleResponse(" -
MOBY::Client::CollectionArticle - a small object describing a MOBY Collection input or output
+MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central
experimental - please do not use in your code
This describes the Collection articles from either the findService Response of MOBY Central +(i.e. the description of the service), or Collection articles +as provided in a service invocation or response message +(i.e. simple articles containing data)
+Basically it parses the following part of a findService response:
++ <Collection articleName="foo"> + <Simple> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> + </Simple> + <Simple> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> + </Simple> + </Collection>+
OR it parses the following part of a service invocation or response message:
++ <Collection articleName="foo"> + <Simple> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> + </Simple> + <Simple> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> + </Simple> + </Collection>+
The articleName is retrieved with ->articleName +The contained Simples are retrieved as MOBY::Client::SimpleArticle objects +using the ->Simples method call.
Mark Wilkinson (markw at illuminae dot com)
+
+ Title : XML + Usage : $SA = $SA->XML($XML) + Function : set/reset all parameters for this object from the XML + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) XML fragment from and including <Simple>...</Simple>+
+
++ Title : XML_DOM + Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) + Function : set/reset all parameters for this object from the XML::DOM node for <Simple> + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM+
+
Title : isSimple @@ -100,7 +157,7 @@ get both Simple and Collection objects in your Input and output lists, it is good to be able to test what you have in-hand) - Returns : 1 (true)+ Returns : 0 (false)
+
++ Title : isSecondary + Usage : $boolean = $IN->isSecondary() + Function : is this a SecondaryArticle type? + (yes, I know this is obvious) + Returns : 0 (true)=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html 2003/11/01 18:05:55 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html 2004/04/15 14:38:22 1.8 @@ -2,7 +2,7 @@
- Title : output - Usage : $output = $Service->output($args) + Title : input + Usage : $input = $Service->input($args) Args : (optional) listref of SimpleArticle and/or CollectionArticle objects - Function : get/set output + Function : get/set input Returns : listref of MOBY::Client::SimpleArticle and/or MOBY::Client::CollectionArticle objects
=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html 2003/07/01 15:00:47 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html 2004/04/15 14:38:22 1.2 @@ -1,8 +1,8 @@
-
MOBY::Client::SimpleArticle - a small object describing a MOBY Simple input/output article
+MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central
experimental - please do not use in your code
This describes the Simple articles from either the findService Response of MOBY Central +(i.e. the description of the service), or Simple articles +as provided in a service invocation or response message +(i.e. simple articles containing data)
+Basically it parses the following part of a findService response:
+<Simple articleName='foo'> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> +</Simple>
+OR it parses the following part of a service invocation or response message:
+<Simple articleName='foo'> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> +</Simple>
+The articleName is retrieved with ->articleName
+The namespace(s)
are retrieved with ->namespaces
+The objectType is retrieved with ->objectType
+the id (if instantiated) is retrieved with ->id
Mark Wilkinson (markw at illuminae dot com)
+
+ Title : XML + Usage : $SA = $SA->XML($XML) + Function : set/reset all parameters for this object from the XML + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) XML fragment from and including <Simple>...</Simple>+
+
++ Title : XML_DOM + Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) + Function : set/reset all parameters for this object from the XML::DOM node for <Simple> + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM+
+
Title : addNamespace @@ -124,6 +165,15 @@ Input and output lists, it is good to be able to test what you have in-hand) Returns : 0 for false+
+
++ Title : isSecondary + Usage : $boolean = $IN->isSecondary() + Function : is this a SecondaryArticle type? + (yes, I know this is obvious) + Returns : 0 (true)From mwilkinson at pub.open-bio.org Thu Apr 15 10:38:22 2004 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu, 15 Apr 2004 10:38:22 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200404151438.i3FEcMdP016323@pub.open-bio.org> mwilkinson Thu Apr 15 10:38:22 EDT 2004 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16304 Modified Files: Central.html Log Message: updating all documentation that has gone out of sync with the code moby-live/Perl/MOBY Central.html,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/12/02 01:08:24 1.12 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html 2004/04/15 14:38:22 1.13 @@ -2,7 +2,7 @@
Input XML :
@@ -215,7 +215,7 @@There are two forms of Primary articles:
An example of the use of each of these might be another BLAST service, where you provide the sequences that make up the Blast database as well as the sequence to Blast against it. The sequences used to construct the database might be passed as a Collection input article containing multiple Sequence Objects, while the sequence to Blast against it would be a Simple input article consisting of a single Sequence Object.
There is currently only one form of Secondary article:
- Semantic MOBY Server - Hosted Pages - | -
Semantic +MOBY Server - Hosted Pages | +
The Semantic MOBY reference implementation server hosts the following
pages:
-
Page @@ -76,20 +76,40 @@ |
||
www.mygrid.org | +www.go.org | Home page of a -hypothetical vocabulary provider, mygrid.org. | +hypothetical vocabulary provider, go.org. This provider is meant to be +representative of the type of vocabulary information that the real Gene +Ontology (GO) Consortium would need to provide in order to be a +Semantic MOBY vocabulary provider.
www.mygrid.org/terms | + href="http://www.go.org:8080/terms">www.go.org/termsThe vocabulary of terms
-defined by mygrid.org. The notes regarding www.pubs.org/terms apply
+defined by go.org. The notes regarding www.pubs.org/terms apply
here as well. |
|
www.sgd.org | +Home page of a +hypothetical vocabulary provider, sgd.org. This provider is meant to be +representative of the type of vocabulary +information that the real Saccharomyces Gene Database would +need to +provide in order to be a Semantic MOBY vocabulary provider. | +|
www.sgd.org/terms | +The vocabulary of terms +defined by go.org. The notes regarding www.pubs.org/terms apply +here as well. | +|
www.s-moby.org | This page you're currently viewing. | @@ -104,46 +124,55 @@
hosts
file, making the host names refer to the
+entries to the hosts
file, making the host names refer to
+the
local host (127.0.0.1
). The Tomcat web server / servlet
-container then resolves to a virtual host by name. The following entries
+container then resolves to a virtual host by name. The following
+entries
should be added
-to the hosts
file of the given operating system on which the
+to the hosts
file of the given operating system on which
+the
test server is running:
-
-Under Linux/Unix, add to /etc/hosts
+
Under Linux/Unix, add to /etc/hosts
+
-127.0.0.1 www.acmepubs.com acmepubs.com
-127.0.0.1 www.megapubs.com megapubs.com
-127.0.0.1 www.pubs.org pubs.org
-127.0.0.1 www.mygrid.org mygrid.org
-127.0.0.1 www.s-moby.org s-moby.org
-127.0.0.1 www.smobydev.org smobydev.org
-
+
+127.0.0.1 www.acmepubs.com acmepubs.com
+127.0.0.1 www.megapubs.com megapubs.com
+127.0.0.1 www.pubs.org pubs.org
+127.0.0.1 www.go.org go.org
+127.0.0.1 www.sgd.org sgd.org
+127.0.0.1 www.s-moby.org s-moby.org
+127.0.0.1 www.smobydev.org smobydev.org
+
Under Windows NT/2000/XP, add to
<WIN_DIR>/system32/drivers/etc/hosts
+
-127.0.0.1 acmepubs.com
-127.0.0.1 www.acmepubs.com
-127.0.0.1 megapubs.com
-127.0.0.1 www.megapubs.com
-127.0.0.1 mygrid.org
-127.0.0.1 www.mygrid.org
-127.0.0.1 pubs.org
-127.0.0.1 www.pubs.org
-127.0.0.1 s-moby.org
-127.0.0.1 www.s-moby.org
-
+
+127.0.0.1 acmepubs.com
+127.0.0.1 www.acmepubs.com
+127.0.0.1 megapubs.com
+127.0.0.1 www.megapubs.com
+127.0.0.1 go.org
+127.0.0.1 www.go.org
+127.0.0.1 sgd.org
+127.0.0.1 www.sgd.org
+127.0.0.1 pubs.org
+127.0.0.1 www.pubs.org
+127.0.0.1 s-moby.org
+127.0.0.1 www.s-moby.org
+
** * The all not yet existing directories (for example the last - * 'cache' diorectory) will be created for you. + * 'cache' directory) will be created for you. */cache/ *
* * 'rootURLName' is used by method {@link #getURL} to return back @@ -75,7 +78,11 @@ static final char CLEAR_CHAR = '_'; /************************************************************************** * It creates an 'id' in the form: - * rootName / semanticType / prop1_prop2_... (time).syntaxType + * rootName / semanticType / { prop1_prop2_... } (time).syntaxType + * + * The part between { and } (inclusive) will be replaced by a + * unique shorter string in order to create a reasonably long real + * file name. **************************************************************************/ public String createId (String rootName, String semanticType, String syntaxType, @@ -94,10 +101,13 @@ ps[++i] = it.next().toString(); } Arrays.sort (ps); + buf.append ("{"); for (int i = 0; i < ps.length; i++) { buf.append (CLEAR_CHAR); - buf.append (clean (ps[i].toString())); +// buf.append (clean (ps[i].toString())); + buf.append (ps[i].toString()); } + buf.append ("}"); buf.append ("(" + lastModified + ")"); buf.append ("."); buf.append (clean (syntaxType)); @@ -235,6 +245,20 @@ * dir (as set in a constructor). **************************************************************************/ protected String getRelativeFilename (String id) { - return fileSeparator + startingDir + fileSeparator + id; + String fileName = (String)index.get (id); + if (fileName == null) { + int posFrom = id.indexOf ("{"); + int posTo = id.indexOf ("}"); + StringBuffer buf = new StringBuffer(); + buf.append (fileSeparator); + buf.append (startingDir); + buf.append (fileSeparator); + buf.append (id.substring (0, posFrom)); + buf.append (clean (new java.rmi.server.UID().toString())); + buf.append (id.substring (posTo+1)); + fileName = new String (buf); + index.put (id, fileName); + } + return fileName; } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.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/GraphsServlet.java 2003/11/25 13:18:10 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java 2004/04/01 21:03:42 1.5 @@ -491,7 +491,7 @@ h.gen (TD, radios[0]) + h.gen (TD, - "Show all services and all connections")) + + "Show all services and all connections " + h.gen (EM, "(very long and big)"))) + h.gen (TR, h.gen (TD, new String[] { VALIGN, "top" }, radios[1]) + =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java 2003/11/08 00:27:24 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java 2004/04/01 21:03:42 1.2 @@ -40,11 +40,11 @@ * * * The not existing directories (for example the last 'cache' - * diorectory) will be created for you. + * directory) will be created for you. * * The 'contextPath' is a path (relative to the servlet context) * where the cached files will be created (actually starting from - * here, because they may be created ina deeper directory + * here, because they may be created in a deeper directory * structure. Usually you get it in the calling servlet from the * request by method request.getContextPath(). The 'contextPath' * starts with a "/" character but does not end with a "/" From mwilkinson at pub.open-bio.org Thu Apr 1 21:23:48 2004 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu, 1 Apr 2004 16:23:48 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200404012123.i31LNmaC007236@pub.open-bio.org> mwilkinson Thu Apr 1 16:23:47 EST 2004 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv7213/MOBY/Client Modified Files: Service.html Service.pm Log Message: update the execute method to allow multiple inputs to a single invocation. Documentation updated. Fixed bug of articleName attribute being attached to the wrong XML element moby-live/Perl/MOBY/Client Service.html,1.3,1.4 Service.pm,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html 2003/08/06 14:31:21 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html 2004/04/01 21:23:47 1.4 @@ -2,7 +2,7 @@
+ $Service->execute(XMLinputlist => [ + [ + 'input1', '<Object namespace="blah" id="123"/>', + 'input2', '<Object namespace="blah" id="234"/>', + ] + ]); + This would cause a single invocation of a service requiring + two input parameters named "input1" and "input2"
@@ -122,72 +110,6 @@ } /************************************************************************* - * Find and return an instance of a DOM parser wrapper. A parser - * wrapper is a class allowing a uniform access to DOM parsers - - * because it defines a way how a Document is created and returned - * (see details in interface - * org.biomoby.shared.dom.ParseWrappers, or in samples in - * the distribution of Apache Xerces-2 where this is all taken - * from). - *
- * - * The DOM parser wrapper class name is taken from, in this order: - *
- * - * This is based on the samples shown int the Apache Xerces-2 distribution. - * See more details there. This implementation differ from those samples - * in few not too crucial details: - *
- * @param parserClassName is a class to be instatiated (unless there is - * a Java property {@link #PROP_PARSER_WRAPPER}) - * @return an instance of a DOM parser wrapper - * @throws MobyException if unable to instantiate specified DOM parser - *************************************************************************/ - public static ParserWrapper getDOMParser (String parserClassName) - throws MobyException { - - // which parser do we want - String name = System.getProperty (PROP_PARSER_WRAPPER); - if (name != null) - parserClassName = name; - if (parserClassName == null) - parserClassName = DEFAULT_PARSER_WRAPPER; - - // create parser - try { - return (ParserWrapper)Class.forName (parserClassName).newInstance(); - } - catch (Exception e) { - throw new MobyException ("Unable to instantiate parser (" + parserClassName +")"); - } - } - - /************************************************************************* - * Find and return an instance of a DOM parser wrapper. - * It does the same as method {@link #getDOMParser(String)} except that it - * does not get any parser class name in the parameter. - *
- *
- * @return an instance of a DOM parser wrapper
- * @see #getDOMParser(String)
- * @throws MobyException if unable to instantiate the specified DOM parser
- *************************************************************************/
- public static ParserWrapper getDOMParser()
- throws MobyException {
- return getDOMParser (null);
- }
-
- /*************************************************************************
* Return just the last part of the LSID identifier. An example of
* an LSID identifier as used by and returned from the Moby
* registry is urn:lsid:biomoby.org:objectclass:object.
From gordonp at pub.open-bio.org Fri Apr 2 16:40:23 2004
From: gordonp at pub.open-bio.org (Paul Gordon)
Date: Fri, 2 Apr 2004 11:40:23 -0500
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404021640.i32GeNlC013362@pub.open-bio.org>
gordonp
Fri Apr 2 11:40:23 EST 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv13318/src/main/org/biomoby/client
Modified Files:
CentralImpl.java
Log Message:
Revised documentation, interfaces and classes pertaining to XML parsing and server cache to reflect new parsing and caching schemes
moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.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/CentralImpl.java 2004/04/01 23:24:26 1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2004/04/02 16:40:23 1.11
@@ -8,7 +8,6 @@
package org.biomoby.client;
import org.biomoby.shared.*;
-import org.biomoby.shared.dom.*;
import org.apache.axis.client.*;
import org.apache.axis.*;
From mwilkinson at pub.open-bio.org Sun Apr 4 18:53:14 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Sun, 4 Apr 2004 14:53:14 -0400
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404041853.i34IrECT029372@pub.open-bio.org>
mwilkinson
Sun Apr 4 14:53:13 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv29353/MOBY
Modified Files:
Central.pm
Log Message:
bug in the registration object - it should return LSID's in the 'id' tag. I think it now does this properly
moby-live/Perl/MOBY Central.pm,1.123,1.124
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/01/15 16:04:54 1.123
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 18:53:13 1.124
@@ -2887,7 +2887,7 @@
my $reg = &Registration({
success => 0,
message => "$message",
- registration_id => "$id",
+ id => "$id",
});
return $reg;
}
@@ -2897,7 +2897,7 @@
my $reg = &Registration({
success => 1,
message => "$message",
- registration_id => "$id",
+ id => "$id",
});
return $reg;
}
From mwilkinson at pub.open-bio.org Sun Apr 4 19:08:41 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Sun, 4 Apr 2004 15:08:41 -0400
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404041908.i34J8fLj029465@pub.open-bio.org>
mwilkinson
Sun Apr 4 15:08:41 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv29446/MOBY
Modified Files:
Central.pm
Log Message:
bug in the registration object - it should return LSID's in the 'id' tag. I think it now does this properly
moby-live/Perl/MOBY Central.pm,1.124,1.125
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 18:53:13 1.124
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2004/04/04 19:08:41 1.125
@@ -109,7 +109,7 @@
sub Registration {
my ( $details) = @_;
- my $id = $details->{registration_id};
+ my $id = $details->{id};
my $success = $details->{success};
my $message = $details->{message};
From mwilkinson at pub.open-bio.org Wed Apr 14 19:56:59 2004
From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
Date: Wed, 14 Apr 2004 15:56:59 -0400
Subject: [MOBY-guts] biomoby commit
Message-ID: <200404141956.i3EJuxi2013404@pub.open-bio.org>
mwilkinson
Wed Apr 14 15:56:59 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv13353/Perl/MOBY/Client
Modified Files:
Central.pm CollectionArticle.pm ServiceInstance.pm
SimpleArticle.pm
Log Message:
CommonSubs now includes support for services that use Secondary Parameter's. I am also almost finished writing an OO-interface for building/deconstructing MOBY objects, so that people don't have to learn the XML::DOM API. This is incomplete and untested yet, so don't shoot me if it doesn't work. See the docs for CommonSubs 'complexServiceInputParser' for details on how to manage services that use multiple inputs and/or secondary parameters. As soon as I get this OO interface working I will create an equivalent subroutine that parses the input into objects (but I wont remove this routine, so it wont break you servies if you use it)
moby-live/Perl/MOBY/Client Central.pm,1.73,1.74 CollectionArticle.pm,1.6,1.7 ServiceInstance.pm,1.10,1.11 SimpleArticle.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2004/03/26 16:10:40 1.73
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2004/04/14 19:56:59 1.74
@@ -1487,7 +1487,19 @@
}
}
}
-
+ my @SECONDARIES;
+ my $secs = $Service->getElementsByTagName("secondaryArticles"); # there should only be one, but... who knows what
+ for my $in(0..$secs->getLength-1){
+ my $current = $secs->item($in);
+
+ foreach my $param($current->getChildNodes){ # child nodes will be "Parameter" tag names
+ next unless $param->getNodeType == ELEMENT_NODE && $param->getTagName eq "Parameter";
+ my $THIS;
+ $THIS = MOBY::Client::SecondaryArticle->new(XML_DOM => $param);
+ push @SECONDARIES, $THIS;
+ }
+ }
+
my $Instance = MOBY::Client::ServiceInstance->new(
authority => $AuthURI,
authoritative => $authoritative,
@@ -1498,6 +1510,7 @@
category => $cat,
input => \@INPUTS,
output => \@OUTPUTS,
+ secondary => \@SECONDARIES,
description => $Description,
registry => $Registry,
XML => $Service->toString,
@@ -1597,7 +1610,7 @@
#
my ($self, $xml) = @_;
my $Parser = new XML::DOM::Parser;
-
+ #print STDERR $xml;
my $doc = $Parser->parse($xml);
my $Object = $doc->getDocumentElement();
my $obj = $Object->getTagName;
@@ -1608,7 +1621,8 @@
my $reg = MOBY::Client::Registration->new(
success => $success,
message => $message,
- registration_id => $id,);
+ registration_id => $id,
+ id => $id);
return $reg;
}
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/12/02 00:23:23 1.6
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2004/04/14 19:56:59 1.7
@@ -19,9 +19,42 @@
=head1 DESCRIPTION
-This describes the Collection articles from the findService Response of MOBY Central
-(i.e. the description of the service), it DOES NOT create collection articles
-as provided by a service provider (i.e. simple articles containing data)
+This describes the Collection articles from either the findService Response of MOBY Central
+(i.e. the description of the service), or Collection articles
+as provided in a service invocation or response message
+(i.e. simple articles containing data)
+
+Basically it parses the following part of a findService response:
+
+
@@ -61,57 +68,55 @@
MOBY Services
+
-
not written yet
The following is a generalized architecture for *all* -BioMOBY services showing how to parse incoming messages...
+BioMOBY services showing how to parse incoming messages +using the subroutines provided in CommonSubssub myServiceName { - my ($caller, $message) = @_; # get the incoming MOBY query XML-
- my @queries = getInputs($message); # returns XML::DOM nodes - my $MOBY_RESPONSE = ""; # set empty response - - foreach my $query(@queries){-
- my $queryID = getInputID($query); # get the queryID attribute of the queryInput - - my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query - foreach my $input(@input_articles){ # input is a listref-
- my ($articleName, $article) = @{$input}; # get the named article - - my $simple = isSimpleArticle($article); # articles may be simple or collection - my $collection = isCollectionArticle($article);-
- if ($collection){-
- # do something wtih the collection... - # for example... - my @simples = getCollectedSimples($article); - # blah blah blah... - - } elsif ($simple){ - # maybe you just need the ID of the incoming query: - my ($id) = getSimpleArticleIDs('NCBI_gi', $article); # if you need the ID-
- # or maybe you are going to do something with the content? - # for example, this will get the array of text lines - # for the moby:String object with the articleName 'SequenceString' - # that is in this $article - my @sequence = getNodeContentWithArticle($article, "String", "SequenceString");-
- # DO YOUR ANALYSIS HERE - my $result = ""; #whatever you analysis says - - $MOBY_RESPONSE .= simpleResponse($result, "outputArticlename", $queryID); + my ($caller, $data) = @_; + my $MOBY_RESPONSE; # holds the response raw XML + + # genericServiceInputParser + # unpacks incoming message into an array of arrarefs. + # Each element of the array is a queryInput block, or a mobyData block + # the arrayref has the following structure: + # [SIMPLE, $queryID, $simple] + # the first element is a constant "SIMPLE" or "COLLECTION" + # the second element is the queryID (required for enumerating the responses) + # the third element is the XML::DOM for the Simple or Collection block + my (@inputs)= genericServiceInputParser($data); + # or fail properly with an empty response + return SOAP::Data->type('base64' => responseHeader("my.authURI.com") . responseFooter()) unless (scalar(@inputs)); + + # you only need to do this if you are intending to be namespace aware + # some services might not care what namespace the data is in, so long + # as there is data... + my @validNS_LSID = validateNamespaces("NCBI_gi"); # returns LSID's for each human-readable+
+ foreach (@inputs){ + my ($articleType, $qID, $input) = @{$_}; + unless (($articleType == SIMPLE) && ($input)){ + # in this example, we are only accepting SIMPLE types as input + # so write back an empty response block and move on to the next + $MOBY_RESPONSE .= simpleResponse("", "", $qID) ; + next; + } else { + # now take the namespace and ID from our input article + # (see pod docs for other possibilities) + my $namespace = getSimpleArticleNamespaceURI($input); # get namespace + my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) + + # here is where you do whatever manipulation you need to do + # for your particular service. + # you will be building an XML document into $MOBY_RESPONSE } - } - } - return responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter; + } + return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter)); }
@@ -119,45 +124,62 @@
A COMPLETE EXAMPLE OF AN EASY MOBY SERVICE
This is a service that:
-CONSUMES: Object in the NCBI_Acc namespace -EXECUTES: Retrieval -PRODUCES: GenericSequence (in the NCBI_Acc namespace)
- use Bio::Perl; - + CONSUMES: base Object in the GO namespace + EXECUTES: Retrieval + PRODUCES: GO_Term (in the GO namespace)+
# this subroutine is called from your dispatch_with line - # in your SOAP daemon - - sub myServiceName { - my ($caller, $message) = @_; # get the incoming MOBY query XML+ # in your SOAP daemon
- my @queries = getInputs($message); # returns XML::DOM nodes - my $MOBY_RESPONSE = ""; # set empty response - - foreach my $query(@queries){-
- my $queryID = getInputID($query); # get the queryID attribute of the queryInput - - my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query - foreach my $input(@input_articles){ # input is a listref - my ($articleName, $article) = @{$input}; # get the named article - next unless isSimpleArticle($article); # I only allow simple inputs in my service signature - my ($id) = getSimpleArticleIDs('NCBI_Acc', $article); # if you need the ID - my $seq; - eval {$seq = get_sequence('genbank',$id);} # suppress bioperl error messages - my $response = ""; - if ($seq){ - $length = length($seq); - $response = "<GenericSequence namespace='NCBI_Acc' id='$id'> - <Integer namespace='' id='' articleName='Length'>$length</Integer> - <String namespace='' id='' articleName='SequenceString'>$seq</String> - </GenericSequence>"; - } - $MOBY_RESPONSE .= simpleResponse($response, '', $queryID); + sub getGoTerm { + my ($caller, $message) = @_; + my $MOBY_RESPONSE; + my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...) + return SOAP::Data->type('base64' => responseHeader('my.authURI.com') . responseFooter()) unless (scalar(@inputs));+
+ my @validNS = validateNamespaces("GO"); # ONLY do this if you are intending to be namespace aware!+
+ my $dbh = _connectToGoDatabase(); + return SOAP::Data->type('base64' => responseHeader('my.authURI.com') . responseFooter()) unless $dbh; + my $sth = $dbh->prepare(q{ + select name, term_definition + from term, term_definition + where term.id = term_definition.term_id + and acc=?});+
+ foreach (@inputs){ + my ($articleType, $ID, $input) = @{$_}; + unless ($articleType == SIMPLE){ + $MOBY_RESPONSE .= simpleResponse("", "", $ID); + next; + } else { + my $ns = getSimpleArticleNamespaceURI($input); + (($MOBY_RESPONSE .= simpleResponse("", "", $ID)) && (next)) + unless validateThisNamespace($ns, @validNS); # only do this if you are truly validating namespaces + my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef; + unless (defined($accession)){ + $MOBY_RESPONSE .= simpleResponse("", "", $ID); + next; + } + unless ($accession =~/^GO:/){ + $accession = "GO:$accession"; # we still haven't decided on whether id's should include the prefix... + } + $sth->execute($accession); + my ($term, $def) = $sth->fetchrow_array; + if ($term){ + $MOBY_RESPONSE .= simpleResponse(" + <moby:GO_Term namespace='GO' id='$accession'> + <moby:String namespace='' id='' articleName='Term'>$term</moby:String> + <moby:String namespace='' id='' articleName='Definition'>$def</moby:String> + </moby:GO_Term>", "GO_Term_From_ID", $ID) + } else { + $MOBY_RESPONSE .= simpleResponse("", "", $ID) + } } - } - } - return responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter; + } + + return SOAP::Data->type('base64' => (responseHeader("my.authURI.com") . $MOBY_RESPONSE . responseFooter)); }
@@ -166,7 +188,8 @@
CommonSubs are used to do various manipulations of MOBY Messages. It is useful both Client and Service side to construct and parse MOBY Messages, and ensure that the message structure is valid as per the API.
-It DOES NOT connect to MOBY Central for any of its functions.
+It DOES NOT connect to MOBY Central for any of its functions, though it does +contact the ontology server, so it will require a network connection.
+
+ name : genericServiceInputParser + function : For the MOST SIMPLE SERVICES that take single Simple or Collection inputs + and no Secondaries this routine takes the MOBY message and + breaks the objects out of it in a useful way + usage : my @inputs = genericServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : @inputs - the structure of @inputs is a list of listrefs. + Each listref has three components: + 1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3) + 2. queryID (undef for Secondary parameters) + 3. $data - the data takes several forms + a. $article XML::DOM node for Simples + <queryInput...>...</queryInput> + b. \@article XML:DOM nodes for Collections + c. $secondary XML::DOM node+
+
++ name : complexServiceInputParser + function : For more complex services taht have multiple articles for each input + and/or accept parameters, this routine will take a MOBY message and + extract the Simple/Collection/Parameter objects out of it in a + useful way. + usage : my $inputs = complexServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : $inputs is a hashref with the following structure: + + $inputs->{$queryID} = [ [TYPE, $DOM], [TYPE, $DOM], [TYPE, $DOM] ] + + Simples ------------------------ + + for example, the input message: + + <queryInput queryID = '1'> + <Simple articleName='name1'> + <Object namespace=blah id=blah/> + </Simple> + <Parameter articleName='cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+ will become: + (note that SIMPLE, COLLECTION, and SECONDARY are exported constants from this module) + + $inputs->{1} = [ [SIMPLE, $DOM_name1], + [SECONDARY, $DOM_cutoff] + ]+
+ Please see the XML::DOM pod documentation for information about how + to parse XML DOM objects. + + + Collections -------------------- + + With inputs that have collections these are presented as a + listref of Simple article DOM's. So for the following message: + + <queryInput> + <Collection articleName='name1'> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + </Collection> + <Parameter articleName='cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+ will become + + $inputs->{1} = [ [COLLECTION, [$DOM, $DOM] ], + [SECONDARY, $DOM_cutoff] + ]+
+ Please see the XML::DOM pod documentation for information about how + to parse XML DOM objects.+
+
++ name : getArticles + function : get the Simple/Collection/Parameter articles for a single queryInput + or queryResponse node + usage : @articles = getArticles($XML) + args : raw XML or XML::DOM of a queryInput, mobyData, or queryResponse block (e.g. from getInputs) + returns : a list of listrefs; each listref is one component of the queryInput. + a single queryInput/Response may consist of one or more named or unnamed + simple, collection, or parameter articles. + The listref structure is thus [name, $ARTICLE_DOM]: + + e.g.: @articles = ['name1', $SIMPLE_DOM]+
+ generated from the following sample XML:+
+ <queryInput> + <Simple articleName='name1'> + <Object namespace=blah id=blah/> + </Simple> + </queryInput> + + or : @articles = ['name1', $COLL_DOM], ['paramname1', $PARAM_DOM]+
+ generated from the following sample XML:+
+ <queryInput> + <Collection articleName='name1'> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + <Simple> + <Object namespace=blah id=blah/> + </Simple> + </Collection> + <Parameter articleName='e value cutoff'> + <datatype>Float</datatype> + <default>10</default> + </Parameter> + </queryInput>+
+
++ name : DO NOT USE! + function : to take a MOBY message and break the objects out of it. This is identical + to the subroutine above, except that it returns the data as + Objects rather than XML::DOM nodes + usage : my @inputs = genericServiceInputParser($MOBY_mssage)); + args : $message - this is the SOAP payload; i.e. the XML document containing the MOBY message + returns : @inputs - the structure of @inputs is a list of listrefs. + Each listref has three components: + 1. COLLECTION|SIMPLE|SECONDARY (i.e. constants 1, 2, 3) + 2. queryID (undef for Secondary parameters) + 3. $data - either MOBY::Client::SimpleArticle, CollectionArticle, or SecondaryArticle+
+
name : getSimpleArticleIDs @@ -243,12 +410,16 @@responseHeader
- name : responseHeader($auth) - function : print the XML string of a MOBY response header - usage : return responseHeader('illuminae.com') . $DATA . responseFooter; - args : a string representing the service providers authority URI - caveat : will soon be expanded to include service provision info - and additional namespace declarations + name : responseHeader + function : print the XML string of a MOBY response header +/- serviceNotes + usage : responseHeader('illuminae.com') + responseHeader( + -authority => 'illuminae.com', + -note => 'here is some data from the service provider') + args : a string representing the service providers authority URI, + OR a set of named arguments with the authority and the + service provision notes. + caveat : notes : returns everything required up to the response articles themselves. i.e. something like: <?xml version='1.0' encoding='UTF-8'?> @@ -274,8 +445,8 @@ function : get the queryInput block(s) as XML::DOM nodes usage : @queryInputs = getInputArticles($XML) args : the raw XML of a <MOBY> query, or an XML::DOM document - returns : a list of XML::DOM::Node's, each is a queryInput. - Note : Remember that queryInputs are numbered! This is what you + returns : a list of XML::DOM::Node's, each is a queryInput or mobyData block. + Note : Remember that these blocks are enumerated! This is what you pass as the third argument to the simpleResponse or collectionResponse subroutine to associate the numbered input to the numbered response@@ -285,40 +456,23 @@ name : getInputID function : get the value of the queryID element usage : @queryInputs = getInputID($XML) - args : the raw XML or XML::DOM of a <queryInput> block + args : the raw XML or XML::DOM of a queryInput or mobyData block (e.g. from getInputs) returns : integer, or '' - Note : queryInputs and queryResponses are coordinately enumerated! + Note : Inputs and Responses are coordinately enumerated! The integer you get here is what you pass as the third argument to the simpleResponse or collectionResponse subroutine to associate the numbered input to the numbered response
-
- name : getArticles + name : DO NOT USE!! function : get the Simple/Collection articles for a single queryInput - or queryResponse node + or queryResponse node, rethrning them as SimpleArticle, + SecondaryArticle, or ServiceInstance objects usage : @articles = getArticles($XML) - args : raw XML or XML::DOM of a moby:queryInput or a moby:queryResponse block - returns : a list of listrefs; each listref is one component of the queryInput. - a single queryInput/Responsemay consist of one or more named or unnamed - simple or collection articles. The listref structure is thus [name, $ARTICLE]: - - e.g.: @articles = ['name1', $SIMPLE_DOM] - or : @articles = ['name1', $COLLECTION_DOM], ['name2', $SIMPLE_DOM]...-
- the former is generated from the following sample XML:-
- <queryInput> - <Simple articleName='name1'> - <Object namespace=blah id=blah/> - </Simple> - </queryInput> - <queryInput> - <Simple articleName='name1'> - <Object namespace=blah id=blah/> - </Simple> - </queryInput>+ args : raw XML or XML::DOM of a moby:queryInput, moby:queryResponse block + returns :
@@ -379,6 +533,25 @@ returns : boolean
+
+ name : isSecondaryArticle + function : tests XML (text) or an XML DOM node to see if it represents a Secondary article + usage : if (isSecondaryArticle($node)){do something to it} + input : an XML::DOM node, an XML::DOM::Document or straight XML + returns : boolean+
+
++ name : extractRawContent + function : pass me an article (Simple, or Collection) and I'll give you the + content AS A STRING - i.e. the raw XML of the contained MOBY Object(s) + usage : extractRawContent($simple) + input : the one element of the output from getArticles + returns : string+
+
name : getNodeContentWithArticle @@ -396,16 +569,16 @@ For example, in the following XML: ... ... - <moby:Query> - <queryInput> + <moby:mobyContent> + <moby:mobyData> <Simple> <Sequence namespace=blah id=blah> <Integer namespace='' id='' articleName="Length">3</Integer> <String namespace='' id='' articleName="SequenceString">ATG</String> </Sequence> </Simple> - </queryInput> - </moby:Query> + </moby:mobyData> + </moby:mobyContent> ... ... @@ -422,16 +595,6 @@ }
-
- name : extractRawContent - function : pass me an article (Simple, or Collection) and I'll give you the - content AS A STRING - i.e. the raw XML of the contained MOBY Object(s) - usage : extractRawContent($simple) - input : the one element of the output from getArticles - returns : string-
-
name : validateNamespaces @@ -462,6 +625,15 @@ an array-ref of Simple article XML::DOM::Node's
+
+ name : getServiceNotes + function : to get the content of the Service Notes block of the MOBY message + usage : getServiceNotes($message) + args : $message is either the XML::DOM of the MOBY message, or plain XML + returns : String content of the ServiceNotes block of the MOBY Message+
+
name : getCrossReferences @@ -496,8 +668,78 @@ args : $CENTRAL - your MOBY::Client::Central object $queryTerm - the object type I am interested in \@termlist - the list of object types that I know about - returns : an ontology term as a scalar, or undef if there - is no parent of this node in the nodelist+ returns : an ontology term and LSID as a scalar, or undef if there + is no parent of this node in the nodelist. + (note that it will only return the term if you give it + term names in the @termList. If you give it + LSID's in the termList, then both the parameters + returned will be LSID's - it doesn't back-translate...) +
+
++ Usage : $object->_rearrange( array_ref, list_of_arguments) + Purpose : Rearranges named parameters to requested order. + Example : $self->_rearrange([qw(SEQUENCE ID DESC)], at param); + : Where @param = (-sequence => $s, + : -desc => $d, + : -id => $i); + Returns : @params - an array of parameters in the requested order. + : The above example would return ($s, $i, $d). + : Unspecified parameters will return undef. For example, if + : @param = (-sequence => $s); + : the above _rearrange call would return ($s, undef, undef) + Argument : $order : a reference to an array which describes the desired + : order of the named parameters. + : @param : an array of parameters, either as a list (in + : which case the function simply returns the list), + : or as an associative array with hyphenated tags + : (in which case the function sorts the values + : according to @{$order} and returns that new array.) + : The tags can be upper, lower, or mixed case + : but they must start with a hyphen (at least the + : first one should be hyphenated.) + Source : This function was taken from CGI.pm, written by Dr. Lincoln + : Stein, and adapted for use in Bio::Seq by Richard Resnick and + : then adapted for use in Bio::Root::Object.pm by Steve Chervitz, + : then migrated into Bio::Root::RootI.pm by Ewan Birney. + Comments : + : Uppercase tags are the norm, + : (SAC) + : This method may not be appropriate for method calls that are + : within in an inner loop if efficiency is a concern. + : + : Parameters can be specified using any of these formats: + : @param = (-name=>'me', -color=>'blue'); + : @param = (-NAME=>'me', -COLOR=>'blue'); + : @param = (-Name=>'me', -Color=>'blue'); + : @param = ('me', 'blue'); + : A leading hyphenated argument is used by this function to + : indicate that named parameters are being used. + : Therefore, the ('me', 'blue') list will be returned as-is. + : + : Note that Perl will confuse unquoted, hyphenated tags as + : function calls if there is a function of the same name + : in the current namespace: + : -name => 'foo' is interpreted as -&name => 'foo' + : + : For ultimate safety, put single quotes around the tag: + : ('-name'=>'me', '-color' =>'blue'); + : This can be a bit cumbersome and I find not as readable + : as using all uppercase, which is also fairly safe: + : (-NAME=>'me', -COLOR =>'blue'); + : + : Personal note (SAC): I have found all uppercase tags to + : be more managable: it involves less single-quoting, + : the key names stand out better, and there are no method naming + : conflicts. + : The drawbacks are that it's not as easy to type as lowercase, + : and lots of uppercase can be hard to read. + : + : Regardless of the style, it greatly helps to line + : the parameters up vertically for long/complex lists. + +=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2004/04/14 19:56:59 1.44 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2004/04/14 20:10:35 1.45 @@ -8,7 +8,9 @@ =cut -=head1 Client Side Paradigm +=head2 Client Side Paradigm + +not written yet =cut @@ -51,7 +53,7 @@ # now take the namespace and ID from our input article # (see pod docs for other possibilities) my $namespace = getSimpleArticleNamespaceURI($input); # get namespace - my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) + my ($identifier) = getSimpleArticleIDs($input); # get ID (note array output! see pod) # here is where you do whatever manipulation you need to do # for your particular service. @@ -70,9 +72,9 @@ This is a service that: -CONSUMES: base Object in the GO namespace -EXECUTES: Retrieval -PRODUCES: GO_Term (in the GO namespace) + CONSUMES: base Object in the GO namespace + EXECUTES: Retrieval + PRODUCES: GO_Term (in the GO namespace) # this subroutine is called from your dispatch_with line @@ -101,28 +103,28 @@ $MOBY_RESPONSE .= simpleResponse("", "", $ID); next; } else { - my $ns = getSimpleArticleNamespaceURI($input); - (($MOBY_RESPONSE .= simpleResponse("", "", $ID)) && (next)) - unless validateThisNamespace($ns, @validNS); # only do this if you are truly validating namespaces - my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef; - unless (defined($accession)){ - $MOBY_RESPONSE .= simpleResponse("", "", $ID); - next; - } - unless ($accession =~/^GO:/){ - $accession = "GO:$accession"; # we still haven't decided on whether id's should include the prefix... - } - $sth->execute($accession); - my ($term, $def) = $sth->fetchrow_array; - if ($term){ - $MOBY_RESPONSE .= simpleResponse(" -
MOBY::Client::CollectionArticle - a small object describing a MOBY Collection input or output
+MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central
experimental - please do not use in your code
This describes the Collection articles from either the findService Response of MOBY Central +(i.e. the description of the service), or Collection articles +as provided in a service invocation or response message +(i.e. simple articles containing data)
+Basically it parses the following part of a findService response:
++ <Collection articleName="foo"> + <Simple> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> + </Simple> + <Simple> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> + </Simple> + </Collection>+
OR it parses the following part of a service invocation or response message:
++ <Collection articleName="foo"> + <Simple> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> + </Simple> + <Simple> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> + </Simple> + </Collection>+
The articleName is retrieved with ->articleName +The contained Simples are retrieved as MOBY::Client::SimpleArticle objects +using the ->Simples method call.
Mark Wilkinson (markw at illuminae dot com)
+
+ Title : XML + Usage : $SA = $SA->XML($XML) + Function : set/reset all parameters for this object from the XML + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) XML fragment from and including <Simple>...</Simple>+
+
++ Title : XML_DOM + Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) + Function : set/reset all parameters for this object from the XML::DOM node for <Simple> + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM+
+
Title : isSimple @@ -100,7 +157,7 @@ get both Simple and Collection objects in your Input and output lists, it is good to be able to test what you have in-hand) - Returns : 1 (true)+ Returns : 0 (false)
+
++ Title : isSecondary + Usage : $boolean = $IN->isSecondary() + Function : is this a SecondaryArticle type? + (yes, I know this is obvious) + Returns : 0 (true)=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html 2003/11/01 18:05:55 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.html 2004/04/15 14:38:22 1.8 @@ -2,7 +2,7 @@
- Title : output - Usage : $output = $Service->output($args) + Title : input + Usage : $input = $Service->input($args) Args : (optional) listref of SimpleArticle and/or CollectionArticle objects - Function : get/set output + Function : get/set input Returns : listref of MOBY::Client::SimpleArticle and/or MOBY::Client::CollectionArticle objects
=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html 2003/07/01 15:00:47 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.html 2004/04/15 14:38:22 1.2 @@ -1,8 +1,8 @@
-
MOBY::Client::SimpleArticle - a small object describing a MOBY Simple input/output article
+MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central
experimental - please do not use in your code
This describes the Simple articles from either the findService Response of MOBY Central +(i.e. the description of the service), or Simple articles +as provided in a service invocation or response message +(i.e. simple articles containing data)
+Basically it parses the following part of a findService response:
+<Simple articleName='foo'> + <objectType>someNbject</objectType> + <Namespace>someNamespace</Namespace> + <Namespace>someNamespace2</Namespace> +</Simple>
+OR it parses the following part of a service invocation or response message:
+<Simple articleName='foo'> + <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> +</Simple>
+The articleName is retrieved with ->articleName
+The namespace(s)
are retrieved with ->namespaces
+The objectType is retrieved with ->objectType
+the id (if instantiated) is retrieved with ->id
Mark Wilkinson (markw at illuminae dot com)
+
+ Title : XML + Usage : $SA = $SA->XML($XML) + Function : set/reset all parameters for this object from the XML + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) XML fragment from and including <Simple>...</Simple>+
+
++ Title : XML_DOM + Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) + Function : set/reset all parameters for this object from the XML::DOM node for <Simple> + Returns : MOBY::Client::SimpleArticle + Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM+
+
Title : addNamespace @@ -124,6 +165,15 @@ Input and output lists, it is good to be able to test what you have in-hand) Returns : 0 for false+
+
++ Title : isSecondary + Usage : $boolean = $IN->isSecondary() + Function : is this a SecondaryArticle type? + (yes, I know this is obvious) + Returns : 0 (true)From mwilkinson at pub.open-bio.org Thu Apr 15 14:38:22 2004 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu, 15 Apr 2004 10:38:22 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200404151438.i3FEcMdP016323@pub.open-bio.org> mwilkinson Thu Apr 15 10:38:22 EDT 2004 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16304 Modified Files: Central.html Log Message: updating all documentation that has gone out of sync with the code moby-live/Perl/MOBY Central.html,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/12/02 01:08:24 1.12 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html 2004/04/15 14:38:22 1.13 @@ -2,7 +2,7 @@
Input XML :
@@ -215,7 +215,7 @@There are two forms of Primary articles:
An example of the use of each of these might be another BLAST service, where you provide the sequences that make up the Blast database as well as the sequence to Blast against it. The sequences used to construct the database might be passed as a Collection input article containing multiple Sequence Objects, while the sequence to Blast against it would be a Simple input article consisting of a single Sequence Object.
There is currently only one form of Secondary article: