[MOBY-dev] a question and a comment about the new Objectinheritance

Yan Wong ywong at infobiogen.fr
Thu May 26 08:19:58 UTC 2005


mark wilkinson wrote:

>Good idea!  
>
>The reason they weren't implemented initially was simple lack of need.
>
>M
>
>-----Original Message-----
>From: Benjamin Good <bmg at sfu.ca>
>Date: Wed, 25 May 2005 21:03:12 
>To:Core developer announcements <moby-dev at portal.open-bio.org>,       markw at illuminae.com
>Cc:mobydev <moby-dev at biomoby.org>
>Subject: Re: [MOBY-dev] a question and a comment about the new Object
>	inheritance
>
>It might actually make sense to implement a few more primitives to 
>facilitate WSDL interoperability.  Below see a set of standard 
>primitives from the Axis user-guide.  (Primitives being the things in 
>the xml message that easily bind to existing Java classes).  I wasn't 
>around when you picked the ones you did, so maybe there are reasons not 
>to include all of these?
>
>Standard mappings from WSDL to Java
>xsd:base64Binary -> byte[]
>xsd:boolean -> boolean
>xsd:byte -> byte
>xsd:dateTime -> java.util.Calendar
>xsd:decimal -> java.math.BigDecimal
>xsd:double -> double
>xsd:float -> float
>xsd:hexBinary -> byte[]
>xsd:int -> int
>xsd:integer -> java.math.BigInteger
>xsd:long -> long
>xsd:QName -> javax.xml.namespace.QName
>xsd:short -> short
>xsd:string -> java.lang.String
>
>-ben
>
>
>
>On May 25, 2005, at 12:32 PM, Mark Wilkinson wrote:
>
>  
>
>>Hi all,
>>
>>So, I just went through and updated all of my services to follow the 
>>new
>>Object inheritance system. It took 5 minutes :-)  Turns out that most 
>>of
>>my services only output "Object" anyway, so they don't need any work,
>>and the ones that output other things like DNASequence and GO_Term were
>>already following the proposed API anyway, so... only TWO of my 
>>services
>>actually were affected by the proposed change!  I hope that others have
>>the same experience.
>>
>>I did, however, notice a potential hiccup that we didn't foresee at the
>>meeting.  At the moment, binary data in MOBY is passed as a child of
>>base-64-encoded, which is a child of String.  Under the new system, we
>>can't have children of String, so do we then need a new primitive class
>>for binary data?  I think it still needs to be b64 encoded, but it 
>>seems
>>to me that it does need its own primitive now.
>>
>>opinions anyone?
>>
>>M
>>
>>
>>
>>_______________________________________________
>>MOBY-dev mailing list
>>MOBY-dev at biomoby.org
>>http://www.biomoby.org/mailman/listinfo/moby-dev
>>
>>
>>    
>>
>http://bioinfo.icapture.ubc.ca/bgood
>_______________________________________________
>MOBY-dev mailing list
>MOBY-dev at biomoby.org
>http://www.biomoby.org/mailman/listinfo/moby-dev
>
>--
>Mark Wilkinson
>...on the road!
>_______________________________________________
>MOBY-dev mailing list
>MOBY-dev at biomoby.org
>http://www.biomoby.org/mailman/listinfo/moby-dev
>
>  
>
Some remarks about Primitives and ontology:

First: Do you think that <Integer>FF</Integer> is an integer???

If you say no, then you are wrong because FF is a valid hexadecimal 
REPRESENTATION of an integer number: 255

Reason: The client give the meaning for a message. Forany ordinary human 
who achieved child school FF is not an integer but for a computer IT CAN 
BE!  Of course it is a bit extreme as an example. We all agree, by 
convention, that integers are written with Arab figures.

In France (I don't know how it is in the rest of Europe) floating 
numbers are described as 3,1415 instead of 3.1415 (comma instead of 
point)  In this case also, we agree by convention, that floating numbers 
use the american representation (integer part point fractional part etc..)

Did you know that a Unicode string was inherited from a string ??? to 
display exotic but useful characters that does not exist in English (I 
don't speak of the strange french characters but also for spanish german 
etc..)!) and why not Bytes ??? after all a string is an array of bytes 
so bytes should be the actual primitive (String is an object has Byte)  
etc.. etc.. In java by default, all strings are unicode strings (AFAIK) 
but not all language adopted this convention.

Primitives are computer related problems. I don't think it is wise to 
implement primitives inside the ontology because it is not in its place!

Primitives were intended to solve problems of performance in language 
like Java (just see the superb mess between an Integer and an int both 
speaks about the same mathematical object everybody knows BUT for 
performance issues, it has been implemented this way poisoning life of 
millions software enginner and writers - you don't find that kind of 
issue in other languages -)

As I understand from Moby and the ontology of Moby, we should not mix 
computer related problems with "Business logic"  related problems.

did you know that in ADA (for strict type checking and overflow control) 
you can actually subclass an integer in order to define the precision 
you want in your numbers and it doesn't violate (in any case) the object 
programming paragdim.

For example:

subtype Natural is Integer range 0.. Integer'Last;
subtype Positive is Integer range 1.. Integer'Last;
(I hope no one will have a heart attack on seeing these two lines :p)

So if you want to know if an Integer is an integer CAST it (that what I 
do in Python (for the object mapping with bioMoby XML) ) for example 
with java use Integer.parse(etc) for Python use int(string) etc.. etc..

These instructions tells the program that the content of the XML is an 
integer (according to your language convention)

I think I have been clear and hope I didn't bash anyone too hard :p




More information about the MOBY-dev mailing list