[MOBY-dev] creating primary inputs from scratch

Paul Gordon gordonp at ucalgary.ca
Fri Feb 20 16:39:52 UTC 2009


Hi Michael,

Alas, MobyRequest does not work with the compiled datatypes of MoSeS, it 
uses the original Moby data type framework extending 
org.biomoby.shared.MobyData. 
The way to build you object is listed below. Please not e that you'll 
need to do a CVS update.  I just found and fixed a bug when the varargs 
c-tor is called with a null namespace.

import org.biomoby.client.*;
import org.biomoby.shared.*;
import org.biomoby.shared.data.*;

public class HelloMOBY2{
    public static void main(String[] args) throws Exception{
        // Find the service
        Central central = new 
CentralImpl("http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl");
        MobyService templateService = new 
MobyService("MassBank_QSearch_Test");
        MobyService[] validServices = central.findService(templateService);
        MobyRequest request = new MobyRequest(central);
        request.setService(validServices[0]);

        // Create the data
        MobyDataType MSPeakRelType = central.getDataType("MSPeakRel");
        MobyDataComposite peak1 = new MobyDataComposite(MSPeakRelType, 
null, null,  //type, ns, id
                                                        "mz", "153.3", 
"relInt", "316"); //members
        MobyDataComposite peak2 = new MobyDataComposite(MSPeakRelType, 
null, null,
                                                        "mz", "273.069", 
"relInt", "999");
        MobyDataComposite msList = new 
MobyDataComposite(central.getDataType("MSPeakRelList"),
                                                         "test", 
(String) null, null);
        msList.put("MSPeakRel", peak1);
        msList.put("MSPeakRel", peak2);
        request.setInput(msList);

        // Run the job and print the results
        MobyContentInstance contents = request.invokeService();
        MobyDataUtils.toXMLDocument(System.out, contents);
    }
}

Michael Gerlich wrote:
> Hi all,
>
> I want to create a simple JUnit test case that tests if all services 
> we're offering (in both default and testing registry) are working. 
> I'am stuck in creating primary inputs for datatypes other than Object, 
> especially ArrayString, ArrayFloat and MSPeakRelList - all defined in 
> both registries.
>
> I modified this example
> http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/SimpleClient.html#helloWorld 
>
>
> An MSPeakRelList is a list/array of MSPeakRel members. MSPeakRel has 
> two children mz and relInt, defining a peak.
>
> Here is what I do in order to create such a datatype as input for a 
> service:
>
> MSPeakRelList msList = new MSPeakRelList();
>       MSPeakRel ms1 = new MSPeakRel();
> ms1.set_mz(153.3);
> ms1.set_relInt(316);
>      MSPeakRel ms2 = new MSPeakRel();
> ms2.set_mz(273.069);
> ms2.set_relInt(999);
>    MSPeakRel[] peaks = new MSPeakRel[2];
> for (int i = 0; i < peaks.length; i++) {
>      peaks[i] = new MSPeakRel();
> }
> peaks[0] = ms1;
> peaks[1] = ms2;
> msList.set_MSPeakRel(peaks);
>
>
> The simple client uses the MobyRequest function setInput(). It's 
> arguments are either of type MobyContentInstance or MobyDataInstance.
> Now what am I supposed to do to correctly set msList as primary input 
> to a service (MassBank_QSearch_Test, testing reg).
>
> BTW, it has gotten quiet on the mailing lists...
>
>
> Kind regards,
>
> Michael
> _______________________________________________
> MOBY-dev mailing list
> MOBY-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/moby-dev
>
>



More information about the MOBY-dev mailing list