[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Apr 9 15:57:46 UTC 2010


gordonp
Fri Apr  9 11:57:46 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util
In directory dev.open-bio.org:/tmp/cvs-serv1836/src/main/ca/ucalgary/seahawk/util

Modified Files:
	DataUtils.java 
Log Message:
Added support for case sensitive searches, and 'previous input' conditional service execution
moby-live/Java/src/main/ca/ucalgary/seahawk/util DataUtils.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/DataUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/DataUtils.java	2010/03/29 19:58:17	1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/DataUtils.java	2010/04/09 15:57:46	1.2
@@ -117,7 +117,7 @@
 		    if(newFilter != null){
 			XPathOption xsel = newFilter.getSelectedXPath();
 			newProvenanceData += "\t"+newFilter.getFilterRegex()+
-			    "\t"+xsel.getXPath()+"\t"+xsel.getDesc();
+			    "\t"+xsel.getXPath()+"\t"+xsel.getDesc()+"\t"+newFilter.getCaseSensitivity();
 		    }
 		    pi.setData(attr_val[0]+"=\""+newProvenanceData+"\"");
 		}
@@ -300,7 +300,7 @@
 	return temp.toURI().toURL();
     }
 
-    private static URL getInputURL(Document responseDom) throws Exception{
+    public static URL getInputURL(Document responseDom) throws Exception{
 	String inputAddr = getSeahawkAttrFromDoc(responseDom, SERVICEINPUT_ATTR);
 	if(inputAddr == null){
 	    return null;
@@ -315,7 +315,11 @@
 	}
     }
 
-    private static Document getInputDoc(Document responseDom) throws Exception{
+    public static Document getInputDoc(Document responseDom) throws Exception{
+	URL inputURL = getInputURL(responseDom);
+	if(inputURL == null){
+	    return null;
+	}
 	try{
 	    return docBuilder.parse(getInputURL(responseDom).openStream());
 	} catch(org.xml.sax.SAXException saxe){
@@ -332,6 +336,9 @@
      */
     public static MobyDataJob getInputSample(Document responseDom, Registry registry) throws Exception{
 	Document inputDoc = getInputDoc(responseDom);
+	if(inputDoc == null){
+	    return null;
+	}
 	MobyContentInstance inputPayload = MobyDataUtils.fromXMLDocument(inputDoc.getDocumentElement(),
 									 registry);
 	if(inputPayload == null || inputPayload.size() == 0){
@@ -633,12 +640,30 @@
 	
 	if(fs != null && fs.getFilterRegex().length() > 0){
 	    XPathOption xsel = fs.getSelectedXPath();
-	    userData.append("\t"+fs.getFilterRegex()+"\t"+xsel.getXPath()+"\t"+xsel.getDesc());
+	    userData.append("\t"+fs.getFilterRegex()+"\t"+xsel.getXPath()+"\t"+xsel.getDesc()+"\t"+fs.getCaseSensitivity());
 	}
 	mobyData.setUserData(userData.toString());
     }
 
     /**
+     * Record a condition for data acceptability, 
+     * another service call with an output filter criteria. i.e. records if(f1(x) matches f1's output filter){...}
+     */
+    public static void addUserData(MobyDataInstance mdi, URL conditionalOutputURL, FilterSearch filter){
+	String filterSpec = "";
+	if(filter != null && filter.getFilterRegex().length() > 0){
+	    XPathOption xsel = filter.getSelectedXPath();
+	    filterSpec = "\t"+filter.getFilterRegex()+"\t"+xsel.getXPath()+"\t"+xsel.getDesc()+"\t"+filter.getCaseSensitivity();
+	}
+	if(mdi.getUserData() != null){
+	    mdi.setUserData(mdi.getUserData().toString()+"\t"+conditionalOutputURL+filterSpec);
+	}
+	else{
+	    mdi.setUserData(conditionalOutputURL.toString()+filterSpec);
+	}
+    }
+
+    /**
      * Retrieves processing instructions embedded in Moby XML docs if they have the for <?seahawk attr="val"?>
      */
     public static String getSeahawkAttrFromDoc(URL docURL, String attrName) throws Exception{ 




More information about the MOBY-guts mailing list