[MOBY-dev] Datatype instantiation in jMoby

Ola Spjuth ola.spjuth at farmbio.uu.se
Tue Oct 16 08:06:23 UTC 2007


On Oct 16, 2007, at 08:45 , groscurt at mpiz-koeln.mpg.de wrote:

> Hi Ola,
>
> for your first question,
>
> MobyDataType.getDataType("DATATYPE");
>
> should retrieve the datataype (check the API for this method).

Great, thanks. Must have missed to check the static methods.

> At this morning, I dont have an answer for question two.
>
> Question three:
> of course services can consume a primtive type - like MobyObject or
> MobyString etc. So I would not always use the composite and just  
> what the
> service actually require

Yes, but would it be acceptable to wrap that MobyObject or MobyString  
in a MobyComposite and it would still work?

Thanks,

    .../Ola


>
>
> If somethings wrong please correct someone..
>
> andreas
>
>
>
>> Hi,
>>
>> In jMoby, I look up a service, and get the first primaryInputs
>> DataType by
>>
>> 	service.getPrimaryData()[0].getDataType();
>>
>> This gives me a Datatype with correct name and LSID, but nothing more
>> (no children).
>>
>> If I do the following:
>>
>> 	String dataTypeName=service.getPrimaryInputs()[i].getDataType
>> ().getName();
>> 	primaryData[i] = new MobyDataComposite(dataTypeName);
>> 	MobyDataType dataType=primaryData[i].getDataType();
>>
>> Then jMoby reads the ontology and I get a dataType that has relations
>> (children). How can I achieve this without having to instantiate a
>> bogus MobyDataComposite? What is the purpose of this behaviour? Would
>> something like this be an acceptable API-request:
>>
>> 	service.getPrimaryData()[0].getDataType();
>> 	service.getPrimaryData()[0].populateFromOntology();
>>
>>
>> Next question:
>> I'd like to create MobyDataObjects that I can later populate with
>> values.
>>
>> The line
>>
>> 	MobyDataObject obj = MobyDataObject.createInstanceFromString
>> (childTypeName,"0");
>>
>> works fine, but I'd like to do is create an object with no values,
>> like the following:
>>
>> 			for(MobyRelationship child: dataType.getAllChildren()){
>> 				String childName = child.getName();
>> 				String childTypeName = child.getDataTypeName();
>> 				if(PrimitiveTypes.isPrimitive(childTypeName)){
>> 						MobyDataObject obj = new MobyDataObject(childTypeName);
>> 						primaryComposites[i].put(childName,obj);
>> 				}
>> 			}
>>
>> Is it wrong to instantiate the values first and fill them at a later
>> point?
>>
>> Last question:
>> Can a service take only one primitive DataType as primaryInput or
>> does it always require a MobyDataComposite? Is it an error in that
>> case to supply a MobyDataComposite with only one primitive
>> MobyDataObject in it (i.e. is it OK to always send a
>> MobyDataComposite as PrimaryInput to a service)?
>>
>> Thanks,
>>
>>     .../Ola
>>
>>
>> _______________________________________________
>> MOBY-dev mailing list
>> MOBY-dev at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/moby-dev
>>
>
>
> _______________________________________________
> 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