[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Sat Dec 27 17:41:32 UTC 2003


mwilkinson
Sat Dec 27 12:41:32 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv29639/Perl/MOBY/Client

Modified Files:
	Central.html Central.pm 
Log Message:
more tweaks for the Gbrowse project.  Create getter/setter methods for the LSID and ISA caches in MOBY::Client::Central so that they can be called from outside of the module itself.  This will allow us to build external tools that play with these caches.  This may not seem useful at the moment since we only have CGI based clients, so the cache is erased every time we make a call, but once we have a standalone client it will be very useful

moby-live/Perl/MOBY/Client Central.html,1.13,1.14 Central.pm,1.66,1.67
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/02 00:57:15	1.13
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/27 17:41:32	1.14
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>MOBY::Client::Central - a client side wrapper for MOBY Central</title>
-<link rev="made" href="mailto:markw at illuminae.(none)" />
+<link rev="made" href="mailto:markw at illuminae.com" />
 </head>
 
 <body style="background-color: white">
@@ -20,8 +20,8 @@
 	<ul>
 
 		<li><a href="#new">new</a></li>
-		<li><a href="#registerobject_a.k.a_registerobjectclass">registerObject  a.k.a registerObjectClass</a></li>
-		<li><a href="#deregisterobject_a.k.a._deregisterobjectclass">deregisterObject a.k.a. deregisterObjectClass</a></li>
+		<li><a href="#registerobject_a_k_a_registerobjectclass">registerObject  a.k.a registerObjectClass</a></li>
+		<li><a href="#deregisterobject_a_k_a__deregisterobjectclass">deregisterObject a.k.a. deregisterObjectClass</a></li>
 		<li><a href="#retrieveobjectdefinition">retrieveObjectDefinition</a></li>
 		<li><a href="#registerservicetype">registerServiceType</a></li>
 		<li><a href="#deregisterservicetype">deregisterServiceType</a></li>
@@ -41,6 +41,8 @@
 		<li><a href="#relationships">Relationships</a></li>
 		<li><a href="#isa">ISA</a></li>
 		<li><a href="#dump">DUMP</a></li>
+		<li><a href="#lsid_cache">LSID_CACHE</a></li>
+		<li><a href="#isa_cache">ISA_CACHE</a></li>
 	</ul>
 
 </ul>
@@ -135,7 +137,7 @@
                 at all, and everything should work</pre>
 <p>
 </p>
-<h2><a name="registerobject_a.k.a_registerobjectclass">registerObject  a.k.a registerObjectClass</a></h2>
+<h2><a name="registerobject_a_k_a_registerobjectclass">registerObject  a.k.a registerObjectClass</a></h2>
 <pre>
  Title     :    registerObject ; registerObjectClass
  Usage     :    $REG = $MOBY-&gt;registerObject(%args)
@@ -154,7 +156,7 @@
                         [Object1, articleName]]}</pre>
 <p>
 </p>
-<h2><a name="deregisterobject_a.k.a._deregisterobjectclass">deregisterObject a.k.a. deregisterObjectClass</a></h2>
+<h2><a name="deregisterobject_a_k_a__deregisterobjectclass">deregisterObject a.k.a. deregisterObjectClass</a></h2>
 <pre>
  Title     :    deregisterObject ; deregisterObjectClass
  Usage     :    $REG = $MOBY-&gt;deregisterObject(%args)
@@ -430,6 +432,27 @@
  Function  :    DUMP the mysql for the current MOBY Central database
  Returns   :    text
  Args      :    $reg - name of MOBY Central you want to use if not default</pre>
