[MOBY-l] empty responses: Collection or Simple? How to match responses to queries?

Frank Gibbons fgibbons at hms.harvard.edu
Tue May 11 15:49:09 UTC 2004


MOBYers,

I'm working on some services, trying to figure out how to provide robust 
responses, and then parse them robustly. In particular, there may be a lot 
of valid queries, for which there an empty response. In theory (according 
to the API), I should return a response for every query, even if it's 
empty. The API will not allow me to return an empty collectionResponse, it 
requires me to use simpleResponse. My problem then is, how do I match the 
queries with the responses? If all the responses are of the same type, I 
can assume the array order corresponds to the ordering using queryID (is 
this correct?), and match them up like that. If they're of different types, 
I can pull out the collections and simples using getResponseArticles, which 
is fine as far as it goes. But how do I match the queries to their 
respective responses, given that the queryIDs live in the mobyData tags, 
which have already been stripped out by the time I get the 
Collections/Simples?

On a personal level, the easiest thing for me to do would be to use MOBY to 
handle communication, but just parse the XML response completely on my own 
(using XML::DOM, but none of MOBY::Client::CommonSubs). I know what it 
looks like, I know what I need to know in order to parse the response, and 
I know what problems to look out for. But the strength of an API lies in 
the use of a common way of doing things, so I'd like to go with that if I 
can. It's just not obvious to me how I should do that. Anyone have ideas?

Thanks,

-Frank

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555       Fax: 
617-432-3557       http://llama.med.harvard.edu/~fgibbons 




More information about the moby-l mailing list