[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Fri Jul 29 22:17:40 UTC 2005


kawas
Fri Jul 29 18:17:39 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier
In directory pub.open-bio.org:/tmp/cvs-serv12281/org/biomoby/registry/rdfagent/verifier

Modified Files:
	ServiceDescrParser.java 
Log Message:
fixed some bugs that were due to the scope of certain variables.
formatted the code.
fixed a bug that ignored article names of collections.
fixed a bug that over wrote preexisting simples in collections with new ones even though both should exist.
fixed a bug that caused pre-existing ns to be associated with simples without ns.
...

moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier ServiceDescrParser.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.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/registry/rdfagent/verifier/ServiceDescrParser.java	2005/07/28 15:26:13	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.java	2005/07/29 22:17:39	1.8
@@ -78,20 +78,16 @@
             servSign = getServSignature(resource);
 
             if (!servSign.isEmpty()) { // a valid MOBY RDF
-                servName = servSign.get("servicename").toString();
+                servName = servSign.get("servicename").toString()+"";
                 auth_URI = servSign.get("authURI").toString();
                 resources.addElement(servName);
 
                 Hashtable servInp = new Hashtable();
-                servInp = getInput(resource);
+                servInp = getInput(resource); //TODO modify collections and simples like getOutput();
                 Hashtable servOut = new Hashtable();
                 servOut = getOutput(resource);
 
-                for (int i = 0; i < ver.length; i++) { // a clearance of the
-                    // array ver[]
-                    ver[i] = 0;
-
-                }
+                ver = new int[]{0,0,0,0,0,0,0,0};
                 if (servInp.containsValue("error")
                         | servOut.containsValue("error")) {
                     servError += 1;
@@ -302,7 +298,7 @@
         Hashtable input = new Hashtable();
 
         Resource si = servDescrMd.getResource(resource);
-
+        if (si.hasProperty(MP.consumes))
         try {
             Resource consumes = si.getRequiredProperty(MP.consumes)
                     .getResource();
@@ -375,7 +371,7 @@
                             // to Input
                             sin += 1;
                             Enumeration num = siminp.keys();
-
+                            siminp= new Hashtable();
                         }
                     } else if (type.equals(MP.Collection)
                             | type.equals(RDF.Bag)) {
@@ -383,9 +379,9 @@
                         // l3Res.hasProperty(RDF.li(1))){
                         if (l3Res.hasProperty(RDF.li(1))) {
                             StmtIterator p34iter = l3Res.listProperties();
-                            if (l3Res.hasProperty(MP.article_name)) {
+                            if (l3Res.hasProperty(MP.articleName)) {
                                 String col_artName = l3Res.getProperty(
-                                        MP.article_name).getObject().toString();
+                                        MP.articleName).getObject().toString();
                                 String[] rezNode = col_artName.split(":http:");
                                 col_artName = rezNode[0];
                                 colinp.put("col_articleName", col_artName);
@@ -449,13 +445,18 @@
                                                 String lsid_nsp = switchURItoLSID(l5Node
                                                         .toString());
                                                 colinp.put(name, lsid_nsp);
-                                            } else {
+                                            } else if (name.equals("articleName")) {
+                                                colinp.put(name, l5Node.getName());
+                                            }else {
                                                 colinp.put(name, l5Node);
                                             }
                                         }
                                         input.put("colinp" + cin, colinp);
                                         cin += 1;
                                         Enumeration num = colinp.keys();
+                                        String col_name = (String)colinp.get("col_articleName");
+                                        colinp = new Hashtable();
+                                        colinp.put("col_articleName", col_name);
                                     }
                                 }
 
@@ -529,7 +530,7 @@
                 input.put("input", "error");
             }
         } catch (Exception e) {
-            Log.warning("Failed:" + e);
+            Log.warning("Failed (ServiceDescrParser.java - getInput): " + e);
         }
         //        }
         //System.out.println("input= "+input);
@@ -558,8 +559,9 @@
         Hashtable output = new Hashtable();
 
         Resource si = servDescrMd.getResource(resource);
-
+        if (si.hasProperty(MP.produces))
         try {
+            
             Resource consumes = si.getRequiredProperty(MP.produces)
                     .getResource();
             StmtIterator p23iter = consumes.listProperties();
@@ -628,7 +630,7 @@
                             // to Output
                             so += 1;
                             Enumeration num = simout.keys();
-
+                            simout = new Hashtable();
                         }
                     }
 
@@ -636,12 +638,12 @@
                         //						 if (l3Res.hasProperty(RDF.type,RDF.Bag) &&
                         // l3Res.hasProperty(RDF.li(1))){
 
-                        if (l3Res.hasProperty(RDF.li(1))) {
+                        if (l3Res.hasProperty(RDF.li(1))) { //TODO is this right? probably should iterate through the anon nodes, breaking when the hasProperty() fails.
                             StmtIterator p34iter = l3Res.listProperties();
 
-                            if (l3Res.hasProperty(MP.article_name)) {
+                            if (l3Res.hasProperty(MP.articleName)) {
                                 String col_artName = l3Res.getProperty(
-                                        MP.article_name).getObject().toString();
+                                        MP.articleName).getObject().toString();
                                 String[] rezNode = col_artName.split(":http:");
                                 col_artName = rezNode[0];
                                 colout.put("col_articleName", col_artName);
@@ -705,13 +707,19 @@
                                                 String lsid_nsp = switchURItoLSID(l5Node
                                                         .toString());
                                                 colout.put(name, lsid_nsp);
-                                            } else {
+                                            } else if (name.equals("articleName")) {
+                                                colout.put(name, rezNode[0]);
+                                            }else {
                                                 colout.put(name, l5Node);
                                             }
                                         }
+                                        //TODO BUG here. colout should be 'new' and not recycled
                                         output.put("colout" + co, colout);
                                         co += 1;
                                         Enumeration num = colout.keys();
+                                        String col_name = (String)colout.get("col_articleName");
+                                        colout = new Hashtable();
+                                        colout.put("col_articleName", col_name);
                                     }
                                 }
 
@@ -732,7 +740,7 @@
                 output.put("output", "error");
             }
         } catch (Exception e) {
-            Log.warning("Failed:" + e);
+            Log.warning("Failed (ServiceDescrParser.java-getOutput): " + e);
         }
         //System.out.println("output = "+output);
         return output;
@@ -845,6 +853,7 @@
         return res;
     }
 
+    //TODO - need to fix this to make it portable
     public String switchURItoLSID(String uri) {
         String lsid = "";
 




More information about the MOBY-guts mailing list