[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Thu Jul 29 00:22:21 UTC 2004


mwilkinson
Wed Jul 28 20:22:21 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/RDF
In directory pub.open-bio.org:/tmp/cvs-serv16780/MOBY/RDF

Modified Files:
	InOutArticlesRDF.pm ServiceInstanceRDF.pm 
Log Message:
ups.  Got my class variables wrong.  Now it increments properly to associate inputs with the correct services

moby-live/Perl/MOBY/RDF InOutArticlesRDF.pm,1.5,1.6 ServiceInstanceRDF.pm,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/InOutArticlesRDF.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Perl/MOBY/RDF/InOutArticlesRDF.pm	2004/07/28 23:45:33	1.5
+++ /home/repository/moby/moby-live/Perl/MOBY/RDF/InOutArticlesRDF.pm	2004/07/29 00:22:21	1.6
@@ -16,30 +16,22 @@
 use constant DC => 'http://purl.org/dc/elements/1.1/';
 
 {
-    my $inputcounter = 1;
-    my $outputcounter = 1;
-    my $simplecounter = 1;
-    my $collectioncounter = 1;    
+    my $inputfactory ||= new RDF::Core::NodeFactory( GenPrefix => '_:input', GenCounter => 0,BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
+    my $outputfactory ||= new RDF::Core::NodeFactory( GenPrefix => '_:output', GenCounter => 0,BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
+    my $simplefactory ||= new RDF::Core::NodeFactory( GenPrefix => '_:simple', GenCounter => 0,BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
+    my $collectionfactory ||= new RDF::Core::NodeFactory( GenPrefix => '_:collection', GenCounter => 0,BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
 
     sub nextinput {
-        ++$inputcounter;
-        $inputcounter = 1 if $inputcounter==100000;
-        return $inputcounter;
+        return $inputfactory->newResource
     }
     sub nextoutput {
-        ++$outputcounter;
-        $outputcounter = 1 if $outputcounter==100000;
-        return $outputcounter;
+        return $outputfactory->newResource
     }
     sub nextsimple {
-        ++$simplecounter;
-        $simplecounter = 1 if $simplecounter==100000;
-        return $simplecounter;
+        return $simplefactory->newResource
     }
     sub nextcollection {
-        ++$collectioncounter;
-        $collectioncounter = 1 if $collectioncounter==100000;
-        return $collectioncounter;
+        return $collectionfactory->newResource
     }
     
 }
@@ -91,14 +83,14 @@
     my $subject = $self->subject;
     my $model = $self->model;
     
-    $self->{inputfactory} = new RDF::Core::NodeFactory( GenPrefix => '_:input', GenCounter => &nextinput(),BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
-    $self->{outputfactory} = new RDF::Core::NodeFactory( GenPrefix => '_:output', GenCounter => &nextoutput(),BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
-    $self->{simplefactory} = new RDF::Core::NodeFactory( GenPrefix => '_:simple', GenCounter => &nextsimple(),BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
-    $self->{collectionfactory} = new RDF::Core::NodeFactory( GenPrefix => '_:collection', GenCounter => &nextcollection(),BaseURI=>'http://www.biomoby.org/nil');# BaseURI=>'http://www.foo.org/');
 
 	$self->{Bag} = new RDF::Core::Resource(RDF_NS,'Bag');
-    
-    my $Thingy = $self->{inputfactory}->newResource;  # create a bnode
+    my $Thingy;
+    if ($self->type eq 'consumes'){
+        $Thingy = &nextinput;  # create a bnode
+    } else {
+        $Thingy = &nextoutput;  # create a bnode
+    }
     my $predicate = $subject->new(MP,$self->type);  # 'consumes' or 'produces'
     my $statement = new RDF::Core::Statement($subject, $predicate, $Thingy);
     $model->addStmt($statement);
@@ -125,13 +117,12 @@
     foreach my $IN(@articles){
         ++$li;
         my $LI = $Thingy->new(RDF_NS, "_$li");
-        my $input = $self->{inputfactory}->newResource;
+        my $input = &nextsimple;
         my $statement = new RDF::Core::Statement($Thingy, $LI, $input);
         $model->addStmt($statement);
             #<Description about bnode1>
             # 	<rdf:_1 bnode2>
-    
-        
+
         if ($IN->isSimple){
             &_addSimple($model, $input, $IN);
         } else {   # COLLECTION
@@ -146,7 +137,7 @@
             foreach my $simp(@{$simps}){
                 ++$lli;
                 my $LI = $input->new(RDF_NS, "_$lli");
-                my $collection_member = $self->{inputfactory}->newResource;
+                my $collection_member = &nextcollection;
                 my $statement = new RDF::Core::Statement($input, $LI, $collection_member);
                 $model->addStmt($statement);
                 

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/ServiceInstanceRDF.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Perl/MOBY/RDF/ServiceInstanceRDF.pm	2004/07/28 23:12:11	1.4
+++ /home/repository/moby/moby-live/Perl/MOBY/RDF/ServiceInstanceRDF.pm	2004/07/29 00:22:21	1.5
@@ -1,6 +1,8 @@
 package MOBY::RDF::ServiceInstanceRDF;
 use strict;
 use MOBY::RDF::InOutArticlesRDF;
+use RDF::Core::Statement;
+
 require Exporter;
 our @ISA = qw(Exporter);
 our @EXPORT_OK = qw();




More information about the MOBY-guts mailing list