[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Thu May 8 21:21:36 UTC 2003
mwilkinson
Thu May 8 17:21:36 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv4445/Perl/MOBY
Modified Files:
Central.pm
Log Message:
should be able to register collections now, but not discover them.
moby-live/Perl/MOBY Central.pm,1.44,1.45
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/05/08 20:11:32 1.44
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/05/08 21:21:36 1.45
@@ -1114,63 +1114,59 @@
my ($object_type, @namespaces);
if ($simp_coll eq "Collection"){
-
- my $table = "collection";
- #$debug && &_LOG("Collection!\n"); # the following SQl belongs in the service_instance object, but screw it, I'm running out of time!
- #$dbh->do("insert into collection_$inout (service_instance_id, article_name) values (?,?)", undef, ($SVC->service_instance_id, $article));
- #my $collection_id=$dbh->{mysql_insertid};
- #my $Simples = $node->getElementsByTagName('Simple');
- #my $length = $Simples->getLength;
- #for (my $x=0; $x<$length; ++$x){
- # &_registerArticles($SVC, $inout, $Simples->item($x),$collection_id);
- #}
-
-
+ $debug && &_LOG("Collection!\n"); # the following SQl belongs in the service_instance object, but screw it, I'm running out of time!
+ $dbh->do("insert into collection_$inout (service_instance_id, article_name) values (?,?)", undef, ($SVC->service_instance_id, $article));
+ my $collection_id=$dbh->{mysql_insertid};
+ my $Simples = $node->getElementsByTagName('Simple');
+ my $length = $Simples->getLength;
+ for (my $x=0; $x<$length; ++$x){
+ &_registerArticles($SVC, $inout, $Simples->item($x),$collection_id);
+ }
} elsif ($simp_coll eq "Simple") {
- my $article = $node->getAttributeNode("articleName");
- $article = $article->getValue() if $article;
-
- # get object type and its URI from the ontoogy server
- my $types = $node->getElementsByTagName('objectType');
- my $OE = MOBY::OntologyServer->new(ontology => "object");
- foreach ($types->item(0)->getChildNodes) { # should only ever be one!
- ($_->getNodeType == TEXT_NODE) && ($object_type = $_->toString);
- }
- my ($success, $message, $typeURI) = $OE->objectExists(term => $object_type);
- unless ($success) {
- $SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist");
- } # kill it all unless this was successful!
+ my $article = $node->getAttributeNode("articleName");
+ $article = $article->getValue() if $article;
- my $namespace_string;
- my $namespaces = $node->getElementsByTagName('Namespace');
- my $num_ns = $namespaces->getLength;
- $OE = MOBY::OntologyServer->new(ontology => "namespace");
- for (my $n = 0; $n<$num_ns;++$n) {
- foreach my $name ($namespaces->item($n)->getChildNodes) {
- if ($name->getNodeType == TEXT_NODE) {
- my ($success, $message, $URI) = $OE->namespaceExists(term => $name->toString);
- unless ($success) {
- $SVC->DELETE_THYSELF; return (-1,"namespace: " . $name->toString . " doesn't exist");
- }
- $namespace_string .=$URI.",";
- }
- }
- }
- chop($namespace_string); # remove trailing comma
- my $dbh = $SVC->dbh;
- my $service_instance_id;
- unless ($collid) {
- $service_instance_id = $SVC->service_instance_id;
- } # one or the other, but not both
- $dbh->do("insert into simple_".$inout."
+ # get object type and its URI from the ontoogy server
+ my $types = $node->getElementsByTagName('objectType');
+ my $OE = MOBY::OntologyServer->new(ontology => "object");
+ foreach ($types->item(0)->getChildNodes) { # should only ever be one!
+ ($_->getNodeType == TEXT_NODE) && ($object_type = $_->toString);
+ }
+ my ($success, $message, $typeURI) = $OE->objectExists(term => $object_type);
+ unless ($success) {
+ $SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist");
+ } # kill it all unless this was successful!
+
+ my $namespace_string;
+ my $namespaces = $node->getElementsByTagName('Namespace');
+ my $num_ns = $namespaces->getLength;
+ $OE = MOBY::OntologyServer->new(ontology => "namespace");
+ for (my $n = 0; $n<$num_ns;++$n) {
+ foreach my $name ($namespaces->item($n)->getChildNodes) {
+ if ($name->getNodeType == TEXT_NODE) {
+ my ($success, $message, $URI) = $OE->namespaceExists(term => $name->toString);
+ unless ($success) {
+ $SVC->DELETE_THYSELF; return (-1,"namespace: " . $name->toString . " doesn't exist");
+ }
+ $namespace_string .=$URI.",";
+ }
+ }
+ }
+ chop($namespace_string); # remove trailing comma
+ my $dbh = $SVC->dbh;
+ my $service_instance_id;
+ unless ($collid) {
+ $service_instance_id = $SVC->service_instance_id;
+ } # one or the other, but not both
+ $dbh->do("insert into simple_".$inout."
(object_type_uri,
namespace_type_uris,
article_name,
service_instance_id,
collection_".$inout."_id)
values (?,?,?,?,?)",
- undef,
- ($typeURI,
+ undef,
+ ($typeURI,
$namespace_string,
$article,
$service_instance_id,
More information about the MOBY-guts
mailing list