[MOBY-guts] biomoby commit

Dmitry Repchevski drepchevski at dev.open-bio.org
Fri Oct 16 12:18:47 UTC 2009


drepchevski
Fri Oct 16 08:18:46 EDT 2009
Update of /home/repository/moby/moby-live/Java/docs
In directory dev.open-bio.org:/tmp/cvs-serv24067

Modified Files:
	inb_moby_core.html 
Log Message:
put the ontology generator applet inside
moby-live/Java/docs inb_moby_core.html,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/inb_moby_core.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/docs/inb_moby_core.html	2009/09/21 16:31:17	1.2
+++ /home/repository/moby/moby-live/Java/docs/inb_moby_core.html	2009/10/16 12:18:46	1.3
@@ -64,6 +64,7 @@
     }
 
     .code {
+      white-space: pre;
       vertical-align: top;
       color: #000099;
       font-size: 10pt;
@@ -131,6 +132,50 @@
     </table>
   </p>
 
+  <h2> Generating JAXB-annotated ontology classes </h2>
+
+  <p>
+    Even MobyCore may work without generated ontology classes, they facilitate a development.
+    Generated classes are nothing more than JAXB annotated beans with properties.
+
+  </p>
+  
+  <div style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px;">
+    <div style="float: left; width: 350px; margin-right: 50px">      
+      <applet width = "350" height = "350" code = "org.inb.biomoby.generator.gui.Main">
+        <param name = "jnlp_href" value = "http://inb.bsc.es/applications/java/mobygenerator/inb_generator_applet.jnlp"/>
+      </applet>
+    </div>
+
+    
+      Here is an example of generated datatype class:
+    
+       
+    <div class="code" style="margin-left: 400px; font-size: 8pt;">
+ at XmlRootElement(name="WeightedAminoAcidSequences")
+ at XmlType(name="WeightedAminoAcidSequences")
+public class WeightedAminoAcidSequences extends AminoAcidSequence implements Serializable {
+    public List&lt;? extends AminoAcidSequence&gt; getAminoAcidSequence() {
+        return getAttributes("AminoAcidSequence");
+    }
+
+    public void addAminoAcidSequence(AminoAcidSequence aminoAcidSequence) {
+        putAttribute("AminoAcidSequence", aminoAcidSequence);
+    }
+
+    public WeightedObject getWeightedObject() {
+        return getAttribute("WeightedObject");
+    }
+
+    public void setWeightedObject(WeightedObject weightedObject) {
+        putAttribute("WeightedObject", weightedObject);
+    }
+}
+    </div>
+
+    <br style="clear:both;"/>
+  </div>
+  
   <h2> Executing synchronous BioMoby services </h2>
 
   <p>
@@ -138,12 +183,10 @@
     This is done by creating a MobyMessage object:
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 MobyObject object = new MobyObject("P00807", "UniProt");
 MobySimple simple = new MobySimple(object, "id");        
 MobyData data = new MobyData(simple, "sip_1");
 MobyMessage request = new MobyMessage(data);
-</pre>
     </div>
   </p>
 
@@ -163,10 +206,8 @@
     Now we can create a MobyDispatch object and execute a service.
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 MobyDispatch dispatch = new MobyDispatch(service);
 MobyMessage response = dispatch.invoke(request);
-</pre>
     </div>
   </p>
 
@@ -181,9 +222,7 @@
     not have AminoAcidSequence class generated. In this case we would have a AnyMobyObject instead of unknown to us AminoAcidSequence.
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 MobyString string = (MobyString) any.getAttribute("SequenceString");
-</pre>
     </div>
   </p>
 
@@ -192,7 +231,6 @@
     <span class="highlight">MobySimple</span> may contain either a primitive type or a complex one, so we have to check. Here is a simple method that traverse a given element:
      
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 public void traverse(AbstractMobyObject object) throws JAXBException
 {
   System.out.println(MobyMessageContext.getMobyName(object) + " " + object.getArticleName());
@@ -206,8 +244,7 @@
        traverse(o);
      }
   }
-}
-</pre>      
+}     
     </div>
   </p>
 
@@ -219,11 +256,9 @@
     <span class="highlight">AnyMobyObject</span> can also be used to setup a datatype dynamically.
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 AnyMobyObject any = new AnyMobyObject("AminoAcidSequece");
 any.putAttribute("SequenceString", new MobyString("ATCG"));
 any.putAttribute("Length", new MobyInteger(4));
-</pre>
     </div>
   </p>
 
@@ -235,7 +270,6 @@
     Here is an example of parsing a <span class="highlight">MobyMessage</span> response:
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 MobyMessage response = dispatch.invoke(request);
 
 if (response.hasExceptions())
@@ -256,7 +290,7 @@
 
    for (MobyDataElement element : elements)
    {
-     if (element instanceof Mobysimple)
+     if (element instanceof MobySimple)
      {
        MobySimple simple = (MobySimple)element;
        AbstractMobyObject object = simple.getObject();
@@ -292,8 +326,7 @@
        throw new Exception(); // expected MobySimple
      }
    }
-}
-</pre>    
+}  
     </div>
   </p>
 
@@ -306,7 +339,6 @@
     The rest of the things are pretty the same as for synchronous invocation:
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 // AminoAcidSequence sequence = new AminoAcidSequence();
 // sequence.setSequenceString(new MobyString("ATCG")):
 // sequence.setLength(new MobyInteger(4));
@@ -326,7 +358,6 @@
 MobyDispatch dispatch = new MobyDispatch(service);
 
 MobyWSRFResource wsrf = dispatch.invokeAsync(request);
-</pre>
     </div>
   </p>
 
@@ -334,7 +365,6 @@
     The result object is an WSRF resource through which we can poll to check our execution status:
 
     <div class="code" style="margin-left: 40px; margin-right: 40px; padding: 5px 5px 5px 5px">
-<pre>
 while(true)
 {
   AnalysisEvent lsae = wsrf.getResourcePropertyStatus("sip_1");
@@ -362,7 +392,6 @@
    // actually must be an error...
    break;
 }
-</pre>
     </div>
   </p>
 




More information about the MOBY-guts mailing list