[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Mon Jul 25 21:13:51 UTC 2005


mwilkinson
Mon Jul 25 17:13:51 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv21605/MOBY

Modified Files:
	OntologyServer.pm 
Log Message:
more of the same.  Pass hashes instead of hashrefs, and avoid passing database ids

moby-live/Perl/MOBY OntologyServer.pm,1.55,1.56
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2005/07/25 20:55:35	1.55
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2005/07/25 21:13:51	1.56
@@ -242,10 +242,6 @@
 	my ( $self, %args ) = @_;
 	$CONFIG ||= MOBY::Config->new;    # exported by Config.pm
 	my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobyobject' );
-	#node => $term,
-	#desc => $desc,
-	#authURI => $auth,
-	#contact => $email
 	return ( 0, "WRONG ONTOLOGY!", '' ) unless ( $self->ontology eq 'object' );
 	return ( 0, "requires a object type node", '' ) unless ( $args{node} );
 	return ( 0, "requires an authURI ",        '' ) unless ( $args{authority} );
@@ -255,9 +251,6 @@
 	  unless ( $args{description} );
 	my $term = $args{node};
 
-#    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){  # if it is an LSID, but not a MOBY LSID, than barf
-#        return (0, "can't create a term in a non-MOBY ontology!", $term);
-#    }
 	my $LSID =
 	  ( $args{'node'} =~ /urn\:lsid/ )
 	  ? $args{'node'}
@@ -280,11 +273,11 @@
 	$args{contact_email} =~ s/^\s+(.*?)\s+$/$1/s;
 	$args{authority}     =~ s/^\s+(.*?)\s+$/$1/s;
 	
-	my $insertid = $adaptor->insert_object({object_type => $args{'node'}}, 
-						{object_lsid => $LSID}, 
-						{description => $args{'description'}},
-						{authority => $args{'authority'}},
-						{contact_email => $args{'contact_email'}});
+	my $insertid = $adaptor->insert_object(object_type => $args{'node'}, 
+						object_lsid => $LSID, 
+						description => $args{'description'},
+						authority => $args{'authority'},
+						contact_email => $args{'contact_email'});
 	unless ( $insertid ) {
 		return ( 0, "Object creation failed for unknown reasons", '' );
 	}
@@ -373,7 +366,7 @@
 				 $lsid );
 	}
 
-	my ($err, $errstr) = $adaptor->delete_object({object_id => $id});
+	my ($err, $errstr) = $adaptor->delete_object(type => $lsid);
 	if ( $err ) {
 		return ( 0, "Delete from Object Class table failed: $errstr",
 				 $lsid );
@@ -463,14 +456,12 @@
 	my ( $subj_id, $subj_lsid, $obj_id, $obj_lsid );
 	my $result = $adaptor->query_object(type => $args{subject_node});
 	my $row = shift(@$result);
-	$subj_id = $row->{object_id};
 	$subj_lsid = $row->{object_lsid};
 	return ( 0, qq{Object type $args{subject_node} does not exist in the ontology}, '' )
 	  unless defined $subj_id;
 	  
 	$result = $adaptor->query_object(type => $args{object_node});
 	$row = shift(@$result);
-	$obj_id = $row->{object_id};
 	$obj_lsid = $row->{object_lsid};
 	return ( 0,qq{Object type $args{object_node} does not exist in the ontology},'' )
 	  unless defined $obj_id;
@@ -491,10 +482,10 @@
 	  || return ( 0,
 			qq{Relationship $args{relationship} does not exist in the ontology},
 			'' );
-	my $insertid = $adaptor->insert_object_term2term({relationship_type => $rel_lsid}, 
-							 {object1_id => $subj_id},
-							 {object2_id => $obj_id},
-							 {object2_articlename => $args{articleName}});
+	my $insertid = $adaptor->insert_object_term2term(relationship_type => $rel_lsid, 
+							 object1_id => $subj_lsid,
+							 object2_id => $obj_lsid,
+							 object2_articlename => $args{articleName});
 	if ($insertid ) {
 		return ( 1, "Object relationsihp created successfully", '' );
 	} else {




More information about the MOBY-guts mailing list