[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Mon Jul 12 00:39:37 UTC 2004


mwilkinson
Sun Jul 11 20:39:37 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv25446/MOBY

Modified Files:
	Central.pm 
Log Message:
tightening the business logic of MOBY Object registration, as I now see a few objects in the ontology that are invalid.

moby-live/Perl/MOBY Central.pm,1.132,1.133
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2004/07/09 00:21:53	1.132
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2004/07/12 00:39:37	1.133
@@ -260,16 +260,20 @@
         return &_error("Object name may not be an URN or URI","") if $1;
     }
 
+    my $ISAs;
 	# validate that the final ontology will be valid by testing against existing relationships and such
 	while (my ($reltype, $obj) = each %{$relationships}){
 		my ($success, $message, $URI) = $RelOntologyServer->relationshipExists(term => $reltype, ontology => 'object'); # success = 1 if it does
-		$success==0 && return &_error($message, $URI );
+        $success==0 && return &_error($message, $URI );
 		foreach (@{$obj}){
+            ++$ISAs if ($URI =~ /isa$/i);
 			my ($objectType, $articleName) = @{$_};
 			my ($success, $message, $URI) = $OntologyServer->objectExists(term => $objectType); # success = 1 if it does
 			$success==0 && return &_error($message, $URI );
 		}
 	}
+    return &_error("Object must have exactly one ISA parent in the MOBY Object ontology") unless $ISAs == 1;
+    
 	$clobber = defined($clobber)?$clobber:0;
 	$clobber = 0 unless ($clobber eq 0 || $clobber eq 1 || $clobber eq 2);  # safety!
 	my ($exists, $exists_message, $URI) = $OntologyServer->objectExists(term => $term); # success = 1 if it does




More information about the MOBY-guts mailing list