[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri Jul 9 02:44:48 UTC 2004


mwilkinson
Thu Jul  8 22:44:48 EDT 2004
Update of /home/repository/moby/moby-live/Perl/scripts/Services
In directory pub.open-bio.org:/tmp/cvs-serv6113

Modified Files:
	LocalServices.pm 
Log Message:
added the Union and Intersection services required by the Generation Challenge Program project.  The existing client will not be able to discover nor use these services.

moby-live/Perl/scripts/Services LocalServices.pm,1.63,1.64
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2004/06/29 16:24:00	1.63
+++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2004/07/09 02:44:48	1.64
@@ -1031,6 +1031,102 @@
 }
 
 
+sub ObjectUnion {
+    my ($caller, $data) = @_;  # data is raw XML
+    my $MOBY_RESPONSE;
+    my $inputs= complexServiceInputParser($data);  # thos converts it to XML::DOM objects
+	# hashref $input->{X} = [[COLLECTION(1), [DOM1, DOM2]], [COLLECTION(2), [DOM3, DOM4]]...]
+	
+    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (keys %{$inputs});
+
+	foreach my $queryID (keys %{$inputs}){
+		my @inputlist = @{$inputs->{$queryID}};
+		my $input1 = shift @inputlist;  # @inputlist = [COLLECTION(1), [DOM1, DOM2]],    [COLLECTION(2), [DOM3, DOM4]]
+		my $input2 = shift @inputlist;  # @inputlist = [COLLECTION(1), [DOM1, DOM2]],    [COLLECTION(2), [DOM3, DOM4]]
+		# input1 is now [COLLECTION(1), [DOM1, DOM2]]
+		my ($type1, $DOMS1) = @{$input1}; # $type = COLLECTION,    $DOMS = [DOM1, DOM2]
+		my ($type2, $DOMS2) = @{$input2}; # $type = COLLECTION,    $DOMS = [DOM1, DOM2]
+		
+		unless (($type1 == COLLECTION) && ($type2 == COLLECTION)){  # COLLECTION is a constant exported from MOBY::CommonSubs
+				$MOBY_RESPONSE .= collectionResponse([], "", $queryID) ;
+				next;
+		}
+		
+		my @DOMS1 = @{$DOMS1};
+		my @DOMS2 = @{$DOMS2};
+		my @ALLDOMS = (@DOMS1, @DOMS2);
+		
+		my %DOMHASH;
+		map {$DOMHASH{"$_"} = $_} @ALLDOMS;
+		
+		foreach my $dom1(@DOMS1){
+			my $ns1 = getSimpleArticleNamespaceURI($dom1);
+			my ($id1) = getSimpleArticleIDs([$dom1]);
+			foreach my $dom2(@DOMS2){
+				my $ns2 = getSimpleArticleNamespaceURI($dom2);
+				my ($id2) = getSimpleArticleIDs([$dom2]);
+				
+				if (($ns1 eq $ns2) && ($id1 eq $id2)){
+					delete $DOMHASH{"$dom2"};
+				}
+			}
+		}
+		my @simples;
+		while (my ($key, $DOM) = each %DOMHASH){
+			push @simples, extractRawContent($DOM);
+		}
+		$MOBY_RESPONSE .= collectionResponse(\@simples, "UnionCollection", $queryID) ;
+
+    }
+	#print $MOBY_RESPONSE;
+#    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
+}
+
+
+sub ObjectIntersection {
+    my ($caller, $data) = @_;  # data is raw XML
+    my $MOBY_RESPONSE;
+    my $inputs= complexServiceInputParser($data);  # thos converts it to XML::DOM objects
+	# hashref $input->{X} = [[COLLECTION(1), [DOM1, DOM2]], [COLLECTION(2), [DOM3, DOM4]]...]
+	
+    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (keys %{$inputs});
+
+	foreach my $queryID (keys %{$inputs}){
+		my @inputlist = @{$inputs->{$queryID}};
+		my $input1 = shift @inputlist;  # @inputlist = [COLLECTION(1), [DOM1, DOM2]],    [COLLECTION(2), [DOM3, DOM4]]
+		my $input2 = shift @inputlist;  # @inputlist = [COLLECTION(1), [DOM1, DOM2]],    [COLLECTION(2), [DOM3, DOM4]]
+		# input1 is now [COLLECTION(1), [DOM1, DOM2]]
+		my ($type1, $DOMS1) = @{$input1}; # $type = COLLECTION,    $DOMS = [DOM1, DOM2]
+		my ($type2, $DOMS2) = @{$input2}; # $type = COLLECTION,    $DOMS = [DOM1, DOM2]
+		
+		unless (($type1 == COLLECTION) && ($type2 == COLLECTION)){  # COLLECTION is a constant exported from MOBY::CommonSubs
+				$MOBY_RESPONSE .= collectionResponse([], "", $queryID) ;
+				next;
+		}
+		
+		my @DOMS1 = @{$DOMS1};
+		my @DOMS2 = @{$DOMS2};
+		my @gooddoms;
+		foreach my $dom1(@DOMS1){
+			my $ns1 = getSimpleArticleNamespaceURI($dom1);
+			my ($id1) = getSimpleArticleIDs([$dom1]);
+			foreach my $dom2(@DOMS2){
+				my $ns2 = getSimpleArticleNamespaceURI($dom2);
+				my ($id2) = getSimpleArticleIDs([$dom2]);
+				
+				if (($ns1 eq $ns2) && ($id1 eq $id2)){
+					push @gooddoms, extractRawContent($dom1);
+				}
+			}
+		}
+		$MOBY_RESPONSE .= collectionResponse(\@gooddoms, "IntersectionCollection", $queryID) ;
+
+    }
+	print $MOBY_RESPONSE;
+#    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
+}
+
+
 ###############################################################
 ######################  for My Machine Only ###################
 sub _dbAccess {




More information about the MOBY-guts mailing list