3 my $TMP_DIR = '/tmp/';#Where your temporary files will be written
4 my $XSLTPROC = '/usr/bin/xsltproc';#Where your xsltproc binary is located
5 my $XSL_SHEET = '/bioinfo/www/bioinfo/services/biomoby/cgi-bin/Services/LIPM/lib/parseMobyMessage.xsl';#Where your xsltproc style-sheet is located
7 #$Id: MOBYXSLT.pm,v 1.4 2005/12/15 14:03:41 carrere Exp $
13 MOBYXSLT - CommonSubs using XSLT
17 Because huge XML message parsing with XML::Dom take too much time.
18 xsltproc is a binary very very efficient to parse huge files.
23 Globals variables are defined in this package:
25 my $TMP_DIR = '/tmp/'; #Where your temporary files will be written
26 my $XSLTPROC = '/usr/bin/xsltproc'; #Where your xsltproc binary is located
27 my $XSL_SHEET = './parseMobyMessage.xsl'; #Where your xsltproc style-sheet is located
35 my ($caller, $message) = (@_);
39 my $service_name = 'MonWebservice';
42 my ($service_notes,$ra_queries) = MOBYXSLT::getInputs($message); #Message Parsing
44 foreach my $query (@{$ra_queries})
46 my $query_id = MOBYXSLT::getInputID($query);#Retrieve Query ID
47 my @a_input_articles = MOBYXSLT::getArticles($query);#Retrieve articles
49 my ($fasta_sequences, $fasta_namespace, $fasta_id) = ('','','');
51 foreach my $input_article (@a_input_articles)
53 my ($article_name, $article) = @{$input_article};
55 if (MOBYXSLT::isSimpleArticle($article))
57 my $object_type = MOBYXSLT::getObjectType($article);
59 if (IsTheCorrectType($object_type))
61 $fasta_sequences = MOBYXSLT::getObjectContent($article);
62 $fasta_namespace = MOBYXSLT::getObjectNamespace($article);
63 $fasta_id = MOBYXSLT::getObjectId($article);
66 elsif (MOBYXSLT::isCollectionArticle($article))
70 elsif (MOBYXSLT::isSecondaryArticle($article))
72 my ($param_name,$param_value) = MOBYXSLT::getParameter($article);#Retrieve parameters
77 #What you want to do with your data
92 $moby_response .= MOBYXSLT::simpleResponse("<$output_object_type1>$out_data</$output_object_type1>", $output_article_name1, $query_id);
96 return SOAP::Data->type(
97 'base64' => (MOBYXSLT::responseHeader(-authority => $auth_uri, -note => "Documentation about $service_name at $url_doc"))
99 . MOBYXSLT::responseFooter());
105 my $TMP_DIR = '/tmp/'; #Where your temporary files will be written
106 my $XSLTPROC = '/usr/bin/xsltproc'; #Where your xsltproc binary is located
107 my $XSL_SHEET = './parseMobyMessage.xsl'; #Where your xsltproc style-sheet is located
112 Note: many functions have same names as those from MOBY::CommonSubs
120 =head2 function getInputs
123 Usage : my ($servicenotes, $ra_queries) = getInputs($moby_message)
125 Function : Parse Moby message and build Perl structures to access
126 for each query to their articles and objects.
127 Returns : $servicenotes: Notes returned by service provider
128 $ra_queries: ARRAYREF of all queries analysed in MOBY message
129 Args : $moby_message: MOBY XML message
130 Globals : $XSLTPROC: /path/to/xsltproc binary
131 $XSL_SHEET: XSL Sheet for MobyMessage Parsing
138 my ($moby_message) = (@_);
140 my $tmp_file = 'MOBYXSLT' . $$ . $^T
;
141 my $header_with_ns = "<moby:MOBY xmlns:moby='http://www.biomoby.org/moby' ";
143 $moby_message =~ s/xmlns:moby/xmlns:moby2/;
145 $moby_message =~ s/<moby:MOBY/$header_with_ns/;
147 open(TMP
, ">$TMP_DIR$tmp_file") || confess
("$! :$TMP_DIR$tmp_file");
148 print TMP
$moby_message;
151 my $parsed_message = `$XSLTPROC $XSL_SHEET $TMP_DIR$tmp_file`;
153 # open (PARSED, ">$TMP_DIR$tmp_file" . ".xsl");
154 # print PARSED "$XSLTPROC $XSL_SHEET $TMP_DIR$tmp_file\n\n\n";
155 # print PARSED "$parsed_message";
158 my $servicenotes = '';
161 my $servicenotes_tag = '#XSL_LIPM_MOBYPARSER_SERVICENOTES#';
163 if ($parsed_message =~ /$servicenotes_tag(.+)$servicenotes_tag/)
165 ($servicenotes) = ($parsed_message =~ /$servicenotes_tag(.+)$servicenotes_tag/);
168 my $mobydata_tag = '#XSL_LIPM_MOBYPARSER_DATA_START#';
169 my ($header, @a_mobydata_blocs) = split($mobydata_tag, $parsed_message);
173 foreach my $mobydata_bloc (@a_mobydata_blocs)
176 my $queryid_tag = '#XSL_LIPM_MOBYPARSER_QUERYID#';
177 my ($queryid) = ($mobydata_bloc =~ /$queryid_tag(.+)$queryid_tag/);
179 my $article_start_tag = '#XSL_LIPM_MOBYPARSER_ARTICLE_START#';
180 my ($header_article, @a_article_blocs) = split($article_start_tag, $mobydata_bloc);
182 my @a_input_articles = ();
184 foreach my $article_bloc (@a_article_blocs)
186 my $articlename_tag = '#XSL_LIPM_MOBYPARSER_ARTICLENAME#';
187 my ($articlename) = ($article_bloc =~ /$articlename_tag(.+)$articlename_tag/);
189 my $articletype_tag = '#XSL_LIPM_MOBYPARSER_ARTICLETYPE#';
190 my ($articletype) = ($article_bloc =~ /$articletype_tag(.+)$articletype_tag/);
191 $articletype =~ s/^moby://;
193 my $simple_start_tag = '#XSL_LIPM_MOBYPARSER_SIMPLE_START#';
195 my $article_objects = '';
196 if (_IsCollection
($articletype))
198 my ($header_collec, @a_simple_blocs) = split($simple_start_tag, $article_bloc);
199 my @a_simple_objects = ();
200 foreach my $simple_bloc (@a_simple_blocs)
202 my $rh_simple = _AnalyseSimple
($simple_bloc);
203 push(@a_simple_objects, $rh_simple);
205 $article_objects = \
@a_simple_objects;
207 elsif (_IsSimple
($articletype))
209 my ($header_collec, $simple_bloc) = split($simple_start_tag, $article_bloc);
210 $article_objects = _AnalyseSimple
($simple_bloc);
212 elsif (_IsSecondary
($articletype))
215 my $secondary_start = '#XSL_LIPM_MOBYPARSER_SECONDARY_START#';
216 my $secondary_end = '#XSL_LIPM_MOBYPARSER_SECONDARY_END#';
217 my $secondary_sep = '#XSL_LIPM_MOBYPARSER_SECONDARY_SEP#';
218 my (@a_param) = ($article_bloc =~ /$secondary_start(.+)$secondary_sep(.+)$secondary_end/);
219 $article_objects = \
@a_param;
222 my %h_input_article = (
223 'article_type' => $articletype,
224 'article_name' => $articlename,
225 'article_objects' => $article_objects
228 push(@a_input_articles, \
%h_input_article);
233 'query_id' => $queryid,
234 'query_articles' => \
@a_input_articles
237 push(@a_queries, \
%h_query);
241 unlink("$TMP_DIR$tmp_file");
242 return ($servicenotes, \
@a_queries);
245 =head2 function getInputID
248 Usage : my $query_id =getInputID($rh_query);
250 Function : Return query_id of a query from getInputs
252 Args : $rh_query: query HASHREF structure from getInputs
259 my $rh_query = shift();
260 return $rh_query->{'query_id'};
263 =head2 function getArticles
266 Usage : my @a_input_articles =getArticles($rh_query);
268 Function : For a query from getInputs, retrieve list of articles
269 represented by a ARRAYREF corresponding to REF(articleName, articlePerlStructure)
270 Returns : @a_input_articles: ARRAY of articles ARRAYREF
271 Args : $rh_query: query HASHREF structure from getInputs
278 my $rh_query = shift();
279 my @a_input_articles = ();
281 foreach my $rh_input_article (@
{$rh_query->{'query_articles'}})
283 my @a_input_article = ($rh_input_article->{'article_name'}, $rh_input_article);
284 push(@a_input_articles, \
@a_input_article);
286 return (@a_input_articles);
289 =head2 function getCollectedSimples
291 Title : getCollectedSimples
292 Usage : my @a_simple_articles =getCollectedSimples($rh_collection_article);
294 Function : For a collection query from getArticles, retrieve list of
296 Returns : @a_simple_articles: ARRAY of articles HASHREF
297 Args : $rh_collection_article: collection article HASHREF structure from getArticles
302 sub getCollectedSimples
304 my $rh_collection_article = shift();
305 return @
{$rh_collection_article->{'article_objects'}};
308 =head2 function getCrossReferences
310 Title : getCrossReferences
311 Usage : my @a_crossreferences =getCrossReferences($rh_simple_article);
313 Function : Takes a simple article structure (from getArticles or getCollectedSimples)
314 and retrieve the list of crossreferences HASHREF
315 Returns : @a_crossreferences: ARRAY of crossreferences HASHREF
316 Args : $rh_simple_article: simple article HASHREF structure from getArticles or getCollectedSimples
321 sub getCrossReferences
323 my $rh_simple_article = shift();
325 if ($rh_simple_article->{'object_crossreference'} ne '')
327 return (@
{$rh_simple_article->{'object_crossreference'}});
335 =head2 function getObjectHasaElements
337 Title : getObjectHasaElements
338 Usage : my @a_hasa_elements =getObjectHasaElements($rh_simple_article);
340 Function : Takes a simple article structure (from getArticles or getCollectedSimples)
341 and retrieve the list of "HASA" element HASHREF
342 Returns : @a_hasa_elements: ARRAY of "HASA" element HASHREF
343 Args : $rh_object: simple article HASHREF structure from getArticles or getCollectedSimples
348 sub getObjectHasaElements
350 my $rh_simple_article = shift();
352 if (defined $rh_simple_article->{'article_objects'})
354 if ($rh_simple_article->{'article_objects'}->{'object_hasa'} ne '')
356 return (@
{$rh_simple_article->{'article_objects'}->{'object_hasa'}});
365 if ($rh_simple_article->{'object_hasa'} ne '')
367 return @
{$rh_simple_article->{'object_hasa'}};
375 # if ($rh_object->{'object_hasa'} ne '')
377 # return (@{$rh_object->{'object_hasa'}});
385 =head2 function getObjectType
387 Title : getObjectType
388 Usage : my $object_type =getObjectType($rh_object);
390 Function : Returns object MOBY class/type
391 Returns : $object_type: object MOBY class/type
392 Args : $rh_object: simple article (object) HASHREF structure from getArticles,getCollectedSimples or getObjectHasaElements
399 my $rh_object = shift();
400 if (defined $rh_object->{'article_objects'})
402 return ($rh_object->{'article_objects'}->{'object_type'});
406 return $rh_object->{'object_type'};
410 =head2 function getObjectName
412 Title : getObjectName
413 Usage : my $object_name =getObjectName($rh_object);
415 Function : Returns object moby:articleName
416 Returns : $object_name: moby:articleName
417 Args : $rh_object: simple article (object) HASHREF structure from getArticles,getCollectedSimples or getObjectHasaElements
424 my $rh_object = shift();
425 if (defined $rh_object->{'article_objects'})
427 return ($rh_object->{'article_objects'}->{'object_name'});
431 return $rh_object->{'object_name'};
435 =head2 function getObjectNamespace
437 Title : getObjectNamespace
438 Usage : my $object_namespace =getObjectNamespace($rh_object);
440 Function : Returns object moby:namespace
441 Returns : $object_name: moby:namespace
442 Args : $rh_object: simple article (object) HASHREF structure from getArticles,getCollectedSimples or getObjectHasaElements
447 sub getObjectNamespace
449 my $rh_object = shift();
450 if (defined $rh_object->{'article_objects'})
452 return ($rh_object->{'article_objects'}->{'object_namespace'});
456 return $rh_object->{'object_namespace'};
460 =head2 function getObjectContent
462 Title : getObjectContent
463 Usage : my $object_content =getObjectContent($rh_object);
465 Function : Returns object content (using HTML::Entities::decode)
466 Warning: this content could contain emptylines if
467 your objects contains Crossreferences or Hasa Elements ...
468 Returns : $object_content: object content (decoded using HTML::Entities::decode)
469 Args : $rh_object: simple article (object) HASHREF structure from getArticles,getCollectedSimples or getObjectHasaElements
476 use HTML
::Entities
();
477 my $rh_object = shift();
478 my $encoded_content = '';
479 if (defined $rh_object->{'article_objects'})
481 $encoded_content = $rh_object->{'article_objects'}->{'object_content'};
485 $encoded_content = $rh_object->{'object_content'};
487 my $decoded_object = HTML
::Entities
::decode
($encoded_content);
488 return ($decoded_object);
491 =head2 function getObjectXML
494 Usage : my $object_xml =getObjectXML($rh_object);
496 Function : Returns full object moby:xml string
497 Returns : $object_xml: object moby:xml string
498 Args : $rh_object: simple article (object) HASHREF structure from getArticles,getCollectedSimples or getObjectHasaElements
505 my $rh_object = shift();
506 if (defined $rh_object->{'article_objects'})
508 return ($rh_object->{'article_objects'}->{'object_xml'});
512 return $rh_object->{'object_xml'};
517 =head2 function getObjectId
520 Usage : my $object_id =getObjectId($rh_object);
522 Function : Returns object moby:id
523 Returns : $object_id: moby:id
524 Args : $rh_object: simple article (object) HASHREF structure from getArticles,getCollectedSimples or getObjectHasaElements
531 my $rh_object = shift();
533 if (defined $rh_object->{'article_objects'})
535 return ($rh_object->{'article_objects'}->{'object_id'});
539 return $rh_object->{'object_id'};
543 =head2 function getParameter
546 Usage : my ($parameter_name,$parameter_value) =getParameter($rh_article);
548 Function : Returns parameter name an value for a Secondary aricle
549 Returns : $parameter_name
551 Args : $rh_article: secondary article HASHREF structure from getArticles
558 my $rh_article = shift();
559 if (_IsSecondary
($rh_article->{'article_type'}))
561 return (@
{$rh_article->{'article_objects'}});
567 =head2 function getNodeContentWithArticle
569 Title : getNodeContentWithArticle
570 Usage : my $content = getNodeContentWithArticle($rh_query, $article_type, $article_name)
572 Function : inside a mobyData bloc (structured in $rh_query),
573 look for an article of a defined type (Simple, Collection or Parameter).
574 Foreach matching article, search for an object named $article_name.
575 If found, return its content.
576 Returns : $content: content of article requested
577 Args : $rh_query: query HASHREF structure from getInputs
578 $article_type: 'Simple/Collection/Parameter'
579 $article_name: attribute moby:articleName
584 sub getNodeContentWithArticle
586 my ($rh_query, $article_type, $article_name) = (@_);
588 foreach my $rh_article (@
{$rh_query->{'query_articles'}})
590 if ( (_IsSecondary
($article_type))
591 && ($rh_article->{'article_type'} =~ /^$article_type$/i)
592 && ($article_name eq $rh_article->{'article_name'}))
594 my ($article_name, $article_value) = @
{$rh_article->{'article_objects'}};
595 return $article_value;
597 elsif (_IsSimple
($article_type))
599 if ($rh_article->{'article_type'} =~ /^$article_type$/i)
602 if ($rh_article->{'article_name'} eq $article_name)
604 return $rh_article->{'article_objects'}->{'object_content'};
606 elsif ($rh_article->{'article_objects'}->{'object_hasa'} ne '')
608 foreach my $rh_object (@
{$rh_article->{'article_objects'}->{'object_hasa'}})
610 if ($rh_object->{'object_name'} eq $article_name)
612 return $rh_object->{'object_content'};
618 elsif (_IsCollection
($article_type))
620 if ($rh_article->{'article_type'} =~ /^$article_type$/i)
622 if ($rh_article->{'article_name'} eq $article_name)
625 foreach my $rh_object (@
{$rh_article->{'article_objects'}})
627 $content .= $rh_object->{'object_content'};
633 foreach my $rh_object (@
{$rh_article->{'article_objects'}})
635 if ($rh_object->{'object_name'} eq $article_name)
637 return $rh_object->{'object_content'};
649 =head2 function isSimpleArticle
651 Title : isSimpleArticle
652 Usage : isSimpleArticle($rh_article)
654 Function : Test if an article is a moby:Simple
655 Returns : $response: BOOLEAN
656 Args : $rh_article: article HASHREF structure from getArticles
663 my $rh_article = shift();
664 my $response = _IsSimple
($rh_article->{article_type
});
668 =head2 function isCollectionArticle
670 Title : isCollectionArticle
671 Usage : isCollectionArticle($rh_article)
673 Function : Test if an article is a moby:Collection
674 Returns : $response: BOOLEAN
675 Args : $rh_article: article HASHREF structure from getArticles
680 sub isCollectionArticle
682 my $rh_article = shift();
683 my $response = _IsCollection
($rh_article->{article_type
});
687 =head2 function isSecondaryArticle
689 Title : isSecondaryArticle
690 Usage : isSecondaryArticle($rh_article)
692 Function : Test if articleType is moby:Parameter (secondary article)
693 Returns : $response: BOOLEAN
694 Args : $rh_article: article HASHREF structure from getArticles
699 sub isSecondaryArticle
701 my $rh_article = shift();
702 my $response = _IsSecondary
($rh_article->{article_type
});
706 =head2 function _AnalyseSimple
708 Title : _AnalyseSimple
709 Usage : _AnalyseSimple($simple_bloc)
711 Function : Analyse a "Simple Bloc" from XSL transformation parsing
712 Build a $rh_simple_article structure with fields:
713 'object_name' => moby:articleName
714 'object_type' => moby:Class
715 'object_namespace' => moby:namespace
716 'object_id' => moby:id
717 'object_content' => text content of simple article
718 'object_xml' => full xml content of article
719 'object_hasa' => ARRAYREF of hasa elements
720 (each one is structured in a same
721 structured hash (recursivity)
722 'object_crossreference' => ARRAYREF of crossreferences objects
723 (each one is structured in a hash with fields
724 'type', 'id', 'namespace')
726 Returns : $rh_simple: article HASHREF
727 Args : $simple_bloc: from parsing of a "simple" XSLT transformation
734 my $simple_bloc = shift();
738 my ($object_type,$object_name,$object_id,$object_namespace) = ('','','','');
739 my $object_type_tag = '#XSL_LIPM_MOBYPARSER_OBJECTTYPE#';
741 if ($simple_bloc =~ /$object_type_tag(.+)$object_type_tag/)
744 $object_type =~ s/^moby://i;
747 my $object_namespace_tag = '#XSL_LIPM_MOBYPARSER_OBJECTNAMESPACE#';
749 if ($simple_bloc =~ /$object_namespace_tag(.+)$object_namespace_tag/)
751 $object_namespace = $1;
754 my $object_id_tag = '#XSL_LIPM_MOBYPARSER_OBJECTID#';
756 if ($simple_bloc =~ /$object_id_tag(.+)$object_id_tag/)
761 my $object_name_tag = '#XSL_LIPM_MOBYPARSER_OBJECTNAME#';
763 if ($simple_bloc =~ /$object_name_tag(.+)$object_name_tag/)
768 my $crossref_start_tag = '#XSL_LIPM_MOBYPARSER_CROSSREF_START#';
769 my $crossref_end_tag = '#XSL_LIPM_MOBYPARSER_CROSSREF_END#';
770 my $crossref_sep_tag = '#XSL_LIPM_MOBYPARSER_CROSSREF_SEP#';
772 while ($simple_bloc =~ m/$crossref_start_tag(.*)$crossref_sep_tag(.*)$crossref_sep_tag(.*)$crossref_end_tag/g)
774 my %h_crossref = ('type' => $1, 'id' => $2, 'namespace' => $3);
775 push(@a_crossref, \
%h_crossref);
778 my $ra_crossref = \
@a_crossref;
779 if ($#a_crossref < 0)
784 my $object_content_tag = '#XSL_LIPM_MOBYPARSER_OBJECTCONTENT#';
785 my ($before, $object_content, $after) = ('','','');
786 ($before, $object_content, $after) = split($object_content_tag, $simple_bloc);
788 my $object_hasa_start_tag = '#XSL_LIPM_MOBYPARSER_OBJECTHASA_START#';
790 if ($simple_bloc =~ /$object_hasa_start_tag/)
792 my (@a_hasa_blocs) = split($object_hasa_start_tag, $simple_bloc);
794 foreach my $hasa_bloc (@a_hasa_blocs)
796 if ($hasa_bloc ne '')
798 my $rh_hasa = _AnalyseSimple
($hasa_bloc);
799 push(@a_hasa, $rh_hasa);
804 my $ra_hasa = \
@a_hasa;
811 "<moby:$object_type moby:id='$object_id' moby:namespace='$object_namespace'>$object_content</moby:$object_type>";
815 $object_xml = "<moby:$object_type moby:id='$object_id' moby:namespace='$object_namespace'>\n";
816 foreach my $rh_hasa (@a_hasa)
818 $object_xml .= $rh_hasa->{'object_content'} . "\n";
820 $object_xml .= "</moby:$object_type>";
824 'object_name' => $object_name,
825 'object_type' => $object_type,
826 'object_namespace' => $object_namespace,
827 'object_id' => $object_id,
828 'object_content' => $object_content,
829 'object_xml' => $object_xml,
830 'object_crossreference' => $ra_crossref,
831 'object_hasa' => $ra_hasa
837 =head2 simpleResponse (stolen from MOBY::CommonSubs)
839 name : simpleResponse
840 function : wraps a simple article in the appropriate (mobyData) structure
841 usage : $resp .= &simpleResponse($object, 'MyArticleName', $queryID);
843 $object - (optional) a MOBY Object as raw XML
844 $article - (optional) an articeName for this article
845 $query - (optional, but strongly recommended) the queryID value for the
846 mobyData block to which you are responding
847 notes : as required by the API you must return a response for every input.
848 If one of the inputs was invalid, you return a valid (empty) MOBY
849 response by calling &simpleResponse(undef, undef, $queryID) with no arguments.
855 my ($data, $articleName, $qID) = @_; # articleName optional
857 $data ||= ''; # initialize to avoid uninit value errors
863 <moby:mobyData moby:queryID='$qID'>
864 <moby:Simple moby:articleName='$articleName'>$data</moby:Simple>
871 <moby:mobyData moby:queryID='$qID'>
872 <moby:Simple moby:articleName='$articleName'>$data</moby:Simple>
879 <moby:mobyData moby:queryID='$qID'/>
884 =head2 collectionResponse (stolen from MOBY::CommonSubs)
886 name : collectionResponse
887 function : wraps a set of articles in the appropriate mobyData structure
888 usage : return responseHeader . &collectionResponse(\@objects, 'MyArticleName', $queryID) . responseFooter;
890 \@objects - (optional) a listref of MOBY Objects as raw XML
891 $article - (optional) an articeName for this article
892 $queryID - (optional, but strongly recommended) the mobyData ID
893 to which you are responding
894 notes : as required by the API you must return a response for every input.
895 If one of the inputs was invalid, you return a valid (empty) MOBY
896 response by calling &collectionResponse(undef, undef, $queryID).
900 sub collectionResponse
902 my ($data, $articleName, $qID) = @_; # articleName optional
906 unless ((ref($data) =~ /array/i) && $data->[0])
907 { # we're expecting an arrayref as input data,and it must not be empty
908 return "<moby:mobyData moby:queryID='$qID'/>";
916 <moby:Simple>$_</moby:Simple>
929 <moby:mobyData moby:queryID='$qID'>
930 <moby:Collection moby:articleName='$articleName'>
939 <moby:mobyData moby:queryID='$qID'>
940 <moby:Collection moby:articleName='$articleName'>$content</moby:Collection>
946 =head2 responseHeader (stolen from MOBY::CommonSubs)
948 name : responseHeader
949 function : print the XML string of a MOBY response header +/- serviceNotes
950 usage : responseHeader('illuminae.com')
952 -authority => 'illuminae.com',
953 -note => 'here is some data from the service provider')
954 args : a string representing the service providers authority URI,
955 OR a set of named arguments with the authority and the
956 service provision notes.
958 notes : returns everything required up to the response articles themselves.
960 <?xml version='1.0' encoding='UTF-8'?>
961 <moby:MOBY xmlns:moby='http://www.biomoby.org/moby'>
962 <moby:Response moby:authority='http://www.illuminae.com'>
969 use HTML
::Entities
();
970 my ($auth, $notes) = &_rearrange
([qw
[AUTHORITY NOTE
]], @_);
971 $auth ||= "not_provided";
974 "<?xml version='1.0' encoding='UTF-8'?>"
975 . "<moby:MOBY xmlns:moby='http://www.biomoby.org/moby' xmlns='http://www.biomoby.org/moby'>"
976 . "<moby:mobyContent moby:authority='$auth'>";
979 my $encodednotes = HTML
::Entities
::encode
($notes);
980 $xml .= "<moby:serviceNotes>$encodednotes</moby:serviceNotes>";
985 =head2 responseFooter (stolen from MOBY::CommonSubs)
987 name : responseFooter
988 function : print the XML string of a MOBY response footer
989 usage : return responseHeader('illuminae.com') . $DATA . responseFooter;
990 notes : returns everything required after the response articles themselves
1000 return "</moby:mobyContent></moby:MOBY>";
1003 =head2 function _IsCollection
1005 Title : _IsCollection
1006 Usage : _IsCollection($article_type)
1008 Function : Compares a string to string 'collection'
1009 Remove namespace 'moby:' from parameter string
1012 Args : $articletype: a string
1019 my $articletype = shift();
1021 $articletype =~ s/^moby://;
1022 if ($articletype =~ /^collection$/i)
1032 =head2 function _IsSimple
1035 Usage : _IsSimple($article_type)
1037 Function : Compares a string to string 'simple'
1038 Remove namespace 'moby:' from parameter string
1041 Args : $articletype: a string
1048 my $articletype = shift();
1050 $articletype =~ s/^moby://;
1051 if ($articletype =~ /^simple$/i)
1061 =head2 function _IsSecondary
1063 Title : _IsSecondary
1064 Usage : _IsSecondary($article_type)
1066 Function : Compares a string to string 'parameter'
1067 Remove namespace 'moby:' from parameter string
1070 Args : $articletype: a string
1077 my $articletype = shift();
1079 $articletype =~ s/^moby://;
1080 if ($articletype =~ /^parameter$/i)
1090 =head2 _rearrange (stolen from MOBY::CommonSubs)
1098 # my $dummy = shift;
1101 return @_ unless (substr($_[0] || '', 0, 1) eq '-');
1102 push @_, undef unless $#_ % 2;
1106 (my $key = shift) =~ tr/a-z\055/A-Z/d; #deletes all dashes!
1107 $param{$key} = shift;
1109 map {$_ = uc($_)} @
$order; # for bug #1343, but is there perf hit here?
1110 return @param{@
$order};