[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Tue Feb 3 18:05:03 UTC 2009


kawas
Tue Feb  3 13:05:03 EST 2009
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Parsers
In directory dev.open-bio.org:/tmp/cvs-serv24944/Perl/MOBY-Server/lib/MOBY/RDF/Parsers

Modified Files:
	ServiceParser.pm 
Log Message:
updated these modules to be more like their java counterparts. Namely, lsids are okay as URI and moved parsing out of URIs to the RDF parser, rather than having it occur in the RDF generator.
moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Parsers ServiceParser.pm,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Parsers/ServiceParser.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Parsers/ServiceParser.pm	2009/01/28 14:51:36	1.5
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Parsers/ServiceParser.pm	2009/02/03 18:05:03	1.6
@@ -773,25 +773,7 @@
 			}
 		}
 		$val = "" if ref($val) eq 'ARRAY';
-
-		# check if $SI->type is an lsid or uri
-		if ( $val =~ m/RESOURCES\/MOBY\-S\/Services(\/[A-Za-z0-9_\-]*)?$/ ) {
-
-			# uri is /Services/
-			$val = substr $1, 1 if $1;
-		}
-		elsif ( $val =~ m/RESOURCES\/MOBY\-S\/Services(\#[A-Za-z0-9_\-]*)?$/ ) {
-
-			# uri is /Services#
-			$val = substr $1, 1 if $1;
-		}
-		elsif ( $val =~ m/^urn\:lsid/i ) {
-
-			# uri is an lsid
-			my $lsid = LS::ID->new($val);
-			$val = $lsid->object if $lsid;
-		}
-		$instance->type( MOBY::RDF::Utils::trim($val) );
+		$instance->type( $self->_unwrap_servicetype ( MOBY::RDF::Utils::trim($val) ) );
 
 		# dont need the performsTask node anymore
 		$performs = undef;
@@ -886,8 +868,8 @@
 		 $uri =~ m/RESOURCES\/MOBY\-S\/Objects(\#[A-Za-z0-9_\-]*)?$/ ) {
 		$uri = substr $1, 1 if $1;
 	} elsif ( $uri =~ m/^urn\:lsid/i ) {
-		my $lsid = LS::ID->new( $uri );
-		$uri =  $lsid->object if $lsid;
+		#my $lsid = LS::ID->new( $uri );
+		#$uri =  $lsid->object if $lsid;
 	}
 	return $uri;
 }
@@ -900,11 +882,26 @@
 	} elsif ($n =~ m/RESOURCES\/MOBY\-S\/Namespaces(\#[A-Za-z0-9_\-]*)?$/ ){
 		$n = substr $1, 1 if $1;
 	} elsif( $n =~ m/^urn\:lsid/i) {
-		my $lsid = LS::ID->new($n);
-		$n = $lsid->object if $lsid;
+		#my $lsid = LS::ID->new($n);
+		#$n = $lsid->object if $lsid;
+	}
+	return $n;
+}
+
+sub _unwrap_servicetype {
+	my ($self, $n) = @_;
+	# get only the servicetype name (strip from lsid or URI)
+	if ($n =~ m/RESOURCES\/MOBY\-S\/Services(\/[A-Za-z0-9_\-]*)?$/) {
+		$n = substr $1, 1 if $1;
+	} elsif ($n =~ m/RESOURCES\/MOBY\-S\/Services(\#[A-Za-z0-9_\-]*)?$/ ){
+		$n = substr $1, 1 if $1;
+	} elsif( $n =~ m/^urn\:lsid/i) {
+		#my $lsid = LS::ID->new($n);
+		#$n = $lsid->object if $lsid;
 	}
 	return $n;
 }
 
+
 1;
 __END__




More information about the MOBY-guts mailing list