+<p>
+</p>
+<h2><a name="lsid_cache">LSID_CACHE</a></h2>
+<pre>
+ Title     :    LSID_CACHE
+ Usage     :    $lsid = $MOBY-&gt;LSID_CACHE($term, $lsid)
+ Function  :    get/set LSID from the cache
+ Returns   :    lsid as a scalar
+ Args      :    the term for which you have/want an lsid,
+                and optionally the lsid to set.</pre>
+<p>
+</p>
+<h2><a name="isa_cache">ISA_CACHE</a></h2>
+<pre>
+ Title     :    ISA_CACHE
+ Usage     :    $lsid = $MOBY-&gt;ISA_CACHE($term, \@isas)
+ Function  :    get/set the ISA relationships in the cache
+ Returns   :    listref of ISA relationships.  The resulting
+                list is IN ORDER from term to root.
+ Args      :    the term for which you have/want the ISA parentage,
+                and optionally the parentage listref to set.</pre>
 
 </body>
 

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/27 13:55:20	1.66
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/27 17:41:32	1.67
@@ -213,6 +213,7 @@
 	}	
 }
 
+
 sub new {
 	my ($caller, %args) = @_;
 	
@@ -1342,6 +1343,7 @@
 }
 
 
+
 sub _relationshipsPayload{
 	my ($payload) = @_;
 	return undef unless $payload;
@@ -1388,23 +1390,23 @@
 	my ($lsid1, $lsid2);
 	unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){
 		my ($s, $d, $lsid) = $OS->objectExists(term => $class1);
-		$self->{LSID_CACHE}->{$class1} = $lsid;
+		$self->LSID_CACHE($class1, $lsid);
 		$lsid1 = $lsid;
 		return 0 unless $s;
 	}
 	unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){
 		my ($s, $d, $lsid) = $OS->objectExists(term => $class2);
-		$self->{LSID_CACHE}->{$class2} = $lsid;
+		$self->LSID_CACHE($class2, $lsid);
 		$lsid2 = $lsid;
 		return 0 unless $s;
 	}
 	my @lsids;
-	unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){
+	unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){
 		my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']);
 		my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
 		@lsids = @$lsids;
 	}
-	$self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids];
+	$self->ISA_CACHE($lsid1, [@lsids]);
 	foreach (@lsids){
 		return 1 if $_ eq $lsid2;
 	}
@@ -1507,6 +1509,61 @@
     return \@Services;
 }
 
+
+=head2 LSID_CACHE
+
+ Title     :	LSID_CACHE
+ Usage     :	$lsid = $MOBY->LSID_CACHE($term, $lsid)
+ Function  :	get/set LSID from the cache
+ Returns   :	lsid as a scalar
+ Args      :	the term for which you have/want an lsid,
+                and optionally the lsid to set.
+
+=cut
+
+
+sub LSID_CACHE {
+	my ($self, $term, $lsid) = @_;
+	if ($term && $lsid){
+		$self->{LSID_CACHE}->{$term} = $lsid;
+		return $self->{LSID_CACHE}->{$term};		
+	} elsif ($term){
+		return $self->{LSID_CACHE}->{$term};
+	} else {
+		return undef
+	}
+}
+
+
+=head2 ISA_CACHE
+
+ Title     :	ISA_CACHE
+ Usage     :	$lsid = $MOBY->ISA_CACHE($term, \@isas)
+ Function  :	get/set the ISA relationships in the cache
+ Returns   :	listref of ISA relationships.  The resulting
+                list is IN ORDER from term to root.
+ Args      :	the term for which you have/want the ISA parentage,
+                and optionally the parentage listref to set.
+
+=cut
+
+sub ISA_CACHE {
+	my ($self, $term, $isas) = @_;
+	return [] if $isas && !(ref($isas)=~/ARRAY/);
+	if ($term && $isas){
+		while (scalar(@$isas)){
+			$self->{ISA_CACHE}->{$term} = [@$isas];
+			$term = shift(@$isas);
+		}
+		return $self->{ISA_CACHE}->{$term};
+	} elsif ($term){
+		return $self->{ISA_CACHE}->{$term};
+	} else {
+		return []
+	}
+}
+
+
 sub parseRegXML {
 		#<MOBYRegistration>
 		#	<id>$id</id>




More information about the MOBY-guts mailing list