[MOBY-dev] Perl API: retrieveObjectDefinition and registerObjectClass call

Pieter Neerincx Pieter.Neerincx at wur.nl
Tue Nov 22 10:49:49 UTC 2005


On 4-Nov-2005, at 10:41 PM, Pieter Neerincx wrote:

>
> On  02Nov2005, at 17:12, Mark Wilkinson wrote:
>
>> I think you're right - that's a much better data structure to be  
>> passing
>> around.
>>
>> This does change the external (perl client) API, right?  :-/
>
> Yep, that's why I'm asking. I have no idea who is currently relying  
> on the retrieveObjectDefinition call and what might break if I  
> change it... So far I have heard no complaints, so I suggest I go  
> ahead and make the change...

One more thing. The retrieveObjectDefinition function lists that it  
returns what you send it when you register an object. In that case it  
makes sense to change the registerObject a.k.a. registerObjectClass  
function as well. Summarising this would mean the following changes  
(changes marked with "->"):

registerObject  a.k.a registerObjectClass

  Usage     :    $REG = $MOBY->registerObject(%args)
  Usage     :    $REG = $MOBY->registerObjectClass(%args)
  Function  :    register a new type of MOBY Object
  Returns   :    MOBY::Registration object
  Args      :    objectType => "the name of the Object"
                 description => "a human-readable description of the  
object"
                 contactEmail => "your at email.address"
                 authURI => "URI of the registrar of this object"

         OLD     Relationships => {
                     relationshipType1 => [
          ->             [Object1, articleName],
          ->             [Object2, articleName]
                     ],
                     relationshipType2 => [
          ->             [Object3, articleName]
                     ]
                  }

         NEW      Relationships => {
                     relationshipType1 => [
          ->             {object      => Object1,
          ->              articleName => ArticleName1},
          ->             {object      => Object2,
          ->              articleName => ArticleName2}
                     ],
          ->         relationshipType2 => [
          ->             {object      => Object3,
          ->              articleName => ArticleName3}
                     ]
                 }

retrieveObjectDefinition

  Usage     : $DEF = $MOBY->retrieveObjectDefinition($objectType[, 
$registry])
  Function  : retrieve the $XML that was used to register an object  
and its relationships
  Returns   : hashref, similar to the hash sent during Object  
registration, plus
              an additional XML hash key that contains the actual XML  
containing
              the object definition as sent by MOBY Central (used for  
a visual
              overview, rather than parsing all of the hash keys)

              objectType => "the name of the Object"
              objectLSID => "urn:lsid:..."
               description => "a human-readable description of the  
object"
               contactEmail => "your at email.address"
              authURI => "URI of the registrar of this object"

         OLD  Relationships => {
                relationshipType1 => [
          ->      [Object1, articleName1, lsid1],
          ->      [Object2, articleName2, lsid2]
                ],
                relationshipType2 => [
          ->      [Object1, articleName3, lsid3]
                ]
              }

         NEW  Relationships => {
                relationshipType1 => [
          ->      {object      => Object1,
          ->       articleName => ArticleName1,
          ->       lsid        => lsid1},
          ->      {object      => Object2,
          ->       articleName => ArticleName2,
          ->       lsid        => lsid2}
                ],
                relationshipType2 => [
          ->      {object      => Object3,
          ->       articleName => ArticleName3,
          ->       lsid        => lsid3}
                ]
              }

              XML => <....XML of object registration.../>

  Args      : objectType =>  the name or LSID URI for an object


I have the necessary changes including those to Frank's tests  
standing by. If I don't receive any complaints during the next days I  
will commit these changes to the CVS on Friday...

Cheers,

Pieter




>
>>
>> Really, what the Perl client code needs is a good laundering.  The
>> CommonSubs.pm module is a total mess after being modified  
>> piecemeal over
>> the past 3 years...
>>
>> I wonder if we shouldn't just start a new module (or modules) that  
>> are
>> named by their domain of function (RegistryIO, OntologyIO, or  
>> something
>> like that) and have all fresh code?  Gradually we could migrate all
>> functionality into these modules.  Client::Central has been around  
>> since
>> the 0.1 prototype of MOBY in 2001 and has never been re-written  
>> top-to-
>> bottom!
>
> That would be a good idea to get cleaner code, but for the time  
> being it's not that bad! It works as advertised and gets my job  
> done :). Try debugging SOAP::Lite and MIME::Parser... those are the  
> ones that really need a complete make-over!
>
>>
>> I'm still waiting to hear about the re-funding attempts for MOBY...
>> fingers crossed!  There will hopefully be a second opportunity  
>> later in
>> the winter, so all is not lost if we fail.
>
> Good luck!
>
> Pieter
>
>> It would be great to have a
>> couple of extra hands dedicated to a complete code re-write
>>
>> M
>>
>>
>>
>>
>> On Wed, 2005-11-02 at 13:44 +0100, Pieter Neerincx wrote:
>>> Hi all,
>>>
>>> Here is a question for those using the Perl API. In
>>>
>>> 	MOBY/Client/Central.pm
>>>
>>> we have a
>>>
>>> 	sub retrieveObjectDefinition
>>>
>>> which calls
>>>
>>> 	sub _ObjectDefinitionPayload {
>>>
>>> This produces an array for the objects, articleNames and lsids for
>>> the relationships of the object whose definition is requested. I'm
>>> wondering why this is an array. Currently I have to rely on the  
>>> order
>>> of elements in this array to figure out which element is the object,
>>> which one is articleName, etc. These are the lines producing the  
>>> array:
>>>
>>> 553     push @{ $relationships{$relationshipType} },
>>> 554              [ $_->toString, $article, $rlsid ];
>>>
>>> Is there any reason why this should be an array? I'd rather not have
>>> to rely on the order of the elements, so are there people who have
>>> any objections when I change this into a hash like in:
>>>
>>>          push @{ $relationships{$relationshipType} },
>>>                   { object      => $_->toString,
>>>                     articleName => $article,
>>>                     lsid        => $rlsid };
>>>
>>> Cheers,
>>>
>>> Pieter
>>>
>>>
>>>
>>>
>>> Wageningen University and Research centre (WUR)
>>> Laboratory of Bioinformatics
>>> Transitorium (building 312) room 1034
>>> Dreijenlaan 3
>>> 6703 HA Wageningen
>>> The Netherlands
>>> phone: 0317-483 060
>>> fax: 0317-483 584
>>> mobile: 06-143 66 783
>>> pieter.neerincx at wur.nl
>>>
>>>
>>>
>>> _______________________________________________
>>> MOBY-dev mailing list
>>> MOBY-dev at biomoby.org
>>> http://www.biomoby.org/mailman/listinfo/moby-dev
>> -- 
>> "Ontologists do it with the edges!"
>>
>> Mark Wilkinson
>> Asst. Professor
>> Dept. of Medical Genetics
>> University of British Columbia
>> PI in Bioinformatics
>> iCAPTURE Centre
>> St. Paul's Hospital
>> Rm. 166, 1081 Burrard St.
>> Vancouver, BC, V6Z 1Y6
>> tel: 604 682 2344 x62129
>> fax: 604 806 9274
>>
>> _______________________________________________
>> MOBY-dev mailing list
>> MOBY-dev at biomoby.org
>> http://www.biomoby.org/mailman/listinfo/moby-dev
>
> Wageningen University and Research centre (WUR)
> Laboratory of Bioinformatics
> Transitorium (building 312) room 1038
> Dreijenlaan 3
> 6703 HA Wageningen
> phone: 0317-484 706
> fax: 0317-483 584
> mobile: 06-143 66 783
> pieter.neerincx at wur.nl
>
> _______________________________________________
> MOBY-dev mailing list
> MOBY-dev at biomoby.org
> http://www.biomoby.org/mailman/listinfo/moby-dev


Wageningen University and Research centre (WUR)
Laboratory of Bioinformatics
Transitorium (building 312) room 1034
Dreijenlaan 3
6703 HA Wageningen
The Netherlands
phone: 0317-483 060
fax: 0317-483 584
mobile: 06-143 66 783
pieter.neerincx at wur.nl






More information about the MOBY-dev mailing list