[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Jul 28 23:12:11 UTC 2004


mwilkinson
Wed Jul 28 19:12:11 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/RDF
In directory pub.open-bio.org:/tmp/cvs-serv16439/RDF

Modified Files:
	InOutArticlesRDF.pm ServiceInstanceRDF.pm 
Log Message:
shuffling subroutines around

moby-live/Perl/MOBY/RDF InOutArticlesRDF.pm,1.2,1.3 ServiceInstanceRDF.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/InOutArticlesRDF.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY/RDF/InOutArticlesRDF.pm	2004/07/28 22:59:34	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY/RDF/InOutArticlesRDF.pm	2004/07/28 23:12:11	1.3
@@ -141,4 +141,59 @@
         $model->addStmt($statement);
     }
 }
+
+
+
+sub _addResource {
+    my ($model, $ns, $predicate, $subject, $ons, $object) = @_;
+
+    $predicate = $subject->new($ns, $predicate);
+    $object = new RDF::Core::Resource($ons, $object);
+    my $statement = new RDF::Core::Statement($subject, $predicate, $object);
+    $model->addStmt($statement);
+
+}
+    
+    
+# these should also be stripped out into their own module
+sub _addClassResource {
+   my ($model, $ns, $thing, $def) = @_;
+    my ($subject, $statement, $class, $label, $type);
+    
+    $label = ($thing =~ /urn:lsid.*:(\S+)$/)?$1:$thing;
+
+    unless (ref($thing) =~ /RDF/){
+        $subject = new RDF::Core::Resource($ns, $thing);
+    }
+    
+    $type = $subject->new(RDF_NS,'type');
+    $class = new RDF::Core::Resource(RDFS_NS,'Class');
+    $statement = new RDF::Core::Statement($subject, $type, $class);
+    $model->addStmt($statement);
+
+    $type = $subject->new(RDFS_NS,'label');
+    $label = new RDF::Core::Literal($label,"en", "http://www.w3.org/2001/XMLSchema#string");
+    $statement = new RDF::Core::Statement($subject, $type, $label);
+    $model->addStmt($statement);
+
+    return $subject unless $def;
+
+    $type = $subject->new(RDFS_NS,'comment');
+    $label = new RDF::Core::Literal($def, "en", "http://www.w3.org/2001/XMLSchema#string");
+    $statement = new RDF::Core::Statement($subject, $type, $label);
+    $model->addStmt($statement);
+    
+    return $subject;
+}
+
+sub _addClassLiteral {
+    my ($model, $pns, $subject, $predicate,  $value) = @_;
+    
+    $predicate = $subject->new($pns, $predicate);
+    $value = new RDF::Core::Literal($value, "en", "http://www.w3.org/2001/XMLSchema#string");
+    my $statement = new RDF::Core::Statement($subject, $predicate, $value);
+    $model->addStmt($statement);
+
+}
+
 1;
\ No newline at end of file

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/ServiceInstanceRDF.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/MOBY/RDF/ServiceInstanceRDF.pm	2004/07/28 23:08:09	1.3
+++ /home/repository/moby/moby-live/Perl/MOBY/RDF/ServiceInstanceRDF.pm	2004/07/28 23:12:11	1.4
@@ -88,4 +88,55 @@
 
 }
 
+# these should be stripped out into their own module...
+sub _addResource {
+    my ($model, $ns, $predicate, $subject, $ons, $object) = @_;
+
+    $predicate = $subject->new($ns, $predicate);
+    $object = new RDF::Core::Resource($ons, $object);
+    my $statement = new RDF::Core::Statement($subject, $predicate, $object);
+    $model->addStmt($statement);
+
+}
+    
+sub _addClassResource {
+   my ($model, $ns, $thing, $def) = @_;
+    my ($subject, $statement, $class, $label, $type);
+    
+    $label = ($thing =~ /urn:lsid.*:(\S+)$/)?$1:$thing;
+
+    unless (ref($thing) =~ /RDF/){
+        $subject = new RDF::Core::Resource($ns, $thing);
+    }
+    
+    $type = $subject->new(RDF_NS,'type');
+    $class = new RDF::Core::Resource(RDFS_NS,'Class');
+    $statement = new RDF::Core::Statement($subject, $type, $class);
+    $model->addStmt($statement);
+
+    $type = $subject->new(RDFS_NS,'label');
+    $label = new RDF::Core::Literal($label,"en", "http://www.w3.org/2001/XMLSchema#string");
+    $statement = new RDF::Core::Statement($subject, $type, $label);
+    $model->addStmt($statement);
+
+    return $subject unless $def;
+
+    $type = $subject->new(RDFS_NS,'comment');
+    $label = new RDF::Core::Literal($def, "en", "http://www.w3.org/2001/XMLSchema#string");
+    $statement = new RDF::Core::Statement($subject, $type, $label);
+    $model->addStmt($statement);
+    
+    return $subject;
+}
+
+sub _addClassLiteral {
+    my ($model, $pns, $subject, $predicate,  $value) = @_;
+    
+    $predicate = $subject->new($pns, $predicate);
+    $value = new RDF::Core::Literal($value, "en", "http://www.w3.org/2001/XMLSchema#string");
+    my $statement = new RDF::Core::Statement($subject, $predicate, $value);
+    $model->addStmt($statement);
+
+}
+
 1;
\ No newline at end of file




More information about the MOBY-guts mailing